From fa66c3d238e25387bfc86625cea5a2224a1cc6c0 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 25 May 2021 19:06:17 +0300 Subject: [PATCH] Make Toplevel::isClient() return true for internal and wayland windows It's needed to merge Toplevel and AbstractClient. Previously, we couldn't do it because Toplevel::isClient() was somewhat widely used. --- src/effects/dimscreen/package/contents/code/main.js | 2 +- src/effects/fade/package/contents/code/main.js | 2 +- src/effects/fadingpopups/package/contents/code/main.js | 2 +- src/effects/scale/package/contents/code/main.js | 2 +- src/effects/translucency/package/contents/code/main.js | 2 +- src/internal_client.cpp | 5 +++++ src/internal_client.h | 1 + src/waylandclient.cpp | 5 +++++ src/waylandclient.h | 1 + 9 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/effects/dimscreen/package/contents/code/main.js b/src/effects/dimscreen/package/contents/code/main.js index f7fa9ef07e..20c1531b57 100644 --- a/src/effects/dimscreen/package/contents/code/main.js +++ b/src/effects/dimscreen/package/contents/code/main.js @@ -47,7 +47,7 @@ var dimScreenEffect = { if (window.popupWindow) { return; } - if (window.x11Client && !window.managed) { + if (!window.managed) { return; } if (window.dimAnimation) { diff --git a/src/effects/fade/package/contents/code/main.js b/src/effects/fade/package/contents/code/main.js index 2b4e8ad339..0a63ed6c6c 100644 --- a/src/effects/fade/package/contents/code/main.js +++ b/src/effects/fade/package/contents/code/main.js @@ -41,7 +41,7 @@ class FadeEffect { if (w.popupWindow) { return false; } - if (w.x11Client && !w.managed) { + if (!w.managed) { return false; } if (!w.visible) { diff --git a/src/effects/fadingpopups/package/contents/code/main.js b/src/effects/fadingpopups/package/contents/code/main.js index a51f2a19ec..632c1973b1 100644 --- a/src/effects/fadingpopups/package/contents/code/main.js +++ b/src/effects/fadingpopups/package/contents/code/main.js @@ -37,7 +37,7 @@ function isPopupWindow(window) { // Override-redirect windows are usually used for user interface // concepts that are expected to be animated by this effect, e.g. // popups that contain window thumbnails on X11, etc. - if (window.x11Client && !window.managed) { + if (!window.managed) { // Some utility windows can look like popup windows (e.g. the // address bar dropdown in Firefox), but we don't want to fade // them because the fade effect didn't do that. diff --git a/src/effects/scale/package/contents/code/main.js b/src/effects/scale/package/contents/code/main.js index 3293f226d1..293fc200ba 100644 --- a/src/effects/scale/package/contents/code/main.js +++ b/src/effects/scale/package/contents/code/main.js @@ -71,7 +71,7 @@ class ScaleEffect { // Override-redirect windows are usually used for user interface // concepts that are not expected to be animated by this effect. - if (window.x11Client && !window.managed) { + if (!window.managed) { return false; } diff --git a/src/effects/translucency/package/contents/code/main.js b/src/effects/translucency/package/contents/code/main.js index 927cde17fb..abd20a9ee4 100644 --- a/src/effects/translucency/package/contents/code/main.js +++ b/src/effects/translucency/package/contents/code/main.js @@ -171,7 +171,7 @@ var translucencyEffect = { } if (window === effects.activeWindow || window.popup === true || - (window.x11Client === true && window.managed === false) || + window.managed === false || window.desktopWindow === true || window.dock === true || window.visible === false || diff --git a/src/internal_client.cpp b/src/internal_client.cpp index cd44702369..99d44adfab 100644 --- a/src/internal_client.cpp +++ b/src/internal_client.cpp @@ -68,6 +68,11 @@ InternalClient::~InternalClient() { } +bool InternalClient::isClient() const +{ + return true; +} + bool InternalClient::hitTest(const QPoint &point) const { if (!AbstractClient::hitTest(point)) { diff --git a/src/internal_client.h b/src/internal_client.h index f520473220..23975cfb54 100644 --- a/src/internal_client.h +++ b/src/internal_client.h @@ -32,6 +32,7 @@ public: QRect transparentRect() const override; NET::WindowType windowType(bool direct = false, int supported_types = 0) const override; void killWindow() override; + bool isClient() const override; bool isPopupWindow() const override; QByteArray windowRole() const override; void closeWindow() override; diff --git a/src/waylandclient.cpp b/src/waylandclient.cpp index 02013962d4..6ca86ed86d 100644 --- a/src/waylandclient.cpp +++ b/src/waylandclient.cpp @@ -75,6 +75,11 @@ pid_t WaylandClient::pid() const return surface()->client()->processId(); } +bool WaylandClient::isClient() const +{ + return true; +} + bool WaylandClient::isLockScreen() const { return surface()->client() == waylandServer()->screenLockerClientConnection(); diff --git a/src/waylandclient.h b/src/waylandclient.h index ee25c56d0d..f4731dc657 100644 --- a/src/waylandclient.h +++ b/src/waylandclient.h @@ -22,6 +22,7 @@ public: QString captionSuffix() const override; QRect transparentRect() const override; pid_t pid() const override; + bool isClient() const override; bool isLockScreen() const override; bool isLocalhost() const override; AbstractClient *findModal(bool allow_itself = false) override;