Skip to content

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

Open

Description

@shmutalov

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:

Activity

  1. changed the title [-]Need to get info about window state (maybe only Windows)[/-] [+]Need to get info about window state (maybe only on Windows)[/+] on Jun 25, 2017
  2. added
    DS - win32
    S - api
    on Apr 22, 2018
  3. added
    H - help wanted
    C - needs discussion
    D - easy
    P - normal
    on May 6, 2018
  4. zrneely commented on Mar 24, 2019

    @zrneely

    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.

  5. repi commented on Mar 25, 2019

    @repi
    Contributor

    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.

  6. elinorbgr commented on Apr 25, 2019

    @elinorbgr
    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.

  7. Osspial commented on Sep 19, 2019

    @Osspial
    Contributor

    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.

  8. added a commit that references this issue on Jun 7, 2021
  9. added a commit that references this issue on Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C - needs discussionD - easyDS - win32H - help wantedP - normalS - api

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions