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

Need to get info about window state (maybe only on Windows) #208

Open
shmutalov opened this issue Jun 25, 2017 · 4 comments
Open

Need to get info about window state (maybe only on Windows) #208

shmutalov opened this issue Jun 25, 2017 · 4 comments
Labels
C - needs discussion Direction must be ironed out D - easy Likely easier than most tasks here DS - windows H - help wanted Someone please save us P - normal Great to have S - api Design and usability

Comments

@shmutalov
Copy link

shmutalov commented Jun 25, 2017

Need to add possibility emit Maximized and Minimized window events to winit.
Current implementation on window minimizing only sends Resized event, where window size on Windows machines equals to zero (w = 0, h = 0). Sometimes it causes bugs in programs (like games), where aspect ratio dynamically calculated on window size change.

There are two suggestions to implement:

  • Add completely new window events - WindowEvent::Minimized and WindowEvent::Maximized, as the result of window minimization don't send WindowEvent::Resized, only that two new
  • Update current WindowEvent::Resized(u32, u32) signature to a new WindowEvent::Resized(u32, u32, bool) one, where bool parameter will be a window minized (true)/maximized (false) state

Look at the following PR's:

@shmutalov shmutalov changed the title Need to get info about window state (maybe only Windows) Need to get info about window state (maybe only on Windows) Jun 25, 2017
@francesca64 francesca64 added DS - windows S - api Design and usability labels Apr 22, 2018
@francesca64 francesca64 added H - help wanted Someone please save us C - needs discussion Direction must be ironed out D - easy Likely easier than most tasks here P - normal Great to have labels May 6, 2018
@zrneely
Copy link

zrneely commented Mar 24, 2019

I'd add that it would be nice to be able to query Window::get_maximized, although the same thing can be accomplished via the proposed WindowEvent::Maximized event - receiving Maximized implies that the window is, well, maximized, and any further resizes mean that it's not.

Also, does this need to be Windows specific? I imagine that most WMs provide something similar, although IIRC on OS X, "Maximized" and "fullscreen" often mean the same thing.

@repi
Copy link
Contributor

repi commented Mar 25, 2019

We would love to have either a WindowEvent::Maximized or a Window::get_maximized so we can now the current state of the window as we persist the window state for the next time the app is started, and can't currently persist if the window was maximised or not.

@elinorbgr
Copy link
Contributor

FTR, an Event::Maximized would be pretty simple to do on wayland. Event::Minimized would be trickier as it's not explicitly advertised by the display server.

@Osspial
Copy link
Contributor

Osspial commented Sep 19, 2019

I'd definitely be alright with having this. It should be fine to have both a get_maximized method and a WindowEvent::Maximized event, since there are distinct uses for both.

We already keep track of this information internally on the Windows backend, so exposing this should be trivial there.

parasyte added a commit to parasyte/egui_winit_platform that referenced this issue Jun 7, 2021
- To start, this just ignores the special `Resized(0, 0)` overload that winit uses on Windows to notify a minimize event. See rust-windowing/winit#208
- This fixes a bug on Windows where minimizing adjusts all of the egui window positions.
hasenbanck pushed a commit to hasenbanck/egui_winit_platform that referenced this issue Jun 7, 2021
- To start, this just ignores the special `Resized(0, 0)` overload that winit uses
  on Windows to notify a minimize event. See
  rust-windowing/winit#208
- This fixes a bug on Windows where minimizing adjusts all of the egui
  window positions.
parasyte added a commit to parasyte/egui that referenced this issue Jun 26, 2021
…positions.

- Fixes emilk#518
- This bug is caused by an issue in winit where minimized windows will
  be given 0 width and height on Windows.
- See: rust-windowing/winit#208
- See also: hasenbanck/egui_winit_platform#19
parasyte added a commit to parasyte/egui that referenced this issue Jun 26, 2021
…positions.

- Closes emilk#518
- This bug is caused by an issue in winit where minimized windows will
  be given 0 width and height on Windows.
- See: rust-windowing/winit#208
- See also: hasenbanck/egui_winit_platform#19
emilk pushed a commit to emilk/egui that referenced this issue Jun 28, 2021
…positions. (#522)

- Closes #518
- This bug is caused by an issue in winit where minimized windows will
  be given 0 width and height on Windows.
- See: rust-windowing/winit#208
- See also: hasenbanck/egui_winit_platform#19
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 D - easy Likely easier than most tasks here DS - windows H - help wanted Someone please save us P - normal Great to have S - api Design and usability
Development

No branches or pull requests

7 participants