diff --git a/effects/glide/glide.cpp b/effects/glide/glide.cpp --- a/effects/glide/glide.cpp +++ b/effects/glide/glide.cpp @@ -313,7 +313,7 @@ return true; } - if (!w->isManaged()) { + if (w->isPopupWindow()) { return false; } diff --git a/effects/scale/scale.cpp b/effects/scale/scale.cpp --- a/effects/scale/scale.cpp +++ b/effects/scale/scale.cpp @@ -274,7 +274,7 @@ return true; } - if (!w->isManaged()) { + if (w->isPopupWindow()) { return false; } diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1979,6 +1979,17 @@ * @since 5.10 */ Q_PROPERTY(bool unresponsive READ isUnresponsive) + + /** + * Whether the window is a popup. + * + * A popup is a window that can be used to implement tooltips, combo box popups, + * popup menus and other similar user interface concepts. + * + * @since 5.XX + **/ + Q_PROPERTY(bool popupWindow READ isPopupWindow CONSTANT) + public: /** Flags explaining why painting should be disabled */ enum { @@ -2230,6 +2241,11 @@ */ bool isUnresponsive() const; + /** + * @since 5.XX + **/ + bool isPopupWindow() const; + /** * Can be used to by effects to store arbitrary data in the EffectWindow. * diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -841,6 +841,7 @@ WINDOW_HELPER(QStringList, activities, "activities") WINDOW_HELPER(bool, skipsCloseAnimation, "skipsCloseAnimation") WINDOW_HELPER(KWayland::Server::SurfaceInterface *, surface, "surface") +WINDOW_HELPER(bool, isPopupWindow, "popupWindow") QString EffectWindow::windowClass() const { diff --git a/shell_client.h b/shell_client.h --- a/shell_client.h +++ b/shell_client.h @@ -163,6 +163,8 @@ void updateColorScheme() override; + bool isPopupWindow() const override; + protected: void addDamage(const QRegion &damage) override; bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override; diff --git a/shell_client.cpp b/shell_client.cpp --- a/shell_client.cpp +++ b/shell_client.cpp @@ -1715,4 +1715,15 @@ surface()->setOutputs(clientOutputs); } +bool ShellClient::isPopupWindow() const +{ + if (m_shellSurface != nullptr) { + return m_shellSurface->isPopup(); + } + if (m_xdgShellPopup != nullptr) { + return true; + } + return false; +} + } diff --git a/toplevel.h b/toplevel.h --- a/toplevel.h +++ b/toplevel.h @@ -210,6 +210,11 @@ */ Q_PROPERTY(KWayland::Server::SurfaceInterface *surface READ surface) + /** + * Whether the window is a popup. + **/ + Q_PROPERTY(bool popupWindow READ isPopupWindow) + public: explicit Toplevel(); virtual xcb_window_t frameId() const; @@ -443,6 +448,15 @@ template static T *findInList(const QList &list, std::function func); + /** + * Whether the window is a popup. + * + * Popups can be used to implement popup menus, tooltips, combo boxes, etc. + * + * @since 5.XX + **/ + virtual bool isPopupWindow() const; + Q_SIGNALS: void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity); void damaged(KWin::Toplevel* toplevel, const QRect& damage); @@ -846,6 +860,20 @@ return *it; } +inline bool Toplevel::isPopupWindow() const +{ + switch (windowType()) { + case NET::ComboBox: + case NET::DropdownMenu: + case NET::PopupMenu: + case NET::Tooltip: + return true; + + default: + return false; + } +} + QDebug& operator<<(QDebug& stream, const Toplevel*); QDebug& operator<<(QDebug& stream, const ToplevelList&);