[gtk+/gtk-2-24] gtk: don't send BUTTON_RELEASE to unrealized widgets
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] gtk: don't send BUTTON_RELEASE to unrealized widgets
- Date: Fri, 11 Feb 2011 09:37:22 +0000 (UTC)
commit 28f82afd0e8e0ea76910a2c32e69feb4c15d861d
Author: Michael Natterer <mitch gimp org>
Date: Fri Feb 11 10:35:25 2011 +0100
gtk: don't send BUTTON_RELEASE to unrealized widgets
which happened when the source widget was hidden or destroyed while a
drag was going on, like when dragging from a popup that got a grab
broken as result of the dnd operation.
gtk/gtkdnd.c | 47 +++++++++++++++++++++++++----------------------
1 files changed, 25 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 50266f9..25f6932 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -4071,7 +4071,6 @@ gtk_drag_update (GtkDragSourceInfo *info,
static void
gtk_drag_end (GtkDragSourceInfo *info, guint32 time)
{
- GdkEvent *send_event;
GtkWidget *source_widget = info->widget;
GdkDisplay *display = gtk_widget_get_display (source_widget);
@@ -4113,28 +4112,32 @@ gtk_drag_end (GtkDragSourceInfo *info, guint32 time)
ungrab_dnd_keys (info->ipc_widget, time);
gtk_grab_remove (info->ipc_widget);
- /* Send on a release pair to 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.
- */
+ if (gtk_widget_get_realized (source_widget))
+ {
+ GdkEvent *send_event;
- send_event = gdk_event_new (GDK_BUTTON_RELEASE);
- send_event->button.window = g_object_ref (gtk_widget_get_root_window (source_widget));
- send_event->button.send_event = TRUE;
- send_event->button.time = time;
- send_event->button.x = 0;
- send_event->button.y = 0;
- send_event->button.axes = NULL;
- send_event->button.state = 0;
- send_event->button.button = info->button;
- send_event->button.device = gdk_display_get_core_pointer (display);
- send_event->button.x_root = 0;
- send_event->button.y_root = 0;
-
- gtk_propagate_event (source_widget, send_event);
- gdk_event_free (send_event);
+ /* Send on a release pair to 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 = gdk_event_new (GDK_BUTTON_RELEASE);
+ send_event->button.window = g_object_ref (gtk_widget_get_root_window (source_widget));
+ send_event->button.send_event = TRUE;
+ send_event->button.time = time;
+ send_event->button.x = 0;
+ send_event->button.y = 0;
+ send_event->button.axes = NULL;
+ send_event->button.state = 0;
+ send_event->button.button = info->button;
+ send_event->button.device = gdk_display_get_core_pointer (display);
+ send_event->button.x_root = 0;
+ send_event->button.y_root = 0;
+
+ gtk_propagate_event (source_widget, send_event);
+ gdk_event_free (send_event);
+ }
}
/*************************************************************
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]