From f343387857843be6bdfc69541cd9027f44c5705b Mon Sep 17 00:00:00 2001 From: Bert Gijsbers Date: Sun, 19 May 2024 22:53:27 +0200 Subject: [PATCH] When lowering a frame by KeyWinLower or by a menu action, then also lower the frame in the focus order, otherwise it appears as the first entry in the Quick Switch. --- src/wmframe.cc | 19 +++++++++++-------- src/wmframe.h | 3 ++- src/wmmgr.cc | 3 ++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/wmframe.cc b/src/wmframe.cc index d85f7ec63..71c5d417c 100644 --- a/src/wmframe.cc +++ b/src/wmframe.cc @@ -103,6 +103,7 @@ YFrameWindow::YFrameWindow( fShapeMoreTabs(false), fHaveStruts(false), indicatorsCreated(false), + loweringByAction(false), fWindowType(wtNormal) { setStyle(wsOverrideRedirect); @@ -1310,12 +1311,12 @@ void YFrameWindow::actionPerformed(YAction action, unsigned int modifiers) { wmMaximizeHorz(); break; case actionLower: - if (canLower()) - wmLower(); + loweringByAction = true; + wmLower(); + loweringByAction = false; break; case actionRaise: - if (canRaise()) - wmRaise(); + wmRaise(); break; case actionDepth: if (overlapped() && canRaise()) { @@ -1731,7 +1732,7 @@ void YFrameWindow::wmLower() { wmapp->signalGuiEvent(geWindowLower); if (owner()) { for (YFrameWindow* w = this; w; w = w->owner()) { - w->doLower(); + w->doLower(loweringByAction); } } else if (hasState(WinStateModal) && client()->clientLeader()) { @@ -1743,22 +1744,24 @@ void YFrameWindow::wmLower() { lower += w; } for (YFrameWindow* f : lower) { - f->doLower(); + f->doLower(loweringByAction); } } else { - doLower(); + doLower(loweringByAction); } manager->focusTopWindow(); } } -void YFrameWindow::doLower() { +void YFrameWindow::doLower(bool lff) { if (next()) { if (manager->setAbove(this, nullptr)) { beneath(prev()); } } + if (lff) + manager->lowerFocusFrame(this); } void YFrameWindow::wmRaise() { diff --git a/src/wmframe.h b/src/wmframe.h index 33069dd41..9c4622722 100644 --- a/src/wmframe.h +++ b/src/wmframe.h @@ -86,7 +86,7 @@ class YFrameWindow: void wmHide(); void wmShow(); void wmLower(); - void doLower(); + void doLower(bool lff = false); void wmRaise(); void doRaise(); void wmClose(); @@ -520,6 +520,7 @@ class YFrameWindow: bool fHaveStruts; bool indicatorsCreated; + bool loweringByAction; enum WindowType fWindowType; diff --git a/src/wmmgr.cc b/src/wmmgr.cc index e459dd0a8..f8a0dba8b 100644 --- a/src/wmmgr.cc +++ b/src/wmmgr.cc @@ -3948,8 +3948,9 @@ void YTopWindow::setFrame(YFrameWindow* frame) { bool YTopWindow::handleKey(const XKeyEvent& key) { if (key.type == KeyPress && manager->netActiveWindow() == None && - fHandle && fFrame && fFrame->visible() && + fHandle && fFrame && windowContext.find(fHandle) == fFrame && + fFrame->visible() && xapp->AltMask) { YFrameWindow* f = fFrame;