ShadeHover highlighted windows in tabbox
The setting says "show selected window" ;-) BUG: 186206 FIXED-IN: 5.3 REVIEW: 122472
This commit is contained in:
parent
ea5a5f196d
commit
40a06a23a9
5 changed files with 51 additions and 10 deletions
|
@ -56,6 +56,10 @@ public:
|
|||
Q_UNUSED(tabbox)
|
||||
Q_UNUSED(elevate)
|
||||
}
|
||||
virtual void shadeClient(TabBox::TabBoxClient *c, bool b) const {
|
||||
Q_UNUSED(c)
|
||||
Q_UNUSED(b)
|
||||
}
|
||||
virtual void hideOutline() {
|
||||
}
|
||||
virtual QWeakPointer< TabBox::TabBoxClient > nextClientFocusChain(TabBox::TabBoxClient *client) const;
|
||||
|
|
|
@ -311,6 +311,15 @@ void TabBoxHandlerImpl::elevateClient(TabBoxClient *c, WId tabbox, bool b) const
|
|||
w->elevate(b);
|
||||
}
|
||||
|
||||
void TabBoxHandlerImpl::shadeClient(TabBoxClient *c, bool b) const
|
||||
{
|
||||
Client *cl = static_cast<TabBoxClientImpl*>(c)->client();
|
||||
cl->cancelShadeHoverTimer(); // stop core shading action
|
||||
if (!b && cl->shadeMode() == ShadeNormal)
|
||||
cl->setShade(ShadeHover);
|
||||
else if (b && cl->shadeMode() == ShadeHover)
|
||||
cl->setShade(ShadeNormal);
|
||||
}
|
||||
|
||||
QWeakPointer<TabBoxClient> TabBoxHandlerImpl::desktopClient() const
|
||||
{
|
||||
|
@ -1107,6 +1116,12 @@ void TabBox::slotWalkBackThroughDesktopList()
|
|||
}
|
||||
}
|
||||
|
||||
void TabBox::shadeActivate(Client *c)
|
||||
{
|
||||
if ((c->shadeMode() == ShadeNormal || c->shadeMode() == ShadeHover) && options->isShadeHover())
|
||||
c->setShade(ShadeActivated);
|
||||
}
|
||||
|
||||
bool TabBox::toggle(ElectricBorder eb)
|
||||
{
|
||||
if (!options->focusPolicyIsReasonable())
|
||||
|
@ -1216,8 +1231,7 @@ void TabBox::CDEWalkThroughWindows(bool forward)
|
|||
Workspace::self()->lowerClient(c);
|
||||
if (options->focusPolicyIsReasonable()) {
|
||||
Workspace::self()->activateClient(nc);
|
||||
if (nc->isShade() && options->isShadeHover())
|
||||
nc->setShade(ShadeActivated);
|
||||
shadeActivate(nc);
|
||||
} else {
|
||||
if (!nc->isOnDesktop(currentDesktop()))
|
||||
setCurrentDesktop(nc->desktop());
|
||||
|
@ -1233,8 +1247,7 @@ void TabBox::KDEOneStepThroughWindows(bool forward, TabBoxMode mode)
|
|||
nextPrev(forward);
|
||||
if (Client* c = currentClient()) {
|
||||
Workspace::self()->activateClient(c);
|
||||
if (c->isShade() && options->isShadeHover())
|
||||
c->setShade(ShadeActivated);
|
||||
shadeActivate(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1426,8 +1439,7 @@ void TabBox::accept()
|
|||
close();
|
||||
if (c) {
|
||||
Workspace::self()->activateClient(c);
|
||||
if (c->isShade() && options->isShadeHover())
|
||||
c->setShade(ShadeActivated);
|
||||
shadeActivate(c);
|
||||
if (c->isDesktop())
|
||||
Workspace::self()->setShowingDesktop(!Workspace::self()->showingDesktop());
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
virtual void elevateClient(TabBoxClient* c, WId tabbox, bool elevate) const;
|
||||
virtual void raiseClient(TabBoxClient *client) const;
|
||||
virtual void restack(TabBoxClient *c, TabBoxClient *under);
|
||||
virtual void shadeClient(TabBoxClient *c, bool b) const;
|
||||
virtual QWeakPointer< TabBoxClient > clientToAddToList(KWin::TabBox::TabBoxClient* client, int desktop) const;
|
||||
virtual QWeakPointer< TabBoxClient > desktopClient() const;
|
||||
virtual void activateAndClose();
|
||||
|
@ -231,6 +232,8 @@ private:
|
|||
template <typename Slot>
|
||||
void key(const char *actionName, Slot slot, const QKeySequence &shortcut = QKeySequence());
|
||||
|
||||
void shadeActivate(Client *c);
|
||||
|
||||
private Q_SLOTS:
|
||||
void reconfigure();
|
||||
void globalShortcutChanged(QAction *action, const QKeySequence &seq);
|
||||
|
|
|
@ -176,6 +176,7 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
|
|||
q->elevateClient(currentClient, w ? w->winId() : 0, true);
|
||||
} else {
|
||||
if (lastRaisedClient) {
|
||||
q->shadeClient(lastRaisedClient, true);
|
||||
if (lastRaisedClientSucc)
|
||||
q->restack(lastRaisedClient, lastRaisedClientSucc);
|
||||
// TODO lastRaisedClient->setMinimized( lastRaisedClientWasMinimized );
|
||||
|
@ -183,6 +184,7 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
|
|||
|
||||
lastRaisedClient = currentClient;
|
||||
if (lastRaisedClient) {
|
||||
q->shadeClient(lastRaisedClient, false);
|
||||
// TODO if ( (lastRaisedClientWasMinimized = lastRaisedClient->isMinimized()) )
|
||||
// lastRaisedClient->setMinimized( false );
|
||||
TabBoxClientList order = q->stackingOrder();
|
||||
|
@ -216,6 +218,13 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
|
|||
void TabBoxHandlerPrivate::endHighlightWindows(bool abort)
|
||||
{
|
||||
TabBoxClient *currentClient = q->client(index);
|
||||
if (config.isHighlightWindows() && q->isKWinCompositing()) {
|
||||
foreach (const QWeakPointer<TabBoxClient> &clientPointer, q->stackingOrder()) {
|
||||
if (QSharedPointer<TabBoxClient> client = clientPointer.toStrongRef())
|
||||
if (client != currentClient) // to not mess up with wanted ShadeActive/ShadeHover state
|
||||
q->shadeClient(client.data(), true);
|
||||
}
|
||||
}
|
||||
QWindow *w = window();
|
||||
if (currentClient)
|
||||
q->elevateClient(currentClient, w ? w->winId() : 0, false);
|
||||
|
@ -373,15 +382,21 @@ void TabBoxHandler::show()
|
|||
if (d->config.isHighlightWindows()) {
|
||||
Xcb::sync();
|
||||
// TODO this should be
|
||||
// QMetaObject::invokeMethod(this, "updateHighlightWindows", Qt::QueuedConnection);
|
||||
// QMetaObject::invokeMethod(this, "initHighlightWindows", 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()));
|
||||
QTimer::singleShot(1, this, SLOT(initHighlightWindows()));
|
||||
}
|
||||
}
|
||||
|
||||
void TabBoxHandler::updateHighlightWindows()
|
||||
void TabBoxHandler::initHighlightWindows()
|
||||
{
|
||||
if (isKWinCompositing()) {
|
||||
foreach (const QWeakPointer<TabBoxClient> &clientPointer, stackingOrder()) {
|
||||
if (QSharedPointer<TabBoxClient> client = clientPointer.toStrongRef())
|
||||
shadeClient(client.data(), false);
|
||||
}
|
||||
}
|
||||
d->updateHighlightWindows();
|
||||
}
|
||||
|
||||
|
|
|
@ -180,6 +180,13 @@ public:
|
|||
*/
|
||||
virtual void restack(TabBoxClient *c, TabBoxClient *under) = 0;
|
||||
|
||||
/**
|
||||
* Toggle between ShadeHover and ShadeNormal - not shaded windows are unaffected
|
||||
* @param c The client to be shaded
|
||||
* @param b Whether to un- or shade
|
||||
*/
|
||||
virtual void shadeClient(TabBoxClient *c, bool b) const = 0;
|
||||
|
||||
/**
|
||||
* @return The current stacking order of TabBoxClients
|
||||
*/
|
||||
|
@ -334,7 +341,7 @@ Q_SIGNALS:
|
|||
void selectedIndexChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateHighlightWindows();
|
||||
void initHighlightWindows();
|
||||
|
||||
private:
|
||||
friend class TabBoxHandlerPrivate;
|
||||
|
|
Loading…
Reference in a new issue