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.
diff --git a/src/gui_x11.c b/src/gui_x11.c
index b525cf7..7d01e79 100644
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -2368,7 +2368,7 @@
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 @@
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 @@
}
#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 @@
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;
}
/*