diff options
| author | vaxerski <vaxry@vaxry.net> | 2024-07-27 17:49:27 +0200 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2024-07-27 17:49:35 +0200 |
| commit | 729b47d46d0c749efbffe01ea863a124fad562b4 (patch) | |
| tree | f2abe24cb709c3d97d809aa8e7f97a9bad20c332 | |
| parent | 84227eb587688596b63a5b48848d32083d9680cf (diff) | |
input: refocus last window on keyboard unfocusable surfaces
fixes #4460
| -rw-r--r-- | src/managers/input/InputManager.cpp | 7 | ||||
| -rw-r--r-- | src/protocols/core/Compositor.hpp | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index e2c62367..7d2e7a0e 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -17,6 +17,7 @@ #include "../../protocols/LayerShell.hpp" #include "../../protocols/core/Seat.hpp" #include "../../protocols/core/DataDevice.hpp" +#include "../../protocols/core/Compositor.hpp" #include "../../protocols/XDGShell.hpp" #include "../../devices/Mouse.hpp" @@ -1382,6 +1383,12 @@ void CInputManager::refocusLastWindow(CMonitor* pMonitor) { g_pCompositor->focusWindow(PLASTWINDOW); } else { // otherwise fall back to a normal refocus. + + if (foundSurface && !foundSurface->hlSurface->keyboardFocusable()) { + const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock(); + g_pCompositor->focusWindow(PLASTWINDOW); + } + refocus(); } } diff --git a/src/protocols/core/Compositor.hpp b/src/protocols/core/Compositor.hpp index 85bd0d37..1fa6926a 100644 --- a/src/protocols/core/Compositor.hpp +++ b/src/protocols/core/Compositor.hpp @@ -134,11 +134,11 @@ class CWLSurfaceResource { SP<CWlSurface> resource; wl_client* pClient = nullptr; - int stateLocks = 0; + int stateLocks = 0; - void destroy(); - void commitPendingState(); - void bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data); + void destroy(); + void commitPendingState(); + void bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data); }; class CWLCompositorResource { |
