Mercurial > vim
diff src/gui_x11.c @ 9179:5e18efdad322 v7.4.1873
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 2 14:30:04 2016 +0200
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 02 Jun 2016 14:30:08 +0200 |
parents | 74b15ed0a259 |
children | bb86514cad15 |
line wrap: on
line diff
--- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -2368,7 +2368,7 @@ find_closest_color(Colormap colormap, XC 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; } /*