[gtk/gtk-3-24: 1/2] gdk/wayland: Update selection's offer before updating dnd targets




commit 965aa2e65f1c25113472f06b6662b0b69d724605
Author: Vlad Zahorodnii <vlad zahorodnii kde org>
Date:   Fri Sep 23 10:39:41 2022 +0300

    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.

 gdk/wayland/gdkdevice-wayland.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index ed6ad3b138..a3d464be22 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -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);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]