From fac33750f9aa2e2da3c1f39bb10c93f750c9cf97 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 22 Jun 2021 19:24:51 +0300 Subject: [PATCH] effects: Remove shape property It's unused and the advantages of keeping it are outweighed by the disadvantages - the returned value is dependant on the window type. If you need to draw a drop-shadow that matches the shape of the window or something along that line, render the window into an offscreen texture and sample the alpha channel in a fragment shader. --- autotests/test_window_paint_data.cpp | 9 --------- src/effects.cpp | 17 ----------------- src/effects.h | 2 -- src/libkwineffects/kwineffects.h | 11 ----------- 4 files changed, 39 deletions(-) diff --git a/autotests/test_window_paint_data.cpp b/autotests/test_window_paint_data.cpp index 49fa85016b..b980d9bc70 100644 --- a/autotests/test_window_paint_data.cpp +++ b/autotests/test_window_paint_data.cpp @@ -42,7 +42,6 @@ public: QByteArray readProperty(long int atom, long int type, int format) const override; void refWindow() override; void unrefWindow() override; - QRegion shape() const override; void setData(int role, const QVariant &data) override; void minimize() override; void unminimize() override; @@ -109,9 +108,6 @@ public: int screen() const override { return 0; } - bool hasOwnShape() const override { - return false; - } QPoint pos() const override { return QPoint(); } @@ -383,11 +379,6 @@ void MockEffectWindow::closeWindow() { } -QRegion MockEffectWindow::shape() const -{ - return QRegion(); -} - void MockEffectWindow::unrefWindow() { } diff --git a/src/effects.cpp b/src/effects.cpp index bab98abd1f..b341d04d38 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -16,7 +16,6 @@ #ifdef KWIN_BUILD_ACTIVITIES #include "activities.h" #endif -#include "decorationitem.h" #include "deleted.h" #include "x11client.h" #include "cursor.h" @@ -32,11 +31,9 @@ #include "scripting/scriptedeffect.h" #include "screens.h" #include "screenlockerwatcher.h" -#include "surfaceitem.h" #include "thumbnailitem.h" #include "virtualdesktops.h" #include "window_property_notify_x11_filter.h" -#include "windowitem.h" #include "workspace.h" #include "kwinglutils.h" #include "kwineffectquickview.h" @@ -1886,7 +1883,6 @@ TOPLEVEL_HELPER(bool, isOnScreenDisplay, isOnScreenDisplay) TOPLEVEL_HELPER(bool, isComboBox, isComboBox) TOPLEVEL_HELPER(bool, isDNDIcon, isDNDIcon) TOPLEVEL_HELPER(bool, isDeleted, isDeleted) -TOPLEVEL_HELPER(bool, hasOwnShape, shape) TOPLEVEL_HELPER(QString, windowRole, windowRole) TOPLEVEL_HELPER(QStringList, activities, activities) TOPLEVEL_HELPER(bool, skipsCloseAnimation, skipsCloseAnimation) @@ -1987,19 +1983,6 @@ void EffectWindowImpl::setSceneWindow(Scene::Window* w) sw = w; } -QRegion EffectWindowImpl::shape() const -{ - if (isX11Client()) { - const WindowItem *windowItem = sceneWindow()->windowItem(); - if (DecorationItem *item = windowItem->decorationItem()) { - return item->rect(); - } else if (SurfaceItem *item = windowItem->surfaceItem()) { - return item->shape(); - } - } - return toplevel->rect(); -} - QRect EffectWindowImpl::decorationInnerRect() const { auto client = qobject_cast(toplevel); diff --git a/src/effects.h b/src/effects.h index f6509d10ea..ee9ed48f8b 100644 --- a/src/effects.h +++ b/src/effects.h @@ -420,9 +420,7 @@ public: QString caption() const override; QRect expandedGeometry() const override; - QRegion shape() const override; int screen() const override; - bool hasOwnShape() const override; // only for shadow effect, for now QPoint pos() const override; QSize size() const override; QRect rect() const override; diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index a03e624843..6dbece528c 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -1974,14 +1974,6 @@ class KWINEFFECTS_EXPORT EffectWindow : public QObject * Whether this EffectWindow represents an already deleted window and only kept for the compositor for animations. */ Q_PROPERTY(bool deleted READ isDeleted) - /** - * Whether the window has an own shape - */ - Q_PROPERTY(bool shaped READ hasOwnShape) - /** - * The Window's shape - */ - Q_PROPERTY(QRegion shape READ shape) /** * The Caption of the window. Read from WM_NAME property together with a suffix for hostname and shortcut. */ @@ -2255,10 +2247,7 @@ public: * @since 4.9 */ virtual QRect expandedGeometry() const = 0; - virtual QRegion shape() const = 0; virtual int screen() const = 0; - /** @internal Do not use */ - virtual bool hasOwnShape() const = 0; // only for shadow effect, for now virtual QPoint pos() const = 0; virtual QSize size() const = 0; virtual QRect rect() const = 0;