Ribir icon indicating copy to clipboard operation
Ribir copied to clipboard

Support WindowEvent stream

Open M-Adoo opened this issue 1 year ago • 0 comments

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 avatar Nov 03 '23 03:11 M-Adoo