From ed2fabf5278c808730a29065829edeaf0b09792a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 4 May 2012 01:08:28 +0200 Subject: [PATCH] elevate tabbox when elevating highlighted windows BUG: 299324 FIXED-IN: 4.9 REVIEW: 104845 --- tabbox/tabbox.cpp | 4 +++- tabbox/tabbox.h | 2 +- tabbox/tabboxhandler.cpp | 27 +++++++++++++++++++-------- tabbox/tabboxhandler.h | 5 ++++- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index a9c5cdadfb..c9ed800026 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -256,12 +256,14 @@ void TabBoxHandlerImpl::restack(TabBoxClient *c, TabBoxClient *under) static_cast(under)->client()); } -void TabBoxHandlerImpl::elevateClient(TabBoxClient *c, bool b) const +void TabBoxHandlerImpl::elevateClient(TabBoxClient *c, WId tabbox, bool b) const { if (effects) { const Client *cl = static_cast(c)->client(); if (EffectWindow *w = static_cast(effects)->findWindow(cl->window())) static_cast(effects)->setElevatedWindow(w, b); + if (EffectWindow *w = static_cast(effects)->findWindow(tabbox)) + static_cast(effects)->setElevatedWindow(w, b); } } diff --git a/tabbox/tabbox.h b/tabbox/tabbox.h index 05a129a612..077f282448 100644 --- a/tabbox/tabbox.h +++ b/tabbox/tabbox.h @@ -54,7 +54,7 @@ public: virtual int nextDesktopFocusChain(int desktop) const; virtual int numberOfDesktops() const; virtual TabBoxClientList stackingOrder() const; - virtual void elevateClient(TabBoxClient* c, bool elevate) const; + virtual void elevateClient(TabBoxClient* c, WId tabbox, bool elevate) const; virtual void raiseClient(TabBoxClient *client) const; virtual void restack(TabBoxClient *c, TabBoxClient *under); virtual TabBoxClient* clientToAddToList(TabBoxClient* client, int desktop) const; diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp index 98c7b2ad72..cd21484f59 100644 --- a/tabbox/tabboxhandler.cpp +++ b/tabbox/tabboxhandler.cpp @@ -28,6 +28,7 @@ along with this program. If not, see . // Qt #include #include +#include #include #include // KDE @@ -134,13 +135,17 @@ void TabBoxHandlerPrivate::updateHighlightWindows() Display *dpy = QX11Info::display(); TabBoxClient *currentClient = q->client(index); + QWidget *w = NULL; + if (m_declarativeView && m_declarativeView->isVisible()) { + w = m_declarativeView; + } if (KWindowSystem::compositingActive()) { if (lastRaisedClient) - q->elevateClient(lastRaisedClient, false); + q->elevateClient(lastRaisedClient, m_declarativeView ? m_declarativeView->winId() : 0, false); lastRaisedClient = currentClient; if (currentClient) - q->elevateClient(currentClient, true); + q->elevateClient(currentClient, m_declarativeView ? m_declarativeView->winId() : 0, true); } else { if (lastRaisedClient) { if (lastRaisedClientSucc) @@ -161,10 +166,6 @@ void TabBoxHandlerPrivate::updateHighlightWindows() WId wId; QVector< WId > data; - QWidget *w = NULL; - if (m_declarativeView && m_declarativeView->isVisible()) { - w = m_declarativeView; - } if (config.isShowTabBox() && w) { wId = w->winId(); data.resize(2); @@ -190,7 +191,7 @@ void TabBoxHandlerPrivate::endHighlightWindows(bool abort) { TabBoxClient *currentClient = q->client(index); if (currentClient) - q->elevateClient(currentClient, false); + q->elevateClient(currentClient, m_declarativeView ? m_declarativeView->winId() : 0, false); if (abort && lastRaisedClient && lastRaisedClientSucc) q->restack(lastRaisedClient, lastRaisedClientSucc); lastRaisedClient = 0; @@ -254,10 +255,20 @@ void TabBoxHandler::show() } } if (d->config.isHighlightWindows()) { - d->updateHighlightWindows(); + XSync(QX11Info::display(), false); + // TODO this should be + // QMetaObject::invokeMethod(this, "updateHighlightWindows", Qt::QueuedConnection); + // but we somehow need to cross > 1 event cycle (likely because of queued invocation in the effects) + // to ensure the EffectWindow is present when updateHighlightWindows, thus elevating the window/tabbox + QTimer::singleShot(1, this, SLOT(updateHighlightWindows())); } } +void TabBoxHandler::updateHighlightWindows() +{ + d->updateHighlightWindows(); +} + void TabBoxHandler::hide(bool abort) { d->isShown = false; diff --git a/tabbox/tabboxhandler.h b/tabbox/tabboxhandler.h index 0d5f9faafd..14427e8ca6 100644 --- a/tabbox/tabboxhandler.h +++ b/tabbox/tabboxhandler.h @@ -139,7 +139,7 @@ public: /** * De-/Elevate a client using the compositor (if enabled) */ - virtual void elevateClient(TabBoxClient* c, bool elevate) const = 0; + virtual void elevateClient(TabBoxClient* c, WId tabbox, bool elevate) const = 0; /** * Raise a client (w/o activating it) @@ -340,6 +340,9 @@ signals: void embeddedChanged(bool enabled); void selectedIndexChanged(); +private slots: + void updateHighlightWindows(); + private: friend class TabBoxHandlerPrivate; TabBoxHandlerPrivate* d;