To: vim_dev@googlegroups.com Subject: Patch 8.1.1975 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1975 Problem: MS-Windows GUI responds slowly to timer. Solution: Break out of wait loop when timer was added or input is available. (closes #4893) Files: src/gui_w32.c *** ../vim-8.1.1974/src/gui_w32.c 2019-05-28 23:32:42.942257480 +0200 --- src/gui_w32.c 2019-09-04 13:50:20.314125990 +0200 *************** *** 2074,2080 **** focus = gui.in_focus; while (!s_timed_out) { ! /* Stop or start blinking when focus changes */ if (gui.in_focus != focus) { if (gui.in_focus) --- 2074,2080 ---- focus = gui.in_focus; while (!s_timed_out) { ! // Stop or start blinking when focus changes if (gui.in_focus != focus) { if (gui.in_focus) *************** *** 2094,2122 **** did_add_timer = FALSE; #endif #ifdef MESSAGE_QUEUE ! /* Check channel I/O while waiting for a message. */ for (;;) { MSG msg; parse_queued_messages(); ! if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { process_message(); break; } ! else if (MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT) ! != WAIT_TIMEOUT) break; } #else ! /* ! * Don't use gui_mch_update() because then we will spin-lock until a ! * char arrives, instead we use GetMessage() to hang until an ! * event arrives. No need to check for input_buf_full because we are ! * returning as soon as it contains a single char -- webb ! */ process_message(); #endif --- 2094,2124 ---- did_add_timer = FALSE; #endif #ifdef MESSAGE_QUEUE ! // Check channel I/O while waiting for a message. for (;;) { MSG msg; parse_queued_messages(); ! #ifdef FEAT_TIMERS ! if (did_add_timer) ! break; ! #endif if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { process_message(); break; } ! else if (input_available() ! || MsgWaitForMultipleObjects(0, NULL, FALSE, 100, ! QS_ALLINPUT) != WAIT_TIMEOUT) break; } #else ! // Don't use gui_mch_update() because then we will spin-lock until a ! // char arrives, instead we use GetMessage() to hang until an ! // event arrives. No need to check for input_buf_full because we are ! // returning as soon as it contains a single char -- webb process_message(); #endif *************** *** 2125,2133 **** remove_any_timer(); allow_scrollbar = FALSE; ! /* Clear pending mouse button, the release event may have been ! * taken by the dialog window. But don't do this when getting ! * focus, we need the mouse-up event then. */ if (!s_getting_focus) s_button_pending = -1; --- 2127,2135 ---- remove_any_timer(); allow_scrollbar = FALSE; ! // Clear pending mouse button, the release event may have been ! // taken by the dialog window. But don't do this when getting ! // focus, we need the mouse-up event then. if (!s_getting_focus) s_button_pending = -1; *************** *** 2137,2143 **** #ifdef FEAT_TIMERS if (did_add_timer) { ! /* Need to recompute the waiting time. */ remove_any_timer(); break; } --- 2139,2145 ---- #ifdef FEAT_TIMERS if (did_add_timer) { ! // Need to recompute the waiting time. remove_any_timer(); break; } *** ../vim-8.1.1974/src/version.c 2019-09-04 13:21:22.602256970 +0200 --- src/version.c 2019-09-04 13:52:43.357479742 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1975, /**/ -- The CIA drives around in cars with the "Intel inside" logo. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///