[Xquartz-changes] xserver: Branch 'server-1.4-apple' - 2 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Tue Jan 12 13:47:44 PST 2010
hw/xquartz/quartzKeyboard.c | 30 ++++++++++++++++++++----------
hw/xquartz/quartzKeyboard.h | 1 +
2 files changed, 21 insertions(+), 10 deletions(-)
New commits:
commit edd220027f85f073ec6f9e2f55369df674bdf701
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Jan 12 13:46:43 2010 -0800
Revert "XQuartz: Don't weed out duplicates in generated keymap"
This reverts commit 83faccd1ece2d51617c6a5b286f0bf869af71562.
This is only needed to workaround an issue when XKB is used, which
it isn't with our 1.4 based versions of XQuartz.
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 0f02157..9a92b14 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -412,7 +412,6 @@ void DarwinKeyboardReloadHandler(void) {
keySyms.minKeyCode = MIN_KEYCODE;
keySyms.maxKeyCode = MAX_KEYCODE;
- // TODO: We should build the entire XkbDescRec and use XkbCopyKeymap
/* Apply the mappings to darwinKeyboard */
SetKeySymsMap(&darwinKeyboard->key->curKeySyms, &keySyms);
memcpy(darwinKeyboard->key->modifierMap, keyInfo.modMap, sizeof(keyInfo.modMap));
@@ -798,12 +797,9 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
#endif
}
- // There seems to be an issue with this in 1.5+, shift-space is not
- // producing space, it's sending NoSymbol... ?
- //if (k[3] == k[2]) k[3] = NoSymbol;
- //if (k[1] == k[0]) k[1] = NoSymbol;
- //if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- //if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol;
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
}
/* Fix up some things that are normally missing.. */
@@ -814,7 +810,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
if (k[0] == NoSymbol && k[1] == NoSymbol
&& k[2] == NoSymbol && k[3] == NoSymbol)
- k[0] = k[1] = k[2] = k[3] = known_keys[i].keysym;
+ k[0] = known_keys[i].keysym;
}
}
@@ -827,7 +823,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
if (k[0] == known_numeric_keys[i].normal)
- k[0] = k[1] = k[2] = k[3] = known_numeric_keys[i].keypad;
+ k[0] = known_numeric_keys[i].keypad;
}
}
commit 7d1d7100f8d0786b7559638187347da04ccdf881
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Jan 12 13:43:08 2010 -0800
XQuartz: Setup the modifier map in the quartz thread
This avoids possible doing it twice which could result in incorrect
keycodes for alt due to our loss of information about its side.
Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 29ec89d..0f02157 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -194,6 +194,17 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
int i;
KeySym *k;
+ /* This avoids processing the data a second time which will happen
+ * upon the first keypress (since we need to reload our keymap to
+ * clobber XKB). Doing this a second time will result in an
+ * incorrect keycode for left alt because both are changed to
+ * mode_switch here. This is not a good "final" solution, but it
+ * works around the issue for now.
+ */
+ if(info->modMapInitialized)
+ return;
+ info->modMapInitialized = TRUE;
+
memset(info->modMap, NoSymbol, sizeof(info->modMap));
memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes));
@@ -251,6 +262,7 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
break;
case XK_Mode_switch:
+ ErrorF("DarwinBuildModifierMaps: XK_Mode_switch encountered, unable to determine side.\n");
info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
#ifdef NX_MODIFIERKEY_RALTERNATE
info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
@@ -395,7 +407,6 @@ void DarwinKeyboardReloadHandler(void) {
pthread_mutex_lock(&keyInfo_mutex); {
/* Initialize our keySyms */
- DarwinBuildModifierMaps(&keyInfo);
keySyms.map = keyInfo.keyMap;
keySyms.mapWidth = GLYPHS_PER_KEY;
keySyms.minKeyCode = MIN_KEYCODE;
@@ -820,5 +831,8 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
}
}
+ info->modMapInitialized = FALSE;
+ DarwinBuildModifierMaps(info);
+
return TRUE;
}
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index 1aaec6e..47885b5 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -45,6 +45,7 @@ typedef struct darwinKeyboardInfo_struct {
CARD8 modMap[MAP_LENGTH];
KeySym keyMap[MAP_LENGTH * GLYPHS_PER_KEY];
unsigned char modifierKeycodes[32][2];
+ Bool modMapInitialized;
} darwinKeyboardInfo;
/* These functions need to be implemented by Xquartz, XDarwin, etc. */
More information about the Xquartz-changes
mailing list