From b9a692d203ddc1b229a160f51a92f8f1a562ae45 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 12 Nov 1999 12:09:36 +1100 Subject: - Grab server in gnome-ssh-askpass (Debian bug #49872) --- ChangeLog | 2 ++ gnome-ssh-askpass.c | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1e2cac87..0b6f494fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ IgnoreUserKnownHosts(default=no), used for RhostRSAAuth, ok deraadt,millert - Brought default sshd_config more in line with OpenBSD's + - Grab server in gnome-ssh-askpass (Debian bug #49872) + - Released 1.2pre10 19991111 - Added (untested) Entropy Gathering Daemon (EGD) support diff --git a/gnome-ssh-askpass.c b/gnome-ssh-askpass.c index 6610478c9..749560992 100644 --- a/gnome-ssh-askpass.c +++ b/gnome-ssh-askpass.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include int passphrase_dialog(char **passphrase_p, char *message) { @@ -51,18 +53,36 @@ int passphrase_dialog(char **passphrase_p, char *message) label = gtk_label_new(message); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), entry, FALSE, FALSE, 0); gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); gtk_widget_grab_focus(entry); - gtk_widget_show(entry); + + /* Center window and prepare for grab */ + gtk_object_set(GTK_OBJECT(dialog), "type", GTK_WINDOW_POPUP, NULL); + gnome_dialog_set_default(GNOME_DIALOG(dialog), 0); + gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); + gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE); + gnome_dialog_close_hides(GNOME_DIALOG(dialog), TRUE); + gtk_container_set_border_width(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox), GNOME_PAD); + gtk_widget_show_all(dialog); + + /* Grab focus */ + XGrabServer(GDK_DISPLAY()); + gdk_pointer_grab(dialog->window, TRUE, 0, NULL, NULL, GDK_CURRENT_TIME); + gdk_keyboard_grab(dialog->window, FALSE, GDK_CURRENT_TIME); /* Run dialog */ result = gnome_dialog_run(GNOME_DIALOG(dialog)); + /* Ungrab */ + XUngrabServer(GDK_DISPLAY()); + gdk_pointer_ungrab(GDK_CURRENT_TIME); + gdk_keyboard_ungrab(GDK_CURRENT_TIME); + gdk_flush(); + passphrase = gtk_entry_get_text(GTK_ENTRY(entry)); /* Take copy of passphrase if user selected OK */ -- cgit v1.2.3