-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Missing ModifiersChanged events on macOS #1396
Description
It seems like on macOS, not all modifier changes cause a ModifiersChanged event, regardless of focus. This has been initially reported to Alacritty in alacritty/alacritty#3206.
Looking at the output of the event log, there seems to be a key event with modifiers: LOGO attached, without any prior ModifiersChanged event. The Window is in full focus at this point and has not had any modifier or focus changes since then.
The following log contains only the relevant information, full log can be found in the issue. It has been filtered using grep -E ".*event: (KeyboardInput|ReceivedCharacter|Focused|(DeviceEvent.*ModifiersChanged))".
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: Focused(true) }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 41, state: Pressed, virtual_keycode: Some(Semicolon), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: ReceivedCharacter(';') }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 41, state: Released, virtual_keycode: Some(Semicolon), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 8, state: Pressed, virtual_keycode: Some(C), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: ReceivedCharacter('c') }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 8, state: Released, virtual_keycode: Some(C), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 37, state: Pressed, virtual_keycode: Some(L), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: ReceivedCharacter('l') }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 51, state: Pressed, virtual_keycode: Some(Back), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: ReceivedCharacter('\u{7f}') }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 51, state: Released, virtual_keycode: Some(Back), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 51, state: Pressed, virtual_keycode: Some(Back), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: ReceivedCharacter('\u{7f}') }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 51, state: Released, virtual_keycode: Some(Back), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 51, state: Pressed, virtual_keycode: Some(Back), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: ReceivedCharacter('\u{7f}') }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 51, state: Released, virtual_keycode: Some(Back), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 37, state: Released, virtual_keycode: Some(L), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 9, state: Pressed, virtual_keycode: Some(V), modifiers: LOGO }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: ReceivedCharacter('v') }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 9, state: Released, virtual_keycode: Some(V), modifiers: LOGO }, is_synthetic: false } }
glutin event: DeviceEvent { device_id: DeviceId(DeviceId), event: ModifiersChanged((empty)) }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 123, state: Pressed, virtual_keycode: Some(Left), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 123, state: Released, virtual_keycode: Some(Left), modifiers: (empty) }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 55, state: Pressed, virtual_keycode: Some(LWin), modifiers: LOGO }, is_synthetic: false } }
glutin event: DeviceEvent { device_id: DeviceId(DeviceId), event: ModifiersChanged(LOGO) }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 13, state: Pressed, virtual_keycode: Some(W), modifiers: LOGO }, is_synthetic: false } }
glutin event: WindowEvent { window_id: WindowId(Id(140354613817120)), event: ReceivedCharacter('w') }
There are no synthetic events sent, so that shouldn't be an issue either (they're not implemented on macOS anyways afaik). What surprised me a bit was that there were only two DeviceEvents, since I'm used to a lot more on Linux, but that might be normal.