summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-09-05 17:32:16 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-09-12 15:26:18 -0700
commit999f3362d50a753c1801d565766219808efdb1a5 (patch)
treed50b5c1583ccfeeb54a996a54428ba94b04213e8 /hw
parent6548a55ebdf43231a3c48debf54aa5aa2f1aa956 (diff)
XQuartz: Dead code removal
(cherry picked from commit 43184cd379c4fb7254391b8a362016cbf89b5529)
Diffstat (limited to 'hw')
-rw-r--r--hw/xquartz/X11Application.h1
-rw-r--r--hw/xquartz/X11Application.m8
-rw-r--r--hw/xquartz/X11Controller.m1
-rw-r--r--hw/xquartz/darwin.c88
-rw-r--r--hw/xquartz/darwin.h1
-rw-r--r--hw/xquartz/darwinEvents.c2
-rw-r--r--hw/xquartz/quartzKeyboard.c438
7 files changed, 5 insertions, 534 deletions
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index eaeb369a0..3d06a4553 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -82,7 +82,6 @@ extern int quartzHasRoot, quartzEnableRootless;
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
#define PREFS_SYSBEEP "enable_system_beep"
#define PREFS_KEYEQUIVS "enable_key_equivalents"
-#define PREFS_KEYMAP_FILE "keymap_file"
#define PREFS_SYNC_KEYMAP "sync_keymap"
#define PREFS_DEPTH "depth"
#define PREFS_NO_AUTH "no_auth"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index ef5f0249f..0ce495148 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -171,7 +171,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
DarwinSendDDXEvent(kXquartzActivate, 0);
if (!_x_active) {
- if (x11_document == 0 && darwinKeymapFile == NULL) {
+ if (x11_document == 0) {
OSType types[1];
types[0] = kUnicodeDocument;
NewTSMDocument (1, types, &x11_document, 0);
@@ -667,11 +667,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP
default:darwinSyncKeymap];
-
- tem = [self prefs_get_string:@PREFS_KEYMAP_FILE default:NULL];
- if (tem != NULL) darwinKeymapFile = strdup (tem);
- else darwinKeymapFile = NULL;
-
+
darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
default:darwinDesiredDepth];
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index e06747596..3c12ea78b 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -648,7 +648,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[use_sysbeep setIntValue:quartzUseSysBeep];
[enable_keyequivs setIntValue:X11EnableKeyEquivalents];
[sync_keymap setIntValue:darwinSyncKeymap];
- [sync_keymap setEnabled:darwinKeymapFile == NULL];
[click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]];
[focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]];
[focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]];
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 0a950359e..0788d16fa 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -62,9 +62,7 @@
#include <sys/utsname.h>
#define NO_CFPLUGIN
-#include <IOKit/IOKitLib.h>
#include <IOKit/hidsystem/IOHIDLib.h>
-#include <IOKit/hidsystem/ev_keymap.h>
#ifdef MITSHM
#define _XSHM_SERVER_
@@ -101,7 +99,6 @@ int darwinMainScreenY = 0;
unsigned int darwinDesiredWidth = 0, darwinDesiredHeight = 0;
int darwinDesiredDepth = -1;
int darwinDesiredRefresh = -1;
-char *darwinKeymapFile = "USA.keymapping";
int darwinSyncKeymap = FALSE;
// modifier masks for faking mouse buttons - ANY of these bits trigger it (not all)
@@ -433,62 +430,6 @@ static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff )
*/
/*
- * DarwinFindLibraryFile
- * Search for a file in the standard Library paths, which are (in order):
- *
- * ~/Library/ user specific
- * /Library/ host specific
- * /Network/Library/ LAN specific
- * /System/Library/ OS specific
- *
- * A sub-path can be specified to search in below the various Library
- * directories. Returns a new character string (owned by the caller)
- * containing the full path to the first file found.
- */
-static char * DarwinFindLibraryFile(
- const char *file,
- const char *pathext )
-{
- // Library search paths
- char *pathList[] = {
- "",
- "/Network",
- "/System",
- NULL
- };
- char *home;
- char *fullPath;
- int i = 0;
-
- // Return the file name as is if it is already a fully qualified path.
- if (!access(file, F_OK)) {
- fullPath = xalloc(strlen(file)+1);
- strcpy(fullPath, file);
- return fullPath;
- }
-
- fullPath = xalloc(PATH_MAX);
-
- home = getenv("HOME");
- if (home) {
- snprintf(fullPath, PATH_MAX, "%s/Library/%s/%s", home, pathext, file);
- if (!access(fullPath, F_OK))
- return fullPath;
- }
-
- while (pathList[i]) {
- snprintf(fullPath, PATH_MAX, "%s/Library/%s/%s", pathList[i++],
- pathext, file);
- if (!access(fullPath, F_OK))
- return fullPath;
- }
-
- xfree(fullPath);
- return NULL;
-}
-
-
-/*
* DarwinParseModifierList
* Parse a list of modifier names and return a corresponding modifier mask
*/
@@ -681,18 +622,6 @@ void OsVendorInit(void)
}
#endif
}
- // DEBUG_LOG("Xquartz started at %s\n", ctime(time(NULL)));
-
- // Find the full path to the keymapping file.
- if ( darwinKeymapFile ) {
- char *tempStr = DarwinFindLibraryFile(darwinKeymapFile, "Keyboards");
- if ( !tempStr ) {
- ErrorF("Could not find keymapping file %s.\n", darwinKeymapFile);
- } else {
- ErrorF("Using keymapping provided in %s.\n", tempStr);
- }
- darwinKeymapFile = tempStr;
- }
}
@@ -757,19 +686,6 @@ int ddxProcessArgument( int argc, char *argv[], int i )
return 2;
}
- if ( !strcmp( argv[i], "-keymap" ) ) {
- if ( i == argc-1 ) {
- FatalError( "-keymap must be followed by a filename\n" );
- }
- darwinKeymapFile = argv[i+1];
- return 2;
- }
-
- if ( !strcmp( argv[i], "-nokeymap" ) ) {
- darwinKeymapFile = NULL;
- return 1;
- }
-
if ( !strcmp( argv[i], "+synckeymap" ) ) {
darwinSyncKeymap = TRUE;
return 1;
@@ -853,12 +769,8 @@ void ddxUseMsg( void )
ErrorF("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n");
ErrorF("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n");
ErrorF(" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n");
- ErrorF("-keymap <file> : read the keymapping from a file instead of the kernel.\n");
ErrorF("-version : show the server version.\n");
ErrorF("\n");
-// ErrorF("Quartz modes (Experimental / In Development):\n");
-// ErrorF("-fullscreen : run full screen in parallel with Mac OS X window server.\n");
-// ErrorF("-rootless : run rootless inside Mac OS X window server.\n");
ErrorF("\n");
ErrorF("Options ignored in rootless mode:\n");
ErrorF("-size <height> <width> : use a screen resolution of <height> x <width>.\n");
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 3fac20330..da5ad74a1 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -84,7 +84,6 @@ extern int darwinFakeMouse2Mask;
extern int darwinFakeMouse3Mask;
extern int darwinAppKitModMask;
extern int windowItemModMask;
-extern char *darwinKeymapFile;
extern int darwinSyncKeymap;
extern unsigned int darwinDesiredWidth, darwinDesiredHeight;
extern int darwinDesiredDepth;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 135e41920..1db61d9e4 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -473,7 +473,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
return;
}
- if (darwinSyncKeymap && darwinKeymapFile == NULL) {
+ if (darwinSyncKeymap) {
/* See if keymap has changed. */
static unsigned int last_seed;
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 264f6f8ed..cee582bbe 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -5,9 +5,6 @@
Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
- The code to parse the Darwin keymap is derived from dumpkeymap.c
- by Eric Sunshine, which includes the following copyright:
-
Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com>
All rights reserved.
@@ -40,9 +37,6 @@
#include <dix-config.h>
#endif
-// Define this to get a diagnostic output to stderr which is helpful
-// in determining how the X server is interpreting the Darwin keymap.
-#define DUMP_DARWIN_KEYMAP
//#define XQUARTZ_USE_XKB
#define HACK_MISSING 1
#define HACK_KEYPAD 1
@@ -310,8 +304,6 @@ const static struct {
};
darwinKeyboardInfo keyInfo;
-static FILE *fref = NULL;
-static char *inBuffer = NULL;
static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
{
@@ -320,411 +312,10 @@ static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
}
//-----------------------------------------------------------------------------
-// Data Stream Object
-// Can be configured to treat embedded "numbers" as being composed of
-// either 1, 2, or 4 bytes, apiece.
-//-----------------------------------------------------------------------------
-typedef struct _DataStream {
- unsigned char const *data;
- unsigned char const *data_end;
- short number_size; // Size in bytes of a "number" in the stream.
-} DataStream;
-
-static DataStream* new_data_stream(unsigned char const* data, int size) {
- DataStream* s = (DataStream*)xalloc( sizeof(DataStream) );
- if(s) {
- s->data = data;
- s->data_end = data + size;
- s->number_size = 1; // Default to byte-sized numbers.
- }
- return s;
-}
-
-static void destroy_data_stream(DataStream* s) {
- xfree(s);
-}
-
-static unsigned char get_byte(DataStream* s) {
- assert(s->data + 1 <= s->data_end);
- return *s->data++;
-}
-
-static short get_word(DataStream* s) {
- short hi, lo;
- assert(s->data + 2 <= s->data_end);
- hi = *s->data++;
- lo = *s->data++;
- return ((hi << 8) | lo);
-}
-
-static int get_dword(DataStream* s) {
- int b1, b2, b3, b4;
- assert(s->data + 4 <= s->data_end);
- b4 = *s->data++;
- b3 = *s->data++;
- b2 = *s->data++;
- b1 = *s->data++;
- return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
-}
-
-static int get_number(DataStream* s) {
- switch (s->number_size) {
- case 4: return get_dword(s);
- case 2: return get_word(s);
- default: return get_byte(s);
- }
-}
-
-//-----------------------------------------------------------------------------
// Utility functions to help parse Darwin keymap
//-----------------------------------------------------------------------------
/*
- * bits_set
- * Calculate number of bits set in the modifier mask.
- */
-static short bits_set(short mask) {
- short n = 0;
-
- for ( ; mask != 0; mask >>= 1)
- if ((mask & 0x01) != 0)
- n++;
- return n;
-}
-
-/*
- * parse_next_char_code
- * Read the next character code from the Darwin keymapping
- * and write it to the X keymap.
- */
-static void parse_next_char_code(DataStream *s, KeySym *k) {
- const short charSet = get_number(s);
- const short charCode = get_number(s);
-
- if (charSet == 0) { // ascii character
- if (charCode >= 0 && charCode < 256)
- *k = next_to_x[charCode];
- } else if (charSet == 0x01) { // symbol character
- if (charCode >= MIN_SYMBOL &&
- charCode <= MIN_SYMBOL + NUM_SYMBOL)
- *k = symbol_to_x[charCode - MIN_SYMBOL];
- } else if (charSet == 0xFE) { // function key
- if (charCode >= MIN_FUNCKEY &&
- charCode <= MIN_FUNCKEY + NUM_FUNCKEY)
- *k = funckey_to_x[charCode - MIN_FUNCKEY];
- }
-}
-
-
-/*
- * DarwinReadKeymapFile
- * Read the appropriate keymapping from a keymapping file.
- */
-static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
- struct stat st;
- NXEventSystemDevice info[20];
- int interface = 0, handler_id = 0;
- int map_interface, map_handler_id, map_size = 0;
- unsigned int i, size;
- int *bufferEnd;
- union km_tag {
- int *intP;
- char *charP;
- } km;
-
- fref = fopen( darwinKeymapFile, "rb" );
- if (fref == NULL) {
- ErrorF("Unable to open keymapping file '%s': %s.\n",
- darwinKeymapFile, strerror(errno));
- return FALSE;
- }
- if (fstat(fileno(fref), &st) == -1) {
- ErrorF("Could not stat keymapping file '%s': %s.\n",
- darwinKeymapFile, strerror(errno));
- return FALSE;
- }
-
- // check to make sure we don't crash later
- if (st.st_size <= 16*sizeof(int)) {
- ErrorF("Keymapping file '%s' is invalid (too small).\n",
- darwinKeymapFile);
- return FALSE;
- }
-
- inBuffer = (char*) xalloc( st.st_size );
- bufferEnd = (int *) (inBuffer + st.st_size);
- if (fread(inBuffer, st.st_size, 1, fref) != 1) {
- ErrorF("Could not read %qd bytes from keymapping file '%s': %s.\n",
- st.st_size, darwinKeymapFile, strerror(errno));
- return FALSE;
- }
-
- if (strncmp( inBuffer, "KYM1", 4 ) == 0) {
- // Magic number OK.
- } else if (strncmp( inBuffer, "KYMP", 4 ) == 0) {
- ErrorF("Keymapping file '%s' is intended for use with the original NeXT keyboards and cannot be used by XDarwin.\n", darwinKeymapFile);
- return FALSE;
- } else {
- ErrorF("Keymapping file '%s' has a bad magic number and cannot be used by XDarwin.\n", darwinKeymapFile);
- return FALSE;
- }
-
- // find the keyboard interface and handler id
- size = sizeof( info ) / sizeof( int );
- if (!NXEventSystemInfo( darwinParamConnect, NX_EVS_DEVICE_INFO,
- (NXEventSystemInfoType) info, &size )) {
- ErrorF("Error reading event status driver info.\n");
- return FALSE;
- }
-
- size = size * sizeof( int ) / sizeof( info[0] );
- for( i = 0; i < size; i++) {
- if (info[i].dev_type == NX_EVS_DEVICE_TYPE_KEYBOARD) {
- Bool hasInterface = FALSE;
- Bool hasMatch = FALSE;
-
- interface = info[i].interface;
- handler_id = info[i].id;
-
- // Find an appropriate keymapping:
- // The first time we try to match both interface and handler_id.
- // If we can't match both, we take the first match for interface.
-
- do {
- km.charP = inBuffer;
- km.intP++;
- while (km.intP+3 < bufferEnd) {
- map_interface = NXSwapBigIntToHost(*(km.intP++));
- map_handler_id = NXSwapBigIntToHost(*(km.intP++));
- map_size = NXSwapBigIntToHost(*(km.intP++));
- if (map_interface == interface) {
- if (map_handler_id == handler_id || hasInterface) {
- hasMatch = TRUE;
- break;
- } else {
- hasInterface = TRUE;
- }
- }
- km.charP += map_size;
- }
- } while (hasInterface && !hasMatch);
-
- if (hasMatch) {
- // fill in NXKeyMapping structure
- keyMap->size = map_size;
- keyMap->mapping = (char*) xalloc(map_size);
- memcpy(keyMap->mapping, km.charP, map_size);
- return TRUE;
- }
- } // if dev_id == keyboard device
- } // foreach info struct
-
- // The keymapping file didn't match any of the info structs
- // returned by NXEventSystemInfo.
- ErrorF("Keymapping file '%s' did not contain appropriate keyboard interface.\n", darwinKeymapFile);
- return FALSE;
-}
-
-
-/*
- * DarwinParseNXKeyMapping
- */
-static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) {
- KeySym *k;
- int i;
- short numMods, numKeys, numPadKeys = 0;
- Bool haveKeymap = FALSE;
- NXKeyMapping keyMap;
- DataStream *keyMapStream;
- unsigned char const *numPadStart = 0;
-
- if (darwinKeymapFile) {
- haveKeymap = DarwinReadKeymapFile(&keyMap);
- if (fref)
- fclose(fref);
- if (inBuffer)
- xfree(inBuffer);
- if (!haveKeymap) {
- ErrorF("Reverting to kernel keymapping.\n");
- }
- }
-
- if (!haveKeymap) {
- // get the Darwin keyboard map
- keyMap.size = NXKeyMappingLength( darwinParamConnect );
- keyMap.mapping = (char*) xalloc( keyMap.size );
- if (!NXGetKeyMapping( darwinParamConnect, &keyMap )) {
- return FALSE;
- }
- }
-
- keyMapStream = new_data_stream( (unsigned char const*)keyMap.mapping,
- keyMap.size );
-
- // check the type of map
- if (get_word(keyMapStream)) {
- keyMapStream->number_size = 2;
- ErrorF("Current 16-bit keymapping may not be interpreted correctly.\n");
- }
-
- // Insert X modifier KeySyms into the keyboard map.
- numMods = get_number(keyMapStream);
- while (numMods-- > 0) {
- int left = 1; // first keycode is left
- short const charCode = get_number(keyMapStream);
- short numKeyCodes = get_number(keyMapStream);
-
- // This is just a marker, not a real modifier.
- // Store numeric keypad keys for later.
- if (charCode == NX_MODIFIERKEY_NUMERICPAD) {
- numPadStart = keyMapStream->data;
- numPadKeys = numKeyCodes;
- }
-
- while (numKeyCodes-- > 0) {
- const short keyCode = get_number(keyMapStream);
- if (charCode != NX_MODIFIERKEY_NUMERICPAD) {
- switch (charCode) {
- case NX_MODIFIERKEY_ALPHALOCK:
- info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Caps_Lock;
- break;
- case NX_MODIFIERKEY_SHIFT:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Shift_L : XK_Shift_R);
- break;
- case NX_MODIFIERKEY_CONTROL:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Control_L : XK_Control_R);
- break;
- case NX_MODIFIERKEY_ALTERNATE:
- // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Alt_L : XK_Alt_R);
- break;
- case NX_MODIFIERKEY_COMMAND:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Meta_L : XK_Meta_R);
- break;
- case NX_MODIFIERKEY_SECONDARYFN:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Control_L : XK_Control_R);
- break;
- case NX_MODIFIERKEY_HELP:
- // Help is not an X11 modifier; treat as normal key
- info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Help;
- break;
- }
- }
- left = 0;
- }
- }
-
- // Convert the Darwin keyboard mapping to an X keyboard map.
- // A key can have a different character code for each combination of
- // modifiers. We currently ignore all modifier combinations except
- // those with Shift, AlphaLock, and Alt.
- numKeys = get_number(keyMapStream);
- for (i = 0, k = info->keyMap; i < numKeys; i++, k += GLYPHS_PER_KEY) {
- short const charGenMask = get_number(keyMapStream);
- if (charGenMask != 0xFF) { // is key bound?
- short numKeyCodes = 1 << bits_set(charGenMask);
-
- // Record unmodified case
- parse_next_char_code( keyMapStream, k );
- numKeyCodes--;
-
- // If AlphaLock and Shift modifiers produce different codes,
- // we record the Shift case since X handles AlphaLock.
- if (charGenMask & 0x01) { // AlphaLock
- parse_next_char_code( keyMapStream, k+1 );
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Shift
- parse_next_char_code( keyMapStream, k+1 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Shift-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
-
- // Skip the Control cases
- if (charGenMask & 0x04) { // Control
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Control-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Control-Shift
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Shift-Control-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
- }
-
- // Process Alt cases
- if (charGenMask & 0x08) { // Alt
- parse_next_char_code( keyMapStream, k+2 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Alt-AlphaLock
- parse_next_char_code( keyMapStream, k+3 );
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Alt-Shift
- parse_next_char_code( keyMapStream, k+3 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Alt-Shift-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
- }
-
- while (numKeyCodes-- > 0) {
- get_number(keyMapStream); get_number(keyMapStream);
- }
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-
- // Now we have to go back through the list of keycodes that are on the
- // numeric keypad and update the X keymap.
- keyMapStream->data = numPadStart;
- while(numPadKeys-- > 0) {
- const short keyCode = get_number(keyMapStream);
- k = &info->keyMap[keyCode * GLYPHS_PER_KEY];
- for (i = 0; i < NUM_KEYPAD; i++) {
- if (*k == normal_to_keypad[i].normalSym) {
- k[0] = normal_to_keypad[i].keypadSym;
- break;
- }
- }
- }
-
- // free Darwin keyboard map
- destroy_data_stream( keyMapStream );
- xfree( keyMap.mapping );
-
- return TRUE;
-}
-
-/*
* DarwinBuildModifierMaps
* Use the keyMap field of keyboard info structure to populate
* the modMap and modifierKeycodes fields.
@@ -822,37 +413,12 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
- /* TODO: Clean this up
- * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c
- * DarwinParseNXKeyMapping is here
- */
- if (!DarwinParseNXKeyMapping(&keyInfo)) {
- DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n");
- if (!QuartzReadSystemKeymap(&keyInfo)) {
- FatalError("Could not build a valid keymap.");
- }
+ if (!QuartzReadSystemKeymap(&keyInfo)) {
+ FatalError("Could not build a valid keymap.");
}
DarwinBuildModifierMaps(&keyInfo);
-#ifdef DUMP_DARWIN_KEYMAP
- int i;
- KeySym *k;
- DEBUG_LOG("Darwin -> X converted keyboard map\n");
- for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES;
- i++, k += GLYPHS_PER_KEY)
- {
- int j;
- for (j = 0; j < GLYPHS_PER_KEY; j++) {
- if (k[j] == NoSymbol) {
- DEBUG_LOG("0x%02x:\tNoSym\n", i);
- } else {
- DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]);
- }
- }
- }
-#endif
-
keySyms->map = keyInfo.keyMap;
keySyms->mapWidth = GLYPHS_PER_KEY;
keySyms->minKeyCode = MIN_KEYCODE;