Skip to content

Possible solution to keep created surface consistent #3695

@ztlwk

Description

@ztlwk

Description

Motivation

This issue aims for the following topics:

  • Users have to self-reference the window handle to the surface, which can be hard to implement.
  • The created surfaces must be dropped by user when the the app was suspended, and we may somehow "enforce" it.
  • Owning the optional window and surface in every update can have lifetime issues, and we may make some platform-specific changes to make it "consistent" to user.
  • The "optional" surface problem seemed to be only present in Android.

I am unsure about whether winit should absolutely do some changes for them, but this issue is opened for the discusssions about the possible solutions and winit api design.

Proposed Change

  • Require the user to implement a "bridge" type, which owns the corresponding surface, and gets dropped and recreated by winit when being suspended in Android.
  • Make the "bridge" type or ApplicationHandler trait include the window recreation logic, so winit can recreate the window and own it, which assured the users to have a "window" in every update.

Relevant platforms

Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - androidAffects the Android backendS - enhancementWouldn't this be the coolest?

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions