Skip to content

Commit

Permalink
When lowering a frame by KeyWinLower or by a menu action, then also
Browse files Browse the repository at this point in the history
lower the frame in the focus order, otherwise it appears as the first
entry in the Quick Switch.
  • Loading branch information
gijsbers committed May 19, 2024
1 parent ca61a8f commit f343387
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
19 changes: 11 additions & 8 deletions src/wmframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ YFrameWindow::YFrameWindow(
fShapeMoreTabs(false),
fHaveStruts(false),
indicatorsCreated(false),
loweringByAction(false),
fWindowType(wtNormal)
{
setStyle(wsOverrideRedirect);
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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()) {
Expand All @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion src/wmframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -520,6 +520,7 @@ class YFrameWindow:

bool fHaveStruts;
bool indicatorsCreated;
bool loweringByAction;

enum WindowType fWindowType;

Expand Down
3 changes: 2 additions & 1 deletion src/wmmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f343387

Please sign in to comment.