mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
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)
This commit is contained in:
@@ -2074,7 +2074,7 @@ gui_mch_wait_for_chars(int wtime)
|
|||||||
focus = gui.in_focus;
|
focus = gui.in_focus;
|
||||||
while (!s_timed_out)
|
while (!s_timed_out)
|
||||||
{
|
{
|
||||||
/* Stop or start blinking when focus changes */
|
// Stop or start blinking when focus changes
|
||||||
if (gui.in_focus != focus)
|
if (gui.in_focus != focus)
|
||||||
{
|
{
|
||||||
if (gui.in_focus)
|
if (gui.in_focus)
|
||||||
@@ -2094,29 +2094,31 @@ gui_mch_wait_for_chars(int wtime)
|
|||||||
did_add_timer = FALSE;
|
did_add_timer = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MESSAGE_QUEUE
|
#ifdef MESSAGE_QUEUE
|
||||||
/* Check channel I/O while waiting for a message. */
|
// Check channel I/O while waiting for a message.
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
parse_queued_messages();
|
parse_queued_messages();
|
||||||
|
#ifdef FEAT_TIMERS
|
||||||
|
if (did_add_timer)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
|
if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
|
||||||
{
|
{
|
||||||
process_message();
|
process_message();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT)
|
else if (input_available()
|
||||||
!= WAIT_TIMEOUT)
|
|| MsgWaitForMultipleObjects(0, NULL, FALSE, 100,
|
||||||
|
QS_ALLINPUT) != WAIT_TIMEOUT)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/*
|
// Don't use gui_mch_update() because then we will spin-lock until a
|
||||||
* Don't use gui_mch_update() because then we will spin-lock until a
|
// char arrives, instead we use GetMessage() to hang until an
|
||||||
* char arrives, instead we use GetMessage() to hang until an
|
// event arrives. No need to check for input_buf_full because we are
|
||||||
* event arrives. No need to check for input_buf_full because we are
|
// returning as soon as it contains a single char -- webb
|
||||||
* returning as soon as it contains a single char -- webb
|
|
||||||
*/
|
|
||||||
process_message();
|
process_message();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2125,9 +2127,9 @@ gui_mch_wait_for_chars(int wtime)
|
|||||||
remove_any_timer();
|
remove_any_timer();
|
||||||
allow_scrollbar = FALSE;
|
allow_scrollbar = FALSE;
|
||||||
|
|
||||||
/* Clear pending mouse button, the release event may have been
|
// Clear pending mouse button, the release event may have been
|
||||||
* taken by the dialog window. But don't do this when getting
|
// taken by the dialog window. But don't do this when getting
|
||||||
* focus, we need the mouse-up event then. */
|
// focus, we need the mouse-up event then.
|
||||||
if (!s_getting_focus)
|
if (!s_getting_focus)
|
||||||
s_button_pending = -1;
|
s_button_pending = -1;
|
||||||
|
|
||||||
@@ -2137,7 +2139,7 @@ gui_mch_wait_for_chars(int wtime)
|
|||||||
#ifdef FEAT_TIMERS
|
#ifdef FEAT_TIMERS
|
||||||
if (did_add_timer)
|
if (did_add_timer)
|
||||||
{
|
{
|
||||||
/* Need to recompute the waiting time. */
|
// Need to recompute the waiting time.
|
||||||
remove_any_timer();
|
remove_any_timer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -761,6 +761,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1975,
|
||||||
/**/
|
/**/
|
||||||
1974,
|
1974,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user