On Wed, 11 Jan 2017 12:22, vinc...@vinc17.net said:

> This wasn't the problem. The problem was the incorrect error code:
> GDK_GRAB_NOT_VIEWABLE instead of GDK_GRAB_ALREADY_GRABBED

I do not think this is tan incorrect error code but we should look at
GDK_GRAB_ALREADY_GRABBED too:

  /* Change the cursor for the duration of the grab to indicate that
   * 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.  */



Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
From f7ceec0fea9f7f2043b835bbe70fc8b1a91d8770 Mon Sep 17 00:00:00 2001
From: Werner Koch <w...@gnupg.org>
Date: Wed, 11 Jan 2017 18:40:17 +0100
Subject: [PATCH] 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 <vinc...@vinc17.net>
Signed-off-by: Werner Koch <w...@gnupg.org>
---
 gtk+-2/pinentry-gtk-2.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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)
     {
-- 
2.8.1

Attachment: pgpGXGHrNg0OS.pgp
Description: PGP signature

Reply via email to