Bug#851707: [pkg-gnupg-maint] Bug#851707: pinentry-gtk-2 frequently fails to grab the keyboard under awesome

2017-02-03 Thread Werner Koch
On Thu,  2 Feb 2017 19:29, ber...@debian.org said:

> I am fixing with this patch. Only lightly tested.

FWIW, I forgot to push a fix I had in my local repo.  Just did this, put
also not tested.  This is basically the same as yours but w/o any delay.

Shalom-Salam,

   Werner


commit b0e0bdeac5d40ca645afc9017778b39a26303523
Author: Werner Koch 
Date:   Wed Jan 11 18:40:17 2017 +0100

gtk2: Fix a problem with fvwm

* gtk+-2/pinentry-gtk-2.c (grab_pointer): Take care of
GDK_GRAB_ALREADY_GRABBED.
--

Debian-bug-id: 850708
Co-authored-by: Vincent Lefevre 
Signed-off-by: Werner Koch 

Modified   gtk+-2/pinentry-gtk-2.c
diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index 473c4aa..e37601f 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -203,7 +203,12 @@ grab_pointer (GtkWidget *win, GdkEvent *event, gpointer 
data)
   (void)data;
 
   /* Change the cursor for the duration of the grab to indicate that
- something is going on.  */
+   * something is going on.  The fvwm window manager grabs the pointer
+   * for a short time and thus we may end up with the already grabbed
+   * error code.  Actually this error code should be used to detect a
+   * malicious grabbing application but with fvwm this renders
+   * Pinentry only unusable.  Thus we try again several times also for
+   * that error code.  See Debian bug 850708 for details.  */
   /* XXX: It would be nice to have a key cursor, unfortunately there
  is none readily available.  */
   cursor = gdk_cursor_new_for_display (gtk_widget_get_display (win),
@@ -215,7 +220,8 @@ grab_pointer (GtkWidget *win, GdkEvent *event, gpointer 
data)
 NULL /* confine to */,
 cursor,
 gdk_event_get_time (event));
-  while (tries++ < max_tries && err == GDK_GRAB_NOT_VIEWABLE);
+  while (tries++ < max_tries && (err == GDK_GRAB_NOT_VIEWABLE
+ || err == GDK_GRAB_ALREADY_GRABBED));
 
   if (err)
 {


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


pgpkegKbC5D6l.pgp
Description: PGP signature


Bug#851707: [pkg-gnupg-maint] Bug#851707: pinentry-gtk-2 frequently fails to grab the keyboard under awesome

2017-02-03 Thread Vincent Bernat
 ❦  3 février 2017 12:14 +0100, Werner Koch  :

>> I am fixing with this patch. Only lightly tested.
>
> FWIW, I forgot to push a fix I had in my local repo.  Just did this, put
> also not tested.  This is basically the same as yours but w/o any
> delay.

I think your patch is about #850708. In #851707, I don't get the
"already grabbed" error, I get:

** (pinentry-gtk-2:21583): CRITICAL **: could not grab keyboard: not viewable 
(3)
** (pinentry-gtk-2:21583): WARNING **: it took 4097 tries to grab the keyboard
-- 
Keep it right when you make it faster.
- The Elements of Programming Style (Kernighan & Plauger)


signature.asc
Description: PGP signature