From 1fd7a6e491b6b76f9281bb14e6161a75df71bf5e Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 5 Jan 1999 23:45:21 +0000 Subject: [PATCH] Make gtk_propagate_event() non-static, we need it in gtkdnd.c so that the Tue Jan 5 15:03:47 1999 Owen Taylor * gtk/gtkmain.c (gtk_propagate_event): Make gtk_propagate_event() non-static, we need it in gtkdnd.c so that the button-release we synthesize gets propagated correctly. * gtk/gtkdnd.c: Use gtk_propagate_event() so release gets to a GtkList. But we can't really get this right without access to the windows event masks and doing X-style propagation ourselves. Tue Jan 5 11:31:55 1999 Owen Taylor * gtk/gtkselection.c (gtk_target_list_unref): Free memory allocated for target lists. * gtk/gtkdnd.c (gtk_drag_drop_finished): Release selections before destroying info structure. * gdk/gdkdnd.c gdktypes.h (gdk_drag_get_protocol): Add new value GDK_DRAG_PROTO_NONE, use it for non-drag targets, to quiet Purify. * gdk/gdkdnd.c (gdk_window_register_dnd): Set size of property properly. --- gdk/gdkdnd.c | 4 ++-- gdk/x11/gdkdnd-x11.c | 4 ++-- gtk/gtkdnd.c | 29 +++++++++++++++++++++-------- gtk/gtkmain.c | 4 +--- gtk/gtkmain.h | 5 +++++ 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c index 3cd5effbf..728bdb7f5 100644 --- a/gdk/gdkdnd.c +++ b/gdk/gdkdnd.c @@ -2541,6 +2541,7 @@ gdk_drag_get_protocol (guint32 xid, } } + *protocol = GDK_DRAG_PROTO_NONE; return GDK_NONE; } @@ -2950,8 +2951,7 @@ gdk_window_register_dnd (GdkWindow *window) GDK_WINDOW_XWINDOW (window), xdnd_aware_atom, XA_ATOM, 32, PropModeReplace, - (guchar *)&xdnd_version, - sizeof (xdnd_version)); + (guchar *)&xdnd_version, 1); } /************************************************************* diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 3cd5effbf..728bdb7f5 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -2541,6 +2541,7 @@ gdk_drag_get_protocol (guint32 xid, } } + *protocol = GDK_DRAG_PROTO_NONE; return GDK_NONE; } @@ -2950,8 +2951,7 @@ gdk_window_register_dnd (GdkWindow *window) GDK_WINDOW_XWINDOW (window), xdnd_aware_atom, XA_ATOM, 32, PropModeReplace, - (guchar *)&xdnd_version, - sizeof (xdnd_version)); + (guchar *)&xdnd_version, 1); } /************************************************************* diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 4f74cfef8..cb7df4d69 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -2005,11 +2005,14 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info, gboolean success, guint time) { + gtk_drag_source_release_selections (info, time); + if (info->proxy_dest) { /* The time from the event isn't reliable for Xdnd drags */ gtk_drag_finish (info->proxy_dest->context, success, FALSE, info->proxy_dest->proxy_drop_time); + gtk_drag_source_info_destroy (info); } else { @@ -2039,8 +2042,6 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info, gtk_timeout_add (ANIM_STEP_TIME, gtk_drag_anim_timeout, anim); } } - - gtk_drag_source_release_selections (info, GDK_CURRENT_TIME); /* fixme */ } static void @@ -2459,19 +2460,31 @@ gtk_drag_button_release_cb (GtkWidget *widget, gtk_grab_remove (widget); + /* Send on a release pair to the the original + * widget to convince it to release its grab. We need to + * call gtk_propagate_event() here, instead of + * gtk_widget_event() because widget like GtkList may + * expect propagation. + */ + send_event.button.type = GDK_BUTTON_RELEASE; send_event.button.window = source_widget->window; + send_event.button.send_event = TRUE; + send_event.button.time = event->time; send_event.button.x = 0; send_event.button.y = 0; + send_event.button.pressure = 0.; + send_event.button.xtilt = 0.; + send_event.button.ytilt = 0.; send_event.button.state = event->state; send_event.button.button = event->button; - - send_event.button.time = event->time; + send_event.button.source = GDK_SOURCE_PEN; + send_event.button.deviceid = GDK_CORE_POINTER; + send_event.button.x_root = 0; + send_event.button.y_root = 0; + + gtk_propagate_event (source_widget, &send_event); - /* Send on the button release to the original widget to - * convince it to release its grab - */ - gtk_widget_event (source_widget, &send_event); gtk_widget_unref (source_widget); return TRUE; diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 468e18364..841ae1e97 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -85,8 +85,6 @@ static gint gtk_quit_invoke_function (GtkQuitFunction *quitf); static void gtk_quit_destroy (GtkQuitFunction *quitf); static gint gtk_invoke_key_snoopers (GtkWidget *grab_widget, GdkEvent *event); -static void gtk_propagate_event (GtkWidget *widget, - GdkEvent *event); static void gtk_destroy_closure (gpointer data); static gboolean gtk_invoke_idle_timeout (gpointer data); @@ -1196,7 +1194,7 @@ gtk_quit_invoke_function (GtkQuitFunction *quitf) } } -static void +void gtk_propagate_event (GtkWidget *widget, GdkEvent *event) { diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h index 2c7e4eab4..b44489f89 100644 --- a/gtk/gtkmain.h +++ b/gtk/gtkmain.h @@ -139,6 +139,11 @@ GdkEvent* gtk_get_current_event (void); GtkWidget* gtk_get_event_widget (GdkEvent *event); +/* Private routines internal to GTK+ + */ +void gtk_propagate_event (GtkWidget *widget, + GdkEvent *event); + #ifdef __cplusplus } #endif /* __cplusplus */ -- 2.43.2