-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
I'm in the early stages of building a desktop application, and trying to figure out which events I need to handle, and how. In general, I'd like the documentation to include an overview of "events to handle to achieve basic behavior end users would expect", but as it is, I'm just looking at the page for the winit::event::Event type. While not ideal, that would be fine, however:
The single-sentence descriptions of the Suspended and Resumed events aren't very helpful. I tried logging when receiving them, but I couldn't get them to fire at all (on Ubuntu 21.10 running X11). I initially expected them in response to minimizing and re-opening the window, respectively, but evidently that's not how they work. Multiple google searches didn't help, so I ended up looking at the winit source code. Based on that, it seems these events are only emitted on iOS and Android, but I would like confirmation that this is correct.
There are more questions left open by the documentation - even if I'm right, and these event types don't matter to my use case. Here's what I would assume these events behave like, based on pretty much nothing but their names:
- They strictly alternate, i.e. ignoring all other events, an
Event::Suspendedmust be followed by anEvent::Resumedand vice-versa. - After the application is
Suspended, it won't receive any events until it isResumed. - (Assuming they are indeed exclusive to mobile platforms)
Suspendedfires when the user switches to another app (or the home screen), but not when it is killed.Resumedfires when it is reopened later.
It's also unclear when they can even fire relative to the other event types - maybe include them in the "traditional event-handling loop" reference code sample in the documentation for the winit::event module? Since I don't care about mobile platforms, I can't be bothered to reverse engineer how their respective platform layers work, but either way, I'd expect all of this to be clearly communicated somewhere. (Maybe it is, just in a very non-obvious place?)
Thanks in advance!