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.
This commit is contained in:
Vlad Zahorodnii 2021-06-22 19:24:51 +03:00
parent 80a7362efc
commit fac33750f9
4 changed files with 0 additions and 39 deletions

View file

@ -42,7 +42,6 @@ public:
QByteArray readProperty(long int atom, long int type, int format) const override; QByteArray readProperty(long int atom, long int type, int format) const override;
void refWindow() override; void refWindow() override;
void unrefWindow() override; void unrefWindow() override;
QRegion shape() const override;
void setData(int role, const QVariant &data) override; void setData(int role, const QVariant &data) override;
void minimize() override; void minimize() override;
void unminimize() override; void unminimize() override;
@ -109,9 +108,6 @@ public:
int screen() const override { int screen() const override {
return 0; return 0;
} }
bool hasOwnShape() const override {
return false;
}
QPoint pos() const override { QPoint pos() const override {
return QPoint(); return QPoint();
} }
@ -383,11 +379,6 @@ void MockEffectWindow::closeWindow()
{ {
} }
QRegion MockEffectWindow::shape() const
{
return QRegion();
}
void MockEffectWindow::unrefWindow() void MockEffectWindow::unrefWindow()
{ {
} }

View file

@ -16,7 +16,6 @@
#ifdef KWIN_BUILD_ACTIVITIES #ifdef KWIN_BUILD_ACTIVITIES
#include "activities.h" #include "activities.h"
#endif #endif
#include "decorationitem.h"
#include "deleted.h" #include "deleted.h"
#include "x11client.h" #include "x11client.h"
#include "cursor.h" #include "cursor.h"
@ -32,11 +31,9 @@
#include "scripting/scriptedeffect.h" #include "scripting/scriptedeffect.h"
#include "screens.h" #include "screens.h"
#include "screenlockerwatcher.h" #include "screenlockerwatcher.h"
#include "surfaceitem.h"
#include "thumbnailitem.h" #include "thumbnailitem.h"
#include "virtualdesktops.h" #include "virtualdesktops.h"
#include "window_property_notify_x11_filter.h" #include "window_property_notify_x11_filter.h"
#include "windowitem.h"
#include "workspace.h" #include "workspace.h"
#include "kwinglutils.h" #include "kwinglutils.h"
#include "kwineffectquickview.h" #include "kwineffectquickview.h"
@ -1886,7 +1883,6 @@ TOPLEVEL_HELPER(bool, isOnScreenDisplay, isOnScreenDisplay)
TOPLEVEL_HELPER(bool, isComboBox, isComboBox) TOPLEVEL_HELPER(bool, isComboBox, isComboBox)
TOPLEVEL_HELPER(bool, isDNDIcon, isDNDIcon) TOPLEVEL_HELPER(bool, isDNDIcon, isDNDIcon)
TOPLEVEL_HELPER(bool, isDeleted, isDeleted) TOPLEVEL_HELPER(bool, isDeleted, isDeleted)
TOPLEVEL_HELPER(bool, hasOwnShape, shape)
TOPLEVEL_HELPER(QString, windowRole, windowRole) TOPLEVEL_HELPER(QString, windowRole, windowRole)
TOPLEVEL_HELPER(QStringList, activities, activities) TOPLEVEL_HELPER(QStringList, activities, activities)
TOPLEVEL_HELPER(bool, skipsCloseAnimation, skipsCloseAnimation) TOPLEVEL_HELPER(bool, skipsCloseAnimation, skipsCloseAnimation)
@ -1987,19 +1983,6 @@ void EffectWindowImpl::setSceneWindow(Scene::Window* w)
sw = 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 QRect EffectWindowImpl::decorationInnerRect() const
{ {
auto client = qobject_cast<X11Client *>(toplevel); auto client = qobject_cast<X11Client *>(toplevel);

View file

@ -420,9 +420,7 @@ public:
QString caption() const override; QString caption() const override;
QRect expandedGeometry() const override; QRect expandedGeometry() const override;
QRegion shape() const override;
int screen() const override; int screen() const override;
bool hasOwnShape() const override; // only for shadow effect, for now
QPoint pos() const override; QPoint pos() const override;
QSize size() const override; QSize size() const override;
QRect rect() const override; QRect rect() const override;

View file

@ -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. * Whether this EffectWindow represents an already deleted window and only kept for the compositor for animations.
*/ */
Q_PROPERTY(bool deleted READ isDeleted) 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. * 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 * @since 4.9
*/ */
virtual QRect expandedGeometry() const = 0; virtual QRect expandedGeometry() const = 0;
virtual QRegion shape() const = 0;
virtual int screen() 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 QPoint pos() const = 0;
virtual QSize size() const = 0; virtual QSize size() const = 0;
virtual QRect rect() const = 0; virtual QRect rect() const = 0;