mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
event: Bail out of event_poll when any event is processed
The loop condition was set to only exit when user input is processed, but we must exit on any event to properly notify `event_poll` callers
This commit is contained in:
parent
e1264412f8
commit
b00a37544c
@ -99,13 +99,9 @@ bool event_poll(int32_t ms)
|
|||||||
// Run one event loop iteration, blocking for events if run_mode is
|
// Run one event loop iteration, blocking for events if run_mode is
|
||||||
// UV_RUN_ONCE
|
// UV_RUN_ONCE
|
||||||
uv_run(uv_default_loop(), run_mode);
|
uv_run(uv_default_loop(), run_mode);
|
||||||
// Process immediate events outside uv_run since libuv event loop not
|
|
||||||
// support recursion(processing events may cause a recursive event_poll
|
|
||||||
// call)
|
|
||||||
event_process(false);
|
|
||||||
} while (
|
} while (
|
||||||
// Continue running if ...
|
// Continue running if ...
|
||||||
!input_ready() && // we have no input
|
!event_process(false) && // we didn't process any immediate events
|
||||||
!event_has_deferred() && // no events are waiting to be processed
|
!event_has_deferred() && // no events are waiting to be processed
|
||||||
run_mode != UV_RUN_NOWAIT && // ms != 0
|
run_mode != UV_RUN_NOWAIT && // ms != 0
|
||||||
!timer_data.timed_out); // we didn't get a timeout
|
!timer_data.timed_out); // we didn't get a timeout
|
||||||
@ -139,11 +135,13 @@ void event_push(Event event, bool deferred)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Runs the appropriate action for each queued event
|
// Runs the appropriate action for each queued event
|
||||||
void event_process(bool deferred)
|
bool event_process(bool deferred)
|
||||||
{
|
{
|
||||||
|
bool processed_events = false;
|
||||||
Event event;
|
Event event;
|
||||||
|
|
||||||
while (kl_shift(Event, get_queue(deferred), &event) == 0) {
|
while (kl_shift(Event, get_queue(deferred), &event) == 0) {
|
||||||
|
processed_events = true;
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case kEventSignal:
|
case kEventSignal:
|
||||||
signal_handle(event);
|
signal_handle(event);
|
||||||
@ -158,6 +156,8 @@ void event_process(bool deferred)
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return processed_events;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a flag in the `event_poll` loop for signaling of a timeout
|
// Set a flag in the `event_poll` loop for signaling of a timeout
|
||||||
|
Loading…
Reference in New Issue
Block a user