pinentry: grab_keyboard iteration count, tiling window managers & tooltips

Robin H. Johnson robbat2 at gentoo.org
Sat Feb 18 22:24:42 CET 2017


Some further research into this, on the pinentry side, shows that the
problem has surfaced multiple times:
https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=27;bug=40195 (patch
was merged later)
https://lists.gnupg.org/pipermail/gpa-dev/2010-April/002497.html

There was another Debian bug as a followup to bug 615451 that proposed
adding usleep:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851707

I took this, and added patches to:
- (attached) record & emit how long it took to try grabbing the keyboard/pointer.
- (attached) sleep in 0.1ms between attempts (nanosleep, based on the
  comments on the usleep patch)
- Debugging: Always print how many tries it took, and when we ungrab.

The last of these gave me the most surprising output, it showed that we
did grab more than once, and we didn't ungrab.

** (pinentry-gtk-2:14728): WARNING **: it took 573 tries over 149.80 ms to grab the keyboard
** (pinentry-gtk-2:14728): WARNING **: it took 1 tries over 3.45 ms to grab the pointer
** (pinentry-gtk-2:14728): WARNING **: it took 1 tries over 0.03 ms to grab the keyboard
** (pinentry-gtk-2:14728): WARNING **: it took 1 tries over 0.04 ms to grab the pointer
ERR 83886179 Operation cancelled <Pinentry>

That surprised me: why did the grab happen MORE than once?

Compiling GTK w/ debugging, and using GDK_DEBUG='events' shows
interesting results as well (trimmed all property notify atom cases).
# GDK_DEBUG='events' ./gtk+-2/pinentry-gtk-2 <<< GETPIN 2>&1
OK Pleased to meet you
** (pinentry-gtk-2:22796): WARNING **: it took 385 tries over 97.29 ms to grab the keyboard
** (pinentry-gtk-2:22796): WARNING **: it took 1 tries over 0.69 ms to grab the pointer
Gdk-Message: property notify:	window: 109051905, atom(306): "_NET_WM_NAME"
Gdk-Message: property notify:	window: 109051905, atom(39): "WM_NAME"
... (skipping all of the atoms)
Gdk-Message: configure notify:	window: 109051907  x,y: 2708 536	w,h: 344 128  b-w: 0  above: 111149059	 ovr: 0
Gdk-Message: configure notify:	window: 109051907  x,y: 2708 536	w,h: 344 128  b-w: 0  above: 109051943	 ovr: 0
Gdk-Message: destroy notify:	window: 109051943
Gdk-Message: reparent notify:	window: 109051907  x,y: 0 0  parent: 31459965	ovr: 0
Gdk-Message: map notify:		window: 109051907
Gdk-Message: configure notify:	window: 109051907  x,y: 2709 537	w,h: 344 128  b-w: 1  above: 0	 ovr: 0
Gdk-Message: configure notify:	window: 109051907  x,y: 0 22	w,h: 344 128  b-w: 0  above: 0	 ovr: 0
Gdk-Message: configure notify:	window: 109051907  x,y: 2709 559	w,h: 344 128  b-w: 1  above: 0	 ovr: 0
Gdk-Message: configure notify:	window: 109051907  x,y: 2709 559	w,h: 344 128  b-w: 1  above: 0	 ovr: 0
Gdk-Message: visibility notify:	window: 109051907	 full
** (pinentry-gtk-2:22796): WARNING **: it took 1 tries over 0.04 ms to grab the keyboard
** (pinentry-gtk-2:22796): WARNING **: it took 1 tries over 0.03 ms to grab the pointer
Gdk-Message: expose:		window: 109051907  0	x,y: 0 0  w,h: 344 128
Gdk-Message: client message:	window: 109051907
Gdk-Message: focus in:		window: 109051907, detail: NotifyNonlinear, mode: NotifyNormal
Gdk-Message: enter notify:		window: 109051907  detail: 3 subwin: 0 mode: 1
Gdk-Message: focus out:		window: 109051907, detail: NotifyInferior, mode: NotifyWhileGrabbed
Gdk-Message: key press  :		window: 109051907	 key:       Escape 65307
Gdk-Message:		length:    1 string: ""

-- 
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation Trustee & Treasurer
E-Mail   : robbat2 at gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gtk2-Record-how-long-we-tried-to-grab-the-keyboard-p.patch
Type: text/x-diff
Size: 3521 bytes
Desc: not available
URL: </pipermail/attachments/20170218/a3ec45d4/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-gtk2-sleep-between-grab-attempts.patch
Type: text/x-diff
Size: 2759 bytes
Desc: not available
URL: </pipermail/attachments/20170218/a3ec45d4/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1083 bytes
Desc: Digital signature
URL: </pipermail/attachments/20170218/a3ec45d4/attachment.sig>


More information about the Gnupg-devel mailing list