author | mickeyl <mickeyl> | 2005-02-04 14:39:34 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-02-04 14:39:34 (UTC) |
commit | 93f9fcf5bbcecaf8c7c4070e42676d24caa12d87 (patch) (side-by-side diff) | |
tree | ccd643cf2cdf2d211b5cba4d09e9cc6b9dbec381 /libopie2 | |
parent | 43213784ac3b6057f8c83f22604d75d0557e8c5a (diff) | |
download | opie-93f9fcf5bbcecaf8c7c4070e42676d24caa12d87.zip opie-93f9fcf5bbcecaf8c7c4070e42676d24caa12d87.tar.gz opie-93f9fcf5bbcecaf8c7c4070e42676d24caa12d87.tar.bz2 |
- add definitions for keys and buttons
- add isHeld( Key )
-rw-r--r-- | libopie2/opiecore/oinputsystem.cpp | 16 | ||||
-rw-r--r-- | libopie2/opiecore/oinputsystem.h | 38 | ||||
-rw-r--r-- | libopie2/opiecore/oinputsystemenums.h | 405 |
3 files changed, 424 insertions, 35 deletions
diff --git a/libopie2/opiecore/oinputsystem.cpp b/libopie2/opiecore/oinputsystem.cpp index 8253c18..29de35c 100644 --- a/libopie2/opiecore/oinputsystem.cpp +++ b/libopie2/opiecore/oinputsystem.cpp @@ -145,4 +145,5 @@ QString OInputDevice::uniq() const } + bool OInputDevice::hasFeature( Feature bit ) const { @@ -155,2 +156,17 @@ bool OInputDevice::hasFeature( Feature bit ) const } + +bool OInputDevice::isHeld( Key bit ) const +{ + BIT_MASK( keys, KEY_MAX ); + + if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 ) + { + perror( "EVIOCGKEY" ); + return false; + } + else + { + return BIT_TEST( keys, bit ); + } +} diff --git a/libopie2/opiecore/oinputsystem.h b/libopie2/opiecore/oinputsystem.h index 3746023..9020bc1 100644 --- a/libopie2/opiecore/oinputsystem.h +++ b/libopie2/opiecore/oinputsystem.h @@ -92,42 +92,9 @@ class OInputDevice : public QObject { public: - - enum Feature - { - Synchronous = EV_SYN, - Keys = EV_KEY, - Relative = EV_REL, - Absolute = EV_ABS, - Miscellaneous = EV_MSC, - Leds = EV_LED, - Sound = EV_SND, - AutoRepeat = EV_REP, - ForceFeedback = EV_FF, - PowerManagement = EV_PWR, - ForceFeedbackStatus = EV_FF_STATUS, - }; - - enum Bus - { - PCI = BUS_PCI, - ISAPNP = BUS_ISAPNP, - HIL = BUS_HIL, - BLUETOOTH = BUS_BLUETOOTH, - ISA = BUS_ISA, - I8042 = BUS_I8042, - XTKBD = BUS_XTKBD, - RS232 = BUS_RS232, - GAMEPORT = BUS_GAMEPORT, - PARPORT = BUS_PARPORT, - AMIGA = BUS_AMIGA, - ADB = BUS_ADB, - I2C = BUS_I2C, - HOST = BUS_HOST, - }; - - public: OInputDevice( QObject* parent, const char* name = 0 ); ~OInputDevice(); + #include "oinputsystemenums.h" + public: QString identity() const; @@ -135,4 +102,5 @@ class OInputDevice : public QObject QString uniq() const; bool hasFeature( Feature ) const; + bool isHeld( Key ) const; private: diff --git a/libopie2/opiecore/oinputsystemenums.h b/libopie2/opiecore/oinputsystemenums.h new file mode 100644 index 0000000..3461e5a --- a/dev/null +++ b/libopie2/opiecore/oinputsystemenums.h @@ -0,0 +1,405 @@ + + enum Feature + { + Synchronous = EV_SYN, + Keys = EV_KEY, + Relative = EV_REL, + Absolute = EV_ABS, + Miscellaneous = EV_MSC, + Leds = EV_LED, + Sound = EV_SND, + AutoRepeat = EV_REP, + ForceFeedback = EV_FF, + PowerManagement = EV_PWR, + ForceFeedbackStatus = EV_FF_STATUS, + }; + + enum Bus + { + PCI = BUS_PCI, + ISAPNP = BUS_ISAPNP, + HIL = BUS_HIL, + BLUETOOTH = BUS_BLUETOOTH, + ISA = BUS_ISA, + I8042 = BUS_I8042, + XTKBD = BUS_XTKBD, + RS232 = BUS_RS232, + GAMEPORT = BUS_GAMEPORT, + PARPORT = BUS_PARPORT, + AMIGA = BUS_AMIGA, + ADB = BUS_ADB, + I2C = BUS_I2C, + HOST = BUS_HOST, + }; + + enum Key + { + Key_RESERVED = 0, + Key_ESC = 1, + Key_1 = 2, + Key_2 = 3, + Key_3 = 4, + Key_4 = 5, + Key_5 = 6, + Key_6 = 7, + Key_7 = 8, + Key_8 = 9, + Key_9 = 10, + Key_0 = 11, + Key_MINUS = 12, + Key_EQUAL = 13, + Key_BACKSPACE = 14, + Key_TAB = 15, + Key_Q = 16, + Key_W = 17, + Key_E = 18, + Key_R = 19, + Key_T = 20, + Key_Y = 21, + Key_U = 22, + Key_I = 23, + Key_O = 24, + Key_P = 25, + Key_LEFTBRACE = 26, + Key_RIGHTBRACE = 27, + Key_ENTER = 28, + Key_LEFTCTRL = 29, + Key_A = 30, + Key_S = 31, + Key_D = 32, + Key_F = 33, + Key_G = 34, + Key_H = 35, + Key_J = 36, + Key_K = 37, + Key_L = 38, + Key_SEMICOLON = 39, + Key_APOSTROPHE = 40, + Key_GRAVE = 41, + Key_LEFTSHIFT = 42, + Key_BACKSLASH = 43, + Key_Z = 44, + Key_X = 45, + Key_C = 46, + Key_V = 47, + Key_B = 48, + Key_N = 49, + Key_M = 50, + Key_COMMA = 51, + Key_DOT = 52, + Key_SLASH = 53, + Key_RIGHTSHIFT = 54, + Key_KPASTERISK = 55, + Key_LEFTALT = 56, + Key_SPACE = 57, + Key_CAPSLOCK = 58, + Key_F1 = 59, + Key_F2 = 60, + Key_F3 = 61, + Key_F4 = 62, + Key_F5 = 63, + Key_F6 = 64, + Key_F7 = 65, + Key_F8 = 66, + Key_F9 = 67, + Key_F10 = 68, + Key_NUMLOCK = 69, + Key_SCROLLLOCK = 70, + Key_KP7 = 71, + Key_KP8 = 72, + Key_KP9 = 73, + Key_KPMINUS = 74, + Key_KP4 = 75, + Key_KP5 = 76, + Key_KP6 = 77, + Key_KPPLUS = 78, + Key_KP1 = 79, + Key_KP2 = 80, + Key_KP3 = 81, + Key_KP0 = 82, + Key_KPDOT = 83, + + Key_ZENKAKUHANKAKU = 85, + Key_102ND = 86, + Key_F11 = 87, + Key_F12 = 88, + Key_RO = 89, + Key_KATAKANA = 90, + Key_HIRAGANA = 91, + Key_HENKAN = 92, + Key_KATAKANAHIRAGANA = 93, + Key_MUHENKAN = 94, + Key_KPJPCOMMA = 95, + Key_KPENTER = 96, + Key_RIGHTCTRL = 97, + Key_KPSLASH = 98, + Key_SYSRQ = 99, + Key_RIGHTALT = 100, + Key_LINEFEED = 101, + Key_HOME = 102, + Key_UP = 103, + Key_PAGEUP = 104, + Key_LEFT = 105, + Key_RIGHT = 106, + Key_END = 107, + Key_DOWN = 108, + Key_PAGEDOWN = 109, + Key_INSERT = 110, + Key_DELETE = 111, + Key_MACRO = 112, + Key_MUTE = 113, + Key_VOLUMEDOWN = 114, + Key_VOLUMEUP = 115, + Key_POWER = 116, + Key_KPEQUAL = 117, + Key_KPPLUSMINUS = 118, + Key_PAUSE = 119, + + Key_KPCOMMA = 121, + Key_HANGUEL = 122, + Key_HANJA = 123, + Key_YEN = 124, + Key_LEFTMETA = 125, + Key_RIGHTMETA = 126, + Key_COMPOSE = 127, + + Key_STOP = 128, + Key_AGAIN = 129, + Key_PROPS = 130, + Key_UNDO = 131, + Key_FRONT = 132, + Key_COPY = 133, + Key_OPEN = 134, + Key_PASTE = 135, + Key_FIND = 136, + Key_CUT = 137, + Key_HELP = 138, + Key_MENU = 139, + Key_CALC = 140, + Key_SETUP = 141, + Key_SLEEP = 142, + Key_WAKEUP = 143, + Key_FILE = 144, + Key_SENDFILE = 145, + Key_DELETEFILE = 146, + Key_XFER = 147, + Key_PROG1 = 148, + Key_PROG2 = 149, + Key_WWW = 150, + Key_MSDOS = 151, + Key_COFFEE = 152, + Key_DIRECTION = 153, + Key_CYCLEWINDOWS = 154, + Key_MAIL = 155, + Key_BOOKMARKS = 156, + Key_COMPUTER = 157, + Key_BACK = 158, + Key_FORWARD = 159, + Key_CLOSECD = 160, + Key_EJECTCD = 161, + Key_EJECTCLOSECD = 162, + Key_NEXTSONG = 163, + Key_PLAYPAUSE = 164, + Key_PREVIOUSSONG = 165, + Key_STOPCD = 166, + Key_RECORD = 167, + Key_REWIND = 168, + Key_PHONE = 169, + Key_ISO = 170, + Key_CONFIG = 171, + Key_HOMEPAGE = 172, + Key_REFRESH = 173, + Key_EXIT = 174, + Key_MOVE = 175, + Key_EDIT = 176, + Key_SCROLLUP = 177, + Key_SCROLLDOWN = 178, + Key_KPLEFTPAREN = 179, + Key_KPRIGHTPAREN = 180, + + Key_F13 = 183, + Key_F14 = 184, + Key_F15 = 185, + Key_F16 = 186, + Key_F17 = 187, + Key_F18 = 188, + Key_F19 = 189, + Key_F20 = 190, + Key_F21 = 191, + Key_F22 = 192, + Key_F23 = 193, + Key_F24 = 194, + + Key_PLAYCD = 200, + Key_PAUSECD = 201, + Key_PROG3 = 202, + Key_PROG4 = 203, + Key_SUSPEND = 205, + Key_CLOSE = 206, + Key_PLAY = 207, + Key_FASTFORWARD = 208, + Key_BASSBOOST = 209, + Key_PRINT = 210, + Key_HP = 211, + Key_CAMERA = 212, + Key_SOUND = 213, + Key_QUESTION = 214, + Key_EMAIL = 215, + Key_CHAT = 216, + Key_SEARCH = 217, + Key_CONNECT = 218, + Key_FINANCE = 219, + Key_SPORT = 220, + Key_SHOP = 221, + Key_ALTERASE = 222, + Key_CANCEL = 223, + Key_BRIGHTNESSDOWN = 224, + Key_BRIGHTNESSUP = 225, + Key_MEDIA = 226, + + Key_UNKNOWN = 240, + + Button_MISC = 0x100, + Button_0 = 0x100, + Button_1 = 0x101, + Button_2 = 0x102, + Button_3 = 0x103, + Button_4 = 0x104, + Button_5 = 0x105, + Button_6 = 0x106, + Button_7 = 0x107, + Button_8 = 0x108, + Button_9 = 0x109, + + Button_MOUSE = 0x110, + Button_LEFT = 0x110, + Button_RIGHT = 0x111, + Button_MIDDLE = 0x112, + Button_SIDE = 0x113, + Button_EXTRA = 0x114, + Button_FORWARD = 0x115, + Button_BACK = 0x116, + Button_TASK = 0x117, + + Button_JOYSTICK = 0x120, + Button_TRIGGER = 0x120, + Button_THUMB = 0x121, + Button_THUMB2 = 0x122, + Button_TOP = 0x123, + Button_TOP2 = 0x124, + Button_PINKIE = 0x125, + Button_BASE = 0x126, + Button_BASE2 = 0x127, + Button_BASE3 = 0x128, + Button_BASE4 = 0x129, + Button_BASE5 = 0x12a, + Button_BASE6 = 0x12b, + Button_DEAD = 0x12f, + + Button_GAMEPAD = 0x130, + Button_A = 0x130, + Button_B = 0x131, + Button_C = 0x132, + Button_X = 0x133, + Button_Y = 0x134, + Button_Z = 0x135, + Button_TL = 0x136, + Button_TR = 0x137, + Button_TL2 = 0x138, + Button_TR2 = 0x139, + Button_SELECT = 0x13a, + Button_START = 0x13b, + Button_MODE = 0x13c, + Button_THUMBL = 0x13d, + Button_THUMBR = 0x13e, + + Button_DIGI = 0x140, + Button_TOOL_PEN = 0x140, + Button_TOOL_RUBBER = 0x141, + Button_TOOL_BRUSH = 0x142, + Button_TOOL_PENCIL = 0x143, + Button_TOOL_AIRBRUSH = 0x144, + Button_TOOL_FINGER = 0x145, + Button_TOOL_MOUSE = 0x146, + Button_TOOL_LENS = 0x147, + Button_TOUCH = 0x14a, + Button_STYLUS = 0x14b, + Button_STYLUS2 = 0x14c, + Button_TOOL_DOUBLETAP = 0x14d, + Button_TOOL_TRIPLETAP = 0x14e, + + Button_WHEEL = 0x150, + Button_GEAR_DOWN = 0x150, + Button_GEAR_UP = 0x151, + + Key_OK = 0x160, + Key_SELECT = 0x161, + Key_GOTO = 0x162, + Key_CLEAR = 0x163, + Key_POWER2 = 0x164, + Key_OPTION = 0x165, + Key_INFO = 0x166, + Key_TIME = 0x167, + Key_VENDOR = 0x168, + Key_ARCHIVE = 0x169, + Key_PROGRAM = 0x16a, + Key_CHANNEL = 0x16b, + Key_FAVORITES = 0x16c, + Key_EPG = 0x16d, + Key_PVR = 0x16e, + Key_MHP = 0x16f, + Key_LANGUAGE = 0x170, + Key_TITLE = 0x171, + Key_SUBTITLE = 0x172, + Key_ANGLE = 0x173, + Key_ZOOM = 0x174, + Key_MODE = 0x175, + Key_KEYBOARD = 0x176, + Key_SCREEN = 0x177, + Key_PC = 0x178, + Key_TV = 0x179, + Key_TV2 = 0x17a, + Key_VCR = 0x17b, + Key_VCR2 = 0x17c, + Key_SAT = 0x17d, + Key_SAT2 = 0x17e, + Key_CD = 0x17f, + Key_TAPE = 0x180, + Key_RADIO = 0x181, + Key_TUNER = 0x182, + Key_PLAYER = 0x183, + Key_TEXT = 0x184, + Key_DVD = 0x185, + Key_AUX = 0x186, + Key_MP3 = 0x187, + Key_AUDIO = 0x188, + Key_VIDEO = 0x189, + Key_DIRECTORY = 0x18a, + Key_LIST = 0x18b, + Key_MEMO = 0x18c, + Key_CALENDAR = 0x18d, + Key_RED = 0x18e, + Key_GREEN = 0x18f, + Key_YELLOW = 0x190, + Key_BLUE = 0x191, + Key_CHANNELUP = 0x192, + Key_CHANNELDOWN = 0x193, + Key_FIRST = 0x194, + Key_LAST = 0x195, + Key_AB = 0x196, + Key_NEXT = 0x197, + Key_RESTART = 0x198, + Key_SLOW = 0x199, + Key_SHUFFLE = 0x19a, + Key_BREAK = 0x19b, + Key_PREVIOUS = 0x19c, + Key_DIGITS = 0x19d, + Key_TEEN = 0x19e, + Key_TWEN = 0x19f, + + Key_DEL_EOL = 0x1c0, + Key_DEL_EOS = 0x1c1, + Key_INS_LINE = 0x1c2, + Key_DEL_LINE = 0x1c3, + }; + |