Control: tags -1 + patch

 ❦  2 février 2017 10:50 +0200, Lauri Niskanen <a...@ape3000.com> :

> I can reproduce this bug with awesomewm on Arch Linux. I get the same
> error message as Vincent Bernat.
>
> As a workaround I changed my pinentry program to pinentry-gnome3.

I am fixing with this patch. Only lightly tested.

Index: pinentry-1.0.0/gtk+-2/pinentry-gtk-2.c
===================================================================
--- pinentry-1.0.0.orig/gtk+-2/pinentry-gtk-2.c
+++ pinentry-1.0.0/gtk+-2/pinentry-gtk-2.c
@@ -166,7 +166,7 @@ static int
 grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
 {
   GdkGrabStatus err;
-  int tries = 0, max_tries = 4096;
+  int tries = 0, max_tries = 256;
   (void)data;
 
   if (! pinentry->grab)
@@ -175,7 +175,8 @@ grab_keyboard (GtkWidget *win, GdkEvent
   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);
+  while (tries++ < max_tries && err == GDK_GRAB_NOT_VIEWABLE
+         && (usleep(1000), TRUE));
 
   if (err)
     {
@@ -199,7 +200,7 @@ grab_pointer (GtkWidget *win, GdkEvent *
 {
   GdkGrabStatus err;
   GdkCursor *cursor;
-  int tries = 0, max_tries = 4096;
+  int tries = 0, max_tries = 256;
   (void)data;
 
   /* Change the cursor for the duration of the grab to indicate that
@@ -221,7 +222,8 @@ grab_pointer (GtkWidget *win, GdkEvent *
                             cursor,
                             gdk_event_get_time (event));
   while (tries++ < max_tries && (err == GDK_GRAB_NOT_VIEWABLE
-                                 || err == GDK_GRAB_ALREADY_GRABBED));
+                                 || err == GDK_GRAB_ALREADY_GRABBED)
+         && (usleep(1000), TRUE));
 
   if (err)
     {
-- 
Use uniform input formats.
            - The Elements of Programming Style (Kernighan & Plauger)

Attachment: signature.asc
Description: PGP signature

Reply via email to