Bugzilla – Attachment 2892 Details for
Bug 2640
Make gnome-ssh-askpass2 buildable with GTK+ 3
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Make gnome-ssh-askpass2 buildable with GTK+ 3
0001-Make-gnome-ssh-askpass2-buildable-with-GTK-3.patch (text/plain), 5.43 KB, created by
Colin Watson
on 2016-11-20 07:26:34 AEDT
(
hide
)
Description:
Make gnome-ssh-askpass2 buildable with GTK+ 3
Filename:
MIME Type:
Creator:
Colin Watson
Created:
2016-11-20 07:26:34 AEDT
Size:
5.43 KB
patch
obsolete
>From 7c260d3c52002ddb7fbd64b4441fe95efc3756e4 Mon Sep 17 00:00:00 2001 >From: Colin Watson <cjwatson@debian.org> >Date: Sat, 19 Nov 2016 20:16:47 +0000 >Subject: [PATCH] Make gnome-ssh-askpass2 buildable with GTK+ 3 > >The changes needed from GTK+ 2 are slight, so I don't think it makes >sense to add a gnome-ssh-askpass3.c. They are: > > * add a GTK_VERSION make variable, defaulting to 2.0 > * remove explicit line wrapping of message dialog labels, since > GtkMessageDialog.label is now private and in any case this seems to > be unnecessary; > * create an invisible parent window so that GtkDialog doesn't complain > about lacking a transient parent; > * use accessors for GtkDialog.vbox and GtkWidget.window; > * use gdk_x11_get_default_xdisplay() rather than GDK_DISPLAY(). > >There are some remaining warnings from >gdk_{pointer,keyboard}_{grab,ungrab}, but fixing these is more >complicated (we now have to iterate over multiple devices), and not yet >necessary. >--- > contrib/Makefile | 5 +++-- > contrib/gnome-ssh-askpass2.c | 36 +++++++++++++++++++----------------- > 2 files changed, 22 insertions(+), 19 deletions(-) > >diff --git a/contrib/Makefile b/contrib/Makefile >index eaf7fe2..c033f1e 100644 >--- a/contrib/Makefile >+++ b/contrib/Makefile >@@ -1,4 +1,5 @@ > PKG_CONFIG = pkg-config >+GTK_VERSION = 2.0 > > all: > @echo "Valid targets: gnome-ssh-askpass1 gnome-ssh-askpass2" >@@ -9,9 +10,9 @@ gnome-ssh-askpass1: gnome-ssh-askpass1.c > `gnome-config --libs gnome gnomeui` > > gnome-ssh-askpass2: gnome-ssh-askpass2.c >- $(CC) $(CFLAGS) `$(PKG_CONFIG) --cflags gtk+-2.0` \ >+ $(CC) $(CFLAGS) `$(PKG_CONFIG) --cflags gtk+-$(GTK_VERSION)` \ > gnome-ssh-askpass2.c -o gnome-ssh-askpass2 \ >- `$(PKG_CONFIG) --libs gtk+-2.0 x11` >+ `$(PKG_CONFIG) --libs gtk+-$(GTK_VERSION) x11` > > clean: > rm -f *.o gnome-ssh-askpass1 gnome-ssh-askpass2 gnome-ssh-askpass >diff --git a/contrib/gnome-ssh-askpass2.c b/contrib/gnome-ssh-askpass2.c >index 9d97c30..535a692 100644 >--- a/contrib/gnome-ssh-askpass2.c >+++ b/contrib/gnome-ssh-askpass2.c >@@ -57,19 +57,17 @@ > #include <gdk/gdkx.h> > > static void >-report_failed_grab (const char *what) >+report_failed_grab (GtkWidget *parent_window, const char *what) > { > GtkWidget *err; > >- err = gtk_message_dialog_new(NULL, 0, >+ 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_label_set_line_wrap(GTK_LABEL((GTK_MESSAGE_DIALOG(err))->label), >- TRUE); > > gtk_dialog_run(GTK_DIALOG(err)); > >@@ -89,22 +87,27 @@ passphrase_dialog(char *message) > const char *failed; > char *passphrase, *local; > int result, grab_tries, grab_server, grab_pointer; >- GtkWidget *dialog, *entry; >+ GtkWidget *parent_window, *dialog, *entry; > GdkGrabStatus status; > > grab_server = (getenv("GNOME_SSH_ASKPASS_GRAB_SERVER") != NULL); > grab_pointer = (getenv("GNOME_SSH_ASKPASS_GRAB_POINTER") != NULL); > grab_tries = 0; > >- dialog = gtk_message_dialog_new(NULL, 0, >+ /* Create an invisible parent window so that GtkDialog doesn't >+ * complain. */ >+ parent_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); >+ >+ dialog = gtk_message_dialog_new(GTK_WINDOW(parent_window), 0, > GTK_MESSAGE_QUESTION, > GTK_BUTTONS_OK_CANCEL, > "%s", > message); > > entry = gtk_entry_new(); >- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), entry, FALSE, >- FALSE, 0); >+ gtk_box_pack_start( >+ GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), entry, >+ FALSE, FALSE, 0); > gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); > gtk_widget_grab_focus(entry); > gtk_widget_show(entry); >@@ -112,8 +115,6 @@ passphrase_dialog(char *message) > gtk_window_set_title(GTK_WINDOW(dialog), "OpenSSH"); > gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); > gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE); >- gtk_label_set_line_wrap(GTK_LABEL((GTK_MESSAGE_DIALOG(dialog))->label), >- TRUE); > > /* Make <enter> close dialog */ > gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); >@@ -127,8 +128,8 @@ passphrase_dialog(char *message) > if (grab_pointer) { > for(;;) { > status = gdk_pointer_grab( >- (GTK_WIDGET(dialog))->window, TRUE, 0, NULL, >- NULL, GDK_CURRENT_TIME); >+ (gtk_widget_get_window(GTK_WIDGET(dialog))), TRUE, >+ 0, NULL, NULL, GDK_CURRENT_TIME); > if (status == GDK_GRAB_SUCCESS) > break; > usleep(GRAB_WAIT * 1000); >@@ -139,8 +140,9 @@ passphrase_dialog(char *message) > } > } > for(;;) { >- status = gdk_keyboard_grab((GTK_WIDGET(dialog))->window, >- FALSE, GDK_CURRENT_TIME); >+ status = gdk_keyboard_grab( >+ gtk_widget_get_window(GTK_WIDGET(dialog)), FALSE, >+ GDK_CURRENT_TIME); > if (status == GDK_GRAB_SUCCESS) > break; > usleep(GRAB_WAIT * 1000); >@@ -157,7 +159,7 @@ passphrase_dialog(char *message) > > /* Ungrab */ > if (grab_server) >- XUngrabServer(GDK_DISPLAY()); >+ XUngrabServer(gdk_x11_get_default_xdisplay()); > if (grab_pointer) > gdk_pointer_ungrab(GDK_CURRENT_TIME); > gdk_keyboard_ungrab(GDK_CURRENT_TIME); >@@ -193,10 +195,10 @@ passphrase_dialog(char *message) > gdk_pointer_ungrab(GDK_CURRENT_TIME); > nograb: > if (grab_server) >- XUngrabServer(GDK_DISPLAY()); >+ XUngrabServer(gdk_x11_get_default_xdisplay()); > gtk_widget_destroy(dialog); > >- report_failed_grab(failed); >+ report_failed_grab(parent_window, failed); > > return (-1); > } >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2640
: 2892