From d6d4ebf19e46c77dd92181c9e81b5a196c250791 Mon Sep 17 00:00:00 2001 From: Rami Santina Date: Tue, 2 Aug 2011 17:33:26 +0300 Subject: Added accessibility events mapping to newt mapped gained focus event. used 0xFFFFFFFF for unmapped events --- .../newt/event/android/AndroidNewtEventFactory.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/newt/classes') diff --git a/src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java b/src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java index 77028c713..19588fc1f 100644 --- a/src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java +++ b/src/newt/classes/com/jogamp/newt/event/android/AndroidNewtEventFactory.java @@ -36,7 +36,7 @@ class AndroidNewtEventFactory { static { IntIntHashMap map = new IntIntHashMap(); - map.setKeyNotFoundValue(-1); + map.setKeyNotFoundValue(0xFFFFFFFF); map.put(android.view.KeyEvent.ACTION_DOWN, com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED); map.put(android.view.KeyEvent.ACTION_UP, com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED); @@ -51,6 +51,8 @@ class AndroidNewtEventFactory { map.put(android.view.MotionEvent.ACTION_POINTER_DOWN, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED_MINOR); map.put(android.view.MotionEvent.ACTION_POINTER_UP, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_PRESSED_MINOR); + map.put(android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_GAINED_FOCUS); + eventTypeANDROID2NEWT = map; } @@ -97,6 +99,14 @@ class AndroidNewtEventFactory { if (android.view.KeyEvent.KEYCODE_AT == androidKeyCode) return com.jogamp.newt.event.KeyEvent.VK_AT; return 0; } + + static final com.jogamp.newt.event.WindowEvent createWindowEvent(android.view.accessibility.AccessibilityEvent event, com.jogamp.newt.Window newtSource) { + int type = eventTypeANDROID2NEWT.get(event.getEventType()); + if(0xFFFFFFFF != type) { + return new com.jogamp.newt.event.WindowEvent(type, ((null==newtSource)?null:(Object)newtSource), event.getEventTime()); + } + return null; // no mapping .. + } public static final int androidKeyModifiers2Newt(int androidMods) { int newtMods = 0; @@ -109,7 +119,7 @@ class AndroidNewtEventFactory { static final com.jogamp.newt.event.KeyEvent createKeyEvent(android.view.KeyEvent event, com.jogamp.newt.Window newtSource) { int type = eventTypeANDROID2NEWT.get(event.getAction()); - if(-1 < type) { + if(0xFFFFFFFF != type) { return new com.jogamp.newt.event.KeyEvent( type, (null==newtSource)?null:(Object)newtSource, event.getEventTime(), androidKeyModifiers2Newt(event.getMetaState()), @@ -135,7 +145,7 @@ class AndroidNewtEventFactory { static final com.jogamp.newt.event.MouseEvent createMouseEvent(android.view.MotionEvent event, com.jogamp.newt.Window newtSource) { int type = eventTypeANDROID2NEWT.get(event.getAction()); - if(-1 < type) { + if(0xFFFFFFFF != type) { int rotation = 0; int clickCount = 1; int modifiers = 0; -- cgit v1.2.3