seahorse r2519 - in seahorse-plugins/trunk: . libseahorse



Author: nnielsen
Date: Mon Sep 15 15:17:05 2008
New Revision: 2519
URL: http://svn.gnome.org/viewvc/seahorse?rev=2519&view=rev

Log:
	* libseahorse/seahorse-passphrase.c: Better error reporting when
	a keyboard grab fails. See bug #552321


Modified:
   seahorse-plugins/trunk/ChangeLog
   seahorse-plugins/trunk/libseahorse/seahorse-passphrase.c

Modified: seahorse-plugins/trunk/libseahorse/seahorse-passphrase.c
==============================================================================
--- seahorse-plugins/trunk/libseahorse/seahorse-passphrase.c	(original)
+++ seahorse-plugins/trunk/libseahorse/seahorse-passphrase.c	Mon Sep 15 15:17:05 2008
@@ -94,10 +94,14 @@
 grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
 {
 #ifndef _DEBUG
-	if (!g_object_get_data (G_OBJECT (win), "keyboard-grabbed"))
-		if (gdk_keyboard_grab (win->window, FALSE, gdk_event_get_time (event)))
-			g_message ("could not grab keyboard");
-	g_object_set_data (G_OBJECT (win), "keyboard-grabbed", GINT_TO_POINTER (TRUE));
+	GdkGrabStatus status;
+	if (!g_object_get_data (G_OBJECT (win), "keyboard-grabbed")) {
+		status = gdk_keyboard_grab (win->window, FALSE, gdk_event_get_time (event)); 
+		if (status == GDK_GRAB_SUCCESS)
+			g_object_set_data (G_OBJECT (win), "keyboard-grabbed", GINT_TO_POINTER (TRUE));
+		else
+			g_message ("could not grab keyboard: %d", (int)status);
+	}
 #endif
 	return FALSE;
 }
@@ -204,7 +208,7 @@
     dialog = GTK_DIALOG (w);
 
     g_signal_connect (G_OBJECT (dialog), "size-request", G_CALLBACK (constrain_size), NULL);
-    g_signal_connect (G_OBJECT (dialog), "map-event", G_CALLBACK (grab_keyboard), NULL);
+    g_signal_connect_after (G_OBJECT (dialog), "map-event", G_CALLBACK (grab_keyboard), NULL);
     g_signal_connect (G_OBJECT (dialog), "unmap-event", G_CALLBACK (ungrab_keyboard), NULL);
     g_signal_connect (G_OBJECT (dialog), "window-state-event", G_CALLBACK (window_state_changed), NULL); 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]