kov changed gksu/trunk/ChangeLog, gksu/trunk/gksu/gksu.c
Gustavo Noronha
kov at costa.debian.org
Tue Sep 20 21:37:28 UTC 2005
Mensagem de log:
* gksu/gksu.c:
- applied patch by Michael Vogt with some modifications
to avoid dead-locking X when gksu tries to grab mouse
or keyboard while a menu is open or something else is
stealing focus (Debian #310951, Ubuntu #14430)
-----
Modified: gksu/trunk/ChangeLog
===================================================================
--- gksu/trunk/ChangeLog 2005-09-20 20:36:13 UTC (rev 444)
+++ gksu/trunk/ChangeLog 2005-09-20 21:37:28 UTC (rev 445)
@@ -1,6 +1,12 @@
2005-09-20 Gustavo Noronha Silva <kov at debian.org>
* gksu/gksu.c:
+ - applied patch by Michael Vogt with some modifications
+ to avoid dead-locking X when gksu tries to grab mouse
+ or keyboard while a menu is open or something else is
+ stealing focus (Debian #310951, Ubuntu #14430)
+
+ * gksu/gksu.c:
- do not show the gnome-keyring UI if -a was passed as
an option
Modified: gksu/trunk/gksu/gksu.c
===================================================================
--- gksu/trunk/gksu/gksu.c 2005-09-20 20:36:13 UTC (rev 444)
+++ gksu/trunk/gksu/gksu.c 2005-09-20 21:37:28 UTC (rev 445)
@@ -403,21 +403,43 @@
void
report_failed_grab (FailedGrabWhat what)
{
+ GtkWidget *dialog;
+
+ dialog = g_object_new (GTK_TYPE_MESSAGE_DIALOG,
+ "message-type", GTK_MESSAGE_WARNING,
+ "buttons", GTK_BUTTONS_CLOSE,
+ NULL);
+
switch (what)
{
case FAILED_GRAB_MOUSE:
- gk_dialog (GTK_MESSAGE_WARNING,
- _("Could not grab your mouse.\n"
- "A malicious client may be eavesdropping\n"
- "on your session."));
+ gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG(dialog),
+ _("<b>Could not grab your mouse.</b>\n\n"
+ "A malicious client may be eavesdropping\n"
+ "on your session or you may have just clicked\n"
+ "a menu or some application just decided to get\n"
+ "focus.\n\n"
+ "Try again."));
+
break;
case FAILED_GRAB_KEYBOARD:
- gk_dialog (GTK_MESSAGE_WARNING,
- _("Could not grab your keyboard.\n"
- "A malicious client may be eavesdropping\n"
- "on your session."));
+ gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG(dialog),
+ _("Could not grab your keyboard.\n"
+ "A malicious client may be eavesdropping\n"
+ "on your session or you may have just clicked\n"
+ "a menu or some application just decided to get\n"
+ "focus.\n\n"
+ "Try again."));
break;
}
+
+ gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
+ gtk_dialog_run (GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+
}
pid_t test_lock(const char* fname)
@@ -574,7 +596,7 @@
GdkGrabStatus status;
gint grab_tries = 0;
gint lock = -1;
-
+
gchar *fname = g_strdup_printf ("%s/.gksu.lock", getenv ("HOME"));
pid_t pid = test_lock (fname);
@@ -590,15 +612,8 @@
g_free (fname);
fadeout_screen (gdk_screen_get_default (), 0);
-
gtk_widget_show_all (dialog);
- /* we "raise" the window because there is a race here for
- * focus-follow-mouse and auto-raise WMs that may put the window
- * in the background and confuse users
- */
- gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
-
/* reset cursor */
gdk_window_set_cursor(dialog->window, gdk_cursor_new(GDK_LEFT_PTR));
@@ -611,7 +626,10 @@
usleep (GRAB_WAIT * 1000);
if (++grab_tries > GRAB_TRIES)
{
+ gtk_widget_hide (dialog);
+ hide_fadeout_windows ();
report_failed_grab (FAILED_GRAB_MOUSE);
+ exit (1);
break;
}
}
@@ -627,11 +645,23 @@
if (++grab_tries > GRAB_TRIES)
{
+ gtk_widget_hide (dialog);
+ hide_fadeout_windows ();
report_failed_grab (FAILED_GRAB_KEYBOARD);
+ exit (1);
break;
}
}
+ /* we "raise" the window because there is a race here for
+ * focus-follow-mouse and auto-raise WMs that may put the window
+ * in the background and confuse users
+ */
+ gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
+
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+
return lock;
}
More information about the gksu-commits
mailing list