mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 16:05:58 +01:00
keybinds: fix focuswindow for fullscreen (#4840)
* focuswindow fix * fix format --------- Co-authored-by: ddmetz <77217897+ddmetz@users.noreply.github.com>
This commit is contained in:
parent
7f35bff720
commit
a14f6b570f
2 changed files with 22 additions and 7 deletions
|
@ -1806,7 +1806,8 @@ CMonitor* CCompositor::getMonitorInDirection(const char& dir) {
|
|||
}
|
||||
|
||||
CMonitor* CCompositor::getMonitorInDirection(CMonitor* pSourceMonitor, const char& dir) {
|
||||
if(!pSourceMonitor) return nullptr;
|
||||
if (!pSourceMonitor)
|
||||
return nullptr;
|
||||
|
||||
const auto POSA = pSourceMonitor->vecPosition;
|
||||
const auto SIZEA = pSourceMonitor->vecSize;
|
||||
|
|
|
@ -1748,17 +1748,31 @@ void CKeybindManager::focusWindow(std::string regexp) {
|
|||
|
||||
Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_szTitle);
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||
if (!PWORKSPACE) {
|
||||
Debug::log(ERR, "BUG THIS: null workspace in focusWindow");
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_pCompositor->m_pLastMonitor->activeWorkspace != PWINDOW->m_iWorkspaceID) {
|
||||
Debug::log(LOG, "Fake executing workspace to move focus");
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||
if (!PWORKSPACE) {
|
||||
Debug::log(ERR, "BUG THIS: null workspace in focusWindow");
|
||||
return;
|
||||
}
|
||||
changeworkspace(PWORKSPACE->getConfigName());
|
||||
}
|
||||
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
||||
const auto FSWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
|
||||
const auto FSMODE = PWORKSPACE->m_efFullscreenMode;
|
||||
|
||||
if (FSWINDOW != PWINDOW && !PWINDOW->m_bPinned)
|
||||
g_pCompositor->setWindowFullscreen(FSWINDOW, false, FULLSCREEN_FULL);
|
||||
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
|
||||
if (FSWINDOW != PWINDOW && !PWINDOW->m_bPinned)
|
||||
g_pCompositor->setWindowFullscreen(PWINDOW, true, FSMODE);
|
||||
} else {
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
}
|
||||
|
||||
g_pCompositor->warpCursorTo(PWINDOW->middle());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue