Skip to content

Documentation on Event::{Suspended, Resumed} is lacking #2185

@teryror

Description

@teryror

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::Suspended must be followed by an Event::Resumed and vice-versa.
  • After the application is Suspended, it won't receive any events until it is Resumed.
  • (Assuming they are indeed exclusive to mobile platforms) Suspended fires when the user switches to another app (or the home screen), but not when it is killed. Resumed fires 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - androidAffects the Android backendS - apiDesign and usabilityS - docsAwareness, docs, examples, etc.S - platform parityUnintended platform differences

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions