Skip to content

SDL_KeyMod not present on SDL.EventType.KeyboardButtonUp #14723

@LloydJHowarth

Description

@LloydJHowarth

Using SDL_KeyMod is always None on event SDL.EventType.KeyboardButtonUp

If I use this code:

internal override void OnEvent(SDL.Event e)
{
    switch (e.type)
    {
        // Keyboard Up
        case SDL.EventType.KeyboardButtonUp:
        {
            if (!e.keyboard.repeat)
            {
                var modifier = (Modifier)e.keyboard.keyModifier;
                Debug.Log($"Release {modifier}");
            }
            
            break;
        }
        
        // Keyboard Down
        case SDL.EventType.KeyboardButtonDown:
        {
            if (!e.keyboard.repeat)
            {
                var modifier = (Modifier)e.keyboard.keyModifier;
                Debug.Log($"Press {modifier}");
            }
            
            break;
        }
    }
}

Whenever I check the modifier on KeyboardButtonDown I get the excepted modifier that is pressed for example Alt, Ctrl, etc. However on release it's always none. I would wonder if this is intended behaviour however CapsLock work as expected and is the only SDL_KeyMod that is present on KeyboardButtonUp

Why is this? Is this a bug or intentional behaviour?

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