mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-08 11:25:59 +01:00
refocus on reserved area
This commit is contained in:
parent
3c3f80c2fe
commit
f4add0ac6d
3 changed files with 17 additions and 1 deletions
|
@ -1775,4 +1775,15 @@ void CCompositor::forceReportSizesToWindowsOnWorkspace(const int& wid) {
|
|||
g_pXWaylandManager->setWindowSize(w.get(), w->m_vRealSize.vec(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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*);
|
||||
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
||||
void forceReportSizesToWindowsOnWorkspace(const int&);
|
||||
bool cursorOnReservedArea();
|
||||
|
||||
|
||||
std::string explicitConfigPath;
|
||||
|
|
|
@ -653,7 +653,11 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
// warp and focus
|
||||
if (anotherMonitor)
|
||||
g_pCompositor->warpCursorTo(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f);
|
||||
|
||||
g_pCompositor->focusWindow(PWINDOW, g_pXWaylandManager->getWindowSurface(PWINDOW));
|
||||
|
||||
if (g_pCompositor->cursorOnReservedArea()) // fix focus on bars etc
|
||||
g_pInputManager->refocus();
|
||||
} else
|
||||
g_pInputManager->refocus();
|
||||
|
||||
|
|
Loading…
Reference in a new issue