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)
This commit is contained in:
Matthias Clasen 2005-09-29 13:35:01 +00:00 committed by Matthias Clasen
parent 840796dffe
commit f6501cb4bd
3 changed files with 35 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2005-09-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkpaned.c (gtk_paned_grab_notify): Stop drags when being
grab shadowed. (#317332)
2005-09-29 Tor Lillqvist <tml@novell.com> 2005-09-29 Tor Lillqvist <tml@novell.com>
* gtk-zip.sh.in: DLLs are always in bin nowadays, no need to test. * gtk-zip.sh.in: DLLs are always in bin nowadays, no need to test.

View File

@ -1,3 +1,8 @@
2005-09-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkpaned.c (gtk_paned_grab_notify): Stop drags when being
grab shadowed. (#317332)
2005-09-29 Tor Lillqvist <tml@novell.com> 2005-09-29 Tor Lillqvist <tml@novell.com>
* gtk-zip.sh.in: DLLs are always in bin nowadays, no need to test. * gtk-zip.sh.in: DLLs are always in bin nowadays, no need to test.

View File

@ -130,6 +130,8 @@ static gboolean gtk_paned_cancel_position (GtkPaned *paned);
static gboolean gtk_paned_toggle_handle_focus (GtkPaned *paned); static gboolean gtk_paned_toggle_handle_focus (GtkPaned *paned);
static GType gtk_paned_child_type (GtkContainer *container); static GType gtk_paned_child_type (GtkContainer *container);
static void gtk_paned_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static GtkContainerClass *parent_class = NULL; 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->button_release_event = gtk_paned_button_release;
widget_class->motion_notify_event = gtk_paned_motion; widget_class->motion_notify_event = gtk_paned_motion;
widget_class->grab_broken_event = gtk_paned_grab_broken; 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->add = gtk_paned_add;
container_class->remove = gtk_paned_remove; container_class->remove = gtk_paned_remove;
@ -925,6 +928,26 @@ gtk_paned_grab_broken (GtkWidget *widget,
return TRUE; 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 static gboolean
gtk_paned_button_release (GtkWidget *widget, gtk_paned_button_release (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
@ -933,11 +956,8 @@ gtk_paned_button_release (GtkWidget *widget,
if (paned->in_drag && (event->button == 1)) if (paned->in_drag && (event->button == 1))
{ {
paned->in_drag = FALSE; stop_drag (paned);
paned->drag_pos = -1;
paned->position_set = TRUE;
gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
paned->priv->grab_time);
return TRUE; return TRUE;
} }