[gtk/readonly-events-1: 80/149] gdk: Use event constructors for dnd



commit d6c5ecbea31d386bd3a014eb3fab6464246b7a9e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 15 09:36:19 2020 -0500

    gdk: Use event constructors for dnd

 gdk/gdkdrop.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/gdk/gdkdrop.c b/gdk/gdkdrop.c
index 2f27bccfd5..afc6d5281c 100644
--- a/gdk/gdkdrop.c
+++ b/gdk/gdkdrop.c
@@ -969,11 +969,12 @@ gdk_drop_emit_enter_event (GdkDrop  *self,
 
   g_warn_if_fail (!priv->entered);
 
-  event = gdk_event_new (GDK_DRAG_ENTER);
-  event->any.surface = g_object_ref (priv->surface);
-  event->dnd.drop = g_object_ref (self);
-  event->dnd.time = time;
-  gdk_event_set_device (event, priv->device);
+  event = gdk_event_drag_new (GDK_DRAG_ENTER,
+                              priv->surface,
+                              priv->device,
+                              self,
+                              time,
+                              0, 0);
 
   priv->entered = TRUE;
 
@@ -992,13 +993,12 @@ gdk_drop_emit_motion_event (GdkDrop  *self,
 
   g_warn_if_fail (priv->entered);
 
-  event = gdk_event_new (GDK_DRAG_MOTION);
-  event->any.surface = g_object_ref (priv->surface);
-  event->dnd.drop = g_object_ref (self);
-  event->dnd.time = time;
-  event->dnd.x = x;
-  event->dnd.y = y;
-  gdk_event_set_device (event, priv->device);
+  event = gdk_event_drag_new (GDK_DRAG_MOTION,
+                              priv->surface,
+                              priv->device,
+                              self,
+                              time,
+                              x, y);
 
   gdk_drop_do_emit_event (event, dont_queue);
 }
@@ -1013,11 +1013,12 @@ gdk_drop_emit_leave_event (GdkDrop  *self,
 
   g_warn_if_fail (priv->entered);
 
-  event = gdk_event_new (GDK_DRAG_LEAVE);
-  event->any.surface = g_object_ref (priv->surface);
-  event->dnd.drop = g_object_ref (self);
-  event->dnd.time = time;
-  gdk_event_set_device (event, priv->device);
+  event = gdk_event_drag_new (GDK_DRAG_LEAVE,
+                              priv->surface,
+                              priv->device,
+                              self,
+                              time,
+                              0, 0);
 
   priv->entered = FALSE;
 
@@ -1037,13 +1038,12 @@ gdk_drop_emit_drop_event (GdkDrop  *self,
   g_warn_if_fail (priv->entered);
   g_warn_if_fail (priv->state == GDK_DROP_STATE_NONE);
 
-  event = gdk_event_new (GDK_DROP_START);
-  event->any.surface = g_object_ref (priv->surface);
-  event->dnd.drop = g_object_ref (self);
-  event->dnd.time = time;
-  event->dnd.x = x;
-  event->dnd.y = y;
-  gdk_event_set_device (event, priv->device);
+  event = gdk_event_drag_new (GDK_DROP_START,
+                              priv->surface,
+                              priv->device,
+                              self,
+                              time,
+                              x, y);
 
   priv->state = GDK_DROP_STATE_DROPPING;
 


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