We initialize, but might not start, e.g. when a test case just needs a
backend and doesn't start mutter. When cleaning up, we'll still try to
clean up Xwayland integration, and this commit handles cleaning up
without having made the mess.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1856>
We make objects inert when disabling the seat, but we requests may still
have effect. This is especially bad if disabling is followed by
destroying, but also means e.g. set_cursor() not doing an early out
after the pointer capability was disabled.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
MetaDisplay does a lot of things, and is a central part to anything
window management. To let Wayland units have an easier time tearing
down, make it so that the Wayland infrastructure is terminated before
MetaDisplay.
This also makes sure that X11 support is turned off, so that we don't
stumble upon Xwayland terminating due to the Wayland socket connection
being broken. Will mitigate that in a better way in a later commit.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
We might not be the only entity holding on to the X11 GdkDisplay,
meaning the X11 connection will stay alive indefinitely, e.g. if the gjs
context has some reference to it.
Avoid running into issues due to X11 connection errors by setting the
libX11 handlers to no-ops, so when we are terminating; that means the
GDK X11 connection can stay "alive" until its too late, and we'll just
silently ignore any connection errors that may happen due to the
lingering GDK display reference.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
It keeps references to cursors, and cursors keep references to DRM
buffers. In order to be able to clean up on exit, explicitly destroy the
cursor tracker on shutdown.
We can't rely on GObject reference counting, as gjs might hold onto a
reference until it's garbage collected.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
Various things, e.g, the renderer, the stage, either directly or
indirectly depends on GPU objects being alive during tear-down. Make it
so, by moving GPU cleanup after the other cleaning. This will allow
tearing down a couple of more objects.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
The first phase happens early, which discards pending page flips,
meaning the references held by those page flip closures are released.
The second phase happens late, after other units depending on the KMS
abstraction, have been cleaned up.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
We already swapped the front buffer, and even if it didn't get
presented, we should still swap our representation of the state, to not
get into a confused buffer tracking state.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
All pointer a11y is a fabrication of Clutter backend-independent
code, with the help of a ClutterVirtualInputDevice and with some
UI on top.
On the other hand, MetaInputSettings is a backend implementation
detail, this has 2 gotchas:
- In the native backend, the MetaInputSettings (and pointer a11y
with it) are initialized early, before the ClutterSeat core
pointer is set up.
- Doing this from the MetaInputSettings also means another dubious
access from the input thread into main thread territory.
Move the pointer a11y into ClutterSettings, making this effectively
backend-independent business, invariably done from the main thread
and ensured to happen after seat initialization.
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1765
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1849>
Since commit d2f8a30625 we use Graphene to union paint volumes, it
turns out a quite severe issue snuck in during review of that MR though:
Unioned paint volumes (so paint volumes of any actors with children) now
have negative heights. Once projected to 2d coordinates they luckily are
correct again, which is why everything is still working.
The problem is that obvious once looking closer: For the y coordinates
of the unioned paint volume we confused the maximum and the minimum
points and simply used the wrong coordinates to create the unioned paint
volume.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1827>
The graphene functions used by clutter for picking assume that boxes are
inclusive in both there start and end coordinates, so picking at y
coordinate 32 for an actor with the height 32 placed at y coordinate 0
would still be considered a hit. This however is wrong as 32 is the
first position that is not in the actor anymore.
Usually this would not be much of a problem, because motion events are
rarely ever at exactly these borders and even if they are there will be
another motion event soon after. But since actors in gnome-shell usually
are aligned with the pixel grid and on X11 enter/leave events are
generated by the X server at integer coordinates, this case is much
more likely for those.
This can cause issues with Firefox which when using client side
decorations, still requests MWM_DECOR_BORDER via _MOTIF_WM_HINTS to have
mutter draw a border + shadow. This means that the Firefox window even
when using CSD is still reparented. For such windows we receive among
others XI_RawMotion and XI_Enter events, but no XI_Motion events. And
the raw motion events are discarded after an enter event, because that
sets has_pointer_focus to TRUE in MetaSeatX11. So when moving the cursor
from the panel to a maximized Firefox window the last event clutter
receives is the enter event at exactly integer coordinates. Since the
panel is 32px tall and the generated enter event is at y position 32,
the picking code will pick a panel actor and the focus will remain on it
as long as the cursor does not leave the Firefox window.
Fix this by excluding the bottom and right border of a box when picking.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4041
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1842>
Compositor behaviour when calling `wl_data_device_manager_get_data_device`
for the same seat multiple times is not very clearly defined in
the spec and both Mutter and Weston currently don't handle
the DnD case properly.
While Weston handles DnD only for the last created data device,
Mutter, because of some internal reshuffling, ends up toggling
between two devices.
Properly handling this case requires some bigger changes. So
in order to behave predictable and in line with Weston,
only take the last created data device into account while
still keeping the previous created ones around.
The main affect client here is Firefox, which gets very
confused by the toggling behaviour and becomes more stable
with this patch.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1841>
Virtual Kernel Mode Setting (vkms) is a virtual /dev/dri/card* device
not backed by any actual hardware. It's intended for testing purposes,
e.g. to run tests suites with a reproducable setup, or in continuous
integration pipelines.
Currently mutter don't have any tests that can run on top of vkms, but
will eventually get that. To prepare for the ability to do that, and
having said kernel module loaded without causing wierd issues with any
active session, add an udev rule that tells mutter to ignore any vkms
device.
Otherwise, when vkms is loaded, mutter would detect it, assume it's a
regular monitor, configure it as such, thus add a region of the stage
that ends up nowhere, which isn't very helpful. It might also conflict
with running actual tests that need to interact with vkms if the active
session has taken control of it.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1740>
With atomic mode setting, commits don't work when CRTCs aren't enabled,
which they aren't when we're power saving. This means the gamma state
fails to being update. To fix night light and for whatever other reason
gamma ramps was changed during power saving by marking the CRTC gamma
state as invalid when leaving power saving, as well as when resuming.
This means that the next frame will append the CRTC gamma state to the
KMS commit.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1755
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1835>
This GSource is not being properly unref nor the variable holding it
cleared. This on one hand leaks the GSource memory, on the other hand
may trigger warnings in keyboard_repeat() as the source may be
(reentrantly) cleared, yet we don't exit early as
seat_impl->repeat_source is never NULL.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1839>
When a viewport source rect or destination size is set, `stex->dst_width`
gives us the the cropped and/or scaled size. At this step, we need the
uncropped/unscaled size however.
Note: this is only ever relevant if buffer transform and viewport are
used together - otherwise the values are the same.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1836>
The shadow size is factored into the paint volume MetaWindowActorX11
returns in its get_paint_volume() vfunc override, so we should
invalidate the paint volume every time that shadow might change.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1829>
Turns out ClutterClones need a bit of extra handling as always, there's
currently nothing that invalidates a clones paint volume when the source
actors paint volume changes.
Since ClutterClones get_paint_volume() implementation simply takes the
source actors paint volume and returns that, we should make sure they
are kept in sync and invalidate the clones paint volume as soon as the
source actor gets its PV invalidated.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1829>
When using buffer transforms and viewports together, we currently
apply the transformation (read: rotation) first, resulting in
wrong buffer coordinates for viewport source rects.
Flip the order in whitch we apply our matrix transformations.
This can be tested e.g. via:
`weston-simple-damage --use-viewport --transform=flipped-180`
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1832>
If a subsurface first gets reordered and afterwards detached from
the parent before the parent surface got commited, we currently
would end up reattaching the subsurface to its previous parent.
While clients should avoid this behaviour, it's legit according
to the spec.
We already prevent similar cases where the subsurface is destroyed -
extend that check to detaching, which includes the destroy case.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1831>
Currently when reordering subsurfaces, we un- and reparent all child
actors of the window actor. This is unnecessarily wasteful and
triggers bugs in clutter. While the underlying issue should be fixed
eventually, simply reorder the actors with the tools clutter provides
us with, avoiding those bugs and likely being faster as well.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1831>
Users who customized their workspace shortcuts before updating to
GNOME 40 are experiencing troubles when trying to use the same
keybinding for the horizontal shortcuts, because of hidden conflicts
with the vertical ones.
We can address this by registering the old shortcuts with Settings
without showing them in the UI, so that they are taken into account
by Settings' conflict resolution.
https://gitlab.gnome.org/GNOME/mutter/-/issues/1740
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1814>