minor fixes to X11 configure/or handling

This commit is contained in:
vaxerski 2023-02-28 18:50:47 +00:00
parent 89e7d812c8
commit 7e523e4d5e
4 changed files with 28 additions and 15 deletions

View file

@ -498,10 +498,6 @@ CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
void CCompositor::removeWindowFromVectorSafe(CWindow* pWindow) { void CCompositor::removeWindowFromVectorSafe(CWindow* pWindow) {
if (windowExists(pWindow) && !pWindow->m_bFadingOut) { if (windowExists(pWindow) && !pWindow->m_bFadingOut) {
if (pWindow->m_bIsX11 && pWindow->m_iX11Type == 2) {
std::erase_if(m_dUnmanagedX11Windows, [&](std::unique_ptr<CWindow>& el) { return el.get() == pWindow; });
}
// if X11, also check its children // if X11, also check its children
// and delete any needed // and delete any needed
if (pWindow->m_bIsX11) { if (pWindow->m_bIsX11) {
@ -519,6 +515,10 @@ void CCompositor::removeWindowFromVectorSafe(CWindow* pWindow) {
} }
} }
if (pWindow->m_bIsX11 && pWindow->m_iX11Type == 2) {
std::erase_if(m_dUnmanagedX11Windows, [&](std::unique_ptr<CWindow>& el) { return el.get() == pWindow; });
}
std::erase_if(m_vWindows, [&](std::unique_ptr<CWindow>& el) { return el.get() == pWindow; }); std::erase_if(m_vWindows, [&](std::unique_ptr<CWindow>& el) { return el.get() == pWindow; });
} }
} }
@ -529,6 +529,11 @@ bool CCompositor::windowExists(CWindow* pWindow) {
return true; return true;
} }
for (auto& u : m_dUnmanagedX11Windows) {
if (u.get() == pWindow)
return true;
}
return false; return false;
} }

View file

@ -155,6 +155,7 @@ class CWindow {
DYNLISTENER(toplevelClose); DYNLISTENER(toplevelClose);
DYNLISTENER(toplevelActivate); DYNLISTENER(toplevelActivate);
DYNLISTENER(toplevelFullscreen); DYNLISTENER(toplevelFullscreen);
DYNLISTENER(setOverrideRedirect);
// DYNLISTENER(newSubsurfaceWindow); // DYNLISTENER(newSubsurfaceWindow);
union { union {

View file

@ -58,6 +58,7 @@ namespace Events {
DYNLISTENFUNC(requestResize); DYNLISTENFUNC(requestResize);
DYNLISTENFUNC(requestMinimize); DYNLISTENFUNC(requestMinimize);
DYNLISTENFUNC(requestMaximize); DYNLISTENFUNC(requestMaximize);
DYNLISTENFUNC(setOverrideRedirect);
// Window subsurfaces // Window subsurfaces
// LISTENER(newSubsurfaceWindow); // LISTENER(newSubsurfaceWindow);

View file

@ -446,7 +446,6 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW, PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW,
"XWayland Window Late"); "XWayland Window Late");
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late"); PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late");
PWINDOW->hyprListener_configureX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_configure, &Events::listener_configureX11, PWINDOW, "XWayland Window Late");
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late"); PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late");
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_minimize, &Events::listener_requestMinimize, PWINDOW, PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_minimize, &Events::listener_requestMinimize, PWINDOW,
"Xwayland Window Late"); "Xwayland Window Late");
@ -596,7 +595,6 @@ void Events::listener_unmapWindow(void* owner, void* data) {
Debug::log(LOG, "Unregistered late callbacks XWL"); Debug::log(LOG, "Unregistered late callbacks XWL");
PWINDOW->hyprListener_fullscreenWindow.removeCallback(); PWINDOW->hyprListener_fullscreenWindow.removeCallback();
PWINDOW->hyprListener_activateX11.removeCallback(); PWINDOW->hyprListener_activateX11.removeCallback();
PWINDOW->hyprListener_configureX11.removeCallback();
PWINDOW->hyprListener_setTitleWindow.removeCallback(); PWINDOW->hyprListener_setTitleWindow.removeCallback();
PWINDOW->hyprListener_setGeometryX11U.removeCallback(); PWINDOW->hyprListener_setGeometryX11U.removeCallback();
PWINDOW->hyprListener_requestMaximize.removeCallback(); PWINDOW->hyprListener_requestMaximize.removeCallback();
@ -889,12 +887,15 @@ void Events::listener_activateX11(void* owner, void* data) {
} }
void Events::listener_configureX11(void* owner, void* data) { void Events::listener_configureX11(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner; CWindow* PWINDOW = (CWindow*)owner;
if (!g_pCompositor->windowValidMapped(PWINDOW))
return;
const auto E = (wlr_xwayland_surface_configure_event*)data; const auto E = (wlr_xwayland_surface_configure_event*)data;
if (!PWINDOW->m_uSurface.xwayland->mapped || !PWINDOW->m_bMappedX11) {
wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height);
return;
}
g_pHyprRenderer->damageWindow(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW);
if (!PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen) { if (!PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen) {
@ -904,11 +905,6 @@ void Events::listener_configureX11(void* owner, void* data) {
return; return;
} }
if (!PWINDOW->m_uSurface.xwayland->mapped || !PWINDOW->m_bMappedX11) {
wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height);
return;
}
if (E->width > 1 && E->height > 1) if (E->width > 1 && E->height > 1)
PWINDOW->setHidden(false); PWINDOW->setHidden(false);
else else
@ -974,6 +970,14 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
} }
} }
void Events::listener_setOverrideRedirect(void* owner, void* data) {
const auto PWINDOW = (CWindow*)owner;
if (!PWINDOW->m_bIsMapped && PWINDOW->m_uSurface.xwayland->mapped) {
Events::listener_mapWindow(PWINDOW, nullptr);
}
}
void Events::listener_surfaceXWayland(wl_listener* listener, void* data) { void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
const auto XWSURFACE = (wlr_xwayland_surface*)data; const auto XWSURFACE = (wlr_xwayland_surface*)data;
@ -993,6 +997,8 @@ void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
PNEWWINDOW->hyprListener_mapWindow.initCallback(&XWSURFACE->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XWayland Window"); PNEWWINDOW->hyprListener_mapWindow.initCallback(&XWSURFACE->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XWayland Window");
PNEWWINDOW->hyprListener_unmapWindow.initCallback(&XWSURFACE->events.unmap, &Events::listener_unmapWindow, PNEWWINDOW, "XWayland Window"); PNEWWINDOW->hyprListener_unmapWindow.initCallback(&XWSURFACE->events.unmap, &Events::listener_unmapWindow, PNEWWINDOW, "XWayland Window");
PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XWSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW, "XWayland Window"); PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XWSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW, "XWayland Window");
PNEWWINDOW->hyprListener_setOverrideRedirect.initCallback(&XWSURFACE->events.set_override_redirect, &Events::listener_setOverrideRedirect, PNEWWINDOW, "XWayland Window");
PNEWWINDOW->hyprListener_configureX11.initCallback(&XWSURFACE->events.request_configure, &Events::listener_configureX11, PNEWWINDOW, "XWayland Window");
} }
void Events::listener_newXDGSurface(wl_listener* listener, void* data) { void Events::listener_newXDGSurface(wl_listener* listener, void* data) {