Commit graph

8 commits

Author SHA1 Message Date
Vlad Zahorodnii
7e9c6587db Remove scene window traces in scene items
This further decouples scene items from scene windows. The SurfaceItem
still needs to access the underlying window, I would like to re-iterate
over that later.

With this change, it will be possible to introduce WindowItem factory
function in the Toplevel class.
2021-08-12 17:52:24 +00:00
Vlad Zahorodnii
fdb1914a83 wayland: Wire in surface mapped state
If a sub-surface should be considered unmapped, make the corresponding
item invisible.

Note that this must apply only to sub-surfaces. Whether the main surface
should be visible is up to kwin. It may want to play an animation when
the toplevel surface is unmapped, etc.
2021-08-11 06:41:00 +00:00
Vlad Zahorodnii
964c487d4f wayland: Switch to ClientBuffer
The main motivation behind the split is to simplify client buffer code
and allow adding new features easier, for example referencing the shm
pool when a shm buffer is destroyed, or monitoring for readable linux
dmabuf file descriptors, etc.

Also, a referenced ClientBuffer cannot be destroyed, unlike the old
BufferInterface.
2021-07-23 15:33:38 +00:00
Vlad Zahorodnii
f431b6ad96 wayland: Cache last surface-to-buffer matrix
If window quads need to be generated after the wl_surface is destroyed,
the SurfaceItemWayland::mapToBuffer() function will return wrong values.

In order to fix that, we need to store the last surface-to-buffer matrix
in SurfaceItem.
2021-07-22 06:26:00 +00:00
Vlad Zahorodnii
be6c33458f wayland: Allow placing sub-surfaces below their parent
According to the spec, if the wl_subsurface.place_below request is
called with the parent surface, the sub-surface must be placed below the
parent surface.

BUG: 438808
2021-07-08 06:55:38 +00:00
Vlad Zahorodnii
bd4650482e Remove unused class forward declarations in scene.h 2021-05-18 12:24:56 +03:00
Vlad Zahorodnii
0f2f69ad7c Decouple window pixmaps from scene windows
One of the scene redesign goals is to make wayland surface items
re-usable. So we have the same rendering path for drag-and-drop icons,
software cursors, and window surfaces.

The biggest issue at the moment is that window pixmaps are tightly
coupled with scene windows.

This change de-couples window pixmaps from scene windows. In order to
achieve that, some architecture changes were made.

The WindowPixmap class was replaced with the SurfacePixmap class. A
surface pixmap is created by a surface item.

Under the hood, a SurfacePixmap will create a PlatformSurfaceTexture
object, which contains all the information necessary for the renderer.

The SceneOpenGLTexture class was removed. However, the GLX and the EGL
on X11 backends still mess with GLTexture's internals.
2021-05-18 09:11:24 +00:00
Vlad Zahorodnii
47113e09b8 scene: Introduce window items
Currently, dealing with sub-surfaces is very difficult due to the scene
design being heavily influenced by X11 requirements.

The goal of this change is to re-work scene abstractions to make improving
the wayland support easier.

The Item class is based on the QQuickItem class. My hope is that one day
we will be able to transition to QtQuick for painting scene, but in
meanwhile it makes more sense to have a minimalistic internal item class.

The WindowItem class represents a window. The SurfaceItem class represents
the contents of either an X11, or a Wayland, or an internal surface. The
DecorationItem and the ShadowItem class represent the server-side deco and
drop-shadow, respectively.

At the moment, the SurfaceItem is bound to the scene window, but the long
term plan is to break that connection so we could re-use the SurfaceItem
for things such as software cursors and drag-and-drop additional icons.

One of the responsibilities of the Item is to schedule repaints as needed.
Ideally, there shouldn't be any addRepaint() calls in the core code. The
Item class schedules repaints on geometry updates. In the future, it also
has to request an update if its opacity or visibility changes.
2021-03-31 13:56:55 +00:00