perform report_failed_grab() inline

This commit is contained in:
Damien Miller 2021-04-10 18:45:00 +10:00
parent ea996ce2d0
commit d5d6b7d76d
1 changed files with 9 additions and 20 deletions

View File

@ -62,22 +62,6 @@
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
static void
report_failed_grab (GtkWidget *parent_window, const char *what)
{
GtkWidget *err;
err = gtk_message_dialog_new(GTK_WINDOW(parent_window), 0,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
"Could not grab %s. A malicious client may be eavesdropping "
"on your session.", what);
gtk_window_set_position(GTK_WINDOW(err), GTK_WIN_POS_CENTER);
gtk_dialog_run(GTK_DIALOG(err));
gtk_widget_destroy(err);
}
static void static void
ok_dialog(GtkWidget *entry, gpointer dialog) ok_dialog(GtkWidget *entry, gpointer dialog)
{ {
@ -153,7 +137,7 @@ passphrase_dialog(char *message, int prompt_type)
char *passphrase, *local; char *passphrase, *local;
int result, grab_tries, grab_server, grab_pointer; int result, grab_tries, grab_server, grab_pointer;
int buttons, default_response; int buttons, default_response;
GtkWidget *parent_window, *dialog, *entry; GtkWidget *parent_window, *dialog, *entry, *err;
GdkGrabStatus status; GdkGrabStatus status;
GdkColor fg, bg; GdkColor fg, bg;
GdkSeat *seat; GdkSeat *seat;
@ -282,9 +266,14 @@ passphrase_dialog(char *message, int prompt_type)
nograb: nograb:
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
report_failed_grab(parent_window, failed); err = gtk_message_dialog_new(GTK_WINDOW(parent_window), 0,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
return (-1); "Could not grab input. A malicious client may be eavesdropping "
"on your session.");
gtk_window_set_position(GTK_WINDOW(err), GTK_WIN_POS_CENTER);
gtk_dialog_run(GTK_DIALOG(err));
gtk_widget_destroy(err);
return -1;
} }
int int