effects: Fix EffectWindow::shape() for X11 windows
With the introduction of scene items, the Scene::Window::bufferShape() method was removed as it makes no sense on wayland - a window may have several sub-surfaces, so a single region to indicate the shape of the window won't work. SurfaceItem::shape() returns the shape of a surface. On Wayland, it corresponds to the rect of the wl_surface. On X11, it corresponds to the client window rect inside the frame window, or custom shape region if the client has set one. On the other hand, EffectWindow::shape() wants a completely different thing. If the window is decorated, it needs to return the rect of the decoration. Otherwise it has to return the shape region if there's one. In the future, the EffectWindow::shape() function must be removed as it doesn't fit the item based design. The main reason why we have it at all is because the x server doesn't support translucency, setting a shape region is a (hacky) way to work around that limitation, xeyes is a notable example. BUG: 437138 BUG: 435862
This commit is contained in:
parent
a20a4327f5
commit
2d9e2f0c70
1 changed files with 9 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
|||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
#include "activities.h"
|
||||
#endif
|
||||
#include "decorationitem.h"
|
||||
#include "deleted.h"
|
||||
#include "x11client.h"
|
||||
#include "cursor.h"
|
||||
|
@ -35,6 +36,7 @@
|
|||
#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"
|
||||
|
@ -2014,8 +2016,13 @@ void EffectWindowImpl::setSceneWindow(Scene::Window* w)
|
|||
|
||||
QRegion EffectWindowImpl::shape() const
|
||||
{
|
||||
if (isX11Client() && sceneWindow()) {
|
||||
return sceneWindow()->surfaceItem()->shape();
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue