diff --git a/src/compositor_x11.cpp b/src/compositor_x11.cpp index c72a9c5555..813a7199c7 100644 --- a/src/compositor_x11.cpp +++ b/src/compositor_x11.cpp @@ -149,6 +149,7 @@ void X11Compositor::start() // Internal setup failed, abort. return; } + kwinApp()->setX11CompositeWindow(backend()->overlayWindow()->window()); startupWithWorkspace(); m_syncManager.reset(X11SyncManager::create()); } @@ -157,6 +158,7 @@ void X11Compositor::stop() { m_syncManager.reset(); Compositor::stop(); + kwinApp()->setX11CompositeWindow(XCB_WINDOW_NONE); } void X11Compositor::composite(RenderLoop *renderLoop) @@ -215,20 +217,6 @@ void X11Compositor::composite(RenderLoop *renderLoop) } } -bool X11Compositor::checkForOverlayWindow(WId w) const -{ - if (!backend()) { - // No backend, so it cannot be the overlay window. - return false; - } - if (!backend()->overlayWindow()) { - // No overlay window, it cannot be the overlay. - return false; - } - // Compare the window ID's. - return w == backend()->overlayWindow()->window(); -} - bool X11Compositor::isOverlayWindowVisible() const { if (!backend()) { diff --git a/src/compositor_x11.h b/src/compositor_x11.h index 0497dbd271..503ccad1bd 100644 --- a/src/compositor_x11.h +++ b/src/compositor_x11.h @@ -80,11 +80,6 @@ public: bool openGLCompositingIsBroken() const override; void createOpenGLSafePoint(OpenGLSafePoint safePoint) override; - /** - * Checks whether @p w is the Scene's overlay window. - */ - bool checkForOverlayWindow(WId w) const; - /** * @returns Whether the Scene's Overlay X Window is visible. */ diff --git a/src/main.h b/src/main.h index d3d277ef4a..50ab407cce 100644 --- a/src/main.h +++ b/src/main.h @@ -181,6 +181,14 @@ public: return m_rootWindow; } + /** + * @returns the X11 composite overlay window handle. + */ + xcb_window_t x11CompositeWindow() const + { + return m_compositeWindow; + } + /** * @returns the X11 xcb connection */ @@ -205,6 +213,10 @@ public: { m_connection = c; } + void setX11CompositeWindow(xcb_window_t window) + { + m_compositeWindow = window; + } qreal xwaylandScale() const { @@ -368,6 +380,7 @@ private: OperationMode m_operationMode; xcb_timestamp_t m_x11Time = XCB_TIME_CURRENT_TIME; xcb_window_t m_rootWindow = XCB_WINDOW_NONE; + xcb_window_t m_compositeWindow = XCB_WINDOW_NONE; xcb_connection_t *m_connection = nullptr; #if KWIN_BUILD_ACTIVITIES bool m_useKActivities = true; diff --git a/src/workspace.cpp b/src/workspace.cpp index 76f96b2b8c..2b52b6b8a0 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -661,10 +661,8 @@ X11Window *Workspace::createX11Window(xcb_window_t windowId, bool is_mapped) X11Window *Workspace::createUnmanaged(xcb_window_t windowId) { - if (X11Compositor *compositor = X11Compositor::self()) { - if (compositor->checkForOverlayWindow(windowId)) { - return nullptr; - } + if (kwinApp()->x11CompositeWindow() == windowId) { + return nullptr; } X11Window *window = new X11Window(); if (!window->track(windowId)) {