diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-03-18 10:05:57 +0200 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2009-01-22 15:06:25 +1100 |
commit | 40877c6680863bd6a8475f2bb0c54df55bcf0b0e (patch) | |
tree | 9f958934add153efc9f6e85900fd5ff9ab2320da /hw/dmx/input | |
parent | f9da417163b6b2d6234d2542c1f375e33db7159a (diff) |
XKB: Make XKB mandatory
No more #ifdef XKB, because you can't disable the build, and no more
noXkbExtension either.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/dmx/input')
-rw-r--r-- | hw/dmx/input/dmxcommon.c | 6 | ||||
-rw-r--r-- | hw/dmx/input/dmxcommon.h | 4 | ||||
-rw-r--r-- | hw/dmx/input/dmxdummy.c | 2 | ||||
-rw-r--r-- | hw/dmx/input/dmxinputinit.c | 114 | ||||
-rw-r--r-- | hw/dmx/input/dmxinputinit.h | 2 | ||||
-rw-r--r-- | hw/dmx/input/usb-keyboard.c | 2 |
6 files changed, 47 insertions, 83 deletions
diff --git a/hw/dmx/input/dmxcommon.c b/hw/dmx/input/dmxcommon.c index e77bb7918..2bffb17e7 100644 --- a/hw/dmx/input/dmxcommon.c +++ b/hw/dmx/input/dmxcommon.c @@ -258,7 +258,6 @@ void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) * specified \a pDev. */ void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { -#ifdef XKB GETPRIVFROMPDEV; GETDMXINPUTFROMPRIV; char *pt; @@ -284,7 +283,6 @@ void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) if ((pt = strchr(info->names.keycodes, '+'))) *pt = '\0'; } dmxCommonRestoreState(priv); -#endif } /** Turn \a pDev on (i.e., take input from \a pDev). */ @@ -577,7 +575,6 @@ void dmxCommonSaveState(pointer private) if (dmxInput->console) priv = dmxInput->devs[0]->private; if (!priv->display || priv->stateSaved) return; DMXDBG0("dmxCommonSaveState\n"); -#ifdef XKB if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) { if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb) || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) { @@ -596,7 +593,6 @@ void dmxCommonSaveState(pointer private) } } } -#endif XGetKeyboardControl(priv->display, &ks); priv->savedKctrl.click = ks.key_click_percent; @@ -636,14 +632,12 @@ void dmxCommonRestoreState(pointer private) priv->stateSaved = 0; DMXDBG0("dmxCommonRestoreState\n"); -#ifdef XKB if (priv->xkb) { *priv->xkb->indicators = priv->savedIndicators; XkbSetIndicatorMap(priv->display, ~0, priv->xkb); XkbFreeKeyboard(priv->xkb, 0, True); priv->xkb = 0; } -#endif for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) { CARD32 tmp; diff --git a/hw/dmx/input/dmxcommon.h b/hw/dmx/input/dmxcommon.h index a9b260cd9..68f2b520d 100644 --- a/hw/dmx/input/dmxcommon.h +++ b/hw/dmx/input/dmxcommon.h @@ -54,14 +54,10 @@ XModifierKeymap *savedModMap; \ int stateSaved -#ifdef XKB #define DMX_COMMON_XKB \ DMX_COMMON_OTHER; \ XkbDescPtr xkb; \ XkbIndicatorRec savedIndicators -#else -#define DMX_COMMON_XKB DMX_COMMON_OTHER -#endif #define DMX_COMMON_PRIVATE \ DMX_COMMON_XKB; \ diff --git a/hw/dmx/input/dmxdummy.c b/hw/dmx/input/dmxdummy.c index 2afe2580d..971892b9f 100644 --- a/hw/dmx/input/dmxdummy.c +++ b/hw/dmx/input/dmxdummy.c @@ -60,9 +60,7 @@ void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) info->freemap = 0; info->focusClass = 1; info->kbdFeedbackClass = 1; -#ifdef XKB info->force = 1; -#endif } /** Return information about the dummy mouse device specified in \a pDev diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index a0eb80fe9..bce886fd3 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -306,15 +306,13 @@ static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal, dmxLocal->kctrl = *ctrl; if (dmxLocal->kCtrl) { dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl); -#ifdef XKB - if (!noXkbExtension && dmxLocal->pDevice->kbdfeed) { + if (dmxLocal->pDevice->kbdfeed) { XkbEventCauseRec cause; XkbSetCauseUnknown(&cause); /* Generate XKB events, as necessary */ XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False, NULL, &cause); } -#endif } } @@ -370,7 +368,6 @@ void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, } } -#ifdef XKB static void dmxKeyboardFreeNames(XkbComponentNamesPtr names) { if (names->keymap) XFree(names->keymap); @@ -380,76 +377,61 @@ static void dmxKeyboardFreeNames(XkbComponentNamesPtr names) if (names->symbols) XFree(names->symbols); if (names->geometry) XFree(names->geometry); } -#endif static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info) { -#ifdef XKB GETDMXINPUTFROMPDEVICE; -#else - DevicePtr pDev = &pDevice->public; -#endif -#ifdef XKB - if (noXkbExtension) { -#endif - if (!InitKeyboardDeviceStruct(pDev, &info->keySyms, info->modMap, - dmxKeyboardBellProc, - dmxKeyboardKbdCtrlProc)) - return BadImplementation; -#ifdef XKB + XkbSetRulesDflts(dmxConfigGetXkbRules(), + dmxConfigGetXkbModel(), + dmxConfigGetXkbLayout(), + dmxConfigGetXkbVariant(), + dmxConfigGetXkbOptions()); + if (!info->force && (dmxInput->keycodes + || dmxInput->symbols + || dmxInput->geometry)) { + if (info->freenames) dmxKeyboardFreeNames(&info->names); + info->freenames = 0; + info->names.keycodes = dmxInput->keycodes; + info->names.types = NULL; + info->names.compat = NULL; + info->names.symbols = dmxInput->symbols; + info->names.geometry = dmxInput->geometry; + + dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s", + info->names.keycodes); + if (info->names.symbols && *info->names.symbols) + dmxLogInputCont(dmxInput, " %s", info->names.symbols); + if (info->names.geometry && *info->names.geometry) + dmxLogInputCont(dmxInput, " %s", info->names.geometry); + dmxLogInputCont(dmxInput, "\n"); + } else if (info->names.keycodes) { + dmxLogInput(dmxInput, "XKEYBOARD: From device: %s", + info->names.keycodes); + if (info->names.symbols && *info->names.symbols) + dmxLogInputCont(dmxInput, " %s", info->names.symbols); + if (info->names.geometry && *info->names.geometry) + dmxLogInputCont(dmxInput, " %s", info->names.geometry); + dmxLogInputCont(dmxInput, "\n"); } else { - XkbSetRulesDflts(dmxConfigGetXkbRules(), - dmxConfigGetXkbModel(), - dmxConfigGetXkbLayout(), - dmxConfigGetXkbVariant(), - dmxConfigGetXkbOptions()); - if (!info->force && (dmxInput->keycodes - || dmxInput->symbols - || dmxInput->geometry)) { - if (info->freenames) dmxKeyboardFreeNames(&info->names); - info->freenames = 0; - info->names.keycodes = dmxInput->keycodes; - info->names.types = NULL; - info->names.compat = NULL; - info->names.symbols = dmxInput->symbols; - info->names.geometry = dmxInput->geometry; - - dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s", - info->names.keycodes); - if (info->names.symbols && *info->names.symbols) - dmxLogInputCont(dmxInput, " %s", info->names.symbols); - if (info->names.geometry && *info->names.geometry) - dmxLogInputCont(dmxInput, " %s", info->names.geometry); - dmxLogInputCont(dmxInput, "\n"); - } else if (info->names.keycodes) { - dmxLogInput(dmxInput, "XKEYBOARD: From device: %s", - info->names.keycodes); - if (info->names.symbols && *info->names.symbols) - dmxLogInputCont(dmxInput, " %s", info->names.symbols); - if (info->names.geometry && *info->names.geometry) - dmxLogInputCont(dmxInput, " %s", info->names.geometry); - dmxLogInputCont(dmxInput, "\n"); - } else { - dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n", - dmxConfigGetXkbRules(), - dmxConfigGetXkbLayout(), - dmxConfigGetXkbModel(), - dmxConfigGetXkbVariant() - ? dmxConfigGetXkbVariant() : "", - dmxConfigGetXkbOptions() - ? dmxConfigGetXkbOptions() : ""); - } - XkbInitKeyboardDeviceStruct(pDevice, - &info->names, - &info->keySyms, - info->modMap, - dmxKeyboardBellProc, - dmxKeyboardKbdCtrlProc); + dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n", + dmxConfigGetXkbRules(), + dmxConfigGetXkbLayout(), + dmxConfigGetXkbModel(), + dmxConfigGetXkbVariant() + ? dmxConfigGetXkbVariant() : "", + dmxConfigGetXkbOptions() + ? dmxConfigGetXkbOptions() : ""); } + XkbInitKeyboardDeviceStruct(pDevice, + &info->names, + &info->keySyms, + info->modMap, + dmxKeyboardBellProc, + dmxKeyboardKbdCtrlProc); + if (info->freenames) dmxKeyboardFreeNames(&info->names); -#endif return Success; } @@ -552,9 +534,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) XFree(info.keySyms.map); info.keySyms.map = NULL; } -#ifdef XKB if (info.xkb) XkbFreeKeyboard(info.xkb, 0, True); -#endif return Success; } diff --git a/hw/dmx/input/dmxinputinit.h b/hw/dmx/input/dmxinputinit.h index 6f491edf9..2e625cfd4 100644 --- a/hw/dmx/input/dmxinputinit.h +++ b/hw/dmx/input/dmxinputinit.h @@ -87,12 +87,10 @@ typedef struct _DMXLocalInitInfo { KeySymsRec keySyms; /**< Key symbols */ int freemap; /**< If non-zero, free keySyms.map */ CARD8 modMap[MAP_LENGTH]; /**< Modifier map */ -#ifdef XKB XkbDescPtr xkb; /**< XKB description */ XkbComponentNamesRec names; /**< XKB component names */ int freenames; /**< Non-zero if names should be free'd */ int force; /**< Do not allow command line override */ -#endif int buttonClass; /**< Non-zero if buttons are present */ int numButtons; /**< Number of buttons */ diff --git a/hw/dmx/input/usb-keyboard.c b/hw/dmx/input/usb-keyboard.c index efec2705b..455513d06 100644 --- a/hw/dmx/input/usb-keyboard.c +++ b/hw/dmx/input/usb-keyboard.c @@ -434,8 +434,6 @@ void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) kbdUSBGetMap(pDev, &info->keySyms, info->modMap); info->focusClass = 1; info->kbdFeedbackClass = 1; -#ifdef XKB info->names.keycodes = xstrdup("powerpcps2"); info->force = 1; -#endif } |