diff options
author | Jeremy Huddleston <jeremy@yuffie.local> | 2007-11-28 23:07:41 -0800 |
---|---|---|
committer | Jeremy Huddleston <jeremy@yuffie.local> | 2007-11-29 02:21:16 -0800 |
commit | 38397560612424b5b348f34c1a0bea8c47a574be (patch) | |
tree | 61a3546a0ac9f3476908847fb0058c829e586b13 | |
parent | 89c3dfe41e3a17a4f27b20e23623dc5777670feb (diff) |
Darwin: Removed support for darwinSwapAltMeta
(cherry picked from commit 3d153c8fa40986d194b7701f5eafa0080e32399a)
-rw-r--r-- | hw/darwin/darwin.c | 6 | ||||
-rw-r--r-- | hw/darwin/darwin.h | 3 | ||||
-rw-r--r-- | hw/darwin/darwinKeyboard.c | 123 | ||||
-rw-r--r-- | hw/darwin/quartz/X11Application.m | 3 |
4 files changed, 35 insertions, 100 deletions
diff --git a/hw/darwin/darwin.c b/hw/darwin/darwin.c index b08770c10..87edd9a71 100644 --- a/hw/darwin/darwin.c +++ b/hw/darwin/darwin.c @@ -100,7 +100,6 @@ int darwinDesiredDepth = -1; int darwinDesiredRefresh = -1; char *darwinKeymapFile = "USA.keymapping"; int darwinSyncKeymap = FALSE; -int darwinSwapAltMeta = FALSE; // modifier masks for faking mouse buttons int darwinFakeMouse2Mask = NX_ALTERNATEMASK; @@ -766,11 +765,6 @@ int ddxProcessArgument( int argc, char *argv[], int i ) return 2; } - if ( !strcmp( argv[i], "-swapAltMeta" ) ) { - darwinSwapAltMeta = 1; - return 1; - } - if ( !strcmp( argv[i], "-keymap" ) ) { if ( i == argc-1 ) { FatalError( "-keymap must be followed by a filename\n" ); diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h index e2e482955..4f118470f 100644 --- a/hw/darwin/darwin.h +++ b/hw/darwin/darwin.h @@ -27,7 +27,7 @@ #ifndef _DARWIN_H #define _DARWIN_H -// #include "dix-config.h" // This makes us crash for some reason... +//#include "dix-config.h" // This crashes us for some reason... #define SHAPE #include <IOKit/IOTypes.h> @@ -113,7 +113,6 @@ extern int darwinMouseAccelChange; extern int darwinFakeButtons; extern int darwinFakeMouse2Mask; extern int darwinFakeMouse3Mask; -extern int darwinSwapAltMeta; extern char *darwinKeymapFile; extern int darwinSyncKeymap; extern unsigned int darwinDesiredWidth, darwinDesiredHeight; diff --git a/hw/darwin/darwinKeyboard.c b/hw/darwin/darwinKeyboard.c index 47acb65c5..b51e2da5b 100644 --- a/hw/darwin/darwinKeyboard.c +++ b/hw/darwin/darwinKeyboard.c @@ -58,10 +58,7 @@ // Define this to get a diagnostic output to stderr which is helpful // in determining how the X server is interpreting the Darwin keymap. -#undef DUMP_DARWIN_KEYMAP - -/* Define this to use Alt for Mode_switch. */ -//#define ALT_IS_MODE_SWITCH 1 +#define DUMP_DARWIN_KEYMAP #include <stdio.h> #include <stdlib.h> @@ -77,9 +74,6 @@ #define MetaMask Mod2Mask #define FunctionMask Mod3Mask -// FIXME: It would be nice to support some of the extra keys in XF86keysym.h, -// at least the volume controls that now ship on every Apple keyboard. - #define UK(a) NoSymbol // unknown symbol static KeySym const next_to_x[256] = { @@ -513,7 +507,7 @@ Bool DarwinParseNXKeyMapping( break; case NX_MODIFIERKEY_ALTERNATE: info->keyMap[keyCode * GLYPHS_PER_KEY] = - (left ? XK_Mode_switch : XK_Alt_R); + (left ? XK_Alt_L : XK_Alt_R); break; case NX_MODIFIERKEY_COMMAND: info->keyMap[keyCode * GLYPHS_PER_KEY] = @@ -638,27 +632,23 @@ Bool DarwinParseNXKeyMapping( return TRUE; } - /* * DarwinBuildModifierMaps * Use the keyMap field of keyboard info structure to populate * the modMap and modifierKeycodes fields. */ static void -DarwinBuildModifierMaps( - darwinKeyboardInfo *info) -{ +DarwinBuildModifierMaps(darwinKeyboardInfo *info) { int i; KeySym *k; memset(info->modMap, NoSymbol, sizeof(info->modMap)); memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes)); - for (i = 0; i < NUM_KEYCODES; i++) - { + for (i = 0; i < NUM_KEYCODES; i++) { k = info->keyMap + i * GLYPHS_PER_KEY; - switch (k[0]) { + switch (*k) { case XK_Shift_L: info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i; info->modMap[MIN_KEYCODE + i] = ShiftMask; @@ -728,34 +718,9 @@ DarwinBuildModifierMaps( info->modMap[MIN_KEYCODE + i] = Mod3Mask; break; } - - if (darwinSwapAltMeta) - { - switch (k[0]) - { - case XK_Alt_L: - k[0] = XK_Meta_L; - break; - case XK_Alt_R: - k[0] = XK_Meta_R; - break; - case XK_Meta_L: - k[0] = XK_Alt_L; - break; - case XK_Meta_R: - k[0] = XK_Alt_R; - break; - } - } - -#if ALT_IS_MODE_SWITCH - if (k[0] == XK_Alt_L) - k[0] = XK_Mode_switch; -#endif } } - /* * DarwinLoadKeyboardMapping * Load the keyboard map from a file or system and convert @@ -764,9 +729,17 @@ DarwinBuildModifierMaps( static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) { + int i; + KeySym *k; + memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap)); + /* TODO: Clean this up + * DarwinModeReadSystemKeymap is in quartz/quartzKeyboard.c + * DarwinParseNXKeyMapping is here + */ if (!DarwinParseNXKeyMapping(&keyInfo)) { + DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running DarwinModeReadSystemKeymap().\n"); if (!DarwinModeReadSystemKeymap(&keyInfo)) { FatalError("Could not build a valid keymap."); } @@ -775,20 +748,18 @@ DarwinLoadKeyboardMapping(KeySymsRec *keySyms) DarwinBuildModifierMaps(&keyInfo); #ifdef DUMP_DARWIN_KEYMAP - ErrorF("Darwin -> X converted keyboard map\n"); - for (i = 0, k = info->keyMap; i < NX_NUMKEYCODES; + DEBUG_LOG("Darwin -> X converted keyboard map\n"); + for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES; i++, k += GLYPHS_PER_KEY) { int j; - ErrorF("0x%02x:", i); for (j = 0; j < GLYPHS_PER_KEY; j++) { if (k[j] == NoSymbol) { - ErrorF("\tNoSym"); + DEBUG_LOG("0x%02x:\tNoSym\n", i); } else { - ErrorF("\t0x%x", k[j]); + DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]); } } - ErrorF("\n"); } #endif @@ -937,32 +908,6 @@ int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) } /* - * DarwinModifierNXMaskToNXKeyCode - * Returns 0 if mask is not a known modifier mask. - */ -int DarwinModifierNXMaskToNXKeyCode(int mask) -{ - switch (mask) { - case NX_ALPHASHIFTMASK: return XK_Caps_Lock; - case NX_SHIFTMASK: ErrorF("Warning: Received NX_SHIFTMASK, treating as NX_DEVICELSHIFTKEYMASK\n"); - case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT; //XK_Shift_L; - case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT; //XK_Shift_R; - case NX_CONTROLMASK: ErrorF("Warning: Received NX_CONTROLMASK, treating as NX_DEVICELCTLKEYMASK\n"); - case NX_DEVICELCTLKEYMASK: return XK_Control_L; - case NX_DEVICERCTLKEYMASK: return XK_Control_R; - case NX_ALTERNATEMASK: ErrorF("Warning: Received NX_ALTERNATEMASK, treating as NX_DEVICELALTKEYMASK\n"); - case NX_DEVICELALTKEYMASK: return XK_Alt_L; - case NX_DEVICERALTKEYMASK: return XK_Alt_R; - case NX_COMMANDMASK: ErrorF("Warning: Received NX_COMMANDMASK, treating as NX_DEVICELCMDKEYMASK\n"); - case NX_DEVICELCMDKEYMASK: return XK_Meta_L; - case NX_DEVICERCMDKEYMASK: return XK_Meta_R; - case NX_NUMERICPADMASK: return XK_Num_Lock; - case NX_HELPMASK: return XK_Help; - case NX_SECONDARYFNMASK: return XK_Control_L; // this seems very wrong, but is what the old code did - } -} - -/* * DarwinModifierNXMaskToNXKey * Returns -1 if mask is not a known modifier mask. */ @@ -997,25 +942,25 @@ int DarwinModifierNXMaskToNXKey(int mask) return -1; } -char * DarwinModifierNXMaskTostring(int mask) +const char *DarwinModifierNXMaskTostring(int mask) { switch (mask) { - case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK"; - case NX_SHIFTMASK: return "NX_SHIFTMASK"; - case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK"; - case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK"; - case NX_CONTROLMASK: return "NX_CONTROLMASK"; - case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK"; - case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK"; - case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK"; - case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK"; - case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK"; - case NX_COMMANDMASK: return "NX_COMMANDMASK"; - case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK"; - case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK"; - case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK"; - case NX_HELPMASK: return "NX_HELPMASK"; - case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK"; + case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK"; + case NX_SHIFTMASK: return "NX_SHIFTMASK"; + case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK"; + case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK"; + case NX_CONTROLMASK: return "NX_CONTROLMASK"; + case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK"; + case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK"; + case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK"; + case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK"; + case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK"; + case NX_COMMANDMASK: return "NX_COMMANDMASK"; + case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK"; + case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK"; + case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK"; + case NX_HELPMASK: return "NX_HELPMASK"; + case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK"; } return "unknown mask"; } diff --git a/hw/darwin/quartz/X11Application.m b/hw/darwin/quartz/X11Application.m index 60d11c5ed..a43d536d3 100644 --- a/hw/darwin/quartz/X11Application.m +++ b/hw/darwin/quartz/X11Application.m @@ -612,9 +612,6 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS default:quartzXpluginOptions]; #endif - - darwinSwapAltMeta = [self prefs_get_boolean:@PREFS_SWAP_ALT_META - default:darwinSwapAltMeta]; darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS default:darwinFakeButtons]; if (darwinFakeButtons) { |