Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the window be owned by the event loop #3434

Open
madsmtm opened this issue Jan 27, 2024 · 1 comment
Open

Make the window be owned by the event loop #3434

madsmtm opened this issue Jan 27, 2024 · 1 comment
Labels
C - needs discussion Direction must be ironed out S - api Design and usability

Comments

@madsmtm
Copy link
Member

madsmtm commented Jan 27, 2024

Part of #3367, opening to discuss separately.

Roughly proposed API:

let window_id = event_loop.create_window();

// Later

let window: &Window = event_loop.get_window(window_id);
window.set_title("foo");

See this comment for a full description of the issue.

Related: #3317.

@madsmtm madsmtm added S - api Design and usability C - needs discussion Direction must be ironed out labels Jan 27, 2024
@madsmtm madsmtm added this to the Version 0.31.0 milestone Jan 27, 2024
@kchibisov
Copy link
Member

In general I'd add a note that I'd like to see more ECS (entity component system) approach to the resources winit owns and then we should have weak handles or owned data types to interact with them from the code owned by the user.

In general, ECS based approach forces you to work with handles when you do complex structures, like scene trees where you want to refer to render surface. Handles allow you to freely remove or move out the resources without swap_remove, since you can just override besides being worrying for dropping the window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - needs discussion Direction must be ironed out S - api Design and usability
Development

No branches or pull requests

2 participants