From 2f4357ef874b11caa38200119264e9826d72d689 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 1 Feb 2005 14:47:33 +0000 Subject: Ungrab the pointer when moving tab between notebooks. Fixes bug #165797. 2005-02-01 Christian Persch * src/ephy-notebook.c: (motion_notify_cb), (move_tab_to_another_notebook), (button_release_cb), (ephy_notebook_finalize): Ungrab the pointer when moving tab between notebooks. Fixes bug #165797. --- src/ephy-notebook.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c index 8f8cdc5d9..58667b9bf 100644 --- a/src/ephy-notebook.c +++ b/src/ephy-notebook.c @@ -77,6 +77,7 @@ static void ephy_notebook_class_init (EphyNotebookClass *klass); static void ephy_notebook_finalize (GObject *object); static void move_tab_to_another_notebook (EphyNotebook *src, EphyNotebook *dest, + GdkEventMotion *event, int dest_position); /* Local variables */ @@ -443,7 +444,7 @@ motion_notify_cb (EphyNotebook *notebook, if (dest != notebook) { move_tab_to_another_notebook (notebook, dest, - page_num); + event, page_num); } else { @@ -458,11 +459,15 @@ motion_notify_cb (EphyNotebook *notebook, static void move_tab_to_another_notebook (EphyNotebook *src, EphyNotebook *dest, + GdkEventMotion *event, int dest_position) { EphyTab *tab; int cur_page; + LOG ("moving tab from notebook %p to notebook %p at %d", + src, dest, dest_position); + /* This is getting tricky, the tab was dragged in a notebook * in another window of the same app, we move the tab * to that new notebook, and let this notebook handle the @@ -475,7 +480,12 @@ move_tab_to_another_notebook (EphyNotebook *src, tab = EPHY_TAB (gtk_notebook_get_nth_page (GTK_NOTEBOOK (src), cur_page)); /* stop drag in origin window */ + /* ungrab the pointer if it's grabbed */ drag_stop (src); + if (gdk_pointer_is_grabbed ()) + { + gdk_pointer_ungrab (event->time); + } gtk_grab_remove (GTK_WIDGET (src)); ephy_notebook_move_tab (src, dest, tab, dest_position); @@ -516,12 +526,14 @@ button_release_cb (EphyNotebook *notebook, /* ungrab the pointer if it's grabbed */ if (gdk_pointer_is_grabbed ()) { - gdk_pointer_ungrab (GDK_CURRENT_TIME); + gdk_pointer_ungrab (event->time); gtk_grab_remove (GTK_WIDGET (notebook)); } } + /* This must be called even if a drag isn't happening */ drag_stop (notebook); + return FALSE; } @@ -730,8 +742,6 @@ ephy_notebook_finalize (GObject *object) } g_object_unref (notebook->priv->title_tips); - LOG ("EphyNotebook finalised %p", object); - G_OBJECT_CLASS (parent_class)->finalize (object); } -- cgit v1.2.3