summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremy@yuffie.local>2007-12-10 20:47:48 -0800
committerJeremy Huddleston <jeremy@yuffie.local>2007-12-10 21:03:30 -0800
commit1ff945a8e43e622b39b360ee49efd6ae3b77be67 (patch)
treefe0666688601ab04db319a0f38998503a13a3400
parent7d61893b49569a72bccb63f1ae8c9ce4ef4e354f (diff)
Xquartz: Make Alt work with Xmodmap again
(cherry picked from commit 0e017177dcca7185716ca760dcce9ddedc7bfef9)
-rw-r--r--hw/xquartz/darwinEvents.c2
-rw-r--r--hw/xquartz/darwinKeyboard.c20
-rw-r--r--hw/xquartz/quartzKeyboard.c8
-rw-r--r--hw/xquartz/quartzKeyboard.h4
4 files changed, 16 insertions, 18 deletions
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index ae82f5b14..1d09e0941 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -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);
diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c
index f6dcfb34a..f1b90b76a 100644
--- a/hw/xquartz/darwinKeyboard.c
+++ b/hw/xquartz/darwinKeyboard.c
@@ -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,
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 0a50d06ac..9b899ca67 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -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;
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index c5f22bf14..0c7e70e48 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -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 */