Skip to content

Keycode::from_scancode only appropriate for key_event = true #388

Description

@PARTYMANX

I noticed a couple of interface issues with Keycode::from_scancode that render it an insufficient interface over SDL_GetKeyFromScancode:
First, modstate uses the sys struct SDL_Keymod. This requires translations when trying to account for modifier keys in events, which use the keyboard::Mod struct. That said, the second issue renders that a bit moot: when key_event is true, it will only return Some for defined Keycode values. When providing a modstate with key_event set to false, the function is meant to be able to return both upper and lowercase letters, for example.

To replicate the original function, Keycode may need to be closer to SDL_Keycode, being a tuple struct with u32 instead of an enum.

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