1 /* Copyright 2012 Mozilla Foundation and Mozilla contributors
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef GONKKEYMAPPING_H
17 #define GONKKEYMAPPING_H
19 #include "libui/android_keycodes.h"
20 #include "mozilla/EventForwards.h"
25 /* See libui/KeycodeLabels.h for the mapping */
26 static const unsigned long kKeyMapping
[] = {
33 NS_VK_SLEEP
, // ENDCALL
51 NS_VK_PAGE_UP
, // VOLUME_UP
52 NS_VK_PAGE_DOWN
, // VOLUME_DOWN
54 NS_VK_PRINTSCREEN
, // CAMERA
93 NS_VK_RETURN
, // ENTER
95 NS_VK_BACK_QUOTE
, // GRAVE
106 NS_VK_F1
, // HEADSETHOOK
112 0, // MEDIA_PLAY_PAUSE
117 0, // MEDIA_FAST_FORWARD
149 NS_VK_HOME
, // MOVE_HOME
189 // There are more but we don't map them
192 static KeyNameIndex
GetKeyNameIndex(int aKeyCode
)
195 #define NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX(aNativeKey, aKeyNameIndex) \
196 case aNativeKey: return aKeyNameIndex;
198 #include "NativeKeyToDOMKeyName.h"
200 #undef NS_NATIVE_KEY_TO_DOM_KEY_NAME_INDEX
241 case AKEYCODE_PERIOD
:
245 case AKEYCODE_EQUALS
:
246 case AKEYCODE_LEFT_BRACKET
:
247 case AKEYCODE_RIGHT_BRACKET
:
248 case AKEYCODE_BACKSLASH
:
249 case AKEYCODE_SEMICOLON
:
250 case AKEYCODE_APOSTROPHE
:
254 case AKEYCODE_NUMPAD_0
:
255 case AKEYCODE_NUMPAD_1
:
256 case AKEYCODE_NUMPAD_2
:
257 case AKEYCODE_NUMPAD_3
:
258 case AKEYCODE_NUMPAD_4
:
259 case AKEYCODE_NUMPAD_5
:
260 case AKEYCODE_NUMPAD_6
:
261 case AKEYCODE_NUMPAD_7
:
262 case AKEYCODE_NUMPAD_8
:
263 case AKEYCODE_NUMPAD_9
:
264 case AKEYCODE_NUMPAD_DIVIDE
:
265 case AKEYCODE_NUMPAD_MULTIPLY
:
266 case AKEYCODE_NUMPAD_SUBTRACT
:
267 case AKEYCODE_NUMPAD_ADD
:
268 case AKEYCODE_NUMPAD_DOT
:
269 case AKEYCODE_NUMPAD_COMMA
:
270 case AKEYCODE_NUMPAD_EQUALS
:
271 case AKEYCODE_NUMPAD_LEFT_PAREN
:
272 case AKEYCODE_NUMPAD_RIGHT_PAREN
:
273 return KEY_NAME_INDEX_USE_STRING
;
276 return KEY_NAME_INDEX_Unidentified
;
280 static CodeNameIndex
GetCodeNameIndex(int aScanCode
)
283 #define NS_NATIVE_KEY_TO_DOM_CODE_NAME_INDEX(aNativeKey, aCodeNameIndex) \
284 case aNativeKey: return aCodeNameIndex;
286 #include "NativeKeyToDOMCodeName.h"
288 #undef NS_NATIVE_KEY_TO_DOM_CODE_NAME_INDEX
291 return CODE_NAME_INDEX_UNKNOWN
;
295 } // namespace widget
296 } // namespace mozilla
298 #endif /* GONKKEYMAPPING_H */