* Added a bit of code to Keymap that lets it load a keymap from disk; I might

unify the three or so version we have of that class into one in the not so
  distant future.
* Moved the AT keycode map into its own file.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36259 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-04-14 12:51:44 +00:00
parent d97b5913aa
commit 64e57f07ce
4 changed files with 396 additions and 337 deletions

View File

@ -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 <SupportDefs.h>
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

View File

@ -1,6 +1,6 @@
/* /*
* Copyright 2004-2006, Jérôme Duval. All rights reserved. * 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. * Copyright 2008-2009, Stephan Aßmus, superstippi@gmx.de.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
@ -23,6 +23,7 @@
#include <Path.h> #include <Path.h>
#include <String.h> #include <String.h>
#include "ATKeymap.h"
#include "kb_mouse_driver.h" #include "kb_mouse_driver.h"
@ -87,300 +88,6 @@ private:
const static uint32 kKeyboardThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4; const static uint32 kKeyboardThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4;
const static char* kKeyboardDevicesDirectory = "/dev/input/keyboard"; 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* extern "C" BInputServerDevice*
instantiate_input_device() instantiate_input_device()
@ -418,7 +125,8 @@ get_short_name(const char* longName)
KeyboardDevice::KeyboardDevice(KeyboardInputDevice* owner, const char* path) KeyboardDevice::KeyboardDevice(KeyboardInputDevice* owner, const char* path)
: BHandler("keyboard device"), :
BHandler("keyboard device"),
fOwner(owner), fOwner(owner),
fFD(-1), fFD(-1),
fThread(-1), fThread(-1),
@ -857,14 +565,13 @@ KeyboardDevice::_UpdateLEDs()
if (fFD < 0) if (fFD < 0)
return; return;
uint32 locks = fModifiers; char lockIO[3] = {0, 0, 0};
char lockIO[3];
memset(lockIO, 0, sizeof(lockIO)); if ((fModifiers & B_NUM_LOCK) != 0)
if (locks & B_NUM_LOCK)
lockIO[0] = 1; lockIO[0] = 1;
if (locks & B_CAPS_LOCK) if ((fModifiers & B_CAPS_LOCK) != 0)
lockIO[1] = 1; lockIO[1] = 1;
if (locks & B_SCROLL_LOCK) if ((fModifiers & B_SCROLL_LOCK) != 0)
lockIO[2] = 1; lockIO[2] = 1;
ioctl(fFD, KB_SET_LEDS, &lockIO); ioctl(fFD, KB_SET_LEDS, &lockIO);

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@ -13,8 +13,13 @@
#include <File.h> #include <File.h>
#include <InputServerTypes.h> #include <InputServerTypes.h>
#include <Message.h> #include <Message.h>
#include <input_globals.h> #ifdef CONSOLED
# include <FindDirectory.h>
#else
# include <input_globals.h>
#endif
#include <errno.h>
#include <new> #include <new>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -86,6 +91,7 @@ Keymap::Keymap()
: :
fChars(NULL) fChars(NULL)
{ {
#ifndef CONSOLED
key_map *keys; key_map *keys;
_get_key_map(&keys, &fChars, &fCharsSize); _get_key_map(&keys, &fChars, &fCharsSize);
@ -93,6 +99,7 @@ Keymap::Keymap()
memcpy(&fKeys, keys, sizeof(key_map)); memcpy(&fKeys, keys, sizeof(key_map));
free(keys); free(keys);
} }
#endif
} }
@ -437,7 +444,8 @@ Keymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey,
status_t status_t
Keymap::LoadCurrent() Keymap::LoadCurrent()
{ {
key_map *keys = NULL; #ifndef CONSOLED
key_map* keys = NULL;
free(fChars); free(fChars);
fChars = NULL; fChars = NULL;
@ -449,5 +457,43 @@ Keymap::LoadCurrent()
memcpy(&fKeys, keys, sizeof(fKeys)); memcpy(&fKeys, keys, sizeof(fKeys));
free(keys); free(keys);
return B_OK; 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
} }

View File

@ -1,43 +1,42 @@
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ /*
// * Copyright 2004, Haiku.
// Copyright (c) 2004, Haiku * Distributed under the terms of the MIT License.
// *
// This software is part of the Haiku distribution and is covered * Authors:
// by the Haiku license. * Jérôme Duval
// */
//
// File: Keymap.h
// Author: Jérôme Duval
// Description: Keyboard input server addon
// Created : September 7, 2004
//
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
#ifndef KEYMAP_H #ifndef KEYMAP_H
#define KEYMAP_H #define KEYMAP_H
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <Entry.h> #include <Entry.h>
class Keymap
{ class Keymap {
public: public:
Keymap(); Keymap();
~Keymap(); ~Keymap();
void DumpKeymap();
bool IsModifierKey(uint32 keyCode); void DumpKeymap();
uint32 Modifier(uint32 keyCode); bool IsModifierKey(uint32 keyCode);
uint32 KeyForModifier(uint32 modifier); uint32 Modifier(uint32 keyCode);
uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); uint32 KeyForModifier(uint32 modifier);
bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey); uint8 IsDeadKey(uint32 keyCode, uint32 modifiers);
void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); bool IsDeadSecondKey(uint32 keyCode,
uint32 Locks() { return fKeys.lock_settings; }; uint32 modifiers, uint8 activeDeadKey);
status_t LoadCurrent(); void GetChars(uint32 keyCode, uint32 modifiers,
uint8 activeDeadKey, char** chars,
int32* numBytes);
uint32 Locks() { return fKeys.lock_settings; };
status_t LoadCurrent();
private: private:
char *fChars; char* fChars;
key_map fKeys; key_map fKeys;
ssize_t fCharsSize; ssize_t fCharsSize;
}; };
#endif //KEYMAP_H #endif // KEYMAP_H