diff --git a/effects/glide/glide.cpp b/effects/glide/glide.cpp --- a/effects/glide/glide.cpp +++ b/effects/glide/glide.cpp @@ -301,7 +301,8 @@ // So, the only way to decide whether a window should be animated is // to use a heuristic: if a window has decoration, then it's most // likely a dialog or a settings window so we have to animate it. - if (w->windowClass() == QLatin1String("plasmashell plasmashell")) { + if (w->windowClass() == QLatin1String("plasmashell plasmashell") + || w->windowClass() == QLatin1String("plasmashell org.kde.plasmashell")) { return w->hasDecoration(); } @@ -313,7 +314,11 @@ return true; } - if (!w->isManaged()) { + if (w->isWaylandClient() && w->isXdgPopup()) { + return false; + } + + if (w->isX11Client() && !w->isManaged()) { return false; } diff --git a/effects/scale/scale.cpp b/effects/scale/scale.cpp --- a/effects/scale/scale.cpp +++ b/effects/scale/scale.cpp @@ -262,7 +262,8 @@ // So, the only way to decide whether a window should be animated is // to use a heuristic: if a window has decoration, then it's most // likely a dialog or a settings window so we have to animate it. - if (w->windowClass() == QLatin1String("plasmashell plasmashell")) { + if (w->windowClass() == QLatin1String("plasmashell plasmashell") + || w->windowClass() == QLatin1String("plasmashell org.kde.plasmashell")) { return w->hasDecoration(); } @@ -274,7 +275,11 @@ return true; } - if (!w->isManaged()) { + if (w->isWaylandClient() && w->isXdgPopup()) { + return false; + } + + if (w->isX11Client() && !w->isManaged()) { return false; } diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1963,6 +1963,41 @@ * @since 5.10 */ Q_PROPERTY(bool unresponsive READ isUnresponsive) + + /** + * Whether this is a Wayland client. + * + * @since 5.XX + **/ + Q_PROPERTY(bool waylandClient READ isWaylandClient CONSTANT) + + /** + * Whether this is an X11 client. + * + * @since 5.XX + **/ + Q_PROPERTY(bool x11Client READ isX11Client CONSTANT) + + /** + * Whether this is a toplevel surface. + * + * @note For X11 clients, it's always @c false. + * @since 5.XX + **/ + Q_PROPERTY(bool xdgToplevel READ isXdgToplevel CONSTANT) + + /** + * Whether this is a popup surface. + * + * A popup surface is a short-lived, temporary surface. It can be used + * to implement for example menus, popovers, tooltips and other similar + * user interface concepts. + * + * @note For X11 clients, it's always @c false. + * @since 5.XX + **/ + Q_PROPERTY(bool xdgPopup READ isXdgPopup CONSTANT) + public: /** Flags explaining why painting should be disabled */ enum { @@ -2214,6 +2249,26 @@ */ bool isUnresponsive() const; + /** + * @since 5.XX + **/ + bool isWaylandClient() const; + + /** + * @since 5.XX + **/ + bool isX11Client() const; + + /** + * @since 5.XX + **/ + bool isXdgToplevel() const; + + /** + * @since 5.XX + **/ + bool isXdgPopup() 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 @@ -775,6 +775,10 @@ EffectWindow *q; bool managed = false; + bool waylandClient; + bool x11Client; + bool xdgToplevel; + bool xdgPopup; }; EffectWindow::Private::Private(EffectWindow *q) @@ -794,6 +798,11 @@ // an instance of Deleted becomes parent of the EffectWindow, effects // can still figure out whether it is/was a managed window. d->managed = parent->property("managed").value(); + + d->waylandClient = parent->inherits("KWin::ShellClient"); + d->x11Client = !d->waylandClient; // currently, we can have only X11 and Wayland clients + d->xdgToplevel = parent->property("xdgToplevel").value(); + d->xdgPopup = parent->property("xdgPopup").value(); } EffectWindow::~EffectWindow() @@ -991,6 +1000,26 @@ return d->managed; } +bool EffectWindow::isWaylandClient() const +{ + return d->waylandClient; +} + +bool EffectWindow::isX11Client() const +{ + return d->x11Client; +} + +bool EffectWindow::isXdgToplevel() const +{ + return d->xdgToplevel; +} + +bool EffectWindow::isXdgPopup() const +{ + return d->xdgPopup; +} + //**************************************** // EffectWindowGroup diff --git a/shell_client.h b/shell_client.h --- a/shell_client.h +++ b/shell_client.h @@ -163,6 +163,9 @@ void updateColorScheme() override; + bool isXdgToplevel() const override; + bool isXdgPopup() 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 @@ -1710,4 +1710,14 @@ surface()->setOutputs(clientOutputs); } +bool ShellClient::isXdgToplevel() const +{ + return m_xdgShellSurface != nullptr; +} + +bool ShellClient::isXdgPopup() const +{ + return m_xdgShellPopup != nullptr; +} + } diff --git a/toplevel.h b/toplevel.h --- a/toplevel.h +++ b/toplevel.h @@ -210,6 +210,24 @@ */ Q_PROPERTY(KWayland::Server::SurfaceInterface *surface READ surface) + /** + * Whether this is a toplevel surface. + * + * @note For X11 clients, it's always @c false. + **/ + Q_PROPERTY(bool xdgToplevel READ isXdgToplevel CONSTANT) + + /** + * Whether this is a popup surface. + * + * A popup surface is a short-lived, temporary surface. It can be used + * to implement for example menus, popovers, tooltips and other similar + * user interface concepts. + * + * @note For X11 clients, it's always @c false. + **/ + Q_PROPERTY(bool xdgPopup READ isXdgPopup CONSTANT) + public: explicit Toplevel(); virtual xcb_window_t frameId() const; @@ -443,6 +461,24 @@ template static T *findInList(const QList &list, std::function func); + /** + * Returns whether this is a toplevel surface. + * + * @see isXdgPopup + * @note This method is relevant only for Wayland clients + * @since 5.XX + **/ + virtual bool isXdgToplevel() const; + + /** + * Returns whether this is a popup surface. + * + * @see isXdgToplevel + * @note This method is relevant only for Wayland clients + * @since 5.XX + **/ + virtual bool isXdgPopup() const; + Q_SIGNALS: void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity); void damaged(KWin::Toplevel* toplevel, const QRect& damage); @@ -846,6 +882,16 @@ return *it; } +inline bool Toplevel::isXdgToplevel() const +{ + return false; +} + +inline bool Toplevel::isXdgPopup() const +{ + return false; +} + QDebug& operator<<(QDebug& stream, const Toplevel*); QDebug& operator<<(QDebug& stream, const ToplevelList&);