java-access-bridge r224 - in trunk: . bridge/org/GNOME/Accessibility



Author: wwalker
Date: Tue Jun 17 14:27:57 2008
New Revision: 224
URL: http://svn.gnome.org/viewvc/java-access-bridge?rev=224&view=rev

Log:
Fix for bug #318615 to adjust keysyms being sent to the AT.


Modified:
   trunk/ChangeLog
   trunk/bridge/org/GNOME/Accessibility/KeyEventAdapter.java

Modified: trunk/bridge/org/GNOME/Accessibility/KeyEventAdapter.java
==============================================================================
--- trunk/bridge/org/GNOME/Accessibility/KeyEventAdapter.java	(original)
+++ trunk/bridge/org/GNOME/Accessibility/KeyEventAdapter.java	Tue Jun 17 14:27:57 2008
@@ -29,6 +29,8 @@
 
 public class KeyEventAdapter {
 
+    private static HashMap nonAlphaNumericMap = null;
+
     private static class LockingKeyListener  extends EventListenerImpl {
         boolean numLock = false;
 
@@ -55,6 +57,41 @@
     private static EventListener lockingKeyEventListener = null;
 
     static {
+        // Non-alphanumeric symbols that need to be mapped to X11 keysym names
+        nonAlphaNumericMap = new HashMap( 40 );
+        nonAlphaNumericMap.put("!", "exclam");
+        nonAlphaNumericMap.put("@", "at");
+        nonAlphaNumericMap.put("#", "numbersign");
+        nonAlphaNumericMap.put("$", "dollar");
+        nonAlphaNumericMap.put("%", "percent");
+        nonAlphaNumericMap.put("^", "asciicircum");
+        nonAlphaNumericMap.put("&", "ampersand");
+        nonAlphaNumericMap.put("*", "asterisk");
+        nonAlphaNumericMap.put("(", "parenleft");
+        nonAlphaNumericMap.put(")", "parenright");
+        nonAlphaNumericMap.put("-", "minus");
+        nonAlphaNumericMap.put("_", "underscore");
+        nonAlphaNumericMap.put("=", "equal");
+        nonAlphaNumericMap.put("+", "plus");
+        nonAlphaNumericMap.put("\\", "backslash");
+        nonAlphaNumericMap.put("|", "bar");
+        nonAlphaNumericMap.put("`", "grave");
+        nonAlphaNumericMap.put("~", "asciitilde");
+        nonAlphaNumericMap.put("[", "bracketleft");
+        nonAlphaNumericMap.put("{", "braceleft");
+        nonAlphaNumericMap.put("]", "bracketright");
+        nonAlphaNumericMap.put("}", "braceright");
+        nonAlphaNumericMap.put(";", "semicolon");
+        nonAlphaNumericMap.put(":", "colon");
+        nonAlphaNumericMap.put("'", "apostrophe");
+        nonAlphaNumericMap.put("\"", "quotedbl");
+        nonAlphaNumericMap.put(",", "comma");
+        nonAlphaNumericMap.put("<", "less");
+        nonAlphaNumericMap.put(".", "period");
+        nonAlphaNumericMap.put(">", "greater");
+        nonAlphaNumericMap.put("/", "slash");
+        nonAlphaNumericMap.put("?", "question");
+
         lockingKeyListener = new LockingKeyListener();
         lockingKeyEventListener = EventListenerHelper.narrow( lockingKeyListener.tie());
 
@@ -139,8 +176,10 @@
 		code = (short) e.getKeyCode ();
 		timestamp = (int) e.getWhen ();
 
-		
-       //  System.err.println("deviceEventFromKeyEvent: device id = " + id + " " + string + " " + code + " " + modifiers);
+                String nonAlphaNumericString = (String) nonAlphaNumericMap.get(string);
+                if (nonAlphaNumericString != null) string = nonAlphaNumericString;
+
+	// System.err.println("deviceEventFromKeyEvent: device id = " + id + " " + string + " " + code + " " + modifiers);
 		return new DeviceEvent (type, id, code, modifiers, timestamp,
 					string, true);
 	}
@@ -198,6 +237,9 @@
 			modifiers |= (KeyMask.NUMLOCK.value());
         }
 
+                String nonAlphaNumericString = (String) nonAlphaNumericMap.get(string);
+                if (nonAlphaNumericString != null) string = nonAlphaNumericString;
+
         // System.err.println("coalescePressAndTyped: device id = " + id + " " + string + " " + pressEvent.getKeyCode () + " " + modifiers);
 		if (pressEvent.getKeyChar () == typedEvent.getKeyChar ()) 
 			return new DeviceEvent (EventType.KEY_PRESSED_EVENT, 
@@ -321,14 +363,15 @@
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_PAGE_UP),      new GNOMEKeyInfo( 0xFF9A, "KP_Page_Up" ) ); // GDK_KP_Page_Up
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_PAGE_DOWN),    new GNOMEKeyInfo( 0xFF9B, "KP_Page_Down" ) ); // GDK_KP_Page_Down
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_END),          new GNOMEKeyInfo( 0xFF9C, "KP_End" ) ); // GDK_KP_End
+        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_BEGIN),        new GNOMEKeyInfo( 0xFF9D, "KP_Begin" ) ); // GDK_KP_Begin
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_INSERT),       new GNOMEKeyInfo( 0xFF9E, "KP_Insert" ) ); // GDK_KP_Insert
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_DELETE),       new GNOMEKeyInfo( 0xFF9F, "KP_Delete" ) ); // GDK_KP_Delete
-        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_MULTIPLY),     new GNOMEKeyInfo( 0xFFAA, "*" ) ); // GDK_KP_Multiply
-        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_ADD),          new GNOMEKeyInfo( 0xFFAB, "+" ) ); // GDK_KP_Add
+        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_MULTIPLY),     new GNOMEKeyInfo( 0xFFAA, "KP_Multiply" ) ); // GDK_KP_Multiply
+        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_ADD),          new GNOMEKeyInfo( 0xFFAB, "KP_Add" ) ); // GDK_KP_Add
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_SEPARATOR),    new GNOMEKeyInfo( 0xFFAC, "KP_Separator" ) ); // GDK_KP_Separator
-        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_SUBTRACT),     new GNOMEKeyInfo( 0xFFAD, "-" ) ); // GDK_KP_Subtract
-        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_DECIMAL),      new GNOMEKeyInfo( 0xFFAE, "." ) ); // GDK_KP_Decimal
-        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_DIVIDE),       new GNOMEKeyInfo( 0xFFAF, "/" ) ); // GDK_KP_Divide
+        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_SUBTRACT),     new GNOMEKeyInfo( 0xFFAD, "KP_Subtract" ) ); // GDK_KP_Subtract
+        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_DECIMAL),      new GNOMEKeyInfo( 0xFFAE, "KP_Decimal" ) ); // GDK_KP_Decimal
+        keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_DIVIDE),       new GNOMEKeyInfo( 0xFFAF, "KP_Divide" ) ); // GDK_KP_Divide
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD0),      new GNOMEKeyInfo( 0xFFB0, "KP_0" ) ); // GDK_KP_0
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD1),      new GNOMEKeyInfo( 0xFFB1, "KP_1" ) ); // GDK_KP_1
         keyMap.put( new Integer(NUMPAD_OFFSET + KeyEvent.VK_NUMPAD2),      new GNOMEKeyInfo( 0xFFB2, "KP_2" ) ); // GDK_KP_2



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]