It can be especially useful if the compositor wants to ensure that all
globals have been created before starting to accept client connections.
Unfortunately, start() and terminate() stuff doesn't align well with it,
so the terminate() method was dropped to ensure that Display always
returns the same wl_display object.
The main purpose behind the kwaylandserver library is to provide a set
of re-usable wayland compositor extension implementations. However, it's
worth noting that the design of kwaylandserver is far from perfect at
the moment.
KWaylandServer tries to hide all low level wayland details from the
compositor. But it's not the case with buffers, which diminishes the
whole point behind the library.
Creating OpenGL textures from Wayland buffers is the responsibility of
the compositor. So, when it comes to client buffers, we are one foot in
KWaylandServer, and the other foot in the compositor.
Since the surface size is a logical size, the compositor can't use it
for allocating memory for OpenGL textures. This change adds the buffer
size property in SurfaceInterface that can be used for allocating memory
for textures as well as monitoring buffer size changes.
I must say that the introduction of the buffer size property is a crude
hack because BufferInterface just needs to provide an OpenGL texture for
each plane. The main blocker for that is that it would involve moving
the backend, the compositor, and the wayland bits in the same place, for
example kwayland-server or ultimately kwin.
The buffer scale and the buffer transform property specify transforms
that had been applied to the buffer's contents. Neither one of those
properties apply to the surface, in other words the buffer transform
property doesn't indicate that the surface was rotated or flipped or both.
This change doesn't gain anything in terms of new features, etc. It just
attempts to make things more clear.
The source can have a different lifespan to the offer being made.
If a source is removed and we get a drag actions changed before the
offer is cancelled we don't want to crash.
Couldn't reproduce locally, but the trace was good.
BUG: 423127
The compositor needs to monitor changes in the mapping between the
surface local coordinates and the buffer coordinates because texture
coordinates correspond to the latter. One way to do it is to monitor
things such as the surface size, the buffer size, the buffer scale,
etc. The main problem with doing so is that there are so many factors
that contribute to how mapping between the surface local coordinate
space and the buffer coordinate space is performed.
In order to provide a generic way for monitoring changes in the mapping
between the surface local coordinate space and the buffer coordinate
space, this patch introduces two new matrices. The first one specifies
how the surface-local coordinates are mapped to buffer coordinates, and
the other one specifies how to map the buffer coordinates to surface
local coordinates.
With the new two matrices, the compositor has a generic way to get
notified when it has to re-compute texture coordinates.
The wp_viewporter compositor extension allows clients to crop and scale
their surface. It can be useful for applications such as video players
because it may potentially reduce their power usage.
Unfortunately, in order to map a point from the surface-local coordinate
space to the buffer pixel coordinate space, one cannot divide the point
by the scale factor since the buffer might be rotated or flipped.
This change introduces a couple of helper methods for converting points,
regions, and rectangles from the surface-local coordinates to the buffer
pixel coordinates and vice versa.
The new methods can be useful when one wants to get the size of the
buffer along some specific dimension, e.g. width or height.
Of course, size() could be used for this purpose, but with the new
helper methods, one has to type less.
The current xdg-shell wrappers don't match existing abstractions in the
xdg-shell protocol well, which makes it more difficult to refactor code
that is responsible for managing configure events and geometry in kwin.
Given that the xdg_decoration and the xdg_shell protocols are tightly
coupled together, I had to rewrite our wrappers for the xdg_decoration
protocol as well.
Summary:
This patch makes use of wlroot's DataControl interface to support
clipboard management.
Unlike wl_data_device clipboards are sent on every change to all
watchers.
If the data device has a selection set it updates immediately.
Because it was started a year ago it uses the existing style of
wrapping objects. The unit test uses the new approach.
Test Plan:
Updated kwin
used wlroot's wl-copy, wl-paste which are xclip replacements to
show that the clipboard updated correctly
Reviewers: #kwin
Differential Revision: https://phabricator.kde.org/D29330
Summary:
Clipboard managers and middle click paste are new protocols.
We want to be able to copy from a clipboard manager to a regular
clipboard and vice versa without duplicating loads of code.
If we support kliper's "syncronise contents of the clipboard and
selection" inside the compositor that would become an unmanageable amount
of combinations.
It also potentially allows the idea of our XWayland bridge not being a
wayland client and simplifying that code.
Test Plan: Unit test passes
Reviewers: #kwin
Subscribers: zzag
Differential Revision: https://phabricator.kde.org/D29329
Summary:
A DataDevice will have zero or one active DataSource as the seclection.
In the existing code we track the current data device then update it to
the newest data device
when the source inside a data device changes.
If we store the active data source inside Seat instead of the device
everything becomes
somewhat simpler and safer.
An entire unit test vanishes as that case of an externally set
DataDevice with no source
can no longer happen.
There's also a lot of duplication that's been merged in this patch so we
have one path.
There are some technical behavioural changes in particular we do cleanup
when the
source vanishes rather than the data device, but if anything that seems
safer and more correct.
It's a precursor for introducing an abstraction class round the source
without needing to meddle
with too much code.
Test Plan: Relevant unit tests passed, ran with it for a while with no
issue.
Reviewers: #kwin
Differential Revision: https://phabricator.kde.org/D29328
BlurInterface always used to be my go-to template when starting a new
protocol, we may as well make it up-to-date with the generation.
Code is reduced by a third.
wl_shell_surface has been deprecated for quite a long time. Nowadays
most clients use the xdg-shell protocol to create desktop-style user
interface elements.
Summary:
Firefox has two wl_data_devices. One in firefox code one in GTK code.
Both need to get data offers.
I've left handling the case for multiple data devices and drags to make
this patch feasible to put into 5.19 and I didn't want to make this
patch invasive.
Test Plan:
Firefox in wayland
WAYLAND_DEBUG=1 firefox |& grep data
Shows now both created devices get offers
Also I can paste
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: meven, ngraham, zzag
Differential Revision: https://phabricator.kde.org/D29720
Summary:
Firefox has two wl_data_devices. One in firefox code one in GTK code.
Both need to get data offers.
I've left handling the case for multiple data devices and drags to make
this patch feasible to put into 5.19 and I didn't want to make this
patch invasive.
Test Plan:
Firefox in wayland
WAYLAND_DEBUG=1 firefox |& grep data
Shows now both created devices get offers
Also I can paste
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: ngraham, zzag
Differential Revision: https://phabricator.kde.org/D29720
Summary:
In KWin, we need to know when a sub-surface becomes mapped or unmapped
so we can generate or filter out window quads for the sub-surface.
Reviewers: #kwin, davidedmundson, apol
Reviewed By: #kwin, davidedmundson, apol
Differential Revision: https://phabricator.kde.org/D29256