elevate tabbox when elevating highlighted windows

BUG: 299324
FIXED-IN: 4.9
REVIEW: 104845
icc-effect-5.14.5
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());
}
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<TabBoxClientImpl*>(c)->client();
if (EffectWindow *w = static_cast<EffectsHandlerImpl*>(effects)->findWindow(cl->window()))
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 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;

View File

@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QKeyEvent>
#include <QModelIndex>
#include <QTimer>
#include <QX11Info>
#include <X11/Xlib.h>
// 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;

View File

@ -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;