Xquartz: Make Alt work with Xmodmap again

(cherry picked from commit 0e017177dc)
This commit is contained in:
Jeremy Huddleston 2007-12-10 20:47:48 -08:00
parent 7d61893b49
commit 1ff945a8e4
4 changed files with 16 additions and 18 deletions

View File

@ -424,7 +424,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
static unsigned int last_seed;
unsigned int this_seed;
this_seed = DarwinModeSystemKeymapSeed();
this_seed = QuartzSystemKeymapSeed();
if (this_seed != last_seed) {
last_seed = this_seed;
DarwinKeyboardReload(darwinKeyboard);

View File

@ -507,8 +507,9 @@ Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) {
(left ? XK_Control_L : XK_Control_R);
break;
case NX_MODIFIERKEY_ALTERNATE:
info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
// (left ? XK_Alt_L : XK_Alt_R);
// 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] =
@ -685,6 +686,7 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
case XK_Alt_L:
info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
info->modMap[MIN_KEYCODE + i] = Mod1Mask;
*k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
break;
case XK_Alt_R:
@ -693,15 +695,11 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
#else
info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
#endif
*k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
info->modMap[MIN_KEYCODE + i] = Mod1Mask;
break;
case XK_Mode_switch:
// Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
#ifdef NX_MODIFIERKEY_RALTERNATE
info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
#endif
info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
info->modMap[MIN_KEYCODE + i] = Mod1Mask;
break;
@ -735,12 +733,12 @@ static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
/* TODO: Clean this up
* DarwinModeReadSystemKeymap is in quartz/quartzKeyboard.c
* QuartzReadSystemKeymap is in quartz/quartzKeyboard.c
* DarwinParseNXKeyMapping is here
*/
if (!DarwinParseNXKeyMapping(&keyInfo)) {
DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running DarwinModeReadSystemKeymap().\n");
if (!DarwinModeReadSystemKeymap(&keyInfo)) {
DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n");
if (!QuartzReadSystemKeymap(&keyInfo)) {
FatalError("Could not build a valid keymap.");
}
}
@ -790,7 +788,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
// DarwinKeyboardReload(pDev);
/* Initialize the seed, so we don't reload the keymap unnecessarily
(and possibly overwrite xinitrc changes) */
DarwinModeSystemKeymapSeed();
QuartzSystemKeymapSeed();
assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
keyInfo.modMap, QuartzBell,

View File

@ -66,11 +66,11 @@ const static struct {
{55, XK_Meta_L},
{56, XK_Shift_L},
{57, XK_Caps_Lock},
{58, XK_Mode_switch},
{58, XK_Alt_L},
{59, XK_Control_L},
{60, XK_Shift_R},
{61, XK_Mode_switch},
{61, XK_Alt_R},
{62, XK_Control_R},
{63, XK_Meta_R},
@ -146,7 +146,7 @@ const static struct {
{UKEYSYM (0x31b), XK_dead_horn}, /* COMBINING HORN */
};
unsigned int DarwinModeSystemKeymapSeed(void) {
unsigned int QuartzSystemKeymapSeed(void) {
static unsigned int seed;
static KeyboardLayoutRef last_key_layout;
KeyboardLayoutRef key_layout;
@ -195,7 +195,7 @@ static KeySym make_dead_key(KeySym in) {
return in;
}
Bool DarwinModeReadSystemKeymap(darwinKeyboardInfo *info) {
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
KeyboardLayoutRef key_layout;
const void *chr_data = NULL;
int num_keycodes = NUM_KEYCODES;

View File

@ -47,7 +47,7 @@ typedef struct darwinKeyboardInfo_struct {
/* These functions need to be implemented by XQuartz, XDarwin, etc. */
void DarwinKeyboardReload(DeviceIntPtr pDev);
Bool DarwinModeReadSystemKeymap(darwinKeyboardInfo *info);
unsigned int DarwinModeSystemKeymapSeed(void);
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
unsigned int QuartzSystemKeymapSeed(void);
#endif /* QUARTZ_KEYBOARD_H */