1
0
Fork 0
Commit graph

1668 commits

Author SHA1 Message Date
Carlos Garnacho
dc6d3cead2 backends: Shuffle ClutterBackendX11 code into MetaClutterBackendX11
We have a Clutter implementation of the X11, just to subclass it in
our backends. Move the implementation entirely to src/backends/x11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1862>
2021-07-16 19:08:06 +02:00
Jonas Ådahl
50ed027b6f context: Move X11 display policy under the context
The context implementations already effectively dictate the policy, so
let them do it more directly instead of going indirectly via global
variables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:34:37 +02:00
Jonas Ådahl
d3b7d8df0d wayland: Initialize in a single step
Before we first created the MetaWaylandCompositor instance, which would
repare Clutter/Cogl so they could initialize and turn on Wayland display
server features, then later to initialize the rest. Now that part is
done by the Wayland infrastructure itself, so we don't need the early
initialization. Simplify things a bit by centralizing it all into a
single meta_wayland_compositor_new() call.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:34:37 +02:00
Jonas Ådahl
0330ce1f15 context: Make the context own MetaWaylandCompositor
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:34:37 +02:00
Jonas Ådahl
7d116bee0f main: Move MetaX11DisplayPolicy to a new meta-private-enums.h
As with the compositor type enum, also have the X11 display policy enum,
as it's also effectively part of the context configuration. But as with
the compositor type, move it to a header file for enums only, and since
this is a private one, create a private variant meta-enums.h.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
2021-07-15 11:34:36 +02:00
Carlos Garnacho
ec390b68c5 wayland: Implement the xdg-activation protocol
This protocol implements the IPC necessary to focus application
windows across launcher/launchee. Add support for it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1845>
2021-07-09 09:34:28 +00:00
Jonas Ådahl
10c4bc6e3f drm-buffer: Create from MetaDeviceFile instead of MetaKmsDevice
The DRM buffers aren't really tied to mode setting, so they shouldn't
need to have an associated mode setting device. Now that we have a
device file level object that can fill this role, port over
MetaDrmBuffer and friends away from MetaKmsDevice to MetaDeviceFile.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
2021-07-07 21:03:26 +02:00
Christian Rauch
aacdc0b6f1 wayland: Apply states without needing a newly attached buffer
Applying some states, such as the minimum and maximum toplevel size, do not
require a new buffer and can operate on the old buffer. Requiring a client
to commit a new buffer just to change such states prevents setting limits
on an already existing surface buffer.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1716
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1795>
2021-07-06 09:11:10 +00:00
Jonas Ådahl
9542c713ad window/wayland: Replace constraint side effect peeking with state checks
When the MetaWindow resize machinery for toplevels ended up in the
Wayland window implementation, we tried to avoid configuring
not-yet-mapped windows that just had its zero sized dimension pass
through the constraint machinery, resulting in a 1x1 sized window.

If we'd properly set up the min size metadata earlier, that 1x1 would
likely be the minimum size set of a window, which makes things harder to
predict when peeking at side effects.

However, what the side effect peeking intends to do, as documented in
the comment, was to figure out when the client hadn't committed any
buffer yet, i.e. during the initial map, and in those cases avoid
sending that nasty 1x1 size, resulting in silly window sizes. A more
robust way to detect this is instead checking when we shouldn't really
try resize things our own way, and in those cases early out as was done
before.

This means that, for a yet to me mapped window, we only ever want to
send an initial non-zero configuration when 1) it's initially maximized,
2) initially fullscreen, or 3) initially tiled in any way, as those are
the situations where the compositor is the one deciding the size.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1912>
2021-07-05 10:27:58 +00:00
JoseExposito
dc919998b1 wayland/pointer-gestures: Fix swipe cancellation
The cancel phase for swipe gestures was not being handled, hence,
Wayland "end" events where not sent to clients when the gesture was
cancelled.

A swipe gesture is cancelled when extra finger(s) are put down on the
touchpad in the middle of the gesture or when some, but not all, of the
fingers are put up.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1857>
2021-06-15 22:22:30 +00:00
Carlos Garnacho
fcdda41def wayland: Make implicit grabs during popups be owner_events=TRUE
Getting crossing events is necessary between client surfaces while
there is a popup grab in effect (e.g. allow press-drag-release in
menus), we should only stick with the focus surface while the pointer
is outside any client surface.

This partially undoes commit 79050004b0 (or, at least, mutter no
longer fixes the bug it claimed to fix). This will be addressed in
gtk4.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1885>
2021-06-09 19:00:15 +00:00
Carlos Garnacho
4ed05830e2 wayland: Close pipe file descriptors after use
Both ends were being leaked here, one directly, other through the
GIOChannel.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4302
(just maybe)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1870>
2021-05-25 16:31:07 +00:00
Jonas Ådahl
301d2c55c6 wayland: Make init and shutdown symmetric
We first initialized the Wayland infrastructure, then the display, but
on shutdown, we first teared down the Wayland infrastructure, then the
display.

Make things a bit more symmetric and tear down the display before
Wayland. This however means we need to tear down some things Wayland a
bit earlier than the rest. For now this is a separate function, but
eventually, it can be replaced with a signal shared by the backend's
'prepare-shutdown' signal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
dc97163bcd xwayland: Pass MetaWaylandCompositor pointer when initializing
This way we can initialize without having any way to retrieve it via
some global variable. This isn't needed now, but will be once Wayland
infrastructure initializiation is done in a single step.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
d03c194552 wayland/output: Use the passed compositor pointer
This is especially important as we might end up here when initializing
the Wayland infrastructure. Later that will be done in one step, meaning
the "get_default()" function will not work properly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
5bc8823701 xwayland: Don't fetch global when shutting down DND
It might not be there when shutting down, so get it from a more managed
place. Note that this isn't strictly needed right now, but eventually,
the MetaWaylandCompositor pointer will be cleared using a g_clear*()
helper, which clears the pointer before freeing the instance, which
wouldn't work here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
b578a534a3 clutter: Remove Wayland server helper
It's a wrapper around a similar Cogl API we don't use anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
14eba8bb8f wayland: Bind Wayland EGL display ourselves
This will allow us less awkward startup, where previously we had to
pre-initialize Wayland very early so Cogl could bind the Wayland display
when it initialized. Move things around so we bind the Wayland EGL
display when initializing the rest of Wayland infrastructure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
2021-05-18 14:03:22 +00:00
Jonas Ådahl
6c1793b7d3 Rename MetaDisplayPolicy to MetaX11DisplayPolicy
This lack of X11 in the name was a bit confusing, since this is about
the X11 policy, not some policy of MetaDisplay.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Olivier Fourdan
b03ccfff4d xwayland: Check the condition on displayfd ready
The callback on_displayfd_ready() would unconditionally set the return
value to TRUE, regardless of the condition.

Use the GIO condition to determine if there was data written and adjust
the return value accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1851>
2021-05-11 15:49:25 +00:00
Jonas Ådahl
4490d4524b xwayland: Handle shutting down without having started
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>
2021-05-06 17:55:32 +02:00
Jonas Ådahl
1a43312b96 wayland: Tear down seat too when shutting down
The functionality was mostly there, but not hooked up to anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
9827687ca1 wayland/seat: Unset resource user data when disabling
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>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
8303752e32 wayland/keyboard: Don't free NULL anonymous file
Use g_clear_pointer() instead, as meta_anonymous_file_free() rightfully
doesn't like being passed NULL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
c614cc3e82 wayland: Terminate Xwayland when shutting down
This is less confusing to Xwayland than suddenly loosing the Wayland
socket connection.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
799c6dcf2f main: Tear down Wayland support before MetaDisplay
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>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
b71f52ff32 xwayland: Set libX11 error handlers to no-ops before terminating
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>
2021-05-05 19:52:04 +00:00
Jonas Ådahl
0a12f1c9c6 wayland: Clean up Wayland clients and display on shutdown
This will clean up Wayland related objects, e.g. surfaces and buffers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Robert Mader
96f2da9fb0 wayland/data-device: Clear existing data device resource from list
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>
2021-04-30 22:38:39 +02:00
Robert Mader
6e00e5e6e7 wayland/subsurface: Avoid placement ops for detached subsurfaces
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>
2021-04-19 11:55:49 +00:00
Aleksandr Mezin
90e3d9782d Revert "wayland/window: Correct detection whether to send configure"
It breaks more than it fixes.

After commit [1] Shell doesn't trigger the original issue [2] anymore.

[1]: ba0b9239d3
[2]: https://gitlab.gnome.org/GNOME/mutter/-/issues/1627

This reverts commit 236e9ec68f.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1723

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1804>
2021-04-14 06:36:09 +00:00
Robert Mader
a09c914230 wayland/actor-surface: Call ensure_size_valid() on shaped-texture
Use the new API to make sure the shaped texture has a valid size
during the next layout phase.

This is needed here because, quoting the previous commit:

When the texture size is invalidated using `invalidate_size()`, the new
size will only get calculated the next time `update_size()` is
called. This happens e.g. in `meta_shaped_texture_get_preferred_size()`
via `ensure_size_valid()`.

`update_size()` can chain up to `clutter_content_invalidate_size()`
as well as emitting a `size-changed` signal. If this happens during
layout, the result is a 'change the layout conditions during layout'
issue, causing heavy breakage in e.g. the Shell overview.

To fix this, expose `ensure_size_valid()` as API so callers can make
sure the texture has a valid size without creating redundant size
invalidations calls.

Note that if a buffer with a new size is attached we already trigger
`update_size()` explicitely, avoiding such situations.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1718

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1799>
2021-03-29 15:47:25 +00:00
Carlos Garnacho
4bee25d8e6 wayland: Cancel selection data sources that are set while unfocused
If a client is naive enough to assume that it can set the selection while
it has got no surfaces, mutter will simply ignore the request and leave
the selection unchanged.

This is good and the expected behavior, however the poor client that did
this will enter in an inconsistent state where it "claimed" the selection,
but nobody told it that the wl_data_source is not current.

So, when the client is focused the next time, it will receive wl_data_offers
as usual, but it will still think all the time that it is owning the
selection. In the case of GTK, that takes client-side shortcuts, so any
attempted paste will still bring back the client-side aborted selection.

To fix this, cancel the selection right away if it happened while unfocused,
the client will be able to undo its own failed selection, and not assume
that future offers are its own.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1469
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1772>
2021-03-23 17:07:31 +00:00
Daniel van Vugt
3555f65b75 wayland-dma-buf: Add support for DRM_FORMAT_ABGR2101010
It seems to be the preferred format of the Mesa V3D driver on
Raspberry Pi 4. If the compositor doesn't advertise it then Mesa will
fallback from `zwp_linux_dmabuf_v1` to `wl_drm`, incorrectly. Meaning
it will keep using a buffer with modifiers on an interface that does
not have modifiers.

Add support for `DRM_FORMAT_ABGR2101010`. It works, and prevents Mesa
from taking its broken fallback path.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1520
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1798>
2021-03-23 16:40:40 +00:00
Olivier Fourdan
1f1bf4cd9d xwayland: Check permissions on /tmp/.X11-unix
For Xwayland, mutter creates the sockets in the standard /tmp/.X11-unix
directory.

Yet, if that directory already exists, it may have been created by
another user with full control over the created socket.

To avoid that issue, if the directory /tmp/.X11-unix already exists,
check that the permissions are as we expect, i.e. the directory belongs
to either root or the user herself, is writable and has the sticky bit.

Thanks to fabian@ritter-vogt.de for reporting that issue.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1708

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1787>
2021-03-18 17:43:02 +01:00
Olivier Fourdan
7b5e855032 xwayland: Use defines for X11 directory and path
Rather than repeating the same strings for X11 directory and path all
around the code, use a define.

No functional change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1787>
2021-03-18 17:43:02 +01:00
Robert Mader
2ef6490323 wayland/surface: Do not free placement ops of cached state
The list gets freed in `meta_wayland_surface_state_clear()`
if the pointer is still set.

Fixes ba8499f9ec

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1783>
2021-03-15 12:49:45 +00:00
Robert Mader
ba8499f9ec wayland/subsurface: Move placement ops to the parents pending state
Unlike other subsurface state, placement operations need to get
applied in order. As per spec:

```
Requests are handled in order and applied immediately to a pending
state. The final pending state is copied to the active state the
next time the state of the parent surface is applied.
```

Having placement operations being part of the subsurface state
makes it difficult to support arbitrary orderings. Make them
part of the parents surface pending state instead.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1691

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1768>
2021-03-14 00:38:18 +01:00
Aleksandr Mezin
236e9ec68f wayland/window: Correct detection whether to send configure
When deciding if `configure` event should be sent,
`meta_window_wayland_move_resize_internal` compares requested window size
with `window->rect` size. However, `window->rect` is only updated when `commit`
is received. So the following sequence produces incorrect result:

1. a window initially has size `size1`
2. `move_resize_internal` is called with `size2`. `configure` is sent
3. `move_resize_internal` is called with `size1` to restore original size,
but `commit` for `size2` haven't arrived yet. So `window->rect` still has size
`size1`, and thus new `configure` is not sent
4. `commit` for `size2` arrives, window changes size to `size2`

Expected window size in the end: `size1`
Actual: `size2`

To fix the issue, take size from pending `configure` events into account.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1627

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1755>
2021-03-12 16:25:10 +00:00
Ivan Molodetskikh
82af1fb87e wayland: Send presentation feedbacks to cursors
This commit assumes that cursor surfaces work in a "mailbox" fashion. If
they are painted multiple times before a successful flip, all commits
but the last get discarded, and the last commit gets presented after the
flip succeeds. This is more or less how it works in the atomic backend,
and also more or less how it works in other backends, with the exception
that the cursor painting might fail without any way of knowing. This
assumption is still better than unconditionally discarding all cursor
surface feedbacks as if the cursor painting always fails.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:12 +00:00
Ivan Molodetskikh
cd9ae13465 backend: Pass stage view to cursor-painted signal
Will be used for presentation-time handling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:12 +00:00
Ivan Molodetskikh
2ce3a050f0 wayland: Wire up presentation-time machinery
- add surfaces to the presentation list,
- move their feedbacks to the map in on-after-update,
- fire the feedbacks in on_presented().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:12 +00:00
Ivan Molodetskikh
f0c2200466 wayland: Store map of ready presentation feedbacks
These are feedbacks for updates that were drawn or otherwise displayed
on screen, and need to be fired as soon as their presentation happens.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:12 +00:00
Ivan Molodetskikh
0c3490223e wayland: Store list of presentation-time surfaces
These are surfaces that might have registered presentation-time
callbacks, similar to the frame callback surface list.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:12 +00:00
Ivan Molodetskikh
bb57f35296 wayland: Add presentation_feedback_present()
Regarding the sequence = 0 fallback: in some cases (moving a cursor
plane on atomic amdgpu) we get sequence = 0 in the page flip callback.
This seems like an amdgpu bug, so work around it by assuming a sequence
delta of 1 (it is equal to 1 because of the sequence != 0 check above).

Sequence can also legitimately be 0 if we're lucky during the 32-bit
overflow, in which case assuming a delta of 1 will give more or less
reasonable values on this and next presentation, after which it'll be
back to normal.

Sequence is also 0 on mode set fallback and when running nested, in
which case assuming a delta of 1 every frame is the best we can do.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:11 +00:00
Ivan Molodetskikh
dccc60ec3e wayland: Implement stub presentation-time
The presentation-time protocol allows surfaces to get accurate
timestamps of when their contents were shown on screen.

This commit implements a stub version of the protocol which correctly
discards all presentation feedback objects (as if the surface contents
are never shown on screen). Subsequent commits will implement sending
the presented events to surfaces shown on screen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
2021-03-08 09:48:11 +00:00
Philip Withnall
bec456ba0a xwayland: Fix some FD leaks on error paths
If `meta_xwayland_start_xserver()` returned via an error path, some of
the socket FDs were leaked.

Fix that, and add `steal_fd()` calls to make it clearer that FDs passed
to `g_subprocess_launcher_take_fd()` are transferred to it. There were
no bugs with how `GSubprocessLauncher` was being used.

Spotted while working on
https://gitlab.gnome.org/GNOME/glib/-/issues/2332.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1738>
2021-02-24 14:17:07 +00:00
Olivier Fourdan
6438919a89 window: Add "is_focus_async" API
X11 clients can use different models of input handling, of which some
may not result focus being set synchronously.

For such clients, meta_focus_window() will not change the focus itself
but rely on the client itself to set the input focus on the desired
window.

Add a new MetaWindow API to check when dealing with such a window.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1716>
2021-02-23 11:08:59 +00:00
Robert Mader
6eeeffdc68 src: Stop using GSlice
It has been inofficially deprecated for years, is known to cause issues
with valgrind and potentially hides memory corruption.
Lets stop using it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1512>
2021-02-22 13:52:27 +01:00
Carlos Garnacho
698fe3f1a9 wayland: Avoid automatically decoupling source/offer after grab
In the case that DnD is performed and succeeds, we want to release
the grab early, and let the transfer IPC happen in the back. For
that to happen without a hitch, drag source and offer must be left
related to each other after undoing the grab, even though the default
ungrabbing code does that automatically (indirectly, by unsetting the
drag focus).

In these cases, we used to manually unset the current source, so
this decoupling was skipped. Notably, one missed case is X11 DnD,
so we might end up with the situation there that DnD did succeed,
transfer is ongoing, but the source and offer are already decoupled,
this confused the machinery and missed the finishing XdndFinished
to be emitted to the X11 drag source.

The prior commits prepared for this source/offer decoupling being
a manual operation, this commit avoids doing this automatically
when ungrabbing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1720>
2021-02-09 19:33:13 +00:00