From 4231da403e3c879dd6ac261e51f4ca60813935e3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 2 Jun 2016 14:30:04 +0200 Subject: patch 7.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. --- src/gui_x11.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/gui_x11.c') diff --git a/src/gui_x11.c b/src/gui_x11.c index b525cf7a6..7d01e79dc 100644 --- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -2368,7 +2368,7 @@ find_closest_color(Colormap colormap, XColor *colorPtr) for (i = 0; i < cmap_size; i++) colortable[i].pixel = (unsigned long)i; - XQueryColors (gui.dpy, colormap, colortable, cmap_size); + XQueryColors(gui.dpy, colormap, colortable, cmap_size); /* * Find the color that best approximates the desired one, then @@ -2792,7 +2792,8 @@ gui_mch_update(void) int gui_mch_wait_for_chars(long wtime) { - int focus; + int focus; + int retval = FAIL; /* * Make this static, in case gui_x11_timer_cb is called after leaving @@ -2828,7 +2829,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. */ + break; +# endif #endif /* @@ -2843,12 +2852,15 @@ gui_mch_wait_for_chars(long wtime) if (input_available()) { - if (timer != (XtIntervalId)0 && !timed_out) - XtRemoveTimeOut(timer); - return OK; + retval = OK; + break; } } - return FAIL; + + if (timer != (XtIntervalId)0 && !timed_out) + XtRemoveTimeOut(timer); + + return retval; } /* -- cgit v1.2.1