gtk2: When X11 input grabbing fails, try again over ~0.4 seconds.
* gtk+-2/pinentry-gtk-2.c (grab_keyboard): Delay 1 ms before retrying keyboard grab, limit to about 0.2 seconds. (grab_pointer): Delay 1 ms before retrying pointer_grab, limit to about 0.2 seconds. -- These changes were proposed by Vincent Bernat in https://bugs.debian.org/851707#124 Debian-bug-id: 851707 Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Gbp-Pq: Name 0007-gtk2-When-X11-input-grabbing-fails-try-again-over-0..patch
This commit is contained in:
parent
04c7fe7023
commit
2158159d89
|
@ -164,7 +164,7 @@ static int
|
|||
grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
|
||||
{
|
||||
GdkGrabStatus err;
|
||||
int tries = 0, max_tries = 4096;
|
||||
int tries = 0, max_tries = 2048;
|
||||
(void)data;
|
||||
|
||||
if (! pinentry->grab)
|
||||
|
@ -173,7 +173,8 @@ grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
|
|||
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(100), TRUE));
|
||||
|
||||
if (err)
|
||||
{
|
||||
|
@ -197,7 +198,7 @@ grab_pointer (GtkWidget *win, GdkEvent *event, gpointer data)
|
|||
{
|
||||
GdkGrabStatus err;
|
||||
GdkCursor *cursor;
|
||||
int tries = 0, max_tries = 4096;
|
||||
int tries = 0, max_tries = 2048;
|
||||
(void)data;
|
||||
|
||||
/* Change the cursor for the duration of the grab to indicate that
|
||||
|
@ -219,7 +220,8 @@ grab_pointer (GtkWidget *win, GdkEvent *event, gpointer data)
|
|||
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 (100), TRUE));
|
||||
|
||||
if (err)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue