summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-01-09 08:17:16 +0100
committerDave Davenport <qball@gmpclient.org>2017-01-09 08:17:16 +0100
commit78916c6a94a7496376b683fa9bf8dbb60d2cdc34 (patch)
tree8b02eb5fe0ad58f64f01e74c694d99bd36d3ff24 /source
parent713d41f619a1a8b311c3028a97e909e79cf88353 (diff)
Give up and quit rofi after failed to grab keyboard in <5 sec.
Diffstat (limited to 'source')
-rw-r--r--source/rofi.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/rofi.c b/source/rofi.c
index 24e2f28c..3158ec34 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -587,28 +587,28 @@ unsigned int lazy_grab_retry_count_pt = 0;
static gboolean lazy_grab_pointer ( G_GNUC_UNUSED gpointer data )
{
// After 5 sec.
- if ( lazy_grab_retry_count_kb > ( 5 * 1000 ) ) {
- fprintf ( stderr, "Failed to grab keyboard after %u times. Giving up.\n", lazy_grab_retry_count_kb );
- g_main_loop_quit ( main_loop );
+ if ( lazy_grab_retry_count_pt > ( 5 * 1000 ) ) {
+ fprintf ( stderr, "Failed to grab pointer after %u times. Giving up.\n", lazy_grab_retry_count_pt );
return G_SOURCE_REMOVE;
}
if ( take_pointer ( xcb_stuff_get_root_window ( xcb ), 0 ) ) {
return G_SOURCE_REMOVE;
}
- lazy_grab_retry_count_kb++;
+ lazy_grab_retry_count_pt++;
return G_SOURCE_CONTINUE;
}
static gboolean lazy_grab_keyboard ( G_GNUC_UNUSED gpointer data )
{
// After 5 sec.
- if ( lazy_grab_retry_count_pt > ( 5 * 1000 ) ) {
- fprintf ( stderr, "Failed to grab pointer after %u times. Giving up.\n", lazy_grab_retry_count_pt );
+ if ( lazy_grab_retry_count_kb > ( 5 * 1000 ) ) {
+ fprintf ( stderr, "Failed to grab keyboard after %u times. Giving up.\n", lazy_grab_retry_count_kb );
+ g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE;
}
if ( take_keyboard ( xcb_stuff_get_root_window ( xcb ), 0 ) ) {
return G_SOURCE_REMOVE;
}
- lazy_grab_retry_count_pt++;
+ lazy_grab_retry_count_kb ++;
return G_SOURCE_CONTINUE;
}