summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2004-03-21 22:53:08 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2004-03-21 22:53:08 +0000
commit0828d64cb76c7b1d46b2f7782bedbba7bb978125 (patch)
tree8ea0caf14395bf5e5815e9a83a9b1e4187f0916c
parent2c84ceeb0c1d275da51a4f9f3846c50316a695ce (diff)
bug #357. Fix XDarwin so it builds on Mac OS X 10.2 and earlier. Merged
down from -RELEASE-1-TM
-rw-r--r--hw/darwin/darwinEvents.c35
-rw-r--r--hw/darwin/darwinKeyboard.c33
2 files changed, 59 insertions, 9 deletions
diff --git a/hw/darwin/darwinEvents.c b/hw/darwin/darwinEvents.c
index c9f7a925f..49bb67a94 100644
--- a/hw/darwin/darwinEvents.c
+++ b/hw/darwin/darwinEvents.c
@@ -94,6 +94,29 @@ static void DarwinPressModifierMask(
}
}
+#ifdef NX_DEVICELCTLKEYMASK
+#define CONTROL_MASK(flags) (flags & (NX_DEVICELCTLKEYMASK|NX_DEVICERCTLKEYMASK))
+#else
+#define CONTROL_MASK(flags) (NX_CONTROLMASK)
+#endif /* NX_DEVICELCTLKEYMASK */
+
+#ifdef NX_DEVICELSHIFTKEYMASK
+#define SHIFT_MASK(flags) (flags & (NX_DEVICELSHIFTKEYMASK|NX_DEVICERSHIFTKEYMASK))
+#else
+#define SHIFT_MASK(flags) (NX_SHIFTMASK)
+#endif /* NX_DEVICELSHIFTKEYMASK */
+
+#ifdef NX_DEVICELCMDKEYMASK
+#define COMMAND_MASK(flags) (flags & (NX_DEVICELCMDKEYMASK|NX_DEVICERCMDKEYMASK))
+#else
+#define COMMAND_MASK(flags) (NX_COMMANDMASK)
+#endif /* NX_DEVICELCMDKEYMASK */
+
+#ifdef NX_DEVICELALTKEYMASK
+#define ALTERNATE_MASK(flags) (flags & (NX_DEVICELALTKEYMASK|NX_DEVICERALTKEYMASK))
+#else
+#define ALTERNATE_MASK(flags) (NX_ALTERNATEMASK)
+#endif /* NX_DEVICELALTKEYMASK */
/*
* DarwinUpdateModifiers
@@ -109,20 +132,16 @@ static void DarwinUpdateModifiers(
DarwinPressModifierMask(xe, NX_ALPHASHIFTMASK);
}
if (flags & NX_COMMANDMASK) {
- DarwinPressModifierMask(xe,
- flags & (NX_DEVICELCMDKEYMASK|NX_DEVICERCMDKEYMASK));
+ DarwinPressModifierMask(xe, COMMAND_MASK(flags));
}
if (flags & NX_CONTROLMASK) {
- DarwinPressModifierMask(xe,
- flags & (NX_DEVICELCTLKEYMASK|NX_DEVICERCTLKEYMASK));
+ DarwinPressModifierMask(xe, CONTROL_MASK(flags));
}
if (flags & NX_ALTERNATEMASK) {
- DarwinPressModifierMask(xe,
- flags & (NX_DEVICELALTKEYMASK|NX_DEVICERALTKEYMASK));
+ DarwinPressModifierMask(xe, ALTERNATE_MASK(flags));
}
if (flags & NX_SHIFTMASK) {
- DarwinPressModifierMask(xe,
- flags & (NX_DEVICELSHIFTKEYMASK|NX_DEVICERSHIFTKEYMASK));
+ DarwinPressModifierMask(xe, SHIFT_MASK(flags));
}
if (flags & NX_SECONDARYFNMASK) {
DarwinPressModifierMask(xe, NX_SECONDARYFNMASK);
diff --git a/hw/darwin/darwinKeyboard.c b/hw/darwin/darwinKeyboard.c
index 904c4068f..e60e7a3e1 100644
--- a/hw/darwin/darwinKeyboard.c
+++ b/hw/darwin/darwinKeyboard.c
@@ -657,7 +657,6 @@ Bool DarwinParseNXKeyMapping(
return TRUE;
}
-
/*
* DarwinBuildModifierMaps
* Use the keyMap field of keyboard info structure to populate
@@ -685,7 +684,11 @@ DarwinBuildModifierMaps(
break;
case XK_Shift_R:
+#ifdef NX_MODIFIERKEY_RSHIFT
info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+#endif
info->modMap[MIN_KEYCODE + i] = ShiftMask;
break;
@@ -695,7 +698,11 @@ DarwinBuildModifierMaps(
break;
case XK_Control_R:
+#ifdef NX_MODIFIERKEY_RCONTROL
info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+#endif
info->modMap[MIN_KEYCODE + i] = ControlMask;
break;
@@ -710,7 +717,11 @@ DarwinBuildModifierMaps(
break;
case XK_Alt_R:
+#ifdef NX_MODIFIERKEY_RALTERNATE
info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+#endif
info->modMap[MIN_KEYCODE + i] = Mod1Mask;
break;
@@ -724,7 +735,11 @@ DarwinBuildModifierMaps(
break;
case XK_Meta_R:
+#ifdef NX_MODIFIERKEY_RCOMMAND
info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+#endif
info->modMap[MIN_KEYCODE + i] = Mod2Mask;
break;
@@ -842,17 +857,25 @@ int DarwinModifierNXMaskToNXKey(int mask)
switch (mask) {
case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK;
case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT;
+#ifdef NX_DEVICELSHIFTKEYMASK
case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT;
case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT;
+#endif
case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL;
+#ifdef NX_DEVICELCTLKEYMASK
case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL;
case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL;
+#endif
case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE;
+#ifdef NX_DEVICELALTKEYMASK
case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE;
case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE;
+#endif
case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND;
+#ifdef NX_DEVICELCMDKEYMASK
case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND;
case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND;
+#endif
case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD;
case NX_HELPMASK: return NX_MODIFIERKEY_HELP;
case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN;
@@ -869,13 +892,21 @@ int DarwinModifierNXKeyToNXMask(int key)
switch (key) {
case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK;
case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK;
+#ifdef NX_MODIFIERKEY_RSHIFT
case NX_MODIFIERKEY_RSHIFT: return NX_SHIFTMASK;
+#endif
case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK;
+#ifdef NX_MODIFIERKEY_RCONTROL
case NX_MODIFIERKEY_RCONTROL: return NX_CONTROLMASK;
+#endif
case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK;
+#ifdef NX_MODIFIERKEY_RALTERNATE
case NX_MODIFIERKEY_RALTERNATE: return NX_ALTERNATEMASK;
+#endif
case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK;
+#ifdef NX_MODIFIERKEY_RCOMMAND
case NX_MODIFIERKEY_RCOMMAND: return NX_COMMANDMASK;
+#endif
case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK;
case NX_MODIFIERKEY_HELP: return NX_HELPMASK;
case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK;