6454041: decimal separator munches the character standing at the right (sk keyboard)
authoryan
Tue, 05 Aug 2008 15:26:08 +0400
changeset 1187 6067b9e2eac6
parent 1186 09060e8ca52c
child 1188 44c63c47def9
6454041: decimal separator munches the character standing at the right (sk keyboard) Summary: in a group of keysyms associated with a key, check for keypad-ness of more keysyms Reviewed-by: art
jdk/src/solaris/classes/sun/awt/X11/XKeysym.java
jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h
--- a/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java	Fri Jul 25 15:19:11 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java	Tue Aug 05 15:26:08 2008 +0400
@@ -101,10 +101,15 @@
         // Otherwise, it is [1].
         int ndx = XToolkit.isXsunServer() &&
                   ! XToolkit.isXKBenabled() ? 2 : 1;
+        // Even if XKB is enabled, we have another problem: some symbol tables (e.g. cz) force
+        // a regular comma instead of KP_comma for a decimal separator. Result is,
+        // bugs like 6454041. So, we will try for keypadness  a keysym with ndx==0 as well.
         XToolkit.awtLock();
         try {
-            return XlibWrapper.IsKeypadKey(
-                XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), ndx ) );
+            return (XlibWrapper.IsKeypadKey(
+                XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), ndx ) ) ||
+                   XlibWrapper.IsKeypadKey(
+                XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), 0 ) ));
         } finally {
             XToolkit.awtUnlock();
         }
--- a/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h	Fri Jul 25 15:19:11 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h	Tue Aug 05 15:26:08 2008 +0400
@@ -139,10 +139,15 @@
 tojava         // Otherwise, it is [1].
 tojava         int ndx = XToolkit.isXsunServer() &&
 tojava                   ! XToolkit.isXKBenabled() ? 2 : 1;
+tojava         // Even if XKB is enabled, we have another problem: some symbol tables (e.g. cz) force
+tojava         // a regular comma instead of KP_comma for a decimal separator. Result is,
+tojava         // bugs like 6454041. So, we will try for keypadness  a keysym with ndx==0 as well.
 tojava         XToolkit.awtLock();
 tojava         try {
-tojava             return XlibWrapper.IsKeypadKey(
-tojava                 XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), ndx ) );
+tojava             return (XlibWrapper.IsKeypadKey(
+tojava                 XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), ndx ) ) ||
+tojava                    XlibWrapper.IsKeypadKey(
+tojava                 XlibWrapper.XKeycodeToKeysym(ev.get_display(), ev.get_keycode(), 0 ) ));
 tojava         } finally {
 tojava             XToolkit.awtUnlock();
 tojava         }