| Summary: | SWT.KeyDown event.keyCode reports wrong key number for Marathi & Bengali | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Ehud Michelson <ehudm> |
| Component: | SWT | Assignee: | Felipe Heidrich <eclipse.felipe> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ehudm, rinat_nunu, snorthov |
| Version: | 3.3 | ||
| Target Milestone: | 3.4 M6 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Interesting, it fails for numbers but works for letters. The Hindi, Malayalam and Punjabi keyboard use latin number that is why they work. For the Marathi keyboard the correct output when you 1 is pressed is: keycode 49 (0x31) character 2407 (0x967 Devanagari number 1) for the bengali keyboard: keycode 49 (0x31) character 2535 (0x9e7 Bengali number 1) We are getting this wrong cause OS.MapVirtualKey() is mapping number to unicode values, for example, it maps 0x31 to 0x967, Steve, can you help me with this problem ? fixed in HEAD > 20080228 |
SWT.KeyDown event.keyCode reports wrong key number for Marathi & Bengali (1) Run the following simple SWT program. (2) Press 1 key on the keyboard and see that the reported key code is 49. (3) Change the keyboard language to either Marathi or Bengali. (4) Repeat step (2) and notice that for Marathi the key code is 2407 and for Bengali it is 2535. (5) Doesn't reproduce with other Hindo languages like Hindi, Malayalam and Punjabi. ============================================================= import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*; public class TextControlBug { private static Shell shell = null; public static void main(String[] args) { Display display = new Display(); createShell(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } private static void createShell() { shell = new Shell(); Text textCtrl = new Text(shell, SWT.SINGLE); textCtrl.setBounds(50, 10, 300, 80); shell.pack(); textCtrl.addListener(SWT.KeyDown, new Listener() { public void handleEvent(Event event) { System.out.println("eventKeyCode: " + event.keyCode); } }); } }