comparison src/gui_w32.c @ 17958:1d69e11db360 v8.1.1975

patch 8.1.1975: MS-Windows GUI responds slowly to timer Commit: https://github.com/vim/vim/commit/89c00033310a1cad89efd2a7fc873f8969dd4401 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 4 13:53:21 2019 +0200 patch 8.1.1975: MS-Windows GUI responds slowly to timer Problem: MS-Windows GUI responds slowly to timer. Solution: Break out of wait loop when timer was added or input is available. (closes #4893)
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 Sep 2019 14:00:03 +0200
parents ce562b9f702e
children 59bc3cd42cf5
comparison
equal deleted inserted replaced
17957:ac4fc61b10d3 17958:1d69e11db360
2072 allow_scrollbar = TRUE; 2072 allow_scrollbar = TRUE;
2073 2073
2074 focus = gui.in_focus; 2074 focus = gui.in_focus;
2075 while (!s_timed_out) 2075 while (!s_timed_out)
2076 { 2076 {
2077 /* Stop or start blinking when focus changes */ 2077 // Stop or start blinking when focus changes
2078 if (gui.in_focus != focus) 2078 if (gui.in_focus != focus)
2079 { 2079 {
2080 if (gui.in_focus) 2080 if (gui.in_focus)
2081 gui_mch_start_blink(); 2081 gui_mch_start_blink();
2082 else 2082 else
2092 2092
2093 #ifdef FEAT_TIMERS 2093 #ifdef FEAT_TIMERS
2094 did_add_timer = FALSE; 2094 did_add_timer = FALSE;
2095 #endif 2095 #endif
2096 #ifdef MESSAGE_QUEUE 2096 #ifdef MESSAGE_QUEUE
2097 /* Check channel I/O while waiting for a message. */ 2097 // Check channel I/O while waiting for a message.
2098 for (;;) 2098 for (;;)
2099 { 2099 {
2100 MSG msg; 2100 MSG msg;
2101 2101
2102 parse_queued_messages(); 2102 parse_queued_messages();
2103 2103 #ifdef FEAT_TIMERS
2104 if (did_add_timer)
2105 break;
2106 #endif
2104 if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) 2107 if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
2105 { 2108 {
2106 process_message(); 2109 process_message();
2107 break; 2110 break;
2108 } 2111 }
2109 else if (MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT) 2112 else if (input_available()
2110 != WAIT_TIMEOUT) 2113 || MsgWaitForMultipleObjects(0, NULL, FALSE, 100,
2114 QS_ALLINPUT) != WAIT_TIMEOUT)
2111 break; 2115 break;
2112 } 2116 }
2113 #else 2117 #else
2114 /* 2118 // Don't use gui_mch_update() because then we will spin-lock until a
2115 * Don't use gui_mch_update() because then we will spin-lock until a 2119 // char arrives, instead we use GetMessage() to hang until an
2116 * char arrives, instead we use GetMessage() to hang until an 2120 // event arrives. No need to check for input_buf_full because we are
2117 * event arrives. No need to check for input_buf_full because we are 2121 // returning as soon as it contains a single char -- webb
2118 * returning as soon as it contains a single char -- webb
2119 */
2120 process_message(); 2122 process_message();
2121 #endif 2123 #endif
2122 2124
2123 if (input_available()) 2125 if (input_available())
2124 { 2126 {
2125 remove_any_timer(); 2127 remove_any_timer();
2126 allow_scrollbar = FALSE; 2128 allow_scrollbar = FALSE;
2127 2129
2128 /* Clear pending mouse button, the release event may have been 2130 // Clear pending mouse button, the release event may have been
2129 * taken by the dialog window. But don't do this when getting 2131 // taken by the dialog window. But don't do this when getting
2130 * focus, we need the mouse-up event then. */ 2132 // focus, we need the mouse-up event then.
2131 if (!s_getting_focus) 2133 if (!s_getting_focus)
2132 s_button_pending = -1; 2134 s_button_pending = -1;
2133 2135
2134 return OK; 2136 return OK;
2135 } 2137 }
2136 2138
2137 #ifdef FEAT_TIMERS 2139 #ifdef FEAT_TIMERS
2138 if (did_add_timer) 2140 if (did_add_timer)
2139 { 2141 {
2140 /* Need to recompute the waiting time. */ 2142 // Need to recompute the waiting time.
2141 remove_any_timer(); 2143 remove_any_timer();
2142 break; 2144 break;
2143 } 2145 }
2144 #endif 2146 #endif
2145 } 2147 }