summaryrefslogtreecommitdiffstats
path: root/src/gui_gtk_x11.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-02 14:30:04 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-02 14:30:04 +0200
commit4231da403e3c879dd6ac261e51f4ca60813935e3 (patch)
treed0c43a8b05ae0a727db41ac821ffc36df6d37880 /src/gui_gtk_x11.c
parentc4bc0e6542185b659d2a165b635f9561549071ea (diff)
patch 7.4.1873v7.4.1873
Problem: When a callback adds a timer the GUI doesn't use it until later. (Ramel Eshed) Solution: Return early if a callback adds a timer.
Diffstat (limited to 'src/gui_gtk_x11.c')
-rw-r--r--src/gui_gtk_x11.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 77e84c1be2..d497c7530c 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -6535,15 +6535,15 @@ input_timer_cb(gpointer data)
int
gui_mch_wait_for_chars(long wtime)
{
- int focus;
- guint timer;
- static int timed_out;
+ int focus;
+ guint timer;
+ static int timed_out;
+ int retval = FAIL;
timed_out = FALSE;
/* this timeout makes sure that we will return if no characters arrived in
* time */
-
if (wtime > 0)
#if GTK_CHECK_VERSION(3,0,0)
timer = g_timeout_add((guint)wtime, input_timer_cb, &timed_out);
@@ -6568,7 +6568,15 @@ gui_mch_wait_for_chars(long wtime)
}
#ifdef MESSAGE_QUEUE
+# ifdef FEAT_TIMERS
+ did_add_timer = FALSE;
+# endif
parse_queued_messages();
+# ifdef FEAT_TIMERS
+ if (did_add_timer)
+ /* Need to recompute the waiting time. */
+ goto theend;
+# endif
#endif
/*
@@ -6582,13 +6590,8 @@ gui_mch_wait_for_chars(long wtime)
/* Got char, return immediately */
if (input_available())
{
- if (timer != 0 && !timed_out)
-#if GTK_CHECK_VERSION(3,0,0)
- g_source_remove(timer);
-#else
- gtk_timeout_remove(timer);
-#endif
- return OK;
+ retval = OK;
+ goto theend;
}
} while (wtime < 0 || !timed_out);
@@ -6597,7 +6600,15 @@ gui_mch_wait_for_chars(long wtime)
*/
gui_mch_update();
- return FAIL;
+theend:
+ if (timer != 0 && !timed_out)
+#if GTK_CHECK_VERSION(3,0,0)
+ g_source_remove(timer);
+#else
+ gtk_timeout_remove(timer);
+#endif
+
+ return retval;
}