The main motivation behind this change is to get rid of the dependency
on EGLSurface so the order in which output layers are presented or
updated doesn't matter.
At the moment, if both the cursor and the primary layers are updated
within same frame, the read and draw surfaces in present() will be wrong
for the primary layer.
With fbos, the read and draw surfaces won't matter.
Having both selectionChanged and selectionCleared as well as
sendSelection and sendClearSelection complicates things. API users
have to connect to both signals, internally the methods have logic
to call themselves but in the end do the same as the protocols only
know send_selection.
It's a necessary step to let kwin repaint the cursor from Compositor.
Unfortunately, it also means that we need to add more (temporary) code
to paint the cursor in backends.
Currently, output backends track the cursor behind the scenes. This
results in some amount of code duplication, for example the handling of
hidden cursors, every backend handles in its own unique way, some don't
do it correctly. Another issue is that output backend interact with
other components behind the back. This can be a problem for tasks such
as backing the cursor with an output layer.
This change introduces explicit output cursor manipulation APIs in the
Output class. There's a good chance that it's going to be revised more
in the future as part of streamlining output layer manipulation apis.
With the proposed changes, the workspace would need to call
Output::setCursor() or Output::moveCursor() to set/unset or move the
cursor, respectively.
At the moment, we rely on placeholder output getting created, but there
are cases where it's desired to spin kwin with virtual outputs so you
could take screenshots and things as such.
As explained in [1], WL_SURFACE_ID is racy because wayland aggressively
reuses object ids. The xwayland-shell-v1 protocol intends to fix that by
two things:
* associating a serial number with each X11 window. This is to avoid
potential XID reuse
* referring to the wayland surface by the wl_surface rather than
specifying an object id
Unfortunately, we will have to maintain both legacy WL_SURFACE_ID and
WL_SURFACE_SERIAL for quiet some time until most instances of Xwayland
support the xwayland-shell-v1 protocol [2].
[1] https://gitlab.freedesktop.org/xorg/xserver/-/issues/1157
[2] https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/163
The main motivation behind this change is to allow setting the cursor
per output, which eases up implementing things such as cursor output layers.
It also has another advantage - output related code is more
encapsulated. Furthermore, we could decouple output backends from Cursor.
We need to completely renegotiate stream parameters in case of window
size gets changed, otherwise no renegotiation will happen and clients
will not accommodate to our changes.
Fixes: https://github.com/obsproject/obs-studio/issues/7875