From c3f1dc3f526a7f94c37d72f8314bc4bce969f0d8 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 10 Dec 2022 15:15:40 +0000 Subject: [PATCH] fix minor issues with move focus and follow mouse 0 --- src/managers/KeybindManager.cpp | 9 +++++---- src/managers/input/InputManager.cpp | 10 +++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 3dd6488b..a71b040e 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -945,6 +945,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) { void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { // hacky, but works lol + // TODO: this sucks CWindow* PWINDOW = nullptr; @@ -1015,11 +1016,11 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { // manually post event cuz it got ignored above g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", PWINDOW, PWORKSPACE->m_szName.c_str())}); - // this window is gone. Unfocus if needed - if (g_pCompositor->m_pLastWindow == PWINDOW) - g_pCompositor->focusWindow(nullptr); + PWINDOW->m_iWorkspaceID = OLDWORKSPACEIDRETURN; + const auto PNEXTCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW); + PWINDOW->m_iWorkspaceID = workspaceToMoveTo; - g_pInputManager->refocus(); + g_pCompositor->focusWindow(PNEXTCANDIDATE); } void CKeybindManager::moveFocusTo(std::string args) { diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 51d5d4e2..41233f92 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -297,16 +297,12 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { m_bLastFocusOnLS = false; } else { - if (pFoundLayerSurface) { - m_bLastFocusOnLS = true; - if (pFoundLayerSurface->layer <= ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) { - g_pCompositor->focusWindow(nullptr); - } - } - if (pFoundLayerSurface && pFoundLayerSurface->layerSurface->current.keyboard_interactive && *PFOLLOWMOUSE != 3 && allowKeyboardRefocus) { g_pCompositor->focusSurface(foundSurface); } + + if (pFoundLayerSurface) + m_bLastFocusOnLS = true; } wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);