mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-08 16:25:58 +01:00
refocus on reserved area
This commit is contained in:
parent
3c3f80c2fe
commit
f4add0ac6d
3 changed files with 17 additions and 1 deletions
|
@ -1776,3 +1776,14 @@ void CCompositor::forceReportSizesToWindowsOnWorkspace(const int& wid) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCompositor::cursorOnReservedArea() {
|
||||||
|
const auto PMONITOR = getMonitorFromCursor();
|
||||||
|
|
||||||
|
const auto XY1 = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft;
|
||||||
|
const auto XY2 = PMONITOR->vecPosition + PMONITOR->vecSize - PMONITOR->vecReservedBottomRight;
|
||||||
|
|
||||||
|
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal();
|
||||||
|
|
||||||
|
return !VECINRECT(CURSORPOS, XY1.x, XY1.y, XY2.x, XY2.y);
|
||||||
|
}
|
||||||
|
|
|
@ -164,6 +164,7 @@ public:
|
||||||
void closeWindow(CWindow*);
|
void closeWindow(CWindow*);
|
||||||
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
||||||
void forceReportSizesToWindowsOnWorkspace(const int&);
|
void forceReportSizesToWindowsOnWorkspace(const int&);
|
||||||
|
bool cursorOnReservedArea();
|
||||||
|
|
||||||
|
|
||||||
std::string explicitConfigPath;
|
std::string explicitConfigPath;
|
||||||
|
|
|
@ -653,7 +653,11 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
// warp and focus
|
// warp and focus
|
||||||
if (anotherMonitor)
|
if (anotherMonitor)
|
||||||
g_pCompositor->warpCursorTo(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f);
|
g_pCompositor->warpCursorTo(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f);
|
||||||
|
|
||||||
g_pCompositor->focusWindow(PWINDOW, g_pXWaylandManager->getWindowSurface(PWINDOW));
|
g_pCompositor->focusWindow(PWINDOW, g_pXWaylandManager->getWindowSurface(PWINDOW));
|
||||||
|
|
||||||
|
if (g_pCompositor->cursorOnReservedArea()) // fix focus on bars etc
|
||||||
|
g_pInputManager->refocus();
|
||||||
} else
|
} else
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue