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

Support WindowEvent stream #461

Open
M-Adoo opened this issue Nov 3, 2023 · 0 comments
Open

Support WindowEvent stream #461

M-Adoo opened this issue Nov 3, 2023 · 0 comments
Labels
enhancement New feature or request framework

Comments

@M-Adoo
Copy link
Collaborator

M-Adoo commented Nov 3, 2023

Is your feature request related to a problem? Please describe.
User need to response to the window resize, close, etc. For example, when the window is closing, user need to release the resource, save the data, etc.

Describe the solution you'd like
A WindowEvent stream is needed. User can subscribe to the stream to get the event.

window.events().subscribe(|event| {
    match event {
        WindowEvent::Close => {
          // Cancel the window close.
          event.prevent_default();
        }
        WindowEvent::Resize => {
            // resize the window
        }
    }
});

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context

We introduced an AppEvent::WndFocusChanged(WindowId, bool) in #454 which should be removed in favor of this.

@M-Adoo M-Adoo added enhancement New feature or request framework labels Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request framework
Projects
None yet
Development

No branches or pull requests

1 participant