Commit 93abb9a2 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

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
parent 5da8b4c7
......@@ -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<ShellClient *>(c) != nullptr;
m_wasX11Client = !m_wasWaylandClient;
m_wasPopupWindow = c->isPopupWindow();
}
void Deleted::unrefWindow()
......
......@@ -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()
......
......@@ -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<bool>();
}
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<int>, 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
//****************************************
......
......@@ -1935,6 +1935,9 @@ void ShellClient::updateClientOutputs()
bool ShellClient::isPopupWindow() const
{
if (Toplevel::isPopupWindow()) {
return true;
}
if (m_shellSurface != nullptr) {
return m_shellSurface->isPopup();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment