Broadcast window attributes#2926
Conversation
a1feb22 to
1d4983e
Compare
kchibisov
left a comment
There was a problem hiding this comment.
In general, such information should be a part of the Resized event, since it's a part of the state change and resize will be generated as well.
I'm not sure if we should expose minimize for that, maybe we should, idk.
Also, could we maybe use something like that https://wayland.app/protocols/xdg-shell#xdg_toplevel:enum:state ? Or at least map some of them. Are tiled states exposed on Windows for example? What about macOS and how it all maps to it?
The new Resized event should be called Configure I guess to follow the Wayland naming since it sorts of makes sense and have a size just as a part of it's field and other field is the bitflags with the state.
We may have minimized there as well.
We can rename it pub enum Configuration {
/// The window is in normal mode
Normal,
/// The window is in fullscreen mode
Fullscreen,
/// The window is minimized
Minimized,
/// The size of the window was resized. Contains the client area's new dimensions.
Resized(PhysicalSize<u32>),
}As for tiling; to my knowledge there's no easy way to get tiling information. On macOS if you tile left or right, the full-screen selector is triggered. |
|
It should be pub struct Configure {
size: PhysicalSize<u32>,
state: WindowState, // bitflags, TILED_LEFT, RIGHT, etc, | MAXIMIZED | FULLSCREEN | MINIMIZED
}I could send this API change myself and you could open PR against my branch then. |
Sure, if thats how you want it you can open a PR and and I'll follow up! 👍🏻 |
|
Could you send your patches against #2929 ? |
Yes will look at this when back from vacation in a couple of days. |
1d4983e to
0136429
Compare
0136429 to
5ac9357
Compare
kchibisov
left a comment
There was a problem hiding this comment.
The maximized is missing on both macOS and Windows
| if let Some(screen) = self.window.screen() { | ||
| let rect = screen.frame(); | ||
| let logical_size = | ||
| LogicalSize::new(rect.size.width as f64, rect.size.height as f64); | ||
| let size = logical_size.to_physical::<u32>(self.window.scale_factor()); | ||
|
|
||
| self.queue_event(WindowEvent::Configured { | ||
| size, | ||
| state: Default::default(), | ||
| }); | ||
| } |
There was a problem hiding this comment.
In general, won't it all trigger the frame changes or other events? Can't we simply get the all the stiles of zoomed, fullscreen inside the resize handle or macOS won't resize to the same sizes? Do we have, maybe, some state changes hooks?
There was a problem hiding this comment.
We should use the delegate methods now they are there, imo. That's cleanest imo.
Notify clients about the window state changes, most underlying systems do change the window states. Fixes rust-windowing#2334.
Co-authored-by: Mads Marquart <mads@marquart.dk>
Co-authored-by: Mads Marquart <mads@marquart.dk>
f05d266 to
80f80fc
Compare
80f80fc to
0fc3605
Compare
Fixes #2334.
This PR adds a new
WindowEvent::WindowAttributewhich tells if the window is in fullscreen, minimize or normal mode.Currently, macOS and Windows has been implemented, since that's the two platforms I am able to develop on.
CHANGELOG.mdif knowledge of this change could be valuable to users