Skip to content

Wrong virtual keycode in WindowEvent from Alt key while holding Shift on X11 #1656

@Bakutomo

Description

@Bakutomo

Platform:

X11 on Linux

Steps to reproduce:

  1. cargo run --example window | grep KeyboardInput
  2. hold either shift key down
  3. press or release the alt key

Expected result:

A WindowEvent with virtual_keycode: Some(LAlt)

Actual result:

A WindowEvent with virtual_keycode: None

The below output is from the input sequence:
press LShift, press LAlt, release LShift, release LAlt

DeviceEvent { device_id: DeviceId(X(DeviceId(12))), event: Key(KeyboardInput { scancode: 42, state: Pressed, virtual_keycode: Some(LShift), modifiers: (empty) }) }
WindowEvent { window_id: WindowId(X(WindowId(117440513))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 42, state: Pressed, virtual_keycode: Some(LShift), modifiers: SHIFT }, is_synthetic: false } }

DeviceEvent { device_id: DeviceId(X(DeviceId(12))), event: Key(KeyboardInput { scancode: 56, state: Pressed, virtual_keycode: Some(LAlt), modifiers: SHIFT }) }
WindowEvent { window_id: WindowId(X(WindowId(117440513))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 56, state: Pressed, virtual_keycode: None, modifiers: SHIFT | ALT }, is_synthetic: false } }

DeviceEvent { device_id: DeviceId(X(DeviceId(12))), event: Key(KeyboardInput { scancode: 42, state: Released, virtual_keycode: Some(LShift), modifiers: SHIFT | ALT }) }
WindowEvent { window_id: WindowId(X(WindowId(117440513))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 42, state: Released, virtual_keycode: Some(LShift), modifiers: ALT }, is_synthetic: false } }

DeviceEvent { device_id: DeviceId(X(DeviceId(12))), event: Key(KeyboardInput { scancode: 56, state: Released, virtual_keycode: Some(LAlt), modifiers: ALT }) }
WindowEvent { window_id: WindowId(X(WindowId(117440513))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 56, state: Released, virtual_keycode: Some(LAlt), modifiers: (empty) }, is_synthetic: false } }

Note that the virtual_keycode in DeviceEvent is correct. Only WindowEvent is affected. The same problem also happens if I hold RShift instead of LShift.

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedC - needs discussionDirection must be ironed outDS - x11Affects the X11 backend, or generally free Unix platforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions