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
This commit is contained in:
Vlad Zagorodniy 2018-11-12 12:47:36 +02:00
parent 5da8b4c78a
commit 93abb9a273
4 changed files with 16 additions and 7 deletions

View file

@ -52,6 +52,7 @@ Deleted::Deleted()
, m_wasX11Client(false) , m_wasX11Client(false)
, m_wasWaylandClient(false) , m_wasWaylandClient(false)
, m_wasGroupTransient(false) , m_wasGroupTransient(false)
, m_wasPopupWindow(false)
{ {
} }
@ -142,6 +143,7 @@ void Deleted::copyToDeleted(Toplevel* c)
m_wasWaylandClient = qobject_cast<ShellClient *>(c) != nullptr; m_wasWaylandClient = qobject_cast<ShellClient *>(c) != nullptr;
m_wasX11Client = !m_wasWaylandClient; m_wasX11Client = !m_wasWaylandClient;
m_wasPopupWindow = c->isPopupWindow();
} }
void Deleted::unrefWindow() void Deleted::unrefWindow()

View file

@ -172,6 +172,15 @@ public:
return m_transients; 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: protected:
virtual void debug(QDebug& stream) const; virtual void debug(QDebug& stream) const;
private Q_SLOTS: private Q_SLOTS:
@ -223,6 +232,7 @@ private:
bool m_wasGroupTransient; bool m_wasGroupTransient;
ToplevelList m_transientFor; ToplevelList m_transientFor;
DeletedList m_transients; DeletedList m_transients;
bool m_wasPopupWindow;
}; };
inline void Deleted::refWindow() inline void Deleted::refWindow()

View file

@ -785,7 +785,6 @@ public:
bool managed = false; bool managed = false;
bool waylandClient; bool waylandClient;
bool x11Client; bool x11Client;
bool popupWindow;
}; };
EffectWindow::Private::Private(EffectWindow *q) EffectWindow::Private::Private(EffectWindow *q)
@ -808,7 +807,6 @@ EffectWindow::EffectWindow(QObject *parent)
d->waylandClient = parent->inherits("KWin::ShellClient"); d->waylandClient = parent->inherits("KWin::ShellClient");
d->x11Client = !d->waylandClient; d->x11Client = !d->waylandClient;
d->popupWindow = parent->property("popupWindow").value<bool>();
} }
EffectWindow::~EffectWindow() EffectWindow::~EffectWindow()
@ -858,6 +856,7 @@ WINDOW_HELPER(QStringList, activities, "activities")
WINDOW_HELPER(bool, skipsCloseAnimation, "skipsCloseAnimation") WINDOW_HELPER(bool, skipsCloseAnimation, "skipsCloseAnimation")
WINDOW_HELPER(KWayland::Server::SurfaceInterface *, surface, "surface") WINDOW_HELPER(KWayland::Server::SurfaceInterface *, surface, "surface")
WINDOW_HELPER(QVector<int>, desktops, "x11DesktopIds") WINDOW_HELPER(QVector<int>, desktops, "x11DesktopIds")
WINDOW_HELPER(bool, isPopupWindow, "popupWindow")
QString EffectWindow::windowClass() const QString EffectWindow::windowClass() const
{ {
@ -1020,11 +1019,6 @@ bool EffectWindow::isX11Client() const
return d->x11Client; return d->x11Client;
} }
bool EffectWindow::isPopupWindow() const
{
return d->popupWindow;
}
//**************************************** //****************************************
// EffectWindowGroup // EffectWindowGroup
//**************************************** //****************************************

View file

@ -1935,6 +1935,9 @@ void ShellClient::updateClientOutputs()
bool ShellClient::isPopupWindow() const bool ShellClient::isPopupWindow() const
{ {
if (Toplevel::isPopupWindow()) {
return true;
}
if (m_shellSurface != nullptr) { if (m_shellSurface != nullptr) {
return m_shellSurface->isPopup(); return m_shellSurface->isPopup();
} }