From 8c9f38e40500720d4de5881d62ec43625e9680ea Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 17 Dec 2023 19:58:01 +0000 Subject: [PATCH] events: improve wl_surface::commit event tracking --- src/events/Windows.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index b184f4c2..6a151cfd 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -479,7 +479,6 @@ void Events::listener_mapWindow(void* owner, void* data) { Debug::log(LOG, "Window got assigned a surfaceTreeNode {:x}", (uintptr_t)PWINDOW->m_pSurfaceTree); if (!PWINDOW->m_bIsX11) { - PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xdg->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XDG Window Late"); PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XDG Window Late"); PWINDOW->hyprListener_newPopupXDG.initCallback(&PWINDOW->m_uSurface.xdg->events.new_popup, &Events::listener_newPopupXDG, PWINDOW, "XDG Window Late"); PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_maximize, &Events::listener_requestMaximize, PWINDOW, @@ -672,7 +671,6 @@ void Events::listener_unmapWindow(void* owner, void* data) { if (!PWINDOW->m_bIsX11) { Debug::log(LOG, "Unregistered late callbacks XDG"); - PWINDOW->hyprListener_commitWindow.removeCallback(); PWINDOW->hyprListener_setTitleWindow.removeCallback(); PWINDOW->hyprListener_newPopupXDG.removeCallback(); PWINDOW->hyprListener_requestMaximize.removeCallback(); @@ -853,6 +851,7 @@ void Events::listener_destroyWindow(void* owner, void* data) { g_pCompositor->m_pLastFocus = nullptr; } + PWINDOW->hyprListener_commitWindow.removeCallback(); PWINDOW->hyprListener_mapWindow.removeCallback(); PWINDOW->hyprListener_unmapWindow.removeCallback(); PWINDOW->hyprListener_destroyWindow.removeCallback(); @@ -1186,6 +1185,7 @@ void Events::listener_surfaceXWayland(wl_listener* listener, void* data) { 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"); + PNEWWINDOW->hyprListener_commitWindow.initCallback(&XWSURFACE->surface->events.commit, &Events::listener_commitWindow, PNEWWINDOW, "XWayland Window"); } void Events::listener_newXDGToplevel(wl_listener* listener, void* data) { @@ -1200,6 +1200,7 @@ void Events::listener_newXDGToplevel(wl_listener* listener, void* data) { PNEWWINDOW->hyprListener_mapWindow.initCallback(&XDGSURFACE->surface->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XDG Window"); PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XDGSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW, "XDG Window"); + PNEWWINDOW->hyprListener_commitWindow.initCallback(&XDGSURFACE->surface->events.commit, &Events::listener_commitWindow, PNEWWINDOW, "XDG Window"); } void Events::listener_NewXDGDeco(wl_listener* listener, void* data) {