Commit Graph

24902 Commits

Author SHA1 Message Date
Florian Müllner
0bce4323c7 Bump version to 3.34.4
Update NEWS.
2020-02-16 15:49:35 +01:00
Olivier Fourdan
b2bc345463 wayland/subsurface: Keep subsurface actors reactive
The actors of Wayland subsurfaces are set to be reactive on creation,
when receiving the `wl_subcompositor.get_subsurface` request.

However, if a client creates several subsurfaces and then creates the
xdg_toplevel object after, the previous subsurface actors are reset.

As a result, Clutter picking will skip and ignore those actors in
`clutter_actor_should_pick_paint()` because they aren't marked as
reactive anymore.

An example of such a client being affected by this issue is SCTK, the
Rust library implementing client side decorations for Wayland used
internally by winit and alacritty.

Move the `set_reactive()` call from `get_subsurface()` to the subsurface
`sync_actor_subsurface_state()` vfunc to make sure those remain reactive
even after `xdg_surface.get_toplevel` is invoked.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1024
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1040


(cherry picked from commit 934a829a57)
2020-02-10 09:02:30 +00:00
Robert Mader
2235629d25 core: Extend list of image formats to be stored in the clipboard manager
These types are probably common enough to support.

See also:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1034

(cherry picked from commit b91d66bf98)
2020-02-04 00:27:46 +01:00
Carlos Garnacho
59da900a45 core: Define specific image formats to be stored in the clipboard manager
And order those preferences in order of lossiness (jpeg < png < bmp). This
avoids us from prefering other formats that are not useful or widely
recognized.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/939

(cherry picked from commit 832c0fb0ea)
2020-02-04 00:27:17 +01:00
Carlos Garnacho
0e0dae2774 core: Demote image formats' priority from preservation in clipboard manager
Most usually, applications either expose clipboard content either as text
or as images, so the prioritization here is pointless. However there's some
outliers like LibreOffice Calc which exports content as both image and text
formats (besides other internal ones).

In that mixed case, we probably prefer to keep text formats, rather than
image based ones.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/919

(cherry picked from commit 2fbbf657d5)
2020-02-04 00:26:39 +01:00
Georges Basile Stavracas Neto
4959ae8bc4 clutter/brightness-contrast-effect: Compare float with G_APPROX_VALUE
Nobody should ever compare float for equality. Use G_APPROX_VALUE to
check that.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992

(cherry picked from commit 84ea4ad990)
2020-02-02 17:50:30 +01:00
Georges Basile Stavracas Neto
aea5541ffa clutter/offscreen-effect: Clear offscreen when pre-paint fails
Some ClutterOffscreenEffect subclasses, such as ClutterBrightnessContrastEffect,
early-return FALSE in pre-paint before chaining up. It's an important optimization
that avoids creating or updating the offscreen framebuffer.

However, if an offscreen framebuffer already exists by the time pre-paint fails,
it will be used *without* repaint the actor over it. That causes an old picture
of the actor to be displayed.

Fix that by always clearing the offscreen framebuffer when pre-paint fails.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/810

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992

(cherry picked from commit 64685f4b20)
2020-02-02 17:49:34 +01:00
Georges Basile Stavracas Neto
47fe7ac25b clutter/offscreen-effect: Clear offscreen framebuffer when disabling
When changing the 'enabled' property and disabling the offscreen effect,
it doesn't make sense to preserve the offscreen framebuffer. It's not
drawing, after all.

Furthermore, because ClutterOffscreenEffect only checks if the offscreen
framebuffer exists to decide whether or not to redraw, keeping the fbo
alive is a waste of resources.

Clear the offscreen framebuffer when the effect is disabled or enabled.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/810

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992

(cherry picked from commit bf594e9fb6)
2020-02-02 17:31:46 +01:00
Georges Basile Stavracas Neto
d35d7fb618 clutter/offscreen-effect: Use g_clear_pointer for cleanup
It does the exact same checks, and saves us a few lines of code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992

(cherry picked from commit 3958e75ed2)
2020-02-02 17:31:46 +01:00
Carlos Garnacho
666bd25005 wayland: Handle dragging from/dropping to v1 data device users
Interoperation between wl_data_device_manager v1 and v3 got broken
at some point. Ensure that we resort to the "copy" action if either
the drop site or the drag source are from a client that requested v1.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/965

(cherry picked from commit ffad55c66f)
2020-02-01 16:30:25 +01:00
Robert Mader
208fd1b083 wayland/data-device: Small style fixes
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1031

(cherry picked from commit 15b46a6f88,
to keep future backports easy)
2020-01-31 15:21:18 +01:00
Robert Mader
12152c7edb wayland/data-device: Guard against a potential crash
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1031

(cherry picked from commit c27fc3537b)
2020-01-31 15:20:55 +01:00
Robert Mader
de7782221a wayland/data-device: Cancel drag source when the drag finished unsuccessfully
When a drag was performed but did not finish successfully, e.g. because no
mimetype was accepted, we need to send the source cancel event so clients
know they can destroy the drag source (since version 3).

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/740

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1031

(cherry picked from commit 6cc748cce9)
2020-01-31 15:20:20 +01:00
Carlos Garnacho
651d2a57f8 wayland: Check focus surface client in wl_data_device.set_selection()
Similar to our handling in set_primary(), ignore set_selection() requests
that come from unfocused clients.

https://gitlab.gnome.org/GNOME/mutter/issues/878

(cherry picked from commit e865fcc460)
2020-01-31 15:18:42 +01:00
Carlos Garnacho
e18aa564b0 wayland: Clean up meta_wayland_data_device_set_primary()
This function is already checking for the focus surface client
matching the requestor. The type check was slightly bogus though
as it'd be an screwup in our code, make it an assert instead.

Also, move the check for the client having the focus into the
upper call, so this and wl_data_device.set_selection code can
get more in line.

https://gitlab.gnome.org/GNOME/mutter/issues/878

(cherry picked from commit 16eb461054)
2020-01-31 15:18:16 +01:00
Carlos Garnacho
4cc5b85c5d wayland: Flatten data source object hierarchy
We have an abstract MetaWaylandDataSource and 2 subclasses for
clipboard/primary data sources. Since the abstraction provided
by the additional sublevel is arguable, push the wl_resource
field up, and leave us with just 2 objects to think about, all
of them containing a wl_resource.

https://gitlab.gnome.org/GNOME/mutter/issues/878

(cherry picked from commit c11ef6ef07)
2020-01-31 15:17:43 +01:00
Adam Jackson
ca5ed7369d cogl: Fix GLES2 fallback
Say you're using intel gen3, you poor soul. Your big-GL maxes out at 1.5
unless you use dirty tricks, but you do have GLES2. We try to fall back
to GLES in this case, but we only ever say eglBindAPI(EGL_OPENGL_API).
So when we go to do CreateContext, even though we think we've requested
GLES 2.0, the driver will compare that "2.0" against the maximum big-GL
version, and things will fail.

Fix this by binding EGL_OPENGL_ES_API before trying a GLES context.

https://gitlab.gnome.org/GNOME/mutter/issues/635

(cherry picket from commit f4f7e31303)
2020-01-27 17:09:09 +01:00
Carlos Garnacho
5ae317e004 wayland: Do not check current offer on DnD button release
This check was added on commit 48639ac5 as a means to disregard
DnD drops where the offer would disappear beforehand. However since
that commit was all about wl_data_device_manager version < 3,
forgetting about the selected mimetype seems a behavior more inline
with those versions.

Since no current drop is something expected on X11 drop sites, fixes
DnD over those, while keeping the original bug fixed.

Found by Robert Mader (https://gitlab.gnome.org/GNOME/mutter/issues/974#note_688144)

https://gitlab.gnome.org/GNOME/mutter/issues/974
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1005

(cherry picked from commit 30bf588a38)
2020-01-27 15:28:57 +01:00
Carlos Garnacho
21dca32934 xwayland: Set XDND source-side actions as per XDND
In XDND, we just get a hint on XdndPosition about what's the action
chosen by the user. Make the data source actions the full set on
XdndEnter (as we can't know better), and pass the hint in XdndPosition
as the user chosen action as it should be.

Makes Wayland drop sites aware of the user action as per XDND with X11
drag sources, and still makes modifiers during DnD work.

https://gitlab.gnome.org/GNOME/mutter/issues/974
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1005

(cherry picked from commit 090a6ad409)
2020-01-27 15:28:30 +01:00
Carlos Garnacho
41c6e1375b x11: Map x11 (UTF8_)STRING requests to text/plain mimetypes
Make the x11 selection proxy map UTF8_STRING and STRING to proper
mimetypes, as the selection source (wayland or memory) might not
offer those for backwards compatibility.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1355
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1005

(cherry picked from commit a6c195b05c)
2020-01-27 15:28:03 +01:00
Carlos Garnacho
d38c30c128 wayland: Preserve XdndTypeList for future callers
This Xdnd property is owned by the drag source, we shouldn't delete
it when reading/proxying it to Wayland clients.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2347
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1005

(cherry picked from commit c1df48befd)
2020-01-27 15:27:11 +01:00
Adam Jackson
59e9b073a5 renderer-native: Fix memory leak in secondary GPU update
Leaking a texture object and a framebuffer object every time you update
the secondary GPU is perhaps not the best plan.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1011


(cherry picked from commit 545fcb3dbf)
2020-01-21 14:47:09 +00:00
Sebastian Keller
6b6e724425 shaped-texture: Plug region leak
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1002


(cherry picked from commit b30a29f830)
2020-01-21 14:26:15 +00:00
Carlos Garnacho
156dd576f4 x11: Iterate over selections in a safer manner for event handling
It might be the case that handling an event induces the stream to
trigger completion, hence removing itself from the list. In that
case we would operate on the no longer valid list element to fetch
the next one.

Keep a pointer to the next element beforehand, so we can tiptoe
over streams that did remove themselves.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/869
(cherry picked from commit 45a8806e65)
2020-01-17 13:57:31 +01:00
Carlos Garnacho
4d0a331cfe x11: Detach selection streams on dispose
The streams were only detached from MetaX11Display (and its event handling)
on completion. This is too much to expect, and those might be in some
circumstances replaced while operating.

Make those streams detach themselves on dispose(), so we don't trip into
freed memory later on when trying to dispatch unrelated X11 selection events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/869
(cherry picked from commit e1fa0734a9)
2020-01-17 13:57:24 +01:00
Jonas Ådahl
01d93f2819 kms-impl-simple: Handle mode set race conditions gracefully
If we end up trying to do a mode set on a DRM state that has already
changed behind our back without us yet having seen the hotplug event we
may fail with `EINVAL`. Since the renderer layer doesn't handle mode set
failure, it'll still try to page flip later on, which will then also
fail. When failing, it'll try to look up the cached mode set in order to
retry the mode set later on, as is needed to handle other error
conditions. However, if the mode set prior to the page flip failed, we
won't cache the mode set, and the page flip error handling code will get
confused.

Instead of asserting that a page flip always has a valid cached mode set
ready to look up, handle it being missing more gracefully by failing to
mode set. It is expected that things will correct themself as there
should be a hotplug event waiting around the the corner, to reconfigure
the monitor configuration setting new modes.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/917

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1007
(cherry picked from commit ce3409b2b7)
2020-01-16 16:02:42 +01:00
Jonas Ådahl
be777dbd79 kms-impl-simple: Include mode name in error message
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1007
(cherry picked from commit 7733f88168)
2020-01-16 16:02:42 +01:00
Jonas Ådahl
a9a0110818 wayland/actor-surface: Always consider unmapped actors not on output
This avoids using bogus geometric values from an unmapped actor to
determine whether an actor is on a logical monitor or not. This would
happen when committing to a subsurface of a yet to be mapped toplevel.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit 6d15231f10)
2020-01-16 08:54:31 +01:00
Jonas Ådahl
fd7d0fb339 wayland/surface: Move shaped-texture synchronization to actor surface
As with most other state that ends up being pushed to the actor and the
associated shaped texture, also push the texture and the corresponding
metadata from the actor surface. This fixes an issue when a toplevel
surface was reset, where before the subsurface content was not properly
re-initialized, as content state synchronization only happened on
commit, not when asked to synchronize.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit f0df07cba3)
2020-01-16 08:54:31 +01:00
Jonas Ådahl
1671692590 wayland/surface-actor: Reset and sync subsurface state when resetting
A actor surface may be reset by an xdg_toplevel if a NULL buffer is
attached. This should reset the actor state of the toplevel to an empty
state, while unmapping the previous actor. Subsurfaces, however, should
stay intact, including their relationship to the toplevel. They should
also not be yanked away from the actor of the actor surface prior to it
resetting, so that a window-destroy animation can include the subsurface
actor.

This fixes a potential crash when a subsurface tries to commit to its
wl_surface after the destroy animation of the toplevel has finished, as
the actor would at that point have been destroyed and cleared from the
actor surface struct, causing a segmentation fault.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit fe7bece31e)
2020-01-16 08:54:31 +01:00
Jonas Ådahl
06fc756f0f shaped-texture: Make setting the same texture a no-op
Will be helpful when pushing state to the shaped texture, letting the
one pushing not have to care about checking if anything changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit 3969285e5c)
2020-01-16 08:54:31 +01:00
Jonas Ådahl
81b7196ad9 shaped-texture: Minor clean up
Use cogl_clear_object(), add reference to texture when setting, and
remove redundant runtime type check.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit 60ebf19c9e)
2020-01-16 08:54:31 +01:00
Jonas Ådahl
e91b12fdf9 wayland: Replace manual GNode subsurface iteration with macro
Similar to wl_list_foreach(), add
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE() that iterates over all the
subsurfaces of a surface, without the caller needing to care about
implementation details, such as leaf nodes vs non-leaf nodes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit fcfe90aa9f)
2020-01-16 08:54:31 +01:00
Jonas Ådahl
f52c0a3bf7 wayland/egl-stream: Cache texture snippet
While it's not very relevant now, as we would rarely create it anyway
since the buffer nor texture never changes for a surface, it will be in
the future, as the actor state (including its content,
MetaShapedTexture) will be synchronized by the MetaWaylandActorSurface
at a later point in time, and not by MetaWaylandSurface, at state
application time.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit 76ee026caa)
2020-01-16 08:54:31 +01:00
Umarzuki Bin Mochlis Moktar
78a45e1813 Update Malay translation 2020-01-08 15:06:57 +00:00
Florian Müllner
4947e8ae5b Bump version to 3.34.3
Update NEWS.
2020-01-05 12:37:05 +01:00
Sebastian Keller
5724310899 clutter/stage: Fix picking of rectangles with negative positions
FLT_MIN is the smallest *positive* number above 0 that can be
represented as floating point number. If this is used to initialize the
maximum x/y coordinates of a rectangle, this will always be used if all
x/y coordinates of the rectangle are negative. This means that picking
at 0,0 will always be a hit for such rectangles.

Since mutter creates such a window for server side decorations on X11,
this window will always be picked at 0,0 preventing clicking/hovering
the activities button in gnome-shell at that coordinate.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/893


(cherry picked from commit 674f52ba74)
2019-12-24 16:52:37 +00:00
Pascal Nowack
9772f084bf screen-cast: Fix window recording on HiDPI
Using the same scale for the window as the
logical monitor only works correctly when having
the experimental 'scale-monitor-framebuffer'
feature enabled.
Without this experimental feature, the stream
will contain a black screen, where the actual
window only takes a small part of it.

Therefore, use a scale of 1 for the non-
experimental case.

Patch is based on commit 3fa6a92cc5.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/976


(cherry picked from commit e89cea8e5a)
2019-12-18 19:54:03 +00:00
Florian Müllner
8b087cfe56 Bump version to 3.34.2
Update NEWS.
2019-12-11 20:05:26 +01:00
Bruce Cowan
c05328f76a Update British English translation 2019-12-11 10:25:27 +00:00
Tim Crawford
868a617907 backends/native: Fix double free of error
error is an autoptr, so must not be explicitly freed.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1852
Fixes: 5c500ad402 ("backend: Move GPU ownership from the monitor manager to the backend")

https://gitlab.gnome.org/GNOME/mutter/merge_requests/960


(cherry picked from commit d70ddc65ea)
2019-12-06 19:56:51 +00:00
Pekka Paalanen
6f02d2ead0 kms-impl/simple: Fix meta_set_fallback_feedback_idle
Presumably this function is supposed to be like
meta_kms_impl_simple_handle_page_flip_callback() but the condition in the
if-statement is inverted. Fix the inversion to make these two functions look
alike.

This is part 2 of 2 fixing a complete desktop freeze when drmModePageFlip()
fails with EINVAL and the fallback to drmModeSetCrtc() succeeds but the success
is not registered correctly as completed "flip". The freeze occurs under
wait_for_pending_flips() which calls down into meta_kms_impl_device_dispatch()
which ends up poll()'ing the DRM fd even though drmModeSetCrtc() will not
produce a DRM event, hence the poll() never returns. The freeze was observed
when hotplugging a DisplayLink dock for the first time on Ubuntu 19.10.

This patch makes meta_set_fallback_feedback_idle() actually end up calling into
notify_view_crtc_presented() which decrements
secondary_gpu_state->pending_flips so that wait_for_pending_flips() can finish.

CC stable: gnome-3-34

https://gitlab.gnome.org/GNOME/mutter/merge_requests/953
(cherry picked from commit 832a522cce)
2019-12-06 17:27:15 +01:00
Pekka Paalanen
fc77efbcd7 kms: Process impl idle callbacks before pre dispatch flush
mode_set_fallback() schedules a call to mode_set_fallback_feedback_idle(), but
it is possible for Mutter to repaint before the idle callbacks are dispatched.
If that happens, mode_set_fallback_feedback_idle() does not get called before
Mutter enters wait_for_pending_flips(), leading to a deadlock.

Add the needed interfaces so that meta_kms_device_dispatch_sync() can flush all
the implementation idle callbacks before it checks if any "events" are
available. This prevents the deadlock by ensuring
mode_set_fallback_feedback_idle() does get called before potentially waiting
for actual DRM events.

Presumably this call would not be needed if the implementation was running in
its own thread, since it would eventually dispatch its idle callbacks before
going to sleep polling on the DRM fd. This call might even be unnecessary
overhead in that case, synchronizing with the implementation thread needlessly.
But the thread does not exist yet, so this is needed for now.

This is part 1 of 2 fixing a complete desktop freeze when drmModePageFlip()
fails with EINVAL and the fallback to drmModeSetCrtc() succeeds but the success
is not registered correctly as completed "flip". The freeze occurs under
wait_for_pending_flips() which calls down into meta_kms_impl_device_dispatch()
which ends up poll()'ing the DRM fd even though drmModeSetCrtc() will not
produce a DRM event, hence the poll() never returns. The freeze was observed
when hotplugging a DisplayLink dock for the first time on Ubuntu 19.10.

CC stable: gnome-3-34

https://gitlab.gnome.org/GNOME/mutter/merge_requests/953
(cherry picked from commit 79491df2b8)
2019-12-06 17:27:14 +01:00
Florian Müllner
c0e76186da stack: Allow promoting transient windows to their parent's layer
When a window that should be stacked above another one is placed in a lower
layer than the other window, we currently allow promoting it to the higher
layer when it has a "transient type". We should do the same when the window
is an actual transient of the other window.

This is particularly relevant for wayland windows, where types play a
much smaller role: Transient windows like non-modal dialogs (and since
commit 666bef7a, popup windows as well) currently end up underneath their
always-on-top parent.

https://gitlab.gnome.org/GNOME/mutter/issues/587


(cherry picked from commit 1c89fce30e)
2019-11-29 14:18:59 +00:00
Robert Mader
1b75d78c72 shaped-texture: Do not invalidate content on set_cogl_texture()
This was wrongly introduced in 75cffd0ec4. As the comment above explains, we
only want to queue redraws in response to surface/buffer damage.

This triggered a full redraw when using DMA buffers on Wayland as we currently
create a new texture on every buffer_attach(), breaking partial invalidation.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/947


(cherry picked from commit 0247d35e5a)
2019-11-26 22:43:54 +00:00
Jonas Dreßler
cbbffd1db7 cursor-tracker: Add API to keep the wayland pointer focus while hidden
Since commit a2a8f0cda we force the focus surface of the
meta-wayland-pointer to NULL while the pointer is invisible. This
introduced an issue with the a11y magnifier of the shell, which uses
`meta_cursor_tracker_set_pointer_visible` to hide the real cursor and
show its own magnified cursor at the correct position: Because the
meta-wayland-pointer is still used to communicate with Wayland clients,
the UI of the windows will not respond to mouse movement anymore as
soon as the real cursor is hidden.

Fix this issue for now by adding an additional method to the
cursor-tracker which allows disabling the behavior commit a2a8f0cda
introduced.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/832
2019-11-25 16:15:14 +01:00
Marco Trevisan (Treviño)
06202c342b device-manager-x11: Ignore events if no source device is set
There might be some inconsistent event for which we don't have a known
source device.

In the current state we don't handle them and we could crash when getting
the current device tool.

So, add an utility function that retrieves the source device for an event
that warns if no device is found, and use this for Motion, Key and Button
events.

In case we don't have a valid source in such case, just return early instead
of trying to generate invalid clutter events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/823


(cherry picked from commit 427670cc63)
2019-11-23 01:47:33 +00:00
Robert Mader
9c372388da clutter/cally-root: Use g_clear_signal_handler and fix a signal leak
This commit was split out from `cleanup: Use g_clear_signal_handler()
where possible` as it fixes an actual signal leak and should therefore
get backported to stable releases.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 16:22:14 +01:00
Carlos Garnacho
7e741fe2d2 wayland: Move "ownership" of the DnD selection source to the data device
On wl_data_source destruction we used to indirectly unset the DnD selection
owner via the wl_resource destructor triggering the destruction of the
MetaWaylandDataSource, which would be caught through the weak ref set by
the MetaWaylandDragGrab.

This works as long as the grab is held, however we have a window between
the button being released and the drop site replying with
wl_data_offer.finish that the MetaWaylandDataSource is alive, but its
destruction wouldn't result in the call chain above to unsetting the DnD
source.

In other selection sources, we let the MetaWaylandDataDevice hold the
"ownership" of the MetaWaylandDataSource, and its weak ref functions unset
the respective MetaSelection owners. Do the same here, so the
MetaWaylandDataSource destruction is listened for all its lifetime.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/591

(cherry picked from commit e5af790acb)
2019-11-20 12:59:58 +01:00
Carlos Garnacho
edb618b2a4 wayland: Do not cancel data source on offer destruction
This is wrong for both clipboard and DnD, as the selection source
will still be able to focus another surface, and churn another
wl_offer.

We should just detach the data offer from the data source in this
case, and let the source live on. However, we should still check
that there is a source and an offer to finish DnD, do that when
handling the drop operation instead.

https://gitlab.gnome.org/GNOME/mutter/issues/591

(cherry picked from commit 48639ac5da)
2019-11-20 12:59:40 +01:00