From 46e93f2d17e648ad0ce824bc8f289ace9d47bd0a Mon Sep 17 00:00:00 2001 From: Bert Gijsbers Date: Sun, 21 Jul 2024 21:34:10 +0200 Subject: [PATCH] When raising a frame, check if the focused frame needs to bind the mouse buttons, if it is overlapped. When minimizing or hiding transients, check against transients being tabs in the same frame. --- src/wmframe.cc | 27 +++++++++++++++++++-------- src/wmmgr.h | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/wmframe.cc b/src/wmframe.cc index ac5cecba4..d2ce2f4cd 100644 --- a/src/wmframe.cc +++ b/src/wmframe.cc @@ -1700,18 +1700,21 @@ YFrameClient* YFrameWindow::transient() const { } void YFrameWindow::minimizeTransients() { + YArray trans; for (YFrameClient* t = transient(); t; t = t->nextTransient()) { YFrameWindow* w = t->getFrame(); if (w) { - MSG(("> isMinimized: %d\n", w->isMinimized())); if (w->isMinimized()) { w->fWinState |= WinStateWasMinimized; - } else { + } + else if (find(trans, w) < 0 && w != this) { w->fWinState &= ~WinStateWasMinimized; - w->wmMinimize(); + trans += w; } } } + for (YFrameWindow* w : trans) + w->wmMinimize(); } void YFrameWindow::restoreMinimizedTransients() { @@ -1725,18 +1728,21 @@ void YFrameWindow::restoreMinimizedTransients() { } void YFrameWindow::hideTransients() { + YArray trans; for (YFrameClient* t = transient(); t; t = t->nextTransient()) { YFrameWindow* w = t->getFrame(); if (w) { - MSG(("> isHidden: %d\n", w->isHidden())); if (w->isHidden()) { w->fWinState |= WinStateWasHidden; - } else { + } + else if (find(trans, w) < 0 && w != this) { w->fWinState&= ~WinStateWasHidden; - w->wmHide(); + trans += w; } } } + for (YFrameWindow* w : trans) + w->wmHide(); } void YFrameWindow::restoreHiddenTransients() { @@ -1850,8 +1856,13 @@ void YFrameWindow::wmRaise() { if (canRaise()) { doRaise(); manager->restackWindows(); - if (focused() && container()->buttoned()) - container()->releaseButtons(); + if (focused()) { + if (container()->buttoned()) { + container()->releaseButtons(); + } + } else { + manager->focusOverlap(); + } } } diff --git a/src/wmmgr.h b/src/wmmgr.h index 3179075cd..7254177a2 100644 --- a/src/wmmgr.h +++ b/src/wmmgr.h @@ -261,6 +261,7 @@ class YWindowManager: void actionWindows(YAction action); void toggleDesktop(); void cascadeWindows(); + void focusOverlap(); bool haveClients(); void setupRootProxy(); @@ -342,7 +343,6 @@ class YWindowManager: bool handleWMKey(const XKeyEvent &key, KeySym k, unsigned vm); void setWmState(WMState newWmState); void refresh(); - void focusOverlap(); IApp *app; YActionListener *wmActionListener;