Re: linux: keydown/char missing for non-latin keypresses together with control/alt keys (#17643)

24 views
Skip to first unread message

unxed

unread,
Jan 24, 2022, 1:33:46 PM1/24/22
to wx-...@googlegroups.com, wxtrac, Author

This is very interesting issue. With wx 3.1.4, Alt+NonLatinLetter generates KeyUp and KeyDown with empty key code (but it can be deduced by RawKeyFlags which contains hardware keycode under GTK), but no OnChar.

Same is with wx 3.0.4 under Ubuntu 20.04 (GTK 3.24).

But with the same wx 3.0.4 under Ubuntu 18.04 (GTK 3.22) there is no KeyUp/KeyDown at all for such combinations!

@elfmz


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1020415173@github.com>

unxed

unread,
Jan 24, 2022, 6:47:33 PM1/24/22
to wx-...@googlegroups.com, wxtrac, Author

Okay, 3.0.4 behavior difference between 18.04 and 20.04 is caused by additional backports from 3.0.5 in 20.04, see archive.ubuntu.com/ubuntu/pool/universe/w/wxwidgets3.0/wxwidgets3.0_3.0.4+dfsg-15build1.debian.tar.xz


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1020664650@github.com>

unxed

unread,
Jan 24, 2022, 6:57:09 PM1/24/22
to wx-...@googlegroups.com, wxtrac, Author

keyup/keydown events absence issue indeed fixed in 3.1 branch.

still I am not sure if it is correct to send 0 as keycode for such combinations. shouldn't we detect keysym by hardware key code instead?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1020669104@github.com>

VZ

unread,
Jan 24, 2022, 7:07:52 PM1/24/22
to wx-...@googlegroups.com, wxtrac, Author

still I am not sure if it is correct to send 0 as keycode for such combinations. shouldn't we detect keysym by hardware key code instead?

The scan code should be already available via GetRawKeyFlags(). I'm not sure if we can do anything better, but suggestions are welcome, of course.

Other than that I'm confused: do we still this problem in master or not? This comment seemed to say that we still do, has it been fixed since then?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1020675355@github.com>

unxed

unread,
Jan 24, 2022, 7:52:32 PM1/24/22
to wx-...@googlegroups.com, wxtrac, Author

suggestions are welcome, of course

It seems logical to put Latin key value to keycode field of Alt+NonLatinLetter keydown/up events, as actual local letter resides in UnicodeChar, but sometimes we need to know pressed key, not letter.

To get Latin keycode from GetRawKeyFlags() some translation is needed, like:

static int HardwareKeyCodeToKeySym(int code)
{
    // Returns keysym corresponding to passed GTK hardware keycode
    // Returns zero for every key except non-numeric character keys

	switch (code) {

        // Hardware key codes are defined in /usr/share/X11/xkb/keycodes/xfree86

		case 20: return '-';
		case 21: return '=';
		//   22 is Backspace
		//   23 is Tab
		case 24: return 'Q';
		case 25: return 'W';
		case 26: return 'E';
		case 27: return 'R';
		case 28: return 'T';
		case 29: return 'Y';
		case 30: return 'U';
		case 31: return 'I';
		case 32: return 'O';
		case 33: return 'P';
		case 34: return '[';
		case 35: return ']';
		//   36 is Enter
		//   37 is RCtrl
		case 38: return 'A';
		case 39: return 'S';
		case 40: return 'D';
		case 41: return 'F';
		case 42: return 'G';
		case 43: return 'H';
		case 44: return 'J';
		case 45: return 'K';
		case 46: return 'L';
		case 47: return ';';
		case 48: return '\'';
		case 49: return '`';
		//   50 is LShift
		case 51: return '\\';
		case 52: return 'Z';
		case 53: return 'X';
		case 54: return 'C';
		case 55: return 'V';
		case 56: return 'B';
		case 57: return 'N';
		case 58: return 'M';
		case 59: return '.';
		case 60: return '.';
		case 61: return '/';
	}

	return 0; // not applicable
}

Also where is strange behavior of < key with Shift modifier: its keycode is < character in keyup/down events, but it should be ,. < should be in onchar. It is the common behavior with Shift for keys like >, /, ;, ', etc. But for < it's different.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1020699042@github.com>

unxed

unread,
Jan 24, 2022, 7:55:35 PM1/24/22
to wx-...@googlegroups.com, wxtrac, Author

Other than that I'm confused: do we still this problem in master or not?

Problem of KeyDown/KeyUp events not firing for Alt+NonLatinLetter is definitely solved in master.

Problem of OnChar event events not firing for Alt+NonLatinLetter has another issue, #18637


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1020700561@github.com>

unxed

unread,
Mar 27, 2023, 10:51:23 AMMar 27
to wx-...@googlegroups.com, wxtrac, Author

To get Latin keycode from GetRawKeyFlags() some translation is needed, like:

Working example of such translation.

As for the problem of zero keycode in such events

Now there is a separate issue for it: #23379


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1485259968@github.com>

unxed

unread,
Mar 31, 2023, 8:03:42 PMMar 31
to wx-...@googlegroups.com, wxtrac, Author

Fixed in #23410


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1492744318@github.com>

VZ

unread,
Apr 1, 2023, 2:16:52 PMApr 1
to wx-...@googlegroups.com, wxtrac, Author

Closed #17643 as completed via 2c0f6a2.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issue/17643/issue_event/8904623340@github.com>

unxed

unread,
Apr 4, 2023, 1:31:54 PMApr 4
to wx-...@googlegroups.com, wxtrac, Author

2016-08-29 14:35:50: elfmz created the issue

@elfmz finally fixed :)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you authored the thread.Message ID: <wxWidgets/wxWidgets/issues/17643/1496346444@github.com>

Reply all
Reply to author
Forward
0 new messages