Missing keyEvents for Qt::Key_Alt
-
wrote on 18 Jun 2020, 15:54 last edited by Audetto
Ubuntu - Gnome - X11 - Qt 5.12.8
I am logging all keys pressed using
keyPressEvent(QKeyEvent *event)
and
keyReleaseEvent(QKeyEvent *event)
It works for all keys except Qt::Key_Alt (ok the windows key gives nothing but this is expected)
Imagine I press and release twice
All keys will give me
Press - Event
Release - Event
Press - Event
Release - Eventfor Alt I get
Press - Event
Release - No event triggered
Press - No event triggered
Release - EventWhy is that? Has it to do with GNOME?
-
wrote on 28 Jun 2020, 04:55 last edited by
Yes.. GNOME is an abomination....and the underlying X11 system receives the alt scancode but "something" is mofidying the behaviour.
install and use xev to see what the native X11 system is generating.
-
wrote on 4 Jul 2020, 19:53 last edited by
I tried xev and the events reported for Alt and AltGr are similar, one for press and one for release.
From this I can only imagine Qt is doing something to filter it.KeyPress event, serial 37, synthetic NO, window 0x5200001,
root 0x143, subw 0x0, time 48633066, (480,-15), root:(833,969),
state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 37, synthetic NO, window 0x5200001,
root 0x143, subw 0x0, time 48633218, (480,-15), root:(833,969),
state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyPress event, serial 37, synthetic NO, window 0x5200001,
root 0x143, subw 0x0, time 48634514, (480,-15), root:(833,969),
state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 37, synthetic NO, window 0x5200001,
root 0x143, subw 0x0, time 48634650, (480,-15), root:(833,969),
state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False -
wrote on 4 Jul 2020, 20:02 last edited by
Don't assume it is Qt. Many modern abonimation desktop environments layer that stuff to hide it from the Luser, because we all know low level is dangerous and folks should not be trusted with anything but point-n-click...but I digres. You may/probably have a keyboard management layer that is remapping keysyms.
Now that you understand xev, you should learn about xmodmap.
http://xahlee.info/linux/linux_xmodmap_tutorial.html