Skip to content

Move can_create_surfaces()/destroy_surfaces() from ApplicationHandler to WindowEvent #4420

@MarijnS95

Description

@MarijnS95

It has been brought up in many issues over the years, that winit to this day doesn't support multiple Activitys on Android. I've always envisioned them to be analogous to a system-created window (i.e. needing a new ApplicationHandler::window_created(new_window: Window) callback of sorts) that the user could possibly launch themselves asynchronously with https://github.com/rust-mobile/android-intent.

As brought up again in #4419 this requires the surface events to be moved to WindowEvent as they're strictly related to a single Activity (thus winit Window) for which the underlying presentation surface (a layer in the composition stack/tree of sorts) is created or destroyed.

Looking through the current examples, it completely eludes me why can_create_surfaces() has been the selected place to create new windows now, as that is entirely counter to what the original Event::Resumed used/intended to represent. On winit's Android backend, a Window is anyway a bogus concept that doesn't really represent anything right now.

Is that something we can move and resolve before winit 0.31 is finalized and released, allowing Android to possibly "catch up" without breaking core/API releases - and if anything to demonstrate the right semantics in at least our examples/documentation/guidelines?

Related downstream confusion

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions