Skip to content

getter Window::modifiers(&self) -> ModifiersState #4522

Open

Description

@Random-Scientist

Description

proposed on matrix, also makes the logic discussed in #4469 easier for applications to implement.

Relevant platforms

No response

Activity

  1. added
    S - enhancement
    on Mar 17, 2026
  2. added
    S - api
    on Mar 17, 2026
  3. Murmele commented on Mar 17, 2026

    @Murmele
    Contributor

    Thanks for the creation! The usecase would be that the modifiers can be tracked when the modifier was pressed and the window gets the focus

  4. madsmtm commented on Mar 17, 2026

    @madsmtm
    Member

    Arguably, the whole idea of ModifiersChanged is a bit dubious IMO, the only reason you want the modifier state is to act differently when handling other events IIUC?

    Assuming users handle events inside window_event, I actually think it'd be sufficient to have Window::modifiers? (If users queue events for later handling, they'll have to query Window::modifiers in window_event, accessing Window::modifiers at a later point would return new modifiers).

    Tracing it back to #1124, I don't see a discussion about instead adding Window::modifiers.

  5. madsmtm commented on Mar 17, 2026

    @madsmtm
    Member

    Reading Alacritty's code, they seem to handle ModifiersChanged by updating the cursor icon for example, that might actually be a good enough use-case that it's worth keeping.

  6. Murmele commented on Mar 18, 2026

    @Murmele
    Contributor

    Another one would if you are using shift with scrolling to scroll horizontally. If you press it out of focus of the window then hover the window and scroll. In this case you wanna scroll horizontally, but not vertically

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

    S - apiS - enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions