Bug 552041 - [mac] KeyDown event has wrong keyCode for non-english layouts
Summary: [mac] KeyDown event has wrong keyCode for non-english layouts
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.13   Edit
Hardware: Macintosh Mac OS X
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-11 10:57 EDT by Hugo Almeida CLA
Modified: 2019-10-11 10:58 EDT (History)
0 users

See Also:


Attachments
Test class (1.17 KB, text/plain)
2019-10-11 10:57 EDT, Hugo Almeida CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Almeida CLA 2019-10-11 10:57:32 EDT
Created attachment 280238 [details]
Test class

swt.version: 3.108.0.v20180904-1901 and 4.13 tested

For non-english keyboard layouts the event keyCode seems wrong on mac, and is different from both Windows and Ubuntu.

Experimental setup: see the attached file. Basically just a Text widget with a KeyListener that prints character and keyCode values of the pressed key.

I was using a physical QWERTY keyboard.

Windows/Ubuntu:
QWERTY layout, press z:
character: z
keyCode: 122

QWERTZ layout, press y (so where z is in QWERTY)
character : y
keyCode: 121

Russian layout, press я (again, where z is in QWERTY)
character: я
keyCode: 122

Mac:
QWERTY layout, press z:
character: z
keyCode: 122

QWERTZ layout, press y (so where z is in QWERTY)
character : y
keyCode: 121

Russian layout, press я (again, where z is in QWERTY)
character: я
keyCode: 1103

As you can see, there is a difference in behaviour between OSes. This is specially hard if you are trying to process keys to identify shortcuts.

I noticed Eclipse IDE Text boxes suffer from this difference in different OSes likewise. But any shortcut that is processed through a KeyListener fails precisely because of this.