diff options
author | Vaxry <[email protected]> | 2023-11-04 21:03:08 +0000 |
---|---|---|
committer | Vaxry <[email protected]> | 2023-11-04 21:03:08 +0000 |
commit | 74cf2281dd38a533916eb0b201c3128423b94d7c (patch) | |
tree | 160b8b45ba3d030ca4f0c7835c94bdc864502905 | |
parent | 2b07d54bc74f34a3561612bedaa44ad8ab550b8b (diff) | |
download | Hyprland-74cf2281dd38a533916eb0b201c3128423b94d7c.tar.gz Hyprland-74cf2281dd38a533916eb0b201c3128423b94d7c.zip |
binds: add movefocus_cycles_fullscreen
fixes #3738
-rw-r--r-- | src/Compositor.cpp | 16 | ||||
-rw-r--r-- | src/config/ConfigManager.cpp | 15 | ||||
-rw-r--r-- | src/managers/KeybindManager.cpp | 5 |
3 files changed, 22 insertions, 14 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 53cd2e83..74ac7c11 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1504,13 +1504,19 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) { // 0 -> history, 1 -> shared length static auto* const PMETHOD = &g_pConfigManager->getConfigValuePtr("binds:focus_preferred_method")->intValue; - const auto WINDOWIDEALBB = pWindow->getWindowIdealBoundingBoxIgnoreReserved(); + const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); - const auto POSA = Vector2D(WINDOWIDEALBB.x, WINDOWIDEALBB.y); - const auto SIZEA = Vector2D(WINDOWIDEALBB.width, WINDOWIDEALBB.height); + if (!PMONITOR) + return nullptr; // ?? - auto leaderValue = -1; - CWindow* leaderWindow = nullptr; + const auto WINDOWIDEALBB = pWindow->m_bIsFullscreen ? wlr_box{(int)PMONITOR->vecPosition.x, (int)PMONITOR->vecPosition.y, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y} : + pWindow->getWindowIdealBoundingBoxIgnoreReserved(); + + const auto POSA = Vector2D(WINDOWIDEALBB.x, WINDOWIDEALBB.y); + const auto SIZEA = Vector2D(WINDOWIDEALBB.width, WINDOWIDEALBB.height); + + auto leaderValue = -1; + CWindow* leaderWindow = nullptr; for (auto& w : m_vWindows) { if (w.get() == pWindow || !w->m_bIsMapped || w->isHidden() || w->m_bIsFloating || !isWorkspaceVisible(w->m_iWorkspaceID)) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index e016ba75..f5b9416b 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -243,13 +243,14 @@ void CConfigManager::setDefaultVars() { configValues["input:tablet:region_position"].vecValue = Vector2D(); configValues["input:tablet:region_size"].vecValue = Vector2D(); - configValues["binds:pass_mouse_when_bound"].intValue = 0; - configValues["binds:scroll_event_delay"].intValue = 300; - configValues["binds:workspace_back_and_forth"].intValue = 0; - configValues["binds:allow_workspace_cycles"].intValue = 0; - configValues["binds:workspace_center_on"].intValue = 1; - configValues["binds:focus_preferred_method"].intValue = 0; - configValues["binds:ignore_group_lock"].intValue = 0; + configValues["binds:pass_mouse_when_bound"].intValue = 0; + configValues["binds:scroll_event_delay"].intValue = 300; + configValues["binds:workspace_back_and_forth"].intValue = 0; + configValues["binds:allow_workspace_cycles"].intValue = 0; + configValues["binds:workspace_center_on"].intValue = 1; + configValues["binds:focus_preferred_method"].intValue = 0; + configValues["binds:ignore_group_lock"].intValue = 0; + configValues["binds:movefocus_cycles_fullscreen"].intValue = 1; configValues["gestures:workspace_swipe"].intValue = 0; configValues["gestures:workspace_swipe_fingers"].intValue = 3; diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index ac995ad9..3bed027d 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1004,7 +1004,8 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { } void CKeybindManager::moveFocusTo(std::string args) { - char arg = args[0]; + static auto* const PFULLCYCLE = &g_pConfigManager->getConfigValuePtr("binds:movefocus_cycles_fullscreen")->intValue; + char arg = args[0]; if (!isDirection(args)) { Debug::log(ERR, "Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); @@ -1020,7 +1021,7 @@ void CKeybindManager::moveFocusTo(std::string args) { // remove constraints g_pInputManager->unconstrainMouse(); - const auto PWINDOWTOCHANGETO = PLASTWINDOW->m_bIsFullscreen ? + const auto PWINDOWTOCHANGETO = *PFULLCYCLE && PLASTWINDOW->m_bIsFullscreen ? (arg == 'd' || arg == 'b' || arg == 'r' ? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true) : g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true)) : g_pCompositor->getWindowInDirection(PLASTWINDOW, arg); |