diff options
Diffstat (limited to 'xorg-server/hw/dmx/input/dmxinputinit.c')
-rw-r--r-- | xorg-server/hw/dmx/input/dmxinputinit.c | 154 |
1 files changed, 66 insertions, 88 deletions
diff --git a/xorg-server/hw/dmx/input/dmxinputinit.c b/xorg-server/hw/dmx/input/dmxinputinit.c index 77f8ed5fc..666db2138 100644 --- a/xorg-server/hw/dmx/input/dmxinputinit.c +++ b/xorg-server/hw/dmx/input/dmxinputinit.c @@ -76,17 +76,8 @@ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#define EXTENSION_PROC_ARGS void * #include "extinit.h" -/* From XI.h */ -#ifndef Relative -#define Relative 0 -#endif -#ifndef Absolute -#define Absolute 1 -#endif - DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; static DMXLocalInputInfoRec DMXDummyMou = { @@ -306,15 +297,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 +359,6 @@ void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, } } -#ifdef XKB static void dmxKeyboardFreeNames(XkbComponentNamesPtr names) { if (names->keymap) XFree(names->keymap); @@ -380,76 +368,63 @@ 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 + XkbRMLVOSet rmlvo; + + rmlvo.rules = dmxConfigGetXkbRules(); + rmlvo.model = dmxConfigGetXkbModel(); + rmlvo.layout = dmxConfigGetXkbLayout(); + rmlvo.variant = dmxConfigGetXkbVariant(); + rmlvo.options = dmxConfigGetXkbOptions(); + + XkbSetRulesDflts(&rmlvo); + 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, + dmxKeyboardBellProc, + dmxKeyboardKbdCtrlProc); + if (info->freenames) dmxKeyboardFreeNames(&info->names); -#endif return Success; } @@ -461,7 +436,9 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) int fd; DMXLocalInitInfo info; int i; - + Atom btn_labels[MAX_BUTTONS] = {0}; /* FIXME */ + Atom axis_labels[MAX_VALUATORS] = {0}; /* FIXME */ + if (dmxInput->detached) return Success; memset(&info, 0, sizeof(info)); @@ -479,35 +456,41 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) DevicePtr pDev = (DevicePtr) pDevice; InitKeyboardDeviceStruct(pDev, &info.keySyms, - info.modMap, dmxBell, dmxKbdCtrl); } if (info.buttonClass) { - InitButtonClassDeviceStruct(pDevice, info.numButtons, info.map); + InitButtonClassDeviceStruct(pDevice, info.numButtons, + btn_labels, info.map); } if (info.valuatorClass) { if (info.numRelAxes && dmxLocal->sendsCore) { InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, + axis_labels, GetMaximumEventsNum(), Relative); for (i = 0; i < info.numRelAxes; i++) - InitValuatorAxisStruct(pDevice, i, info.minval[0], - info.maxval[0], info.res[0], + InitValuatorAxisStruct(pDevice, i, axis_labels[i], + info.minval[0], info.maxval[0], + info.res[0], info.minres[0], info.maxres[0]); } else if (info.numRelAxes) { InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, + axis_labels, dmxPointerGetMotionBufferSize(), Relative); for (i = 0; i < info.numRelAxes; i++) - InitValuatorAxisStruct(pDevice, i, info.minval[0], + InitValuatorAxisStruct(pDevice, i, axis_labels[i], + info.minval[0], info.maxval[0], info.res[0], info.minres[0], info.maxres[0]); } else if (info.numAbsAxes) { InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes, + axis_labels, dmxPointerGetMotionBufferSize(), Absolute); for (i = 0; i < info.numAbsAxes; i++) InitValuatorAxisStruct(pDevice, i+info.numRelAxes, + axis_labels[i + info.numRelAxes], info.minval[i+1], info.maxval[i+1], info.res[i+1], info.minres[i+1], info.maxres[i+1]); @@ -517,9 +500,6 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) if (info.proximityClass) InitProximityClassDeviceStruct(pDevice); if (info.ptrFeedbackClass) InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl); - if (info.kbdFeedbackClass) - InitKbdFeedbackClassDeviceStruct(pDevice, dmxKeyboardBellProc, - dmxKeyboardKbdCtrlProc); if (info.intFeedbackClass || info.strFeedbackClass) dmxLog(dmxWarning, "Integer and string feedback not supported for %s\n", @@ -552,9 +532,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; } @@ -1212,7 +1190,7 @@ int dmxInputDetach(DMXInputInfo *dmxInput) : (dmxLocal->sendsCore ? " [sends core events]" : "")); - DisableDevice(dmxLocal->pDevice); + DisableDevice(dmxLocal->pDevice, TRUE); } dmxInput->detached = True; dmxInputLogDevices(); @@ -1280,7 +1258,7 @@ static int dmxInputAttachOld(DMXInputInfo *dmxInput, int *id) : (dmxLocal->sendsCore ? " [sends core events]" : "")); - EnableDevice(dmxLocal->pDevice); + EnableDevice(dmxLocal->pDevice, TRUE); } dmxInputLogDevices(); return 0; |