Skip to content

Expose the current monitor a window is on #19169

Open
@benfrankel

Description

@benfrankel

What problem does this solve or what need does it fill?

I want to add a VideoMode selector to my settings menu. However, there is no way to get a list of supported video modes, because that information lives in Monitor::video_modes, but there's no link from a window to the monitor it's currently on.

What solution would you like?

Expose a window's current monitor index or entity via a Window::monitor or current_monitor field or getter method, or a separate component / relationship. I believe winit has this information.

What alternative(s) have you considered?

  1. Include a Monitor selector in the settings menu as well, and populate video modes based on the selected monitor. This works, but is not the UX we want. Also the selected monitor shown in the settings menu may confusingly become out of sync with the actual monitor if the user moves the window, because there's no way to check if it's still correct.
  2. Iterate over monitors to find one that contains the window's position within its extents. This probably works, but is hacky so it may not work on every platform, and it's not a suitable solution for bevy_new_2d.

Additional context

This came up while working on bevy_new_2d.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WindowingPlatform-agnostic interface layer to run your app inC-FeatureA new feature, making something new possibleS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedX-UncontroversialThis work is generally agreed upon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions