gdk/wayland: Update selection's offer before updating dnd targets

gdk_wayland_drop_context_update_targets gets targets from the
selection's offer. In order to ensure that the drop context has
up-to-date targets, update the selection's offer before updating
targets.

This fixes drag-and-drop not working reliably when running Firefox in
Plasma Wayland session.
This commit is contained in:
Vlad Zahorodnii
2022-09-23 10:39:41 +03:00
parent 4c991b8b39
commit 965aa2e65f

View File

@@ -1188,14 +1188,16 @@ data_device_enter (void *data,
seat->pointer_info.surface_x = wl_fixed_to_double (x);
seat->pointer_info.surface_y = wl_fixed_to_double (y);
gdk_wayland_drop_context_update_targets (seat->drop_context);
selection = gdk_drag_get_selection (seat->drop_context);
dnd_owner = gdk_selection_owner_get_for_display (seat->display, selection);
if (!dnd_owner)
dnd_owner = seat->foreign_dnd_window;
gdk_wayland_selection_set_offer (seat->display, selection, offer);
gdk_wayland_drop_context_update_targets (seat->drop_context);
_gdk_wayland_drag_context_set_source_window (seat->drop_context, dnd_owner);
_gdk_wayland_drag_context_set_dest_window (seat->drop_context,
@@ -1206,8 +1208,6 @@ data_device_enter (void *data,
_gdk_wayland_drag_context_emit_event (seat->drop_context, GDK_DRAG_ENTER,
GDK_CURRENT_TIME);
gdk_wayland_selection_set_offer (seat->display, selection, offer);
emit_selection_owner_change (dest_window, selection);
}