mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Node.js: Avoid running epoll() in the wayland event loop when pumping… (#7682)
Work around pump_events() with `Some(std::time::Duration::ZERO)` still entering `epoll` and thus not returning, preventing us from processing node events. cc #7657 Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
This commit is contained in:
parent
3c7494a543
commit
2b6938bce8
1 changed files with 11 additions and 0 deletions
|
@ -276,6 +276,9 @@ pub struct EventLoopState {
|
|||
|
||||
loop_error: Option<PlatformError>,
|
||||
current_resize_direction: Option<ResizeDirection>,
|
||||
|
||||
/// Set to true when pumping events for the shortest amount of time possible.
|
||||
pumping_events_instantly: bool,
|
||||
}
|
||||
|
||||
impl winit::application::ApplicationHandler<SlintUserEvent> for EventLoopState {
|
||||
|
@ -607,6 +610,10 @@ impl winit::application::ApplicationHandler<SlintUserEvent> for EventLoopState {
|
|||
event_loop.set_control_flow(ControlFlow::wait_duration(next_timer));
|
||||
}
|
||||
}
|
||||
|
||||
if self.pumping_events_instantly {
|
||||
event_loop.set_control_flow(ControlFlow::Poll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -766,9 +773,13 @@ impl EventLoopState {
|
|||
|
||||
let mut winit_loop = not_running_loop_instance.instance;
|
||||
|
||||
self.pumping_events_instantly = timeout.is_some_and(|duration| duration.is_zero());
|
||||
|
||||
let result = winit_loop
|
||||
.pump_app_events(timeout, &mut ActiveEventLoopSetterDuringEventProcessing(&mut self));
|
||||
|
||||
self.pumping_events_instantly = false;
|
||||
|
||||
*GLOBAL_PROXY.get_or_init(Default::default).lock().unwrap() = Default::default();
|
||||
|
||||
// Keep the EventLoop instance alive and re-use it in future invocations of run_event_loop().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue