Skip to content

Keyboard layout handling #200

Closed
Closed

Description

@alexheretic

I noticed I receive key events, for example, VirtualKeyCode::Key2 when shift is on or off. The meaning of this depends on keyboard layout, ie in UK it shift-on-key2 means ". Are there established ways of dealing with layouts at the moment? Is it planned/desired to be included in winit?

Activity

  1. elinorbgr commented on Jun 21, 2017

    @elinorbgr
    Contributor

    When a key is pressed, you normally receive two events:

    • a KeyboardInput event, which as you noted does not take into account modifiers keys like shift, this is intented for input that should not be affected by it (like action keys in a videogame)
    • a ReceivedCharacter event, which contains the UTF8 char generated by the keypress, including all keymap modifiers currently active, which is probably what you are looking for.
  2. alexheretic commented on Jun 21, 2017

    @alexheretic
    ContributorAuthor

    Ah perfect, thank you for pointing that out.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions