Skip to content

Commit

Permalink
fix(linux): improve event loop process on Linux (#587)
Browse files Browse the repository at this point in the history
Co-authored-by: Wu Yu Wei <wusyong9104@gmail.com>
  • Loading branch information
wusyong and Wu Yu Wei committed Oct 12, 2022
1 parent 8451f75 commit b529eec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changes/linux-drag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": patch
---

fix(linux): Improve event loop process on Linux a bit. This changes only a few check and should make dragging windows on egui smoother.
10 changes: 3 additions & 7 deletions src/platform_impl/linux/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ impl<T: 'static> EventLoop<T> {
break code;
}
ControlFlow::Wait => {
if !events.is_empty() || !draws.is_empty() {
if !events.is_empty() {
callback(
Event::NewEvents(StartCause::WaitCancelled {
start: Instant::now(),
Expand Down Expand Up @@ -989,7 +989,7 @@ impl<T: 'static> EventLoop<T> {
blocking = true;
}
}
ControlFlow::Poll => {
_ => {
callback(
Event::NewEvents(StartCause::Poll),
window_target,
Expand All @@ -1010,11 +1010,7 @@ impl<T: 'static> EventLoop<T> {
},
Err(_) => {
callback(Event::MainEventsCleared, window_target, &mut control_flow);
if draws.is_empty() {
state = EventState::NewStart;
} else {
state = EventState::DrawQueue;
}
state = EventState::DrawQueue;
}
},
},
Expand Down

0 comments on commit b529eec

Please sign in to comment.