binds: add movefocus_cycles_fullscreen

fixes #3738
This commit is contained in:
Vaxry 2023-11-04 21:03:08 +00:00
parent 2b07d54bc7
commit 74cf2281dd
3 changed files with 22 additions and 14 deletions

View file

@ -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))

View file

@ -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;

View file

@ -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);