mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-26 13:09:48 +01:00
fix xwayland windows grabbing mouse when hidden
This commit is contained in:
parent
f3d703335d
commit
23ec4793e1
5 changed files with 40 additions and 3 deletions
|
@ -418,4 +418,21 @@ CWindow* CCompositor::getFirstWindowOnWorkspace(const int& id) {
|
|||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CCompositor::fixXWaylandWindowsOnWorkspace(const int& id) {
|
||||
const auto ISVISIBLE = isWorkspaceVisible(id);
|
||||
|
||||
for (auto& w : m_lWindows) {
|
||||
if (w.m_iWorkspaceID == id) {
|
||||
|
||||
// moveXWaylandWindow only moves XWayland windows
|
||||
// so there is no need to check here
|
||||
// if the window is XWayland or not.
|
||||
if (ISVISIBLE)
|
||||
g_pXWaylandManager->moveXWaylandWindow(&w, w.m_vRealPosition);
|
||||
else
|
||||
g_pXWaylandManager->moveXWaylandWindow(&w, Vector2D(42069,42069));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -84,6 +84,7 @@ public:
|
|||
void sanityCheckWorkspaces();
|
||||
int getWindowsOnWorkspace(const int&);
|
||||
CWindow* getFirstWindowOnWorkspace(const int&);
|
||||
void fixXWaylandWindowsOnWorkspace(const int&);
|
||||
|
||||
private:
|
||||
void initAllSignals();
|
||||
|
|
|
@ -100,9 +100,21 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
const auto PMONITOR = g_pCompositor->getMonitorFromID(g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->monitorID);
|
||||
|
||||
// if it's not visible, make it visible.
|
||||
if (!g_pCompositor->isWorkspaceVisible(workspaceToChangeTo))
|
||||
if (!g_pCompositor->isWorkspaceVisible(workspaceToChangeTo)) {
|
||||
const auto OLDWORKSPACEID = PMONITOR->activeWorkspace;
|
||||
|
||||
// change it
|
||||
PMONITOR->activeWorkspace = workspaceToChangeTo;
|
||||
|
||||
// we need to move XWayland windows to narnia or otherwise they will still process our cursor and shit
|
||||
// and that'd be annoying as hell
|
||||
g_pCompositor->fixXWaylandWindowsOnWorkspace(OLDWORKSPACEID);
|
||||
|
||||
// and fix on the new workspace
|
||||
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
|
||||
}
|
||||
|
||||
|
||||
// If the monitor is not the one our cursor's at, warp to it.
|
||||
if (PMONITOR != g_pCompositor->getMonitorFromCursor()) {
|
||||
Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
|
||||
|
@ -111,7 +123,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
|
||||
// focus the first window
|
||||
g_pCompositor->focusWindow(g_pCompositor->getFirstWindowOnWorkspace(workspaceToChangeTo));
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
|
|||
|
||||
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size) {
|
||||
if (pWindow->m_bIsX11)
|
||||
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vEffectivePosition.x, pWindow->m_vEffectivePosition.y, size.x, size.y);
|
||||
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vRealPosition.x, pWindow->m_vRealPosition.y, size.x, size.y);
|
||||
|
||||
else
|
||||
wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y);
|
||||
|
@ -97,4 +97,10 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::moveXWaylandWindow(CWindow* pWindow, const Vector2D& pos) {
|
||||
if (pWindow->m_bIsX11) {
|
||||
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pos.x, pos.y, pWindow->m_vRealSize.x, pWindow->m_vRealSize.y);
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ public:
|
|||
void setWindowStyleTiled(CWindow*, uint32_t);
|
||||
wlr_surface* surfaceAt(CWindow*, const Vector2D&, Vector2D&);
|
||||
bool shouldBeFloated(CWindow*);
|
||||
void moveXWaylandWindow(CWindow*, const Vector2D&);
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CHyprXWaylandManager> g_pXWaylandManager;
|
Loading…
Reference in a new issue