winit icon indicating copy to clipboard operation
winit copied to clipboard

iOS calling `Window::request_redraw()` inside `WindowEvent::RedrawRequested`

Open daxpedda opened this issue 1 year ago • 8 comments

Calling Window::request_redraw() inside WindowEvent::RedrawRequested currently panics on iOS. We should not only not panic, but also correctly schedule the next WindowEvent::RedrawRequested. This is related to #2412.

daxpedda avatar Jan 17 '24 22:01 daxpedda

I think I'm hitting the same issue on iOS. The event loop is not progressing. When callling request_redraw on the RedrawRequested, no other events are progressed afterwards.

maxammann avatar Jul 03 '24 04:07 maxammann

Any update on this? When I try to run an application on ios, I cannot seem to get request_redraw to trigger RedrawRequested repeatedly.

PWhiddy avatar Jan 22 '25 20:01 PWhiddy

for anyone experiencing the same issue as me - ios not doing anything with request_redraw calls while handling a request redraw event, this was my solution: call request_redraw inside about_to_wait instead! I only was able to learn about this because of https://github.com/bevyengine/bevy/pull/11245. This would be super helpful to mention somewhere in the documentation!

PWhiddy avatar Apr 15 '25 07:04 PWhiddy

it's clearly a bug that must be fixed though, and IIRC it's kind of fixed now @madsmtm ?

kchibisov avatar Apr 15 '25 07:04 kchibisov

Experiencing the exact same issue, calling request_redraw() in any case besides WindowEvent::RedrawRequested seems to work.

about_to_wait does not seem to run at 60 FPS, on the other hand.

evrimoztamur avatar May 22 '25 15:05 evrimoztamur

@evrimoztamur Someone was able to suggest a workaround here that worked great for me!

https://github.com/rust-windowing/winit/issues/4204

PWhiddy avatar May 22 '25 16:05 PWhiddy

Thanks! I'm using that right now, but I still wonder why there's platform-inconsistent behavior right now.

evrimoztamur avatar May 23 '25 07:05 evrimoztamur

I can only assume this aspect of iOS may not have been anticipated in the original design. Hopefully eventually there is a uniform API 🙏

PWhiddy avatar May 28 '25 20:05 PWhiddy