gdk: Use event constructors for dnd

This commit is contained in:
Matthias Clasen 2020-02-15 09:36:19 -05:00
parent ef004c64c6
commit d6c5ecbea3

View File

@ -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;