From 70f46970da4a6a08d3d19f3e8f676c3f13787bbc Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 8 Dec 2021 15:21:48 +0200 Subject: [PATCH] Invalidate decoration explicitly Lets us to remove AbstractClient::updateDecoration(). --- src/abstract_client.cpp | 4 ++++ src/abstract_client.h | 1 + src/decorations/decorationbridge.cpp | 2 +- src/internal_client.cpp | 5 +++++ src/internal_client.h | 1 + src/x11client.cpp | 5 +++++ src/x11client.h | 1 + src/xdgshellclient.cpp | 5 +++++ src/xdgshellclient.h | 1 + 9 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index 944b20e9cf..dd8e220e85 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -3750,6 +3750,10 @@ void AbstractClient::updateDecoration(bool check_workspace_pos, bool force) qCWarning(KWIN_CORE, "%s doesn't support server side decorations", metaObject()->className()); } +void AbstractClient::invalidateDecoration() +{ +} + bool AbstractClient::noBorder() const { return true; diff --git a/src/abstract_client.h b/src/abstract_client.h index cf91c0421e..bf7af76383 100644 --- a/src/abstract_client.h +++ b/src/abstract_client.h @@ -766,6 +766,7 @@ public: * TODO: fix boolean traps */ virtual void updateDecoration(bool check_workspace_pos, bool force = false); + virtual void invalidateDecoration(); /** * Returns whether the window provides context help or not. If it does, diff --git a/src/decorations/decorationbridge.cpp b/src/decorations/decorationbridge.cpp index 1837aa3724..66a3ac712a 100644 --- a/src/decorations/decorationbridge.cpp +++ b/src/decorations/decorationbridge.cpp @@ -141,7 +141,7 @@ void DecorationBridge::initPlugin() static void recreateDecorations() { - Workspace::self()->forEachAbstractClient([](AbstractClient *c) { c->updateDecoration(true, true); }); + Workspace::self()->forEachAbstractClient([](AbstractClient *c) { c->invalidateDecoration(); }); } void DecorationBridge::reconfigure() diff --git a/src/internal_client.cpp b/src/internal_client.cpp index 6da0d70fe1..d02f6d7065 100644 --- a/src/internal_client.cpp +++ b/src/internal_client.cpp @@ -336,6 +336,11 @@ void InternalClient::updateDecoration(bool check_workspace_pos, bool force) } } +void InternalClient::invalidateDecoration() +{ + updateDecoration(true, true); +} + void InternalClient::destroyClient() { markAsZombie(); diff --git a/src/internal_client.h b/src/internal_client.h index b9a823fc4a..d179a175d4 100644 --- a/src/internal_client.h +++ b/src/internal_client.h @@ -54,6 +54,7 @@ public: bool takeFocus() override; void setNoBorder(bool set) override; void updateDecoration(bool check_workspace_pos, bool force = false) override; + void invalidateDecoration() override; void destroyClient() override; bool hasPopupGrab() const override; void popupDone() override; diff --git a/src/x11client.cpp b/src/x11client.cpp index b7058bf1ff..c6bd73fab2 100644 --- a/src/x11client.cpp +++ b/src/x11client.cpp @@ -1110,6 +1110,11 @@ void X11Client::updateDecoration(bool check_workspace_pos, bool force) updateFrameExtents(); } +void X11Client::invalidateDecoration() +{ + updateDecoration(true, true); +} + void X11Client::createDecoration(const QRect& oldgeom) { KDecoration2::Decoration *decoration = Decoration::DecorationBridge::self()->createDecoration(this); diff --git a/src/x11client.h b/src/x11client.h index 2019aeb771..f395b21f38 100644 --- a/src/x11client.h +++ b/src/x11client.h @@ -183,6 +183,7 @@ public: bool takeFocus() override; void updateDecoration(bool check_workspace_pos, bool force = false) override; + void invalidateDecoration() override; void updateShape(); diff --git a/src/xdgshellclient.cpp b/src/xdgshellclient.cpp index 5409aedba4..06237932a7 100644 --- a/src/xdgshellclient.cpp +++ b/src/xdgshellclient.cpp @@ -814,6 +814,11 @@ void XdgToplevelClient::updateDecoration(bool check_workspace_pos, bool force) } } +void XdgToplevelClient::invalidateDecoration() +{ + updateDecoration(true, true); +} + bool XdgToplevelClient::supportsWindowRules() const { return true; diff --git a/src/xdgshellclient.h b/src/xdgshellclient.h index d695865e97..f19c286bf4 100644 --- a/src/xdgshellclient.h +++ b/src/xdgshellclient.h @@ -140,6 +140,7 @@ public: bool noBorder() const override; void setNoBorder(bool set) override; void updateDecoration(bool check_workspace_pos, bool force = false) override; + void invalidateDecoration() override; QString preferredColorScheme() const override; bool supportsWindowRules() const override; bool takeFocus() override;