From 755c533b08c817563dc3ab50666001a27879ad9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Fri, 28 Jul 2023 17:52:24 +0200 Subject: [PATCH] iOS: Always set timer when polling to avoid slow waking (#2979) * Always set timer when polling to avoid slow waking * add comment and changelog --------- Co-authored-by: Dusty DeWeese Co-authored-by: Mads Marquart --- CHANGELOG.md | 1 + src/platform_impl/ios/app_state.rs | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38f8156e..4c767b06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre # Unreleased +- On iOS, always wake the event loop when transitioning from `ControlFlow::Poll` to `ControlFlow::Poll`. - **Breaking:** `ActivationTokenDone` event which could be requested with the new `startup_notify` module, see its docs for more. - On Wayland, make double clicking and moving the CSD frame more reliable. - On macOS, add tabbing APIs on `WindowExtMacOS` and `EventLoopWindowTargetExtMacOS`. diff --git a/src/platform_impl/ios/app_state.rs b/src/platform_impl/ios/app_state.rs index 8743a7f2..200cce1a 100644 --- a/src/platform_impl/ios/app_state.rs +++ b/src/platform_impl/ios/app_state.rs @@ -393,9 +393,6 @@ impl AppState { let new = self.control_flow; match (old, new) { - (ControlFlow::Poll, ControlFlow::Poll) => self.set_state(AppStateImpl::PollFinished { - waiting_event_handler, - }), (ControlFlow::Wait, ControlFlow::Wait) => { let start = Instant::now(); self.set_state(AppStateImpl::Waiting { @@ -428,6 +425,7 @@ impl AppState { }); self.waker.start_at(new_instant) } + // Unlike on macOS, handle Poll to Poll transition here to call the waker (_, ControlFlow::Poll) => { self.set_state(AppStateImpl::PollFinished { waiting_event_handler,