View Issue Details

IDProjectCategoryView StatusLast Update
0036077LazarusLCLpublic2019-10-03 20:10
ReporterZoran Vučenović Assigned To 
Status newResolutionopen 
Product Version2.0.5 (SVN) 
Summary0036077: Gtk2 - wrong key code for "X" key
DescriptionIn my LCL application, I am checking state of keys on keyboard.
I noticed that:

Pressing "X" key does not generate code VK_X (which is 88, as declared in LCLType unit, and it is Ord('X') as it should be).
Instead, code 149 is generated.

In OnKeyDown and OnKeyUp event, when pressing X key, I get keycode 149, instead of 88 ($58).

The function LCLIntf.GetKeyState behaves the same.
That is, when X is pressed:
- GetKeyState(149) and $80 <> 0) returns True
- GetKeyState(VK_X) and $80 <> 0 returns False.

Worth mentioning is that, in OnKeyPress I correctly get character 'X' (which is Chr(88)).

Steps To ReproduceI am attaching simple application.
Which key code do you get when pressing "X"?
Additional InformationMy system: Mint 19.2 Xfce, Lazarus 2.0.4, gtk2, FPC 3.0.4.

Please test with other widgetsets too.
TagsNo tags attached.
Fixed in Revision
WidgetsetGTK 2
Attached Files


Zoran Vučenović

2019-09-14 23:53

developer (65,157 bytes)

CudaText man

2019-09-18 20:43

reporter   ~0118109

Ubuntu gtk2 x64, Lazarus trunk. I got key code 88 on press+release.

Anton Kavalenka

2019-09-19 07:40

reporter   ~0118110

Debian 10 gtk2 x86_64, Lazarus r61899 seems to be ok.

Maybe keyboard broken, or your cat holding modifier.

Zoran Vučenović

2019-09-20 08:22

developer   ~0118130

Thanks, Alexey and Anton, for testing.

> Maybe keyboard broken, or your cat holding modifier.

Actually, I get the same wrong key (149) on two different machines with Mint 19.2 xfce installed -- one in virtual box inside windows 10 host, and the other installed natively on a laptop.

Juha Manninen

2019-10-03 20:10

developer   ~0118292

With Manjaro + KDE I also get key code 88 as expected.
It must be specific to Mint + XFCE, but why?

Issue History

Date Modified Username Field Change
2019-09-14 23:53 Zoran Vučenović New Issue
2019-09-14 23:53 Zoran Vučenović File Added:
2019-09-18 20:43 CudaText man Note Added: 0118109
2019-09-19 07:40 Anton Kavalenka Note Added: 0118110
2019-09-20 08:22 Zoran Vučenović Note Added: 0118130
2019-10-03 20:10 Juha Manninen Note Added: 0118292