Skip to content

Add window events (resized, maximized) and getters #1523

@WilliamVenner

Description

@WilliamVenner

Is your feature request related to a problem? Please describe.
It's not possible to save the user's preference of window size or maximization.

Describe the solution you'd like
Rust window events that fire when the window is resized or maximized.

Describe alternatives you've considered
I have looked into detecting window maximization via JavaScript but it is impossible.

Currently JavaScript's onresize event is satisfactory to save the user's preferred window size.

Additional context
tauri-winit has a Window::is_maximized function on Windows and macOS:

https://github.com/rust-windowing/winit/blob/dabcb1834d4f2c6761854d911ec17f1f01e3cc10/src/platform_impl/windows/window.rs#L414

https://github.com/rust-windowing/winit/blob/629cd86c7cc674c40c1f20b992bdd13784f357dd/src/platform_impl/macos/window.rs#L747

However, Linux seems to be unimplemented:

https://github.com/rust-windowing/winit/blob/ca9c05368e76f70a06cdc34b864711584e5744c2/src/platform_impl/linux/mod.rs#L382

A PR seems to have implemented it, but it's been sitting around since February. Looks like you guys made the right decision to make your own winit branch!

rust-windowing/winit#1848

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions