diff --git a/src/add-ons/input_server/devices/keyboard/ATKeymap.h b/src/add-ons/input_server/devices/keyboard/ATKeymap.h new file mode 100644 index 0000000000..230341014e --- /dev/null +++ b/src/add-ons/input_server/devices/keyboard/ATKeymap.h @@ -0,0 +1,307 @@ +/* + * Copyright 2004-2006, Jérôme Duval. All rights reserved. + * Copyright 2005-2010, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef AT_KEYMAP_H +#define AT_KEYMAP_H + + +#include + + +const static uint32 kATKeycodeMap[] = { + 0x1, // Esc + 0x12, // 1 + 0x13, // 2 + 0x14, // 3 + 0x15, // 4 + 0x16, // 5 + 0x17, // 6 + 0x18, // 7 + 0x19, // 8 + 0x1a, // 9 + 0x1b, // 0 + 0x1c, // - + 0x1d, // = + 0x1e, // BACKSPACE + 0x26, // TAB + 0x27, // Q + 0x28, // W + 0x29, // E + 0x2a, // R + 0x2b, // T + 0x2c, // Y + 0x2d, // U + 0x2e, // I + 0x2f, // O + 0x30, // P + 0x31, // [ + 0x32, // ] + 0x47, // ENTER + 0x5c, // Left Control + 0x3c, // A + 0x3d, // S + 0x3e, // D + 0x3f, // F + 0x40, // G + 0x41, // H + 0x42, // J + 0x43, // K + 0x44, // L + 0x45, // ; + 0x46, // ' + 0x11, // ` + 0x4b, // Left Shift + 0x33, // \ (backslash -- note: don't remove non-white-space after BS char) + 0x4c, // Z + 0x4d, // X + 0x4e, // C + 0x4f, // V + 0x50, // B + 0x51, // N + 0x52, // M + 0x53, // , + 0x54, // . + 0x55, // / + 0x56, // Right Shift + 0x24, // * + 0x5d, // Left Alt + 0x5e, // Space + 0x3b, // Caps + 0x02, // F1 + 0x03, // F2 + 0x04, // F3 + 0x05, // F4 + 0x06, // F5 + 0x07, // F6 + 0x08, // F7 + 0x09, // F8 + 0x0a, // F9 + 0x0b, // F10 + 0x22, // Num + 0x0f, // Scroll + 0x37, // KP 7 + 0x38, // KP 8 + 0x39, // KP 9 + 0x25, // KP - + 0x48, // KP 4 + 0x49, // KP 5 + 0x4a, // KP 6 + 0x3a, // KP + + 0x58, // KP 1 + 0x59, // KP 2 + 0x5a, // KP 3 + 0x64, // KP 0 + 0x65, // KP . + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x69, // < + 0x0c, // F11 + 0x0d, // F12 + 0x00, // UNMAPPED + 0x00, // UNMAPPED 90 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 100 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 110 + 0x00, // UNMAPPED + 0x6e, // Katakana/Hiragana, second key right to spacebar, japanese + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x6b, // Ro (\\ key, japanese) + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 120 + 0x6d, // Henkan, first key right to spacebar, japanese + 0x00, // UNMAPPED + 0x6c, // Muhenkan, key left to spacebar, japanese + 0x00, // UNMAPPED + 0x6a, // Yen (macron key, japanese) + 0x70, // Keypad . on Brazilian ABNT2 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 130 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 140 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 150 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x5b, // KP Enter + 0x60, // Right Control + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 160 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 170 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 180 + 0x23, // KP / + 0x00, // UNMAPPED + 0x0e, // Print Screen + 0x5f, // Right Alt + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 190 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x7f, // Break + 0x20, // Home + 0x57, // Up Arrow 200 + 0x21, // Page Up + 0x00, // UNMAPPED + 0x61, // Left Arrow + 0x00, // UNMAPPED + 0x63, // Right Arrow + 0x00, // UNMAPPED + 0x35, // End + 0x62, // Down Arrow + 0x36, // Page Down + 0x1f, // Insert 200 + 0x34, // Delete + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x66, // Left Gui + 0x67, // Right Gui 210 + 0x68, // Menu + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 220 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED +}; + + +#endif // AT_KEYMAP_H diff --git a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp index 5c0f485ecc..1af246c50a 100644 --- a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp +++ b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp @@ -1,6 +1,6 @@ /* * Copyright 2004-2006, Jérôme Duval. All rights reserved. - * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2005-2010, Axel Dörfler, axeld@pinc-software.de. * Copyright 2008-2009, Stephan Aßmus, superstippi@gmx.de. * * Distributed under the terms of the MIT License. @@ -23,6 +23,7 @@ #include #include +#include "ATKeymap.h" #include "kb_mouse_driver.h" @@ -87,300 +88,6 @@ private: const static uint32 kKeyboardThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4; const static char* kKeyboardDevicesDirectory = "/dev/input/keyboard"; -const static uint32 kATKeycodeMap[] = { - 0x1, // Esc - 0x12, // 1 - 0x13, // 2 - 0x14, // 3 - 0x15, // 4 - 0x16, // 5 - 0x17, // 6 - 0x18, // 7 - 0x19, // 8 - 0x1a, // 9 - 0x1b, // 0 - 0x1c, // - - 0x1d, // = - 0x1e, // BACKSPACE - 0x26, // TAB - 0x27, // Q - 0x28, // W - 0x29, // E - 0x2a, // R - 0x2b, // T - 0x2c, // Y - 0x2d, // U - 0x2e, // I - 0x2f, // O - 0x30, // P - 0x31, // [ - 0x32, // ] - 0x47, // ENTER - 0x5c, // Left Control - 0x3c, // A - 0x3d, // S - 0x3e, // D - 0x3f, // F - 0x40, // G - 0x41, // H - 0x42, // J - 0x43, // K - 0x44, // L - 0x45, // ; - 0x46, // ' - 0x11, // ` - 0x4b, // Left Shift - 0x33, // \ (backslash -- note: don't remove non-white-space after BS char) - 0x4c, // Z - 0x4d, // X - 0x4e, // C - 0x4f, // V - 0x50, // B - 0x51, // N - 0x52, // M - 0x53, // , - 0x54, // . - 0x55, // / - 0x56, // Right Shift - 0x24, // * - 0x5d, // Left Alt - 0x5e, // Space - 0x3b, // Caps - 0x02, // F1 - 0x03, // F2 - 0x04, // F3 - 0x05, // F4 - 0x06, // F5 - 0x07, // F6 - 0x08, // F7 - 0x09, // F8 - 0x0a, // F9 - 0x0b, // F10 - 0x22, // Num - 0x0f, // Scroll - 0x37, // KP 7 - 0x38, // KP 8 - 0x39, // KP 9 - 0x25, // KP - - 0x48, // KP 4 - 0x49, // KP 5 - 0x4a, // KP 6 - 0x3a, // KP + - 0x58, // KP 1 - 0x59, // KP 2 - 0x5a, // KP 3 - 0x64, // KP 0 - 0x65, // KP . - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x69, // < - 0x0c, // F11 - 0x0d, // F12 - 0x00, // UNMAPPED - 0x00, // UNMAPPED 90 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 100 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 110 - 0x00, // UNMAPPED - 0x6e, // Katakana/Hiragana, second key right to spacebar, japanese - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x6b, // Ro (\\ key, japanese) - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 120 - 0x6d, // Henkan, first key right to spacebar, japanese - 0x00, // UNMAPPED - 0x6c, // Muhenkan, key left to spacebar, japanese - 0x00, // UNMAPPED - 0x6a, // Yen (macron key, japanese) - 0x70, // Keypad . on Brazilian ABNT2 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 130 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 140 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 150 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x5b, // KP Enter - 0x60, // Right Control - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 160 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 170 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 180 - 0x23, // KP / - 0x00, // UNMAPPED - 0x0e, // Print Screen - 0x5f, // Right Alt - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 190 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x7f, // Break - 0x20, // Home - 0x57, // Up Arrow 200 - 0x21, // Page Up - 0x00, // UNMAPPED - 0x61, // Left Arrow - 0x00, // UNMAPPED - 0x63, // Right Arrow - 0x00, // UNMAPPED - 0x35, // End - 0x62, // Down Arrow - 0x36, // Page Down - 0x1f, // Insert 200 - 0x34, // Delete - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x66, // Left Gui - 0x67, // Right Gui 210 - 0x68, // Menu - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED 220 - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - 0x00, // UNMAPPED - -}; - extern "C" BInputServerDevice* instantiate_input_device() @@ -418,7 +125,8 @@ get_short_name(const char* longName) KeyboardDevice::KeyboardDevice(KeyboardInputDevice* owner, const char* path) - : BHandler("keyboard device"), + : + BHandler("keyboard device"), fOwner(owner), fFD(-1), fThread(-1), @@ -857,14 +565,13 @@ KeyboardDevice::_UpdateLEDs() if (fFD < 0) return; - uint32 locks = fModifiers; - char lockIO[3]; - memset(lockIO, 0, sizeof(lockIO)); - if (locks & B_NUM_LOCK) + char lockIO[3] = {0, 0, 0}; + + if ((fModifiers & B_NUM_LOCK) != 0) lockIO[0] = 1; - if (locks & B_CAPS_LOCK) + if ((fModifiers & B_CAPS_LOCK) != 0) lockIO[1] = 1; - if (locks & B_SCROLL_LOCK) + if ((fModifiers & B_SCROLL_LOCK) != 0) lockIO[2] = 1; ioctl(fFD, KB_SET_LEDS, &lockIO); diff --git a/src/add-ons/input_server/devices/keyboard/Keymap.cpp b/src/add-ons/input_server/devices/keyboard/Keymap.cpp index e75f2f5bd1..c7ca672f34 100644 --- a/src/add-ons/input_server/devices/keyboard/Keymap.cpp +++ b/src/add-ons/input_server/devices/keyboard/Keymap.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Haiku, Inc. All rights reserved. + * Copyright 2004-2010, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -13,8 +13,13 @@ #include #include #include -#include +#ifdef CONSOLED +# include +#else +# include +#endif +#include #include #include #include @@ -86,6 +91,7 @@ Keymap::Keymap() : fChars(NULL) { +#ifndef CONSOLED key_map *keys; _get_key_map(&keys, &fChars, &fCharsSize); @@ -93,6 +99,7 @@ Keymap::Keymap() memcpy(&fKeys, keys, sizeof(key_map)); free(keys); } +#endif } @@ -437,7 +444,8 @@ Keymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, status_t Keymap::LoadCurrent() { - key_map *keys = NULL; +#ifndef CONSOLED + key_map* keys = NULL; free(fChars); fChars = NULL; @@ -449,5 +457,43 @@ Keymap::LoadCurrent() memcpy(&fKeys, keys, sizeof(fKeys)); free(keys); return B_OK; +#else // CONSOLED + char path[PATH_MAX]; + status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, + path, sizeof(path)); + if (status != B_OK) + return status; + + strlcat(path, "/Key_map", sizeof(path)); + int file = open(path, O_RDONLY); + if (file < 0) + return errno; + + if (read(file, &fKeys, sizeof(fKeys)) < (ssize_t)sizeof(fKeys)) { + fprintf(stderr, "error reading keymap keys\n"); + return B_BAD_VALUE; + } + + for (uint32 i = 0; i < sizeof(fKeys) / 4; i++) + ((uint32*)&fKeys)[i] = B_BENDIAN_TO_HOST_INT32(((uint32*)&fKeys)[i]); + + if (read(file, &fCharsSize, sizeof(uint32)) < (ssize_t)sizeof(uint32)) { + fprintf(stderr, "error reading keymap size\n"); + return B_BAD_VALUE; + } + + fCharsSize = B_BENDIAN_TO_HOST_INT32(fCharsSize); + if (fCharsSize < 0) + return B_BAD_VALUE; + + fChars = new char[fCharsSize]; + + if (read(file, fChars, fCharsSize) < 0) { + fprintf(stderr, "error reading keymap chars\n"); + return B_ERROR; + } + + return B_OK; +#endif // CONSOLED } diff --git a/src/add-ons/input_server/devices/keyboard/Keymap.h b/src/add-ons/input_server/devices/keyboard/Keymap.h index ce981be314..478381d796 100644 --- a/src/add-ons/input_server/devices/keyboard/Keymap.h +++ b/src/add-ons/input_server/devices/keyboard/Keymap.h @@ -1,43 +1,42 @@ -// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ -// -// Copyright (c) 2004, Haiku -// -// This software is part of the Haiku distribution and is covered -// by the Haiku license. -// -// -// File: Keymap.h -// Author: Jérôme Duval -// Description: Keyboard input server addon -// Created : September 7, 2004 -// -// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ - +/* + * Copyright 2004, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Jérôme Duval + */ #ifndef KEYMAP_H #define KEYMAP_H + #include #include -class Keymap -{ + +class Keymap { public: - Keymap(); - ~Keymap(); - void DumpKeymap(); - bool IsModifierKey(uint32 keyCode); - uint32 Modifier(uint32 keyCode); - uint32 KeyForModifier(uint32 modifier); - uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); - bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey); - void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); - uint32 Locks() { return fKeys.lock_settings; }; - status_t LoadCurrent(); + Keymap(); + ~Keymap(); + + void DumpKeymap(); + bool IsModifierKey(uint32 keyCode); + uint32 Modifier(uint32 keyCode); + uint32 KeyForModifier(uint32 modifier); + uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); + bool IsDeadSecondKey(uint32 keyCode, + uint32 modifiers, uint8 activeDeadKey); + void GetChars(uint32 keyCode, uint32 modifiers, + uint8 activeDeadKey, char** chars, + int32* numBytes); + uint32 Locks() { return fKeys.lock_settings; }; + + status_t LoadCurrent(); + private: - char *fChars; - key_map fKeys; - ssize_t fCharsSize; + char* fChars; + key_map fKeys; + ssize_t fCharsSize; }; -#endif //KEYMAP_H +#endif // KEYMAP_H