[gtk+] gdk: Remove DRAG_STATUS and DROP_FINISHED events
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Remove DRAG_STATUS and DROP_FINISHED events
- Date: Fri, 15 Dec 2017 22:58:35 +0000 (UTC)
commit a04afde35cc134a69f0fae124e0f930e5282b6af
Author: Benjamin Otte <otte redhat com>
Date: Fri Dec 15 22:54:34 2017 +0100
gdk: Remove DRAG_STATUS and DROP_FINISHED events
Those are source-side events that are handled by signals of the
Dragontext these days.
gdk/gdkevents.c | 14 +-----
gdk/gdkevents.h | 5 --
gdk/gdkeventsprivate.h | 3 +-
gdk/gdkwindow.c | 2 -
gdk/wayland/gdkdnd-wayland.c | 3 -
gdk/x11/gdkdnd-x11.c | 119 +++++++++--------------------------------
gtk/gtkmain.c | 3 -
gtk/gtkwidget.c | 2 -
8 files changed, 28 insertions(+), 123 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 0e67160..ab641ba 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -645,9 +645,7 @@ gdk_event_copy (const GdkEvent *event)
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
case GDK_DROP_START:
- case GDK_DROP_FINISHED:
g_object_ref (event->dnd.context);
break;
@@ -733,9 +731,7 @@ gdk_event_finalize (GObject *object)
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
case GDK_DROP_START:
- case GDK_DROP_FINISHED:
if (event->dnd.context != NULL)
g_object_unref (event->dnd.context);
break;
@@ -842,9 +838,7 @@ gdk_event_get_time (const GdkEvent *event)
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
case GDK_DROP_START:
- case GDK_DROP_FINISHED:
return event->dnd.time;
case GDK_PAD_BUTTON_PRESS:
case GDK_PAD_BUTTON_RELEASE:
@@ -930,9 +924,7 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
case GDK_DROP_START:
- case GDK_DROP_FINISHED:
case GDK_NOTHING:
case GDK_DELETE:
case GDK_DESTROY:
@@ -1077,9 +1069,7 @@ gdk_event_get_root_coords (const GdkEvent *event,
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
case GDK_DROP_START:
- case GDK_DROP_FINISHED:
x = event->dnd.x_root;
y = event->dnd.y_root;
break;
@@ -2115,9 +2105,7 @@ gdk_event_get_drag_context (const GdkEvent *event,
if (event->any.type == GDK_DRAG_ENTER ||
event->any.type == GDK_DRAG_LEAVE ||
event->any.type == GDK_DRAG_MOTION ||
- event->any.type == GDK_DRAG_STATUS ||
- event->any.type == GDK_DROP_START ||
- event->any.type == GDK_DROP_FINISHED)
+ event->any.type == GDK_DROP_START)
{
*context = event->dnd.context;
return TRUE;
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index c4e70c8..01d0416 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -239,10 +239,7 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
* @GDK_DRAG_LEAVE: the mouse has left the window while a drag is in progress.
* @GDK_DRAG_MOTION: the mouse has moved in the window while a drag is in
* progress.
- * @GDK_DRAG_STATUS: the status of the drag operation initiated by the window
- * has changed.
* @GDK_DROP_START: a drop operation onto the window has started.
- * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
* @GDK_SCROLL: the scroll wheel was turned
* @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
* was added in 2.8.
@@ -298,9 +295,7 @@ typedef enum
GDK_DRAG_ENTER,
GDK_DRAG_LEAVE,
GDK_DRAG_MOTION,
- GDK_DRAG_STATUS,
GDK_DROP_START,
- GDK_DROP_FINISHED,
GDK_SCROLL,
GDK_GRAB_BROKEN,
GDK_TOUCH_BEGIN,
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index cf58231..001e20b 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -436,8 +436,7 @@ struct _GdkEventGrabBroken {
/**
* GdkEventDND:
* @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
- * %GDK_DRAG_MOTION, %GDK_DRAG_STATUS, %GDK_DROP_START or
- * %GDK_DROP_FINISHED).
+ * %GDK_DRAG_MOTION or %GDK_DROP_START)
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @context: the #GdkDragContext for the current DND operation.
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 2404dae..97fc36a 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -5489,9 +5489,7 @@ _gdk_make_event (GdkWindow *window,
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
case GDK_DROP_START:
- case GDK_DROP_FINISHED:
event->dnd.time = the_time;
break;
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index 58453cf..5540e2e 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -107,9 +107,7 @@ _gdk_wayland_drag_context_emit_event (GdkDragContext *context,
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
case GDK_DROP_START:
- case GDK_DROP_FINISHED:
break;
default:
return;
@@ -191,7 +189,6 @@ gdk_wayland_drag_context_drag_motion (GdkDragContext *context,
{
context->dest_window = dest_window ? g_object_ref (dest_window) : NULL;
_gdk_wayland_drag_context_set_coords (context, x_root, y_root);
- _gdk_wayland_drag_context_emit_event (context, GDK_DRAG_STATUS, time);
}
gdk_wayland_drag_context_set_action (context, suggested_action);
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 9406d3a..706f124 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -1067,13 +1067,6 @@ xdnd_status_filter (GdkXEvent *xev,
if (context_x11->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
- event->any.send_event = FALSE;
- event->any.type = GDK_DRAG_STATUS;
- event->dnd.context = context;
- gdk_event_set_device (event, gdk_drag_context_get_device (context));
- g_object_ref (context);
-
- event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
if (!(action != 0) != !(flags & 1))
{
GDK_NOTE (DND,
@@ -1083,7 +1076,11 @@ xdnd_status_filter (GdkXEvent *xev,
context->action = xdnd_action_from_atom (display, action);
- return GDK_FILTER_TRANSLATE;
+ if (context->action != context_x11->current_action)
+ {
+ context_x11->current_action = action;
+ g_signal_emit_by_name (context, "action-changed", action);
+ }
}
return GDK_FILTER_REMOVE;
@@ -1112,18 +1109,16 @@ xdnd_finished_filter (GdkXEvent *xev,
if (context)
{
+ g_object_ref (context);
+
context_x11 = GDK_X11_DRAG_CONTEXT (context);
if (context_x11->version == 5)
context_x11->drop_failed = xevent->xclient.data.l[1] == 0;
- event->any.type = GDK_DROP_FINISHED;
- event->dnd.context = context;
- gdk_event_set_device (event, gdk_drag_context_get_device (context));
- g_object_ref (context);
-
- event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
+ g_signal_emit_by_name (context, "dnd-finished");
+ gdk_drag_drop_done (context, !context_x11->drop_failed);
- return GDK_FILTER_TRANSLATE;
+ g_object_unref (context);
}
return GDK_FILTER_REMOVE;
@@ -1218,25 +1213,17 @@ send_client_message_async_cb (Window window,
context->dest_window &&
window == GDK_WINDOW_XID (context->dest_window))
{
- GdkEvent *temp_event;
GdkX11DragContext *context_x11 = data;
g_object_unref (context->dest_window);
context->dest_window = NULL;
context->action = 0;
-
+ if (context->action != context_x11->current_action)
+ {
+ context_x11->current_action = 0;
+ g_signal_emit_by_name (context, "action-changed", 0);
+ }
context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
-
- temp_event = gdk_event_new (GDK_DRAG_STATUS);
- temp_event->any.window = g_object_ref (context->source_window);
- temp_event->any.send_event = TRUE;
- temp_event->dnd.context = g_object_ref (context);
- temp_event->dnd.time = GDK_CURRENT_TIME;
- gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
-
- gdk_display_put_event (gdk_drag_context_get_display (context), temp_event);
-
- g_object_unref (temp_event);
}
g_object_unref (context);
@@ -2282,8 +2269,6 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
if (context->dest_window != dest_window)
{
- GdkEvent *temp_event;
-
/* Send a leave to the last destination */
gdk_drag_do_leave (context_x11, time);
context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
@@ -2327,19 +2312,11 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
/* Push a status event, to let the client know that
* the drag changed
*/
- temp_event = gdk_event_new (GDK_DRAG_STATUS);
- temp_event->any.window = g_object_ref (context->source_window);
- /* We use this to signal a synthetic status. Perhaps
- * we should use an extra field...
- */
- temp_event->any.send_event = TRUE;
-
- temp_event->dnd.context = g_object_ref (context);
- temp_event->dnd.time = time;
- gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
-
- gdk_display_put_event (gdk_drag_context_get_display (context), temp_event);
- g_object_unref (temp_event);
+ if (context->action != context_x11->current_action)
+ {
+ context_x11->current_action = context->action;
+ g_signal_emit_by_name (context, "action-changed", context->action);
+ }
}
else
{
@@ -2366,7 +2343,6 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
case GDK_DRAG_PROTO_ROOTWIN:
{
- GdkEvent *temp_event;
/* GTK+ traditionally has used application/x-rootwin-drop,
* but the XDND spec specifies x-rootwindow-drop.
*/
@@ -2376,15 +2352,11 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
else
context->action = 0;
- temp_event = gdk_event_new (GDK_DRAG_STATUS);
- temp_event->any.window = g_object_ref (context->source_window);
- temp_event->any.send_event = FALSE;
- temp_event->dnd.context = g_object_ref (context);
- temp_event->dnd.time = time;
- gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
-
- gdk_display_put_event (gdk_drag_context_get_display (context), temp_event);
- g_object_unref (temp_event);
+ if (context->action != context_x11->current_action)
+ {
+ context_x11->current_action = context->action;
+ g_signal_emit_by_name (context, "action-changed", context->action);
+ }
}
break;
case GDK_DRAG_PROTO_MOTIF:
@@ -3294,41 +3266,6 @@ gdk_dnd_handle_button_event (GdkDragContext *context,
return TRUE;
}
-static gboolean
-gdk_dnd_handle_drag_status (GdkDragContext *context,
- const GdkEventDND *event)
-{
- GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
- GdkDragAction action;
-
- if (context != event->context)
- return FALSE;
-
- action = gdk_drag_context_get_selected_action (context);
-
- if (action != context_x11->current_action)
- {
- context_x11->current_action = action;
- g_signal_emit_by_name (context, "action-changed", action);
- }
-
- return TRUE;
-}
-
-static gboolean
-gdk_dnd_handle_drop_finished (GdkDragContext *context,
- const GdkEventDND *event)
-{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
-
- if (context != event->context)
- return FALSE;
-
- g_signal_emit_by_name (context, "dnd-finished");
- gdk_drag_drop_done (context, !x11_context->drop_failed);
- return TRUE;
-}
-
gboolean
gdk_x11_drag_context_handle_event (GdkDragContext *context,
const GdkEvent *event)
@@ -3337,7 +3274,7 @@ gdk_x11_drag_context_handle_event (GdkDragContext *context,
if (!context->is_source)
return FALSE;
- if (!x11_context->grab_seat && event->any.type != GDK_DROP_FINISHED)
+ if (!x11_context->grab_seat)
return FALSE;
switch ((guint) event->any.type)
@@ -3351,10 +3288,6 @@ gdk_x11_drag_context_handle_event (GdkDragContext *context,
return gdk_dnd_handle_key_event (context, &event->key);
case GDK_GRAB_BROKEN:
return gdk_dnd_handle_grab_broken_event (context, &event->grab_broken);
- case GDK_DRAG_STATUS:
- return gdk_dnd_handle_drag_status (context, &event->dnd);
- case GDK_DROP_FINISHED:
- return gdk_dnd_handle_drop_finished (context, &event->dnd);
default:
break;
}
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index e127786..73f4c17 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1874,9 +1874,6 @@ gtk_main_do_event (GdkEvent *event)
/* Crossing event propagation happens during picking */
break;
- case GDK_DRAG_STATUS:
- case GDK_DROP_FINISHED:
- break;
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 174b64a..efe230b 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6551,9 +6551,7 @@ gtk_widget_emit_event_signals (GtkWidget *widget,
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
- case GDK_DRAG_STATUS:
case GDK_DROP_START:
- case GDK_DROP_FINISHED:
case GDK_EVENT_LAST:
case GDK_TOUCHPAD_SWIPE:
case GDK_TOUCHPAD_PINCH:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]