aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp3
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h1
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h11
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp39
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h3
6 files changed, 49 insertions, 12 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
index 6c3c7adf..4eeff5f1 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.cpp
@@ -331,6 +331,9 @@ void NativeWindowObject::requestActivate(){
requestProperty(NativeWindowObject::Active, true);
}
+void NativeWindowObject::announceClosed(){
+ this->emit WindowClosed(winid);
+}
// ==== PRIVATE ====
void NativeWindowObject::emitSinglePropChanged(NativeWindowObject::Property prop){
//Simple switch to emit the QML-usable signals as properties are changed
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
index e4efeef7..964f1fc1 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/NativeWindowObject.h
@@ -125,6 +125,7 @@ public slots:
Q_INVOKABLE void requestKill(); //ask the WM to kill the app associated with this window (harsh - only use if not responding)
Q_INVOKABLE void requestPing(); //ask the app if it is still active (a WindowNotResponding signal will get sent out if there is no reply);
Q_INVOKABLE void requestActivate();
+ Q_INVOKABLE void announceClosed();
private:
QHash <NativeWindowObject::Property, QVariant> hash;
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h
index 0cce4fdb..a708ba47 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h
@@ -49,11 +49,16 @@ protected:
}
void enterEvent(QEvent *ev){
QWidget::enterEvent(ev);
- qDebug() << "enter event";
+ qDebug() << "Enter event";
}
void paintEvent(QPaintEvent *){
//Never paint anything with this widget
}
+ void closeEvent(QCloseEvent *ev){
+ qDebug() << "Embed Window Closed";
+ WIN->emit WindowClosed(WIN->id());
+ QWidget::closeEvent(ev);
+ }
};
@@ -69,6 +74,10 @@ public:
if(USE_QWINDOW_EMBED){
QWindow* _window = QWindow::fromWinId(WIN->id());
embedW = QWidget::createWindowContainer(_window, parent);
+ QList<WId> related; related << _window->winId();
+ if(embedW->nativeParentWidget()!=0){ related << embedW->nativeParentWidget()->winId(); }
+ WIN->setProperty(NativeWindowObject::RelatedWindows, QVariant::fromValue< QList<WId> >(related) );
+ //connect(_window, SIGNAL(destroyed(QObject*)), WIN, SLOT(announceClosed()) );
}else{
embedW = new EmbedWidget(WIN, parent);
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
index 0296d592..a2bfa2c6 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeWindow.cpp
@@ -23,8 +23,8 @@ NativeWindow::NativeWindow( NativeWindowObject *obj ) : QFrame(0, Qt::Window | Q
resizeTimer->setSingleShot(true);
resizeTimer->setInterval(10); //1/10 second
connect(resizeTimer, SIGNAL(timeout()), this, SLOT(submitSizeChange()) ); //Let the window system know the window has moved
-
- //WIN->addFrameWinID(this->winId());
+
+ WIN->addFrameWinID(this->winId());
}
NativeWindow::~NativeWindow(){
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
index e11ed752..1faf9f58 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
@@ -291,13 +291,13 @@ NativeWindowObject* NativeWindowSystem::findWindow(WId id, bool checkRelated){
for(int i=0; i<NWindows.length(); i++){
if(id==NWindows[i]->id() ){ return NWindows[i]; }
else if(id==NWindows[i]->frameId() ){ return NWindows[i]; }
- //if(checkRelated && NWindows[i]->isRelatedTo(id)){ return NWindows[i]; }
+ if(checkRelated && NWindows[i]->isRelatedTo(id)){ return NWindows[i]; }
//else if(!checkRelated && id==NWindows[i]->id()){ return NWindows[i]; }
}
//Check to see if this is a transient for some other window
if(checkRelated){
- //WId tid = obj->getTransientFor(id);
- //if(tid!=id){ return findWindow(tid, checkRelated); } //call it recursively as needed
+ WId tid = obj->getTransientFor(id);
+ if(tid!=id){ return findWindow(tid, checkRelated); } //call it recursively as needed
//qDebug() << " -- Could not find Window!";
}
return 0;
@@ -895,16 +895,18 @@ void NativeWindowSystem::NewTrayWindowDetected(WId id){
}
void NativeWindowSystem::WindowCloseDetected(WId id){
- NativeWindowObject *win = findWindow(id, false);
- if(win==0){ win = findWindow(id, true); }
- qDebug() << "Got Window Closed" << id << win;
- qDebug() << "Old Window List:" << NWindows.length();
+ NativeWindowObject *win = findWindow(id, true);
+ //if(win==0){ win = findWindow(id, true); }
+ //qDebug() << "Got Window Closed" << id << win;
+ //qDebug() << "Old Window List:" << NWindows.length();
+ bool ok = false;
if(win!=0){
NWindows.removeAll(win);
win->emit WindowClosed(id);
- qDebug() << "Visible Window Closed!!!";
+ //qDebug() << "Visible Window Closed!!!";
emit WindowClosed();
win->deleteLater();
+ ok = true;
}else{
win = findTrayWindow(id);
if(win!=0){
@@ -912,9 +914,11 @@ void NativeWindowSystem::WindowCloseDetected(WId id){
win->emit WindowClosed(id);
emit TrayWindowClosed();
win->deleteLater();
+ ok = true;
}
}
- qDebug() << " - Now:" << NWindows.length();
+ if(!ok && !NWindows.isEmpty() && !TWindows.isEmpty() ){ QTimer::singleShot(0, this, SLOT(verifyWindowExistance()) ); }
+ //qDebug() << " - Now:" << NWindows.length();
}
void NativeWindowSystem::WindowPropertyChanged(WId id, NativeWindowObject::Property prop){
@@ -1044,6 +1048,23 @@ void NativeWindowSystem::lowerWindow(NativeWindowObject *win){
// === PRIVATE SLOTS ===
//These are the slots which are built-in and automatically connected when a new NativeWindow is created
+void NativeWindowSystem::verifyWindowExistance(){
+ //qDebug() << "Verify Window Existance";
+ QList<xcb_void_cookie_t> cookies;
+ //Generate all the cookies for the probes
+ for(int i=0; i<NWindows.length(); i++){
+ cookies << xcb_configure_window_checked(QX11Info::connection(), NWindows[i]->id(), 0, 0);
+ }
+ //Now look at all the replies and send close messages for any bad-window errors
+ for(int i=0; i<cookies.length(); i++){
+ xcb_generic_error_t *error = xcb_request_check( QX11Info::connection(), cookies[i]);
+ if(error!=0){
+ //qDebug() << " - Got missing window" << NWindows[i]->name();
+ NWindows[i]->announceClosed();
+ }
+ }
+ //qDebug() << " - End Verify";
+}
void NativeWindowSystem::RequestClose(WId win){
//Send the window a WM_DELETE_WINDOW message
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
index d3cbc591..f6651b5b 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
+++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.h
@@ -132,6 +132,9 @@ public slots:
private slots:
+ //Internal Admin functions
+ void verifyWindowExistance();
+
//These are the slots which are built-in and automatically connected when a new NativeWindow is created
void RequestClose(WId);
void RequestKill(WId);
bgstack15