diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-09-29 13:35:01 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-09-29 13:35:01 +0000 |
commit | f6501cb4bd771df3d2366d197dbc85078a219da8 (patch) | |
tree | 53f37d171c8137e1b053bc1a485f502889b56734 /gtk/gtkpaned.c | |
parent | 840796dffe1212db167037b23b6145053c6d6b3f (diff) | |
download | gtk+-f6501cb4bd771df3d2366d197dbc85078a219da8.tar.gz |
Stop drags when being grab shadowed. (#317332)
2005-09-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkpaned.c (gtk_paned_grab_notify): Stop drags when being
grab shadowed. (#317332)
Diffstat (limited to 'gtk/gtkpaned.c')
-rw-r--r-- | gtk/gtkpaned.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 630c61f876..4bc20add00 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -130,6 +130,8 @@ static gboolean gtk_paned_cancel_position (GtkPaned *paned); static gboolean gtk_paned_toggle_handle_focus (GtkPaned *paned); static GType gtk_paned_child_type (GtkContainer *container); +static void gtk_paned_grab_notify (GtkWidget *widget, + gboolean was_grabbed); static GtkContainerClass *parent_class = NULL; @@ -223,6 +225,7 @@ gtk_paned_class_init (GtkPanedClass *class) widget_class->button_release_event = gtk_paned_button_release; widget_class->motion_notify_event = gtk_paned_motion; widget_class->grab_broken_event = gtk_paned_grab_broken; + widget_class->grab_notify = gtk_paned_grab_notify; container_class->add = gtk_paned_add; container_class->remove = gtk_paned_remove; @@ -925,6 +928,26 @@ gtk_paned_grab_broken (GtkWidget *widget, return TRUE; } +static void +stop_drag (GtkPaned *paned) +{ + paned->in_drag = FALSE; + paned->drag_pos = -1; + paned->position_set = TRUE; + gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (paned)), + paned->priv->grab_time); +} + +static void +gtk_paned_grab_notify (GtkWidget *widget, + gboolean was_grabbed) +{ + GtkPaned *paned = GTK_PANED (widget); + + if (!was_grabbed && paned->in_drag) + stop_drag (paned); +} + static gboolean gtk_paned_button_release (GtkWidget *widget, GdkEventButton *event) @@ -933,11 +956,8 @@ gtk_paned_button_release (GtkWidget *widget, if (paned->in_drag && (event->button == 1)) { - paned->in_drag = FALSE; - paned->drag_pos = -1; - paned->position_set = TRUE; - gdk_display_pointer_ungrab (gtk_widget_get_display (widget), - paned->priv->grab_time); + stop_drag (paned); + return TRUE; } |