mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 15:25:58 +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
|
@ -419,3 +419,20 @@ CWindow* CCompositor::getFirstWindowOnWorkspace(const int& id) {
|
||||||
|
|
||||||
return nullptr;
|
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();
|
void sanityCheckWorkspaces();
|
||||||
int getWindowsOnWorkspace(const int&);
|
int getWindowsOnWorkspace(const int&);
|
||||||
CWindow* getFirstWindowOnWorkspace(const int&);
|
CWindow* getFirstWindowOnWorkspace(const int&);
|
||||||
|
void fixXWaylandWindowsOnWorkspace(const int&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAllSignals();
|
void initAllSignals();
|
||||||
|
|
|
@ -100,9 +100,21 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->monitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->monitorID);
|
||||||
|
|
||||||
// if it's not visible, make it visible.
|
// 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;
|
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 the monitor is not the one our cursor's at, warp to it.
|
||||||
if (PMONITOR != g_pCompositor->getMonitorFromCursor()) {
|
if (PMONITOR != g_pCompositor->getMonitorFromCursor()) {
|
||||||
Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
|
Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
|
||||||
|
|
|
@ -68,7 +68,7 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
|
||||||
|
|
||||||
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size) {
|
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size) {
|
||||||
if (pWindow->m_bIsX11)
|
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
|
else
|
||||||
wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y);
|
wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y);
|
||||||
|
@ -98,3 +98,9 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
|
||||||
|
|
||||||
return false;
|
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);
|
void setWindowStyleTiled(CWindow*, uint32_t);
|
||||||
wlr_surface* surfaceAt(CWindow*, const Vector2D&, Vector2D&);
|
wlr_surface* surfaceAt(CWindow*, const Vector2D&, Vector2D&);
|
||||||
bool shouldBeFloated(CWindow*);
|
bool shouldBeFloated(CWindow*);
|
||||||
|
void moveXWaylandWindow(CWindow*, const Vector2D&);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CHyprXWaylandManager> g_pXWaylandManager;
|
inline std::unique_ptr<CHyprXWaylandManager> g_pXWaylandManager;
|
Loading…
Reference in a new issue