[git] Pinentry - branch, master, updated. pinentry-0.9.7-20-gad390f2

by Justus Winter cvs at cvs.gnupg.org
Mon Aug 1 18:00:05 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The standard pinentry collection".

The branch, master has been updated
       via  ad390f29df34ef73f2393a8ad97cbe2d60af31e7 (commit)
       via  fe5bb475da08cb46242825d5abe5b4d27e6086e3 (commit)
       via  abf4f9924412c7afb6ce6c08eeda81b4c5365ab5 (commit)
      from  ed066c261594de69c3c2aeaac98aeaf74bbb5f9e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ad390f29df34ef73f2393a8ad97cbe2d60af31e7
Author: Justus Winter <justus at g10code.com>
Date:   Mon Aug 1 17:49:50 2016 +0200

    gtk2: Be more persistent trying to grab the keyboard.
    
    We seem to get the 'visibility-notify' event before X is willing to
    let us grab the keyboard, insisting that the target window is not
    viewable (sic).
    
    * gtk+-2/pinentry-gtk-2.c (grab_keyboard): Retry grabbing the
    keyboard.
    
    GnuPG-bug-id: 2375
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index 3fff176..0e6b8ff 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -165,13 +165,17 @@ static int
 grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
 {
   GdkGrabStatus err;
+  int tries = 0, max_tries = 4096;
   (void)data;
 
   if (! pinentry->grab)
     return FALSE;
 
-  err = gdk_keyboard_grab (gtk_widget_get_window (win),
-                           FALSE, gdk_event_get_time (event));
+  do
+    err = gdk_keyboard_grab (gtk_widget_get_window (win),
+                             FALSE, gdk_event_get_time (event));
+  while (tries++ < max_tries && err == GDK_GRAB_NOT_VIEWABLE);
+
   if (err)
     {
       g_critical ("could not grab keyboard: %s (%d)",
@@ -180,6 +184,9 @@ grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
       gtk_main_quit ();
     }
 
+  if (tries > 1)
+    g_warning ("it took %d tries to grab the keyboard", tries);
+
   return FALSE;
 }
 

commit fe5bb475da08cb46242825d5abe5b4d27e6086e3
Author: Justus Winter <justus at g10code.com>
Date:   Mon Aug 1 17:18:32 2016 +0200

    gtk2: Print keyboard grabbing errors.
    
    * gtk+-2/pinentry-gtk-2.c (grab_strerror): New function.
    (grab_keyboard): Use the new function to print the error.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index 98d4fc2..3fff176 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -145,22 +145,41 @@ make_transient (GtkWidget *win, GdkEvent *event, gpointer data)
 }
 
 
+/* Convert GdkGrabStatus to string.  */
+static const char *
+grab_strerror (GdkGrabStatus status)
+{
+  switch (status) {
+  case GDK_GRAB_SUCCESS: return "success";
+  case GDK_GRAB_ALREADY_GRABBED: return "already grabbed";
+  case GDK_GRAB_INVALID_TIME: return "invalid time";
+  case GDK_GRAB_NOT_VIEWABLE: return "not viewable";
+  case GDK_GRAB_FROZEN: return "frozen";
+  }
+  return "unknown";
+}
+
+
 /* Grab the keyboard for maximum security */
 static int
 grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
 {
+  GdkGrabStatus err;
   (void)data;
 
   if (! pinentry->grab)
     return FALSE;
 
-  if (gdk_keyboard_grab (gtk_widget_get_window (win),
-			 FALSE, gdk_event_get_time (event)))
+  err = gdk_keyboard_grab (gtk_widget_get_window (win),
+                           FALSE, gdk_event_get_time (event));
+  if (err)
     {
-      g_critical ("could not grab keyboard");
+      g_critical ("could not grab keyboard: %s (%d)",
+                  grab_strerror (err), err);
       grab_failed = 1;
       gtk_main_quit ();
     }
+
   return FALSE;
 }
 

commit abf4f9924412c7afb6ce6c08eeda81b4c5365ab5
Author: Justus Winter <justus at g10code.com>
Date:   Mon Aug 1 15:01:21 2016 +0200

    gtk2: Avoid possible format string troubles.
    
    * gtk+-2/pinentry-gtk-2.c (confirm_unhiding): Do not use message as
    format string.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index 28b4fdc..98d4fc2 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -389,7 +389,7 @@ confirm_unhiding (void)
      GTK_DIALOG_MODAL,
      GTK_MESSAGE_WARNING,
      GTK_BUTTONS_NONE,
-     message);
+     "%s", message);
   gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                           GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                           show_btn_label, GTK_RESPONSE_OK,

-----------------------------------------------------------------------

Summary of changes:
 gtk+-2/pinentry-gtk-2.c | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
The standard pinentry collection
http://git.gnupg.org




More information about the Gnupg-commits mailing list