diff --git a/composite.cpp b/composite.cpp index 9fef596e54..a4bfaab829 100644 --- a/composite.cpp +++ b/composite.cpp @@ -890,17 +890,6 @@ int WaylandCompositor::refreshRate() const return KWin::currentRefreshRate(); } -void WaylandCompositor::updateCompositeBlocking() -{ - // Composite blocking not possible on Wayland. -} - -void WaylandCompositor::updateClientCompositeBlocking(Client *c) -{ - Q_UNUSED(c) - // Composite blocking not possible on Wayland. -} - X11Compositor::X11Compositor(QObject *parent) : Compositor(parent) , m_suspended(options->isUseCompositing() ? NoReasonSuspend : UserSuspend) @@ -1029,11 +1018,6 @@ int X11Compositor::refreshRate() const return m_xrrRefreshRate; } -void X11Compositor::updateCompositeBlocking() -{ - updateClientCompositeBlocking(NULL); -} - void X11Compositor::updateClientCompositeBlocking(Client *c) { if (c) { @@ -1063,6 +1047,11 @@ void X11Compositor::updateClientCompositeBlocking(Client *c) } } +X11Compositor *X11Compositor::self() +{ + return qobject_cast(Compositor::self()); +} + } // included for CompositorSelectionOwner diff --git a/composite.h b/composite.h index 4d1bc39358..94a6306d0e 100644 --- a/composite.h +++ b/composite.h @@ -113,10 +113,6 @@ public: return s_compositor != NULL && s_compositor->isActive(); } - - virtual void updateCompositeBlocking() = 0; - virtual void updateClientCompositeBlocking(KWin::Client *c) = 0; - // for delayed supportproperty management of effects void keepSupportProperty(xcb_atom_t atom); void removeSupportProperty(xcb_atom_t atom); @@ -197,9 +193,6 @@ public: bool checkForOverlayWindow(WId w) const override; - void updateCompositeBlocking() override; - void updateClientCompositeBlocking(KWin::Client* c) override; - protected: void start() override; @@ -267,8 +260,9 @@ public: int refreshRate() const override; - void updateCompositeBlocking() override; - void updateClientCompositeBlocking(KWin::Client* c) override; + void updateClientCompositeBlocking(Client *client = nullptr); + + static X11Compositor *self(); protected: void start() override; diff --git a/workspace.cpp b/workspace.cpp index e3f36f8aed..339f886199 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -596,7 +596,9 @@ Client* Workspace::createClient(xcb_window_t w, bool is_mapped) StackingUpdatesBlocker blocker(this); Client* c = new Client(); setupClientConnections(c); - connect(c, &Client::blockingCompositingChanged, m_compositor, &Compositor::updateClientCompositeBlocking); + if (X11Compositor *compositor = X11Compositor::self()) { + connect(c, &Client::blockingCompositingChanged, compositor, &X11Compositor::updateClientCompositeBlocking); + } connect(c, SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool)), ScreenEdges::self(), SIGNAL(checkBlocking())); if (!c->manage(w, is_mapped)) { Client::deleteClient(c); @@ -749,8 +751,11 @@ void Workspace::removeDeleted(Deleted* c) unconstrained_stacking_order.removeAll(c); stacking_order.removeAll(c); markXStackingOrderAsDirty(); - if (c->wasClient() && m_compositor) { - m_compositor->updateCompositeBlocking(); + if (!c->wasClient()) { + return; + } + if (X11Compositor *compositor = X11Compositor::self()) { + compositor->updateClientCompositeBlocking(); } }