[gtk/matthiasc/for-master: 8/9] wayland: Minor cleanup



commit ab197fa97cc856023fc982672d7d7be60c2ba98d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 4 10:37:58 2020 -0500

    wayland: Minor cleanup
    
    Stop storing selected_action, mainly since the name
    is confusing. Instead, just pass the value directly
    in the 2 places where it is used.

 gdk/wayland/gdkdrop-wayland.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/gdk/wayland/gdkdrop-wayland.c b/gdk/wayland/gdkdrop-wayland.c
index 686157fd81..2648660b4a 100644
--- a/gdk/wayland/gdkdrop-wayland.c
+++ b/gdk/wayland/gdkdrop-wayland.c
@@ -51,7 +51,6 @@ struct _GdkWaylandDrop
   struct wl_data_offer *offer;
   uint32_t source_actions;
   uint32_t action;
-  GdkDragAction selected_action;
   uint32_t serial;
 };
 
@@ -116,19 +115,20 @@ gdk_wayland_drop_drop_set_status (GdkWaylandDrop *drop_wayland,
 }
 
 static void
-gdk_wayland_drop_commit_status (GdkWaylandDrop *wayland_drop)
+gdk_wayland_drop_commit_status (GdkWaylandDrop *wayland_drop,
+                                GdkDragAction   actions)
 {
   GdkDisplay *display;
   uint32_t dnd_actions;
 
   display = gdk_drop_get_display (GDK_DROP (wayland_drop));
 
-  dnd_actions = gdk_to_wl_actions (wayland_drop->selected_action);
+  dnd_actions = gdk_to_wl_actions (actions);
 
   if (GDK_WAYLAND_DISPLAY (display)->data_device_manager_version >=
       WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION)
     {
-      if (gdk_drag_action_is_unique (wayland_drop->selected_action))
+      if (gdk_drag_action_is_unique (actions))
         {
           wl_data_offer_set_actions (wayland_drop->offer, dnd_actions, dnd_actions);
         }
@@ -140,19 +140,16 @@ gdk_wayland_drop_commit_status (GdkWaylandDrop *wayland_drop)
         }
     }
 
-  gdk_wayland_drop_drop_set_status (wayland_drop, wayland_drop->selected_action != 0);
+  gdk_wayland_drop_drop_set_status (wayland_drop, actions != 0);
 }
 
 static void
 gdk_wayland_drop_status (GdkDrop       *drop,
-                         GdkDragAction  action)
+                         GdkDragAction  actions)
 {
-  GdkWaylandDrop *wayland_drop;
-
-  wayland_drop = GDK_WAYLAND_DROP (drop);
-  wayland_drop->selected_action = action;
+  GdkWaylandDrop *wayland_drop = GDK_WAYLAND_DROP (drop);
 
-  gdk_wayland_drop_commit_status (wayland_drop);
+  gdk_wayland_drop_commit_status (wayland_drop, actions);
 }
 
 static void
@@ -163,11 +160,9 @@ gdk_wayland_drop_finish (GdkDrop       *drop,
   GdkDisplay *display = gdk_drop_get_display (drop);
   GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
 
-  wayland_drop->selected_action = action;
-
   if (action)
     {
-      gdk_wayland_drop_commit_status (wayland_drop);
+      gdk_wayland_drop_commit_status (wayland_drop, action);
 
       if (display_wayland->data_device_manager_version >=
           WL_DATA_OFFER_FINISH_SINCE_VERSION)


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