elevate tabbox when elevating highlighted windows

BUG: 299324
FIXED-IN: 4.9
REVIEW: 104845
This commit is contained in:
Thomas Lübking 2012-05-04 01:08:28 +02:00
parent b40f74a3b0
commit ed2fabf527
4 changed files with 27 additions and 11 deletions

View file

@ -256,12 +256,14 @@ void TabBoxHandlerImpl::restack(TabBoxClient *c, TabBoxClient *under)
static_cast<TabBoxClientImpl*>(under)->client()); static_cast<TabBoxClientImpl*>(under)->client());
} }
void TabBoxHandlerImpl::elevateClient(TabBoxClient *c, bool b) const void TabBoxHandlerImpl::elevateClient(TabBoxClient *c, WId tabbox, bool b) const
{ {
if (effects) { if (effects) {
const Client *cl = static_cast<TabBoxClientImpl*>(c)->client(); const Client *cl = static_cast<TabBoxClientImpl*>(c)->client();
if (EffectWindow *w = static_cast<EffectsHandlerImpl*>(effects)->findWindow(cl->window())) if (EffectWindow *w = static_cast<EffectsHandlerImpl*>(effects)->findWindow(cl->window()))
static_cast<EffectsHandlerImpl*>(effects)->setElevatedWindow(w, b); static_cast<EffectsHandlerImpl*>(effects)->setElevatedWindow(w, b);
if (EffectWindow *w = static_cast<EffectsHandlerImpl*>(effects)->findWindow(tabbox))
static_cast<EffectsHandlerImpl*>(effects)->setElevatedWindow(w, b);
} }
} }

View file

@ -54,7 +54,7 @@ public:
virtual int nextDesktopFocusChain(int desktop) const; virtual int nextDesktopFocusChain(int desktop) const;
virtual int numberOfDesktops() const; virtual int numberOfDesktops() const;
virtual TabBoxClientList stackingOrder() 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 raiseClient(TabBoxClient *client) const;
virtual void restack(TabBoxClient *c, TabBoxClient *under); virtual void restack(TabBoxClient *c, TabBoxClient *under);
virtual TabBoxClient* clientToAddToList(TabBoxClient* client, int desktop) const; virtual TabBoxClient* clientToAddToList(TabBoxClient* client, int desktop) const;

View file

@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt // Qt
#include <QKeyEvent> #include <QKeyEvent>
#include <QModelIndex> #include <QModelIndex>
#include <QTimer>
#include <QX11Info> #include <QX11Info>
#include <X11/Xlib.h> #include <X11/Xlib.h>
// KDE // KDE
@ -134,13 +135,17 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
Display *dpy = QX11Info::display(); Display *dpy = QX11Info::display();
TabBoxClient *currentClient = q->client(index); TabBoxClient *currentClient = q->client(index);
QWidget *w = NULL;
if (m_declarativeView && m_declarativeView->isVisible()) {
w = m_declarativeView;
}
if (KWindowSystem::compositingActive()) { if (KWindowSystem::compositingActive()) {
if (lastRaisedClient) if (lastRaisedClient)
q->elevateClient(lastRaisedClient, false); q->elevateClient(lastRaisedClient, m_declarativeView ? m_declarativeView->winId() : 0, false);
lastRaisedClient = currentClient; lastRaisedClient = currentClient;
if (currentClient) if (currentClient)
q->elevateClient(currentClient, true); q->elevateClient(currentClient, m_declarativeView ? m_declarativeView->winId() : 0, true);
} else { } else {
if (lastRaisedClient) { if (lastRaisedClient) {
if (lastRaisedClientSucc) if (lastRaisedClientSucc)
@ -161,10 +166,6 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
WId wId; WId wId;
QVector< WId > data; QVector< WId > data;
QWidget *w = NULL;
if (m_declarativeView && m_declarativeView->isVisible()) {
w = m_declarativeView;
}
if (config.isShowTabBox() && w) { if (config.isShowTabBox() && w) {
wId = w->winId(); wId = w->winId();
data.resize(2); data.resize(2);
@ -190,7 +191,7 @@ void TabBoxHandlerPrivate::endHighlightWindows(bool abort)
{ {
TabBoxClient *currentClient = q->client(index); TabBoxClient *currentClient = q->client(index);
if (currentClient) if (currentClient)
q->elevateClient(currentClient, false); q->elevateClient(currentClient, m_declarativeView ? m_declarativeView->winId() : 0, false);
if (abort && lastRaisedClient && lastRaisedClientSucc) if (abort && lastRaisedClient && lastRaisedClientSucc)
q->restack(lastRaisedClient, lastRaisedClientSucc); q->restack(lastRaisedClient, lastRaisedClientSucc);
lastRaisedClient = 0; lastRaisedClient = 0;
@ -254,10 +255,20 @@ void TabBoxHandler::show()
} }
} }
if (d->config.isHighlightWindows()) { 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) void TabBoxHandler::hide(bool abort)
{ {
d->isShown = false; d->isShown = false;

View file

@ -139,7 +139,7 @@ public:
/** /**
* De-/Elevate a client using the compositor (if enabled) * 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) * Raise a client (w/o activating it)
@ -340,6 +340,9 @@ signals:
void embeddedChanged(bool enabled); void embeddedChanged(bool enabled);
void selectedIndexChanged(); void selectedIndexChanged();
private slots:
void updateHighlightWindows();
private: private:
friend class TabBoxHandlerPrivate; friend class TabBoxHandlerPrivate;
TabBoxHandlerPrivate* d; TabBoxHandlerPrivate* d;