- Grab server in gnome-ssh-askpass (Debian bug #49872)
diff --git a/ChangeLog b/ChangeLog
index a1e2cac..0b6f494 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 6610478..7495609 100644
--- a/gnome-ssh-askpass.c
+++ b/gnome-ssh-askpass.c
@@ -37,6 +37,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <gnome.h>
+#include <X11/Xlib.h>
+#include <gdk/gdkx.h>
 
 int passphrase_dialog(char **passphrase_p, char *message)
 {
@@ -51,18 +53,36 @@
 	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 */