Make scale and glide effect ignore lockscreen greeter

On X11, the lockscreen greeter is an override-redirect window so the
scale and the glide effect ignore it.

On Wayland, the lockscreen greeter is a regular window so both effects
try to animate it upon the screen being unlocked, which looks bad.
This commit is contained in:
Vlad Zahorodnii 2021-05-12 21:56:16 +03:00
parent 0f60cc68a9
commit 7475385c82
9 changed files with 29 additions and 4 deletions

View file

@ -251,6 +251,9 @@ public:
bool isOutline() const override { bool isOutline() const override {
return false; return false;
} }
bool isLockScreen() const override {
return false;
}
pid_t pid() const override { pid_t pid() const override {
return 0; return 0;
} }

View file

@ -37,6 +37,7 @@ Deleted::Deleted()
, m_wasPopupWindow(false) , m_wasPopupWindow(false)
, m_wasOutline(false) , m_wasOutline(false)
, m_wasDecorated(false) , m_wasDecorated(false)
, m_wasLockScreen(false)
{ {
} }
@ -120,6 +121,7 @@ void Deleted::copyToDeleted(Toplevel* c)
m_wasPopupWindow = c->isPopupWindow(); m_wasPopupWindow = c->isPopupWindow();
m_wasOutline = c->isOutline(); m_wasOutline = c->isOutline();
m_wasLockScreen = c->isLockScreen();
} }
void Deleted::unrefWindow() void Deleted::unrefWindow()

View file

@ -100,6 +100,9 @@ public:
bool isOutline() const override { bool isOutline() const override {
return m_wasOutline; return m_wasOutline;
} }
bool isLockScreen() const override {
return m_wasLockScreen;
}
private Q_SLOTS: private Q_SLOTS:
void mainClientClosed(KWin::Toplevel *client); void mainClientClosed(KWin::Toplevel *client);
@ -140,6 +143,7 @@ private:
bool m_wasPopupWindow; bool m_wasPopupWindow;
bool m_wasOutline; bool m_wasOutline;
bool m_wasDecorated; bool m_wasDecorated;
bool m_wasLockScreen;
qreal m_bufferScale = 1; qreal m_bufferScale = 1;
}; };

View file

@ -1918,6 +1918,7 @@ TOPLEVEL_HELPER(bool, skipsCloseAnimation, skipsCloseAnimation)
TOPLEVEL_HELPER(KWaylandServer::SurfaceInterface *, surface, surface) TOPLEVEL_HELPER(KWaylandServer::SurfaceInterface *, surface, surface)
TOPLEVEL_HELPER(bool, isPopupWindow, isPopupWindow) TOPLEVEL_HELPER(bool, isPopupWindow, isPopupWindow)
TOPLEVEL_HELPER(bool, isOutline, isOutline) TOPLEVEL_HELPER(bool, isOutline, isOutline)
TOPLEVEL_HELPER(bool, isLockScreen, isLockScreen)
TOPLEVEL_HELPER(pid_t, pid, pid) TOPLEVEL_HELPER(pid_t, pid, pid)
TOPLEVEL_HELPER(qlonglong, windowId, window) TOPLEVEL_HELPER(qlonglong, windowId, window)

View file

@ -463,6 +463,7 @@ public:
bool isModal() const override; bool isModal() const override;
bool isPopupWindow() const override; bool isPopupWindow() const override;
bool isOutline() const override; bool isOutline() const override;
bool isLockScreen() const override;
KWaylandServer::SurfaceInterface *surface() const override; KWaylandServer::SurfaceInterface *surface() const override;
bool isFullScreen() const override; bool isFullScreen() const override;

View file

@ -310,8 +310,8 @@ bool GlideEffect::isGlideWindow(EffectWindow *w) const
return false; return false;
} }
// Don't animate the outline because it looks very sick. // Don't animate the outline and the screenlocker as it looks bad.
if (w->isOutline()) { if (w->isLockScreen() || w->isOutline()) {
return false; return false;
} }

View file

@ -64,8 +64,8 @@ class ScaleEffect {
return false; return false;
} }
// Dont't animate the outline because it looks very sick. // Dont't animate the outline and the screenlocker as it looks bad.
if (window.outline) { if (window.lockScreen || window.outline) {
return false; return false;
} }

View file

@ -2170,6 +2170,13 @@ class KWINEFFECTS_EXPORT EffectWindow : public QObject
*/ */
Q_PROPERTY(pid_t pid READ pid CONSTANT) Q_PROPERTY(pid_t pid READ pid CONSTANT)
/**
* Whether this EffectWindow represents the screenlocker greeter.
*
* @since 5.22
*/
Q_PROPERTY(bool lockScreen READ isLockScreen CONSTANT)
public: public:
/** Flags explaining why painting should be disabled */ /** Flags explaining why painting should be disabled */
enum { enum {
@ -2491,6 +2498,11 @@ public:
*/ */
virtual bool isOutline() const = 0; virtual bool isOutline() const = 0;
/**
* @since 5.22
*/
virtual bool isLockScreen() const = 0;
/** /**
* @since 5.18 * @since 5.18
*/ */

View file

@ -48,6 +48,8 @@ WaylandClient::WaylandClient(SurfaceInterface *surface)
this, &WaylandClient::updateIcon); this, &WaylandClient::updateIcon);
connect(screens(), &Screens::changed, this, connect(screens(), &Screens::changed, this,
&WaylandClient::updateClientOutputs); &WaylandClient::updateClientOutputs);
connect(surface->client(), &ClientConnection::aboutToBeDestroyed,
this, &WaylandClient::destroyClient);
updateResourceName(); updateResourceName();
updateIcon(); updateIcon();