David 'Digit' Turner | 87250c2 | 2009-09-17 16:45:03 -0700 | [diff] [blame] | 1 | /* Copyright (C) 2009 The Android Open Source Project |
| 2 | ** |
| 3 | ** This software is licensed under the terms of the GNU General Public |
| 4 | ** License version 2, as published by the Free Software Foundation, and |
| 5 | ** may be copied, distributed, and modified under those terms. |
| 6 | ** |
| 7 | ** This program is distributed in the hope that it will be useful, |
| 8 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | ** GNU General Public License for more details. |
| 11 | */ |
| 12 | #ifndef ANDROID_KEYCODE_H |
| 13 | #define ANDROID_KEYCODE_H |
| 14 | |
| 15 | #include "linux_keycodes.h" |
| 16 | |
| 17 | /* Keep it consistent with linux/input.h */ |
| 18 | typedef enum { |
| 19 | kKeyCodeSoftLeft = KEY_SOFT1, |
| 20 | kKeyCodeSoftRight = KEY_SOFT2, |
| 21 | kKeyCodeHome = KEY_HOME, |
| 22 | kKeyCodeBack = KEY_BACK, |
| 23 | kKeyCodeCall = KEY_SEND, |
| 24 | kKeyCodeEndCall = KEY_END, |
| 25 | kKeyCode0 = KEY_0, |
| 26 | kKeyCode1 = KEY_1, |
| 27 | kKeyCode2 = KEY_2, |
| 28 | kKeyCode3 = KEY_3, |
| 29 | kKeyCode4 = KEY_4, |
| 30 | kKeyCode5 = KEY_5, |
| 31 | kKeyCode6 = KEY_6, |
| 32 | kKeyCode7 = KEY_7, |
| 33 | kKeyCode8 = KEY_8, |
| 34 | kKeyCode9 = KEY_9, |
| 35 | kKeyCodeStar = KEY_STAR, |
| 36 | kKeyCodePound = KEY_SHARP, |
| 37 | kKeyCodeDpadUp = KEY_UP, |
| 38 | kKeyCodeDpadDown = KEY_DOWN, |
| 39 | kKeyCodeDpadLeft = KEY_LEFT, |
| 40 | kKeyCodeDpadRight = KEY_RIGHT, |
| 41 | kKeyCodeDpadCenter = KEY_CENTER, |
| 42 | kKeyCodeVolumeUp = KEY_VOLUMEUP, |
| 43 | kKeyCodeVolumeDown = KEY_VOLUMEDOWN, |
| 44 | kKeyCodePower = KEY_POWER, |
| 45 | kKeyCodeCamera = KEY_CAMERA, |
| 46 | kKeyCodeClear = KEY_CLEAR, |
| 47 | kKeyCodeA = KEY_A, |
| 48 | kKeyCodeB = KEY_B, |
| 49 | kKeyCodeC = KEY_C, |
| 50 | kKeyCodeD = KEY_D, |
| 51 | kKeyCodeE = KEY_E, |
| 52 | kKeyCodeF = KEY_F, |
| 53 | kKeyCodeG = KEY_G, |
| 54 | kKeyCodeH = KEY_H, |
| 55 | kKeyCodeI = KEY_I, |
| 56 | kKeyCodeJ = KEY_J, |
| 57 | kKeyCodeK = KEY_K, |
| 58 | kKeyCodeL = KEY_L, |
| 59 | kKeyCodeM = KEY_M, |
| 60 | kKeyCodeN = KEY_N, |
| 61 | kKeyCodeO = KEY_O, |
| 62 | kKeyCodeP = KEY_P, |
| 63 | kKeyCodeQ = KEY_Q, |
| 64 | kKeyCodeR = KEY_R, |
| 65 | kKeyCodeS = KEY_S, |
| 66 | kKeyCodeT = KEY_T, |
| 67 | kKeyCodeU = KEY_U, |
| 68 | kKeyCodeV = KEY_V, |
| 69 | kKeyCodeW = KEY_W, |
| 70 | kKeyCodeX = KEY_X, |
| 71 | kKeyCodeY = KEY_Y, |
| 72 | kKeyCodeZ = KEY_Z, |
| 73 | |
| 74 | kKeyCodeComma = KEY_COMMA, |
| 75 | kKeyCodePeriod = KEY_DOT, |
| 76 | kKeyCodeAltLeft = KEY_LEFTALT, |
| 77 | kKeyCodeAltRight = KEY_RIGHTALT, |
| 78 | kKeyCodeCapLeft = KEY_LEFTSHIFT, |
| 79 | kKeyCodeCapRight = KEY_RIGHTSHIFT, |
| 80 | kKeyCodeTab = KEY_TAB, |
| 81 | kKeyCodeSpace = KEY_SPACE, |
| 82 | kKeyCodeSym = KEY_COMPOSE, |
| 83 | kKeyCodeExplorer = KEY_WWW, |
| 84 | kKeyCodeEnvelope = KEY_MAIL, |
| 85 | kKeyCodeNewline = KEY_ENTER, |
| 86 | kKeyCodeDel = KEY_BACKSPACE, |
| 87 | kKeyCodeGrave = 399, |
| 88 | kKeyCodeMinus = KEY_MINUS, |
| 89 | kKeyCodeEquals = KEY_EQUAL, |
| 90 | kKeyCodeLeftBracket = KEY_LEFTBRACE, |
| 91 | kKeyCodeRightBracket = KEY_RIGHTBRACE, |
| 92 | kKeyCodeBackslash = KEY_BACKSLASH, |
| 93 | kKeyCodeSemicolon = KEY_SEMICOLON, |
| 94 | kKeyCodeApostrophe = KEY_APOSTROPHE, |
| 95 | kKeyCodeSlash = KEY_SLASH, |
| 96 | kKeyCodeAt = KEY_EMAIL, |
| 97 | kKeyCodeNum = KEY_NUM, |
| 98 | kKeyCodeHeadsetHook = KEY_HEADSETHOOK, |
| 99 | kKeyCodeFocus = KEY_FOCUS, |
| 100 | kKeyCodePlus = KEY_PLUS, |
| 101 | kKeyCodeMenu = KEY_SOFT1, |
| 102 | kKeyCodeNotification = KEY_NOTIFICATION, |
| 103 | kKeyCodeSearch = KEY_SEARCH, |
| 104 | |
| 105 | } AndroidKeyCode; |
| 106 | |
| 107 | /* This function is used to rotate D-Pad keycodes, while leaving other ones |
| 108 | * untouched. 'code' is the input keycode, which will be returned as is if |
| 109 | * it doesn't correspond to a D-Pad arrow. 'rotation' is the number of |
| 110 | * *clockwise* 90 degrees rotations to perform on D-Pad keys. |
| 111 | * |
| 112 | * Here are examples: |
| 113 | * android_keycode_rotate( kKeyCodeDpadUp, 1 ) => kKeyCodeDpadRight |
| 114 | * android_keycode_rotate( kKeyCodeDpadRight, 2 ) => kKeyCodeDpadLeft |
| 115 | * android_keycode_rotate( kKeyCodeDpadDown, 3 ) => kKeyCodeDpadRight |
| 116 | * android_keycode_rotate( kKeyCodeSpace, n ) => kKeyCodeSpace independent of n |
| 117 | */ |
| 118 | extern AndroidKeyCode android_keycode_rotate( AndroidKeyCode code, int rotation ); |
| 119 | |
| 120 | #endif /* ANDROID_KEYCODE_H */ |