summaryrefslogtreecommitdiffstats
path: root/src/gui_w32.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_w32.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_w32.c')
-rw-r--r--src/gui_w32.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 10c14c9d9c..82ca7de5d8 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2022,6 +2022,22 @@ gui_mch_update(void)
process_message();
}
+ static void
+remove_any_timer(void)
+{
+ MSG msg;
+
+ if (s_wait_timer != 0 && !s_timed_out)
+ {
+ KillTimer(NULL, s_wait_timer);
+
+ /* Eat spurious WM_TIMER messages */
+ while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
+ ;
+ s_wait_timer = 0;
+ }
+}
+
/*
* GUI input routine called by gui_wait_for_chars(). Waits for a character
* from the keyboard.
@@ -2073,6 +2089,9 @@ gui_mch_wait_for_chars(int wtime)
s_need_activate = FALSE;
}
+#ifdef FEAT_TIMERS
+ did_add_timer = FALSE;
+#endif
#ifdef MESSAGE_QUEUE
/* Check channel while waiting message. */
for (;;)
@@ -2098,15 +2117,7 @@ gui_mch_wait_for_chars(int wtime)
if (input_available())
{
- if (s_wait_timer != 0 && !s_timed_out)
- {
- KillTimer(NULL, s_wait_timer);
-
- /* Eat spurious WM_TIMER messages */
- while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
- ;
- s_wait_timer = 0;
- }
+ remove_any_timer();
allow_scrollbar = FALSE;
/* Clear pending mouse button, the release event may have been
@@ -2117,6 +2128,15 @@ gui_mch_wait_for_chars(int wtime)
return OK;
}
+
+#ifdef FEAT_TIMERS
+ if (did_add_timer)
+ {
+ /* Need to recompute the waiting time. */
+ remove_any_timer();
+ break;
+ }
+#endif
}
allow_scrollbar = FALSE;
return FAIL;