diff options
author | vaxerski <[email protected]> | 2022-08-26 00:38:20 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-08-26 00:38:20 +0200 |
commit | b16a57ceeb2c9fefb0fad444d763211254d36971 (patch) | |
tree | b9e53d239563a92ddc46184db2b1e16c57a8333d | |
parent | 0eb86f4b0d30e4454ac48ee79973f25b8f8291da (diff) | |
download | Hyprland-b16a57ceeb2c9fefb0fad444d763211254d36971.tar.gz Hyprland-b16a57ceeb2c9fefb0fad444d763211254d36971.zip |
fix window rules
-rw-r--r-- | src/events/Windows.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index fbaadd51..b0cd460f 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -267,7 +267,9 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goalv() - Vector2D(10,10); } - if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus && PWINDOW->m_iX11Type != 2 && shouldFocus) { + const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow; + + if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus && PWINDOW->m_iX11Type != 2) { g_pCompositor->focusWindow(PWINDOW); PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA); } else @@ -335,6 +337,13 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->updateToplevel(); + if (!shouldFocus) { + if (g_pCompositor->windowValidMapped(PFOCUSEDWINDOWPREV)) + g_pCompositor->focusWindow(PFOCUSEDWINDOWPREV); + else if (!PFOCUSEDWINDOWPREV) + g_pCompositor->focusWindow(nullptr); + } + Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y); auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName; |