/pidgin/main: db78e70b412c: Ungrab the pointer and keyboard afte...

Elliott Sales de Andrade qulogic at pidgin.im
Tue Jul 24 04:03:59 EDT 2012


Changeset: db78e70b412c1b3c9119361f994630658734b1e8
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-07-24 03:04 -0400
Branch:	 cpw.qulogic.gtk3-required
URL: http://hg.pidgin.im/pidgin/main/rev/db78e70b412c

Description:

Ungrab the pointer and keyboard after closing the GtkStatusBox.

It seems like GTK+3 doesn't break the grab when the popup closes,
or when we ask to focus the entry. This causes the status message
entry to stop receiving events, as well as locking the cursor from
changes. Ungrabbing doesn't seem to have any adverse effect to the
GTK+2 side of things, so we'll add that in.

diffstat:

 pidgin/gtkstatusbox.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (39 lines):

diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c
--- a/pidgin/gtkstatusbox.c
+++ b/pidgin/gtkstatusbox.c
@@ -1380,15 +1380,14 @@
 
 static gboolean
 popup_grab_on_window (GdkWindow *window,
-		      guint32    activate_time,
-		      gboolean   grab_keyboard)
+		      guint32    activate_time)
 {
 	if ((gdk_pointer_grab (window, TRUE,
 			 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
 			 GDK_POINTER_MOTION_MASK,
 			 NULL, NULL, activate_time) == 0))
 	{
-		if (!grab_keyboard || gdk_keyboard_grab (window, TRUE, activate_time) == 0)
+		if (gdk_keyboard_grab (window, TRUE, activate_time) == 0)
 			return TRUE;
 		else {
 			gdk_display_pointer_ungrab (gdk_window_get_display (window), activate_time);
@@ -1411,7 +1410,7 @@
 	gtk_widget_show(box->popup_window);
 	gtk_widget_grab_focus (box->tree_view);
 	if (!popup_grab_on_window (gtk_widget_get_window(box->popup_window),
-				   GDK_CURRENT_TIME, TRUE)) {
+				   GDK_CURRENT_TIME)) {
 		gtk_widget_hide (box->popup_window);
 		return;
 	}
@@ -1435,6 +1434,8 @@
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
 				      FALSE);
 	gtk_grab_remove (box->popup_window);
+	gdk_pointer_ungrab(GDK_CURRENT_TIME);
+	gdk_keyboard_ungrab(GDK_CURRENT_TIME);
 }
 
 static gboolean



More information about the Commits mailing list