From 93abb9a273181a8b8430134609b163a35c4e4aa0 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Mon, 12 Nov 2018 12:47:36 +0200 Subject: [PATCH] Don't cache value of popupWindow property in EffectWindow Summary: With the plasma shell protocol, a ShellClient gets its role/window type after it's created, so the cached value of the popupWindow property in EffectWindow can be wrong. In addition to that, the value of the popupWindow property still can be wrong because plasma shell surfaces don't have xdg-popup role, so we need to check NetWM-based window type in ShellClient::isPopupWindow. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: davidedmundson, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D16835 --- deleted.cpp | 2 ++ deleted.h | 10 ++++++++++ libkwineffects/kwineffects.cpp | 8 +------- shell_client.cpp | 3 +++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/deleted.cpp b/deleted.cpp index 34960bb3e9..0df6c36462 100644 --- a/deleted.cpp +++ b/deleted.cpp @@ -52,6 +52,7 @@ Deleted::Deleted() , m_wasX11Client(false) , m_wasWaylandClient(false) , m_wasGroupTransient(false) + , m_wasPopupWindow(false) { } @@ -142,6 +143,7 @@ void Deleted::copyToDeleted(Toplevel* c) m_wasWaylandClient = qobject_cast(c) != nullptr; m_wasX11Client = !m_wasWaylandClient; + m_wasPopupWindow = c->isPopupWindow(); } void Deleted::unrefWindow() diff --git a/deleted.h b/deleted.h index d7af9f2130..a2dd663fe7 100644 --- a/deleted.h +++ b/deleted.h @@ -172,6 +172,15 @@ public: return m_transients; } + /** + * Returns whether the client was a popup. + * + * @returns @c true if the client was a popup, @c false otherwise. + **/ + bool isPopupWindow() const override { + return m_wasPopupWindow; + } + protected: virtual void debug(QDebug& stream) const; private Q_SLOTS: @@ -223,6 +232,7 @@ private: bool m_wasGroupTransient; ToplevelList m_transientFor; DeletedList m_transients; + bool m_wasPopupWindow; }; inline void Deleted::refWindow() diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 8a159486a5..25644ff7c4 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -785,7 +785,6 @@ public: bool managed = false; bool waylandClient; bool x11Client; - bool popupWindow; }; EffectWindow::Private::Private(EffectWindow *q) @@ -808,7 +807,6 @@ EffectWindow::EffectWindow(QObject *parent) d->waylandClient = parent->inherits("KWin::ShellClient"); d->x11Client = !d->waylandClient; - d->popupWindow = parent->property("popupWindow").value(); } EffectWindow::~EffectWindow() @@ -858,6 +856,7 @@ WINDOW_HELPER(QStringList, activities, "activities") WINDOW_HELPER(bool, skipsCloseAnimation, "skipsCloseAnimation") WINDOW_HELPER(KWayland::Server::SurfaceInterface *, surface, "surface") WINDOW_HELPER(QVector, desktops, "x11DesktopIds") +WINDOW_HELPER(bool, isPopupWindow, "popupWindow") QString EffectWindow::windowClass() const { @@ -1020,11 +1019,6 @@ bool EffectWindow::isX11Client() const return d->x11Client; } -bool EffectWindow::isPopupWindow() const -{ - return d->popupWindow; -} - //**************************************** // EffectWindowGroup //**************************************** diff --git a/shell_client.cpp b/shell_client.cpp index f363a04409..83e58eef2b 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -1935,6 +1935,9 @@ void ShellClient::updateClientOutputs() bool ShellClient::isPopupWindow() const { + if (Toplevel::isPopupWindow()) { + return true; + } if (m_shellSurface != nullptr) { return m_shellSurface->isPopup(); }