summaryrefslogtreecommitdiff
path: root/src/events
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-27 21:46:27 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-27 21:46:27 +0200
commitde8d2fd13645d12c8d05ebff1053d09b768a1939 (patch)
treec2cb1224d50ebe1aa310e58067ca27693f1bf03c /src/events
parent39303fd2b0c82358bd1a1e12a36c2b0ddd1a574e (diff)
handle window subsurface trees
Diffstat (limited to 'src/events')
-rw-r--r--src/events/Windows.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 217fdf57..68adf1dd 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -15,6 +15,12 @@
// //
// ------------------------------------------------------------ //
+void addViewCoords(void* pWindow, int* x, int* y) {
+ const auto PWINDOW = (CWindow*)pWindow;
+ *x += PWINDOW->m_vEffectivePosition.x;
+ *y += PWINDOW->m_vEffectivePosition.y;
+}
+
void Events::listener_mapWindow(wl_listener* listener, void* data) {
CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_mapWindow);
@@ -106,6 +112,8 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
if (!PWINDOW->m_bIsModal)
g_pCompositor->focusWindow(PWINDOW);
+ PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW);
+
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vEffectivePosition.x, PWINDOW->m_vEffectivePosition.y, PWINDOW->m_vEffectiveSize.x, PWINDOW->m_vEffectiveSize.y);
}
@@ -132,6 +140,9 @@ void Events::listener_unmapWindow(wl_listener* listener, void* data) {
// refocus on a new window
g_pInputManager->refocus();
+
+ SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
+ PWINDOW->m_pSurfaceTree = nullptr;
}
void Events::listener_commitWindow(wl_listener* listener, void* data) {
@@ -150,6 +161,11 @@ void Events::listener_destroyWindow(wl_listener* listener, void* data) {
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
+ if (PWINDOW->m_pSurfaceTree) {
+ SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
+ PWINDOW->m_pSurfaceTree = nullptr;
+ }
+
g_pCompositor->removeWindowFromVectorSafe(PWINDOW);
}