Commit graph

10 commits

Author SHA1 Message Date
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
4ebe5d32b4 scene: Introduce z-property
This allows placing child items below their parent item by setting
negative Z values.
2021-07-08 06:55:38 +00:00
Vlad Zahorodnii
1e1ad82f3b Remove unused geometry setters in Item
Originally, only x, y, width, and height property setters were used. A
bit later "position" and "size" helper setters were added to simplify
code in SurfaceItem sub-classes. It seems like setX(), setY(), setWidth(),
and setHeight() are unused now, so remove them.
2021-07-05 20:55:30 +03:00
Vlad Zahorodnii
19699e9a26 scene: Store cached quads using std::optional
This way, the code is slightly more readable.
2021-06-21 16:32:55 +00:00
Vlad Zahorodnii
5339b1a9d7 scene: Move item preprocessing to scene
We no longer use window pixmaps to get the shape and the opaque regions,
so preprocess() can be called now only if we are about to paint the item.
2021-06-14 07:56:02 +00:00
Vlad Zahorodnii
86bb4e68ef Refactor window quad handling
The scene items depend on the scene windows for caching window quads.
The goal of this change is to move window quads management to item.

Merging window quads in one list and then splitting them is inefficient,
it will be highly desirable if window quads are removed from the public
api so we can optimize window quad management.

With this change, the window quad type becomes irrelevant to render
backends for the most part. Note that the Xrender backend is a bit
nitpicky about window quads, so the shadow item doesn't create generic
"WindowQuadShadow" quads anymore.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
d109e7d69b Introduce Item visible property
This property can be used to control the visibility of an item and its
child subtree.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
39e2387f9f Rename Item::scheduleRepaint()
One can think that Item::scheduleRepaint() will trigger repaint of the
whole item, but it actually only schedules the next frame. If nothing
has changed on the screen, no real painting will be done unless maybe if
the rendering backend needs to repair the back buffer.
2021-05-19 12:50:11 +00:00
Vlad Zahorodnii
506214a632 Move repaint scheduling logic to Item
Currently, items depend on scene windows for creating pixmaps, repaint
scheduling, and caching quads.

This change moves repaint scheduling from scene windows to items to
make the scene items depend less on scene windows.

In hindsight, we may clean up the repaint scheduling machinery further
by introducing view objects.
2021-05-19 06:06:01 +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