diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index cc05a386..6b4f0a1a 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -57,6 +57,8 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) { void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) { SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_destroyLayerSurface); + Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface); + if (layersurface->layerSurface->mapped) layersurface->layerSurface->mapped = false; @@ -70,8 +72,6 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) { const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID); - Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface); - // remove the layersurface as it's not used anymore PMONITOR->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface); delete layersurface; @@ -86,6 +86,8 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) { void Events::listener_mapLayerSurface(wl_listener* listener, void* data) { SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_mapLayerSurface); + Debug::log(LOG, "LayerSurface %x mapped", layersurface->layerSurface); + layersurface->layerSurface->mapped = true; wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output); @@ -106,20 +108,18 @@ void Events::listener_mapLayerSurface(wl_listener* listener, void* data) { if (layersurface->layerSurface->current.keyboard_interactive) g_pCompositor->focusSurface(layersurface->layerSurface->surface); - - Debug::log(LOG, "LayerSurface %x mapped", layersurface->layerSurface); } void Events::listener_unmapLayerSurface(wl_listener* listener, void* data) { SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_unmapLayerSurface); + Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface); + if (layersurface->layerSurface->mapped) layersurface->layerSurface->mapped = false; if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus) g_pCompositor->m_pLastFocus = nullptr; - - Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface); } void Events::listener_commitLayerSurface(wl_listener* listener, void* data) { @@ -162,6 +162,8 @@ void createSubsurface(wlr_subsurface* pSubSurface, SLayerSurface* pLayerSurface) if (!pSubSurface || !pLayerSurface) return; + Debug::log(LOG, "Subsurface %x created", pSubSurface); + g_pCompositor->m_lSubsurfaces.push_back(SSubsurface()); const auto PNEWSUBSURFACE = &g_pCompositor->m_lSubsurfaces.back(); @@ -198,12 +200,16 @@ void Events::listener_newSubsurface(wl_listener* listener, void* data) { void Events::listener_mapSubsurface(wl_listener* listener, void* data) { SSubsurface* subsurface = wl_container_of(listener, subsurface, listen_mapSubsurface); + Debug::log(LOG, "Subsurface %x mapped", subsurface); + damageSubsurface(subsurface, true); } void Events::listener_unmapSubsurface(wl_listener* listener, void* data) { SSubsurface* subsurface = wl_container_of(listener, subsurface, listen_unmapSubsurface); + Debug::log(LOG, "Subsurface %x unmapped", subsurface); + damageSubsurface(subsurface, true); } @@ -216,6 +222,8 @@ void Events::listener_commitSubsurface(wl_listener* listener, void* data) { void Events::listener_destroySubsurface(wl_listener* listener, void* data) { SSubsurface* subsurface = wl_container_of(listener, subsurface, listen_destroySubsurface); + Debug::log(LOG, "Subsurface %x destroyed", subsurface); + wl_list_remove(&subsurface->listen_mapSubsurface.link); wl_list_remove(&subsurface->listen_unmapSubsurface.link); wl_list_remove(&subsurface->listen_destroySubsurface.link); diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp index 545c4995..7bd08a57 100644 --- a/src/events/Misc.cpp +++ b/src/events/Misc.cpp @@ -82,14 +82,14 @@ void Events::listener_startDrag(wl_listener* listener, void* data) { } void Events::listener_InhibitActivate(wl_listener* listener, void* data) { - g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client; - Debug::log(LOG, "Activated exclusive for %x.", g_pCompositor->m_sSeat.exclusiveClient); + + g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client; } void Events::listener_InhibitDeactivate(wl_listener* listener, void* data) { + Debug::log(LOG, "Deactivated exclusive."); + g_pCompositor->m_sSeat.exclusiveClient = nullptr; g_pInputManager->refocus(); - - Debug::log(LOG, "Deactivated exclusive."); } \ No newline at end of file diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp index 37acc313..78d841fe 100644 --- a/src/events/Popups.cpp +++ b/src/events/Popups.cpp @@ -46,49 +46,50 @@ void createNewPopup(wlr_xdg_popup* popup, void* parent, bool parentIsLayer) { void Events::listener_newPopup(wl_listener* listener, void* data) { SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_newPopup); + Debug::log(LOG, "New layer popup created from surface %x", layersurface); + const auto WLRPOPUP = (wlr_xdg_popup*)data; createNewPopup(WLRPOPUP, layersurface, true); - - Debug::log(LOG, "New layer popup created from surface %x", layersurface); } void Events::listener_newPopupFromPopup(wl_listener* listener, void* data) { SLayerPopup* layerPopup = wl_container_of(listener, layerPopup, listen_newPopupFromPopup); + Debug::log(LOG, "New layer popup created from popup %x", layerPopup); + const auto WLRPOPUP = (wlr_xdg_popup*)data; createNewPopup(WLRPOPUP, layerPopup, true); - - Debug::log(LOG, "New layer popup created from popup %x", layerPopup); } void Events::listener_destroyPopup(wl_listener* listener, void* data) { SLayerPopup* layerPopup = wl_container_of(listener, layerPopup, listen_destroyPopup); + Debug::log(LOG, "Destroyed popup %x", layerPopup); + wl_list_remove(&layerPopup->listen_mapPopup.link); wl_list_remove(&layerPopup->listen_unmapPopup.link); wl_list_remove(&layerPopup->listen_destroyPopup.link); wl_list_remove(&layerPopup->listen_commitPopup.link); g_pCompositor->m_lLayerPopups.remove(*layerPopup); - - Debug::log(LOG, "Destroyed popup %x", layerPopup); } void Events::listener_mapPopup(wl_listener* listener, void* data) { SLayerPopup* layerPopup = wl_container_of(listener, layerPopup, listen_mapPopup); + Debug::log(LOG, "Mapped popup %x", layerPopup); + const auto PLAYER = g_pCompositor->getLayerForPopup(layerPopup); wlr_surface_send_enter(layerPopup->popup->base->surface, PLAYER->layerSurface->output); - - Debug::log(LOG, "Mapped popup %x", layerPopup); } void Events::listener_unmapPopup(wl_listener* listener, void* data) { SLayerPopup* layerPopup = wl_container_of(listener, layerPopup, listen_unmapPopup); + Debug::log(LOG, "LayerPopup %x unmapped", layerPopup); } void Events::listener_commitPopup(wl_listener* listener, void* data) { @@ -100,6 +101,8 @@ void createNewPopupXDG(wlr_xdg_popup* popup, void* parent, bool parentIsWindow) if (!popup) return; + Debug::log(LOG, "New XDG Popup %x created", popup); + g_pCompositor->m_lXDGPopups.push_back(SXDGPopup()); const auto PNEWPOPUP = &g_pCompositor->m_lXDGPopups.back(); @@ -127,39 +130,39 @@ void createNewPopupXDG(wlr_xdg_popup* popup, void* parent, bool parentIsWindow) void Events::listener_newPopupXDG(wl_listener* listener, void* data) { CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_newPopupXDG); + Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str()); + const auto WLRPOPUP = (wlr_xdg_popup*)data; createNewPopupXDG(WLRPOPUP, PWINDOW, true); - - Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str()); } void Events::listener_newPopupFromPopupXDG(wl_listener* listener, void* data) { SXDGPopup* PPOPUP = wl_container_of(listener, PPOPUP, listen_newPopupFromPopupXDG); + Debug::log(LOG, "New layer popup created from XDG popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str()); + const auto WLRPOPUP = (wlr_xdg_popup*)data; createNewPopupXDG(WLRPOPUP, PPOPUP, true); - - Debug::log(LOG, "New layer popup created from XDG popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str()); } void Events::listener_mapPopupXDG(wl_listener* listener, void* data) { - + Debug::log(LOG, "New XDG Popup mapped"); } void Events::listener_unmapPopupXDG(wl_listener* listener, void* data) { - + Debug::log(LOG, "XDG Popup unmapped"); } void Events::listener_destroyPopupXDG(wl_listener* listener, void* data) { SXDGPopup* PPOPUP = wl_container_of(listener, PPOPUP, listen_destroyPopupXDG); + Debug::log(LOG, "Destroyed popup XDG %x", PPOPUP); + wl_list_remove(&PPOPUP->listen_mapPopupXDG.link); wl_list_remove(&PPOPUP->listen_unmapPopupXDG.link); wl_list_remove(&PPOPUP->listen_destroyPopupXDG.link); g_pCompositor->m_lXDGPopups.remove(*PPOPUP); - - Debug::log(LOG, "Destroyed popup XDG %x", PPOPUP); } \ No newline at end of file diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 07be7cb2..59446df4 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -112,6 +112,8 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) { void Events::listener_unmapWindow(wl_listener* listener, void* data) { CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_unmapWindow); + Debug::log(LOG, "Window %x unmapped", PWINDOW); + if (g_pXWaylandManager->getWindowSurface(PWINDOW) == g_pCompositor->m_pLastFocus) g_pCompositor->m_pLastFocus = nullptr; @@ -134,8 +136,6 @@ void Events::listener_unmapWindow(wl_listener* listener, void* data) { // This might be way more sinister in nature and have a problem more deeply // rooted in the code. // g_pInputManager->refocus(); - - Debug::log(LOG, "Window %x unmapped", PWINDOW); } void Events::listener_commitWindow(wl_listener* listener, void* data) { @@ -147,6 +147,8 @@ void Events::listener_commitWindow(wl_listener* listener, void* data) { void Events::listener_destroyWindow(wl_listener* listener, void* data) { CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_destroyWindow); + Debug::log(LOG, "Window %x destroyed", PWINDOW); + if (g_pXWaylandManager->getWindowSurface(PWINDOW) == g_pCompositor->m_pLastFocus) g_pCompositor->m_pLastFocus = nullptr; @@ -157,8 +159,6 @@ void Events::listener_destroyWindow(wl_listener* listener, void* data) { g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW); - Debug::log(LOG, "Window %x destroyed", PWINDOW); - wl_list_remove(&PWINDOW->listen_mapWindow.link); wl_list_remove(&PWINDOW->listen_unmapWindow.link); wl_list_remove(&PWINDOW->listen_destroyWindow.link); @@ -180,17 +180,17 @@ void Events::listener_setTitleWindow(wl_listener* listener, void* data) { if (!g_pCompositor->windowValidMapped(PWINDOW)) return; - PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW); - Debug::log(LOG, "Window %x set title to %s", PWINDOW, PWINDOW->m_szTitle.c_str()); + + PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW); } void Events::listener_fullscreenWindow(wl_listener* listener, void* data) { CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_fullscreenWindow); - g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW); - Debug::log(LOG, "Window %x fullscreen to %i", PWINDOW, PWINDOW->m_bIsFullscreen); + + g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW); } void Events::listener_activate(wl_listener* listener, void* data) { @@ -217,6 +217,8 @@ void Events::listener_configureX11(wl_listener* listener, void* data) { void Events::listener_surfaceXWayland(wl_listener* listener, void* data) { const auto XWSURFACE = (wlr_xwayland_surface*)data; + Debug::log(LOG, "New XWayland Surface created."); + g_pCompositor->m_lWindows.push_back(CWindow()); const auto PNEWWINDOW = &g_pCompositor->m_lWindows.back(); @@ -231,14 +233,14 @@ void Events::listener_surfaceXWayland(wl_listener* listener, void* data) { wl_signal_add(&XWSURFACE->events.set_title, &PNEWWINDOW->listen_setTitleWindow); wl_signal_add(&XWSURFACE->events.destroy, &PNEWWINDOW->listen_destroyWindow); wl_signal_add(&XWSURFACE->events.request_fullscreen, &PNEWWINDOW->listen_fullscreenWindow); - - Debug::log(LOG, "New XWayland Surface created."); } void Events::listener_newXDGSurface(wl_listener* listener, void* data) { // A window got opened const auto XDGSURFACE = (wlr_xdg_surface*)data; + Debug::log(LOG, "New XDG Surface created. (%ix%i at %i %i)", XDGSURFACE->current.geometry.width, XDGSURFACE->current.geometry.height, XDGSURFACE->current.geometry.x, XDGSURFACE->current.geometry.y); + if (XDGSURFACE->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) return; // TODO: handle? @@ -252,8 +254,6 @@ void Events::listener_newXDGSurface(wl_listener* listener, void* data) { wl_signal_add(&XDGSURFACE->events.destroy, &PNEWWINDOW->listen_destroyWindow); wl_signal_add(&XDGSURFACE->toplevel->events.set_title, &PNEWWINDOW->listen_setTitleWindow); wl_signal_add(&XDGSURFACE->toplevel->events.request_fullscreen, &PNEWWINDOW->listen_fullscreenWindow); - - Debug::log(LOG, "New XDG Surface created."); } // @@ -264,6 +264,8 @@ void createSubsurface(CWindow* pWindow, wlr_subsurface* pSubsurface) { if (!pWindow || !pSubsurface) return; + Debug::log(LOG, "New Window Subsurface %x created", pSubsurface); + g_pCompositor->m_lSubsurfaces.push_back(SSubsurface()); const auto PNEWSUBSURFACE = &g_pCompositor->m_lSubsurfaces.back();