rust-windowing / rust-windowing/winit

CTRL + ALT is not always interpreted as ALT GR on Windows

Open
#4,052 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

B - bug DS - win32
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

Description

See https://github.com/neovide/neovide/issues/2899 for the full description

But in short, on a Nordic layout ctrl + alt + 2 sends ctr + alt + @, while ctrl + alt + 3 correctly sends just £ as it should.

Logs from Neovide
TRACE [neovide::window::keyboard_manager] Modifiers { state: ModifiersState(ALT), pressed_mods: ModifiersKeys(0x0) }
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        AltLeft,
    ),
    logical_key: Named(
        Alt,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: false,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Alt,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] Modifiers { state: ModifiersState(CONTROL | ALT), pressed_mods: ModifiersKeys(0x0) }
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: false,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: true,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: true,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: true,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: true,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: true,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: true,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: true,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        Digit2,
    ),
    logical_key: Character(
        "@",
    ),
    text: Some(
        "@",
    ),
    location: Standard,
    state: Pressed,
    repeat: false,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: Some(
            "@",
        ),
        key_without_modifiers: Character(
            "2",
        ),
    },
}
TRACE [neovide::window::keyboard_manager] Key pressed <C-M-@> ModifiersState(CONTROL | ALT)
TRACE [neovide::channel_utils] UIComand Serial(Keyboard("<C-M-@>"))
TRACE [neovide::bridge::ui_commands] In Serial Command
TRACE [neovide::bridge::ui_commands] Keyboard Input Sent: <C-M-@>
TRACE [neovide::bridge::handler] Neovim notification: "redraw"
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 3, row: 0, column_start: 0, cells: [GridLineCell { text: " ", highlight_id: Some(1), repeat: Some(12) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 1, row: 32, column_start: 84, cells: [GridLineCell { text: "0", highlight_id: Some(36), repeat: None }, GridLineCell { text: "-", highlight_id: None, repeat: None }, GridLineCell { text: "1", highlight_id: None, repeat: None }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 3, row: 0, column_start: 89, cells: [GridLineCell { text: "~", highlight_id: Some(1), repeat: None }, GridLineCell { text: "@", highlight_id: None, repeat: None }, GridLineCell { text: "", highlight_id: None, repeat: None }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 3, row: 0, column_start: 89, cells: [GridLineCell { text: " ", highlight_id: Some(1), repeat: Some(3) }, GridLineCell { text: " ", highlight_id: Some(0), repeat: Some(0) }] }
TRACE [neovide::channel_utils] neovim_handler ModeChange { mode: Normal, mode_index: 0 }
TRACE [neovide::channel_utils] neovim_handler Flush
TRACE [neovide::editor] Image flushed
TRACE [neovide::editor] send_batch
TRACE [neovide::window::keyboard_manager] Modifiers { state: ModifiersState(CONTROL | ALT), pressed_mods: ModifiersKeys(0x0) }
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        ControlLeft,
    ),
    logical_key: Named(
        Control,
    ),
    text: None,
    location: Left,
    state: Pressed,
    repeat: false,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Control,
        ),
    },
}
TRACE [neovide::window::keyboard_manager] KeyEvent {
    physical_key: Code(
        Digit3,
    ),
    logical_key: Character(
        "£",
    ),
    text: Some(
        "£",
    ),
    location: Standard,
    state: Pressed,
    repeat: false,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: Some(
            "£",
        ),
        key_without_modifiers: Character(
            "3",
        ),
    },
}
TRACE [neovide::window::keyboard_manager] Key pressed <C-M-£> ModifiersState(CONTROL | ALT)
TRACE [neovide::channel_utils] UIComand Serial(Keyboard("<C-M-£>"))
TRACE [neovide::bridge::ui_commands] In Serial Command
TRACE [neovide::bridge::ui_commands] Keyboard Input Sent: <C-M-£>
TRACE [neovide::bridge::handler] Neovim notification: "redraw"
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 0, column_start: 0, cells: [GridLineCell { text: "£", highlight_id: Some(0), repeat: None }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 10, column_start: 34, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(32) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 12, column_start: 28, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(44) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 13, column_start: 38, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(23) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 15, column_start: 27, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(46) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 16, column_start: 27, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(46) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 17, column_start: 27, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(46) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 18, column_start: 27, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(46) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 20, column_start: 26, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(47) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 22, column_start: 35, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(29) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 2, row: 23, column_start: 27, cells: [GridLineCell { text: " ", highlight_id: Some(12), repeat: Some(46) }] }
TRACE [neovide::channel_utils] neovim_handler GridLine { grid: 1, row: 32, column_start: 10, cells: [GridLineCell { text: "[", highlight_id: Some(36), repeat: None }, GridLineCell { text: "+", highlight_id: None, repeat: None }, GridLineCell { text: "]", highlight_id: None, repeat: None }, GridLineCell { text: " ", highlight_id: Some(36), repeat: Some(69) }, GridLineCell { text: "1", highlight_id: None, repeat: None }, GridLineCell { text: ",", highlight_id: None, repeat: None }, GridLineCell { text: "3", highlight_id: None, repeat: None }, GridLineCell { text: "-", highlight_id: None, repeat: None }, GridLineCell { text: "2", highlight_id: None, repeat: None }] }
TRACE [neovide::channel_utils] neovim_handler WindowViewport { grid: 2, top_line: 0.0, bottom_line: 2.0, current_line: 0.0, current_column: 2.0, line_count: Some(1.0), scroll_delta: Some(0.0) }
TRACE [neovide::channel_utils] neovim_handler CursorGoto { grid: 2, row: 0, column: 1 }
TRACE [neovide::channel_utils] neovim_handler Flush
TRACE [neovide::editor] Image flushed
TRACE [neovide::editor] send_batch

Note that there's a similar but almost opposite bug, that when pressing ctrl + altgr the ctrl is not reported when it should

Windows version
Windows 11
Winit version

0.29.15

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported behavior on Windows 11 with a Nordic keyboard layout, comparing Ctrl+Alt+2 and Ctrl+Alt+3 and the linked winit issue 3012. The payload names no winit source file or test entry point, so first locate the Windows keyboard event handling and determine how Alt Gr should be represented; done means Ctrl+Alt combinations are interpreted consistently without regressing Ctrl reporting.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.