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 /dix | |
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 'dix')
-rw-r--r-- | dix/devices.c | 119 | ||||
-rw-r--r-- | dix/dispatch.c | 21 | ||||
-rw-r--r-- | dix/events.c | 102 | ||||
-rw-r--r-- | dix/getevents.c | 41 |
4 files changed, 47 insertions, 236 deletions
diff --git a/dix/devices.c b/dix/devices.c index f2410fd5c..9d6651d48 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -63,12 +63,7 @@ SOFTWARE. #include "dixstruct.h" #include "ptrveloc.h" #include "site.h" -#ifndef XKB_IN_SERVER -#define XKB_IN_SERVER -#endif -#ifdef XKB -#include <xkbsrv.h> -#endif +#include "xkbsrv.h" #include "privates.h" #include "xace.h" #include "mi.h" @@ -490,9 +485,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what) { CARD8 *modMap; KeySymsRec keySyms; -#ifdef XKB XkbComponentNamesRec names; -#endif ClassesPtr classes; switch (what) { @@ -523,19 +516,9 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what) return BadAlloc; } -#ifdef XKB - if (!noXkbExtension) { - bzero(&names, sizeof(names)); - XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modMap, - CoreKeyboardBell, CoreKeyboardCtl); - } - else -#endif - { - /* FIXME Our keymap here isn't exactly useful. */ - InitKeyboardDeviceStruct((DevicePtr)pDev, &keySyms, modMap, - CoreKeyboardBell, CoreKeyboardCtl); - } + bzero(&names, sizeof(names)); + XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modMap, + CoreKeyboardBell, CoreKeyboardCtl); xfree(keySyms.map); xfree(modMap); @@ -661,13 +644,11 @@ FreeDeviceClass(int type, pointer *class) case KeyClass: { KeyClassPtr* k = (KeyClassPtr*)class; -#ifdef XKB if ((*k)->xkbInfo) { XkbFreeInfo((*k)->xkbInfo); (*k)->xkbInfo = NULL; } -#endif xfree((*k)->curKeySyms.map); xfree((*k)->modifierKeyMap); xfree((*k)); @@ -676,10 +657,8 @@ FreeDeviceClass(int type, pointer *class) case ButtonClass: { ButtonClassPtr *b = (ButtonClassPtr*)class; -#ifdef XKB if ((*b)->xkb_acts) xfree((*b)->xkb_acts); -#endif xfree((*b)); break; } @@ -724,10 +703,8 @@ FreeFeedbackClass(int type, pointer *class) KbdFeedbackPtr k, knext; for (k = (*kbdfeed); k; k = knext) { knext = k->next; -#ifdef XKB if (k->xkb_sli) XkbFreeSrvLedInfo(k->xkb_sli); -#endif xfree(k); } break; @@ -785,10 +762,8 @@ FreeFeedbackClass(int type, pointer *class) for (l = (*leds); l; l = lnext) { lnext = l->next; -#ifdef XKB if (l->xkb_sli) XkbFreeSrvLedInfo(l->xkb_sli); -#endif xfree(l); } break; @@ -859,11 +834,8 @@ CloseDevice(DeviceIntPtr dev) FreeAllDeviceClasses(classes); } - -#ifdef XKB while (dev->xkb_interest) XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource); -#endif if (DevHasCursor(dev) && dev->spriteInfo->sprite) { xfree(dev->spriteInfo->sprite->spriteTrace); @@ -920,9 +892,7 @@ CloseDownDevices(void) inputInfo.off_devices = NULL; inputInfo.keyboard = NULL; inputInfo.pointer = NULL; -#ifdef XKB XkbDeleteRulesDflts(); -#endif } /** @@ -1193,10 +1163,8 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers return FALSE; } dev->key = keyc; -#ifdef XKB dev->key->xkbInfo= NULL; - if (!noXkbExtension) XkbInitDevice(dev); -#endif + XkbInitDevice(dev); return TRUE; } @@ -1392,19 +1360,14 @@ InitKbdFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc, return FALSE; feedc->BellProc = bellProc; feedc->CtrlProc = controlProc; -#ifdef XKB defaultKeyboardControl.autoRepeat = TRUE; -#endif feedc->ctrl = defaultKeyboardControl; feedc->ctrl.id = 0; if ((feedc->next = dev->kbdfeed) != 0) feedc->ctrl.id = dev->kbdfeed->ctrl.id + 1; dev->kbdfeed = feedc; -#ifdef XKB feedc->xkb_sli= NULL; - if (!noXkbExtension) - XkbFinishDeviceInit(dev); -#endif + XkbFinishDeviceInit(dev); (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl); return TRUE; } @@ -1517,9 +1480,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc) feedc->ctrl.id = 0; if ( (feedc->next = dev->leds) ) feedc->ctrl.id = dev->leds->ctrl.id + 1; -#ifdef XKB feedc->xkb_sli= NULL; -#endif dev->leds = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; @@ -1582,25 +1543,18 @@ SendMappingNotify(DeviceIntPtr pDev, unsigned request, unsigned firstKeyCode, event.u.mappingNotify.firstKeyCode = firstKeyCode; event.u.mappingNotify.count = count; } -#ifdef XKB - if (!noXkbExtension && - ((request == MappingKeyboard) || (request == MappingModifier))) { + if (request == MappingKeyboard || request == MappingModifier) XkbApplyMappingChange(pDev,request,firstKeyCode,count, client); - } -#endif /* 0 is the server client */ for (i=1; i<currentMaxClients; i++) { if (clients[i] && clients[i]->clientState == ClientStateRunning) { -#ifdef XKB - if (!noXkbExtension && - (request == MappingKeyboard) && - (clients[i]->xkbClientFlags != 0) && - (clients[i]->mapNotifyMask&XkbKeySymsMask)) + if (request == MappingKeyboard && + clients[i]->xkbClientFlags != 0 && + (clients[i]->mapNotifyMask & XkbKeySymsMask)) continue; -#endif event.u.u.sequenceNumber = clients[i]->sequence; WriteEventsToClient(clients[i], 1, &event); } @@ -2097,15 +2051,13 @@ DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist, client->errorValue = t; return BadValue; } -#ifdef XKB - if (!noXkbExtension) { - XkbEventCauseRec cause; - XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client); - XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))), - ctrl.leds, &cause); - ctrl.leds = keybd->kbdfeed->ctrl.leds; - } -#endif + + XkbEventCauseRec cause; + XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client); + XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))), + ctrl.leds, &cause); + ctrl.leds = keybd->kbdfeed->ctrl.leds; + break; case KBKey: key = (KeyCode)*vlist; @@ -2123,10 +2075,8 @@ DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist, mask = (1 << (key & 7)); t = (CARD8)*vlist; vlist++; -#ifdef XKB - if (!noXkbExtension && key != DO_ALL) + if (key != DO_ALL) XkbDisableComputedAutoRepeats(keybd,key); -#endif if (t == AutoRepeatModeOff) { if (key == DO_ALL) ctrl.autoRepeat = FALSE; @@ -2159,14 +2109,9 @@ DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist, } keybd->kbdfeed->ctrl = ctrl; -#ifdef XKB /* The XKB RepeatKeys control and core protocol global autorepeat */ /* value are linked */ - if (!noXkbExtension) - XkbSetRepeatKeys(keybd, key, keybd->kbdfeed->ctrl.autoRepeat); - else -#endif - (*keybd->kbdfeed->CtrlProc)(keybd, &keybd->kbdfeed->ctrl); + XkbSetRepeatKeys(keybd, key, keybd->kbdfeed->ctrl.autoRepeat); return Success; @@ -2275,14 +2220,8 @@ ProcBell(ClientPtr client) rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixBellAccess); if (rc != Success) return rc; -#ifdef XKB - if (!noXkbExtension) - XkbHandleBell(FALSE, FALSE, keybd, newpercent, - &keybd->kbdfeed->ctrl, 0, None, NULL, client); - else -#endif - (*keybd->kbdfeed->BellProc)(newpercent, keybd, - &keybd->kbdfeed->ctrl, 0); + XkbHandleBell(FALSE, FALSE, keybd, newpercent, + &keybd->kbdfeed->ctrl, 0, None, NULL, client); } } @@ -2633,15 +2572,9 @@ AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr* strcpy(pointer->name, name); strcat(pointer->name, " pointer"); -#ifdef XKB pointer->public.processInputProc = ProcessOtherEvent; pointer->public.realInputProc = ProcessOtherEvent; - if (!noXkbExtension) - XkbSetExtension(pointer, ProcessPointerEvent); -#else - pointer->public.processInputProc = ProcessPointerEvent; - pointer->public.realInputProc = ProcessPointerEvent; -#endif + XkbSetExtension(pointer, ProcessPointerEvent); pointer->deviceGrab.ActivateGrab = ActivatePointerGrab; pointer->deviceGrab.DeactivateGrab = DeactivatePointerGrab; pointer->coreEvents = TRUE; @@ -2661,15 +2594,9 @@ AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr* strcpy(keyboard->name, name); strcat(keyboard->name, " keyboard"); -#ifdef XKB keyboard->public.processInputProc = ProcessOtherEvent; keyboard->public.realInputProc = ProcessOtherEvent; - if (!noXkbExtension) - XkbSetExtension(keyboard, ProcessKeyboardEvent); -#else - keyboard->public.processInputProc = ProcessKeyboardEvent; - keyboard->public.realInputProc = ProcessKeyboardEvent; -#endif + XkbSetExtension(keyboard, ProcessKeyboardEvent); keyboard->deviceGrab.ActivateGrab = ActivateKeyboardGrab; keyboard->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab; keyboard->coreEvents = TRUE; diff --git a/dix/dispatch.c b/dix/dispatch.c index ee105f8dd..09fd3afc6 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -136,13 +136,8 @@ int ProcInitialConnection(); #endif #include "privates.h" #include "xace.h" -#ifdef XKB -#ifndef XKB_IN_SERVER -#define XKB_IN_SERVER -#endif #include "inputstr.h" -#include <xkbsrv.h> -#endif +#include "xkbsrv.h" #ifdef XSERVER_DTRACE #include "registry.h" @@ -3478,15 +3473,11 @@ void InitClient(ClientPtr client, int i, pointer ospriv) client->priority = 0; client->clientState = ClientStateInitial; client->devPrivates = NULL; -#ifdef XKB - if (!noXkbExtension) { - client->xkbClientFlags = 0; - client->mapNotifyMask = 0; - client->newKeyboardNotifyMask = 0; - client->vMinor = client->vMajor = 0; - QueryMinMaxKeyCodes(&client->minKC,&client->maxKC); - } -#endif + client->xkbClientFlags = 0; + client->mapNotifyMask = 0; + client->newKeyboardNotifyMask = 0; + client->vMinor = client->vMajor = 0; + QueryMinMaxKeyCodes(&client->minKC,&client->maxKC); client->replyBytesRemaining = 0; client->fontResFunc = NULL; client->smart_priority = 0; diff --git a/dix/events.c b/dix/events.c index a1aec2f8f..95bb3e9e4 100644 --- a/dix/events.c +++ b/dix/events.c @@ -133,11 +133,10 @@ of the copyright holder. #endif #include "globals.h" -#ifdef XKB #include <X11/extensions/XKBproto.h> -#include <xkbsrv.h> +#include "xkbsrv.h" +/* XKB FIXME: why is this here? */ extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); -#endif #include "xace.h" @@ -1078,12 +1077,10 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) NoticeTime(xE); -#ifdef XKB /* Fix for key repeating bug. */ if (device->key != NULL && device->key->xkbInfo != NULL && xE->u.u.type == KeyRelease) AccessXCancelRepeatKey(device->key->xkbInfo, xE->u.u.detail); -#endif if (DeviceEventCallback) { @@ -2116,11 +2113,8 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent pDev->valuator->motionHintWindow = pWin; else { - if (((type == DeviceMotionNotify) -#ifdef XKB - || (type == DeviceButtonPress) -#endif - ) && deliveries) + if ((type == DeviceMotionNotify || type == DeviceButtonPress) && + deliveries) CheckDeviceGrabAndHintWindow (pWin, type, (deviceKeyButtonPointer*) pEvents, grab, client, deliveryMask); @@ -3246,7 +3240,6 @@ CheckPassiveGrabsOnWindow( tempGrab.next = NULL; for (; grab; grab = grab->next) { -#ifdef XKB DeviceIntPtr gdev; XkbSrvInfoPtr xkbi = NULL; @@ -3260,40 +3253,16 @@ CheckPassiveGrabsOnWindow( } if (gdev && gdev->key) xkbi= gdev->key->xkbInfo; -#endif tempGrab.modifierDevice = grab->modifierDevice; - if ((device == grab->modifierDevice) && - ((xE->u.u.type == KeyPress) || (xE->u.u.type == DeviceKeyPress))) - tempGrab.modifiersDetail.exact = -#ifdef XKB - (noXkbExtension) ? - ((gdev) ? gdev->key->prev_state : 0) : - ((xkbi) ? xkbi->state.grab_mods : 0); -#else - (gdev) ? gdev->key->prev_state : 0; -#endif - else - tempGrab.modifiersDetail.exact = -#ifdef XKB - (noXkbExtension) ? - ((gdev) ? gdev->key->state : 0) : - ((xkbi) ? xkbi->state.grab_mods : 0); -#else - (gdev) ? gdev->key->state : 0; -#endif - /* ignore the device for core events when comparing grabs */ + tempGrab.modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0; + /* ignore the device for core events when comparing grabs */ if (GrabMatchesSecond(&tempGrab, grab, (xE->u.u.type < LASTEvent)) && (!grab->confineTo || (grab->confineTo->realized && BorderSizeNotEmpty(device, grab->confineTo)))) { -#ifdef XKB - if (!noXkbExtension) { - XE_KBPTR.state &= 0x1f00; - XE_KBPTR.state |= - tempGrab.modifiersDetail.exact&(~0x1f00); - } -#endif + XE_KBPTR.state &= 0x1f00; + XE_KBPTR.state |= tempGrab.modifiersDetail.exact&(~0x1f00); grabinfo = &device->deviceGrab; /* A passive grab may have been created for a different device than it is assigned to at this point in time. @@ -3690,11 +3659,7 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev, * @param count Number of elements in xE. */ void -#ifdef XKB CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count) -#else -ProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count) -#endif { int key, bit; BYTE *kptr; @@ -3765,7 +3730,6 @@ ProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count) XaceHook(XACE_KEY_AVAIL, xE, keybd, count); } -#ifdef XKB /* This function is used to set the key pressed or key released state - this is only used when the pressing of keys does not cause the device's processInputProc to be called, as in for example Mouse Keys. @@ -3795,7 +3759,6 @@ FixKeyState (xEvent *xE, DeviceIntPtr keybd) else FatalError("Impossible keyboard event"); } -#endif /** * Main pointer event processing function for core pointer events. @@ -3810,32 +3773,18 @@ FixKeyState (xEvent *xE, DeviceIntPtr keybd) * @param count Number of elements in xE. */ void -#ifdef XKB CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) -#else -ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) -#endif { GrabPtr grab = mouse->deviceGrab.grab; Bool deactivateGrab = FALSE; ButtonClassPtr butc = mouse->button; SpritePtr pSprite = mouse->spriteInfo->sprite; -#ifdef XKB XkbSrvInfoPtr xkbi= GetPairedDevice(mouse)->key->xkbInfo; -#endif if (!syncEvents.playingEvents) NoticeTime(xE) - XE_KBPTR.state = (butc->state | ( -#ifdef XKB - (noXkbExtension ? - inputInfo.keyboard->key->state : - xkbi->state.grab_mods) -#else - inputInfo.keyboard->key->state -#endif - )); + XE_KBPTR.state = (butc->state | xkbi->state.grab_mods); { NoticeTime(xE); if (DeviceEventCallback) @@ -4171,18 +4120,10 @@ CoreEnterLeaveEvent( event.u.enterLeave.child = child; event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ? ELFlagSameScreen : 0; -#ifdef XKB - if (!noXkbExtension) { - event.u.enterLeave.state = mouse->button->state & 0x1f00; - if (keybd) - event.u.enterLeave.state |= + event.u.enterLeave.state = mouse->button->state & 0x1f00; + if (keybd) + event.u.enterLeave.state |= XkbGrabStateFromRec(&keybd->key->xkbInfo->state); - } else -#endif - { - event.u.enterLeave.state = (keybd) ? keybd->key->state : 0; - event.u.enterLeave.state |= mouse->button->state; - } event.u.enterLeave.mode = mode; focus = (keybd) ? keybd->focus->win : None; if ((focus != NoneWin) && @@ -4262,18 +4203,9 @@ DeviceEnterLeaveEvent( devEnterLeave->mode = mode; devEnterLeave->mode |= (sameScreen ? (ELFlagSameScreen << 4) : 0); -#ifdef XKB - if (!noXkbExtension) { - devEnterLeave->state = mouse->button->state & 0x1f00; - if (keybd) - devEnterLeave->state |= - XkbGrabStateFromRec(&keybd->key->xkbInfo->state); - } else -#endif - { - devEnterLeave->state = (keybd) ? keybd->key->state : 0; - devEnterLeave->state |= mouse->button->state; - } + devEnterLeave->state = mouse->button->state & 0x1f00; + if (keybd) + devEnterLeave->state |= XkbGrabStateFromRec(&keybd->key->xkbInfo->state); mskidx = mouse->id; inputMasks = wOtherInputMasks(pWin); @@ -5540,10 +5472,8 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) int i, eventlength = sizeof(xEvent); -#ifdef XKB - if ((!noXkbExtension)&&(!XkbFilterEvents(pClient, count, events))) + if (!XkbFilterEvents(pClient, count, events)) return; -#endif #ifdef PANORAMIX if(!noPanoramiXExtension && diff --git a/dix/getevents.c b/dix/getevents.c index 44636d73b..112bb102c 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -42,10 +42,8 @@ #include "dixevents.h" #include "mipointer.h" -#ifdef XKB #include <X11/extensions/XKBproto.h> #include "xkbsrv.h" -#endif #ifdef PANORAMIX #include "panoramiX.h" @@ -454,15 +452,9 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator, */ int GetMaximumEventsNum(void) { - /* One base event -- device, plus valuator events. - * Multiply by two if we're doing non-XKB key repeats. */ + /* One base event -- device, plus valuator events. */ int ret = 1 + MAX_VALUATOR_EVENTS; -#ifdef XKB - if (noXkbExtension) -#endif - ret *= 2; - /* One possible DeviceClassesChangedEvent */ ret++; @@ -814,25 +806,7 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type, numEvents += countValuatorEvents(num_valuators); -#ifdef XKB - if (noXkbExtension) -#endif - { - switch (sym) { - case XK_Num_Lock: - case XK_Caps_Lock: - case XK_Scroll_Lock: - case XK_Shift_Lock: - if (type == KeyRelease) - return 0; - else if (type == KeyPress && key_is_down(pDev, key_code)) - type = KeyRelease; - } - } - - /* Handle core repeating, via press/release/press/release. - * FIXME: In theory, if you're repeating with two keyboards in non-XKB, - * you could get unbalanced events here. */ + /* Handle core repeating, via press/release/press/release. */ if (type == KeyPress && key_is_down(pDev, key_code)) { /* If autorepeating is disabled either globally or just for that key, * or we have a modifier, don't generate a repeat event. */ @@ -840,17 +814,6 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type, !key_autorepeats(pDev, key_code) || pDev->key->modifierMap[key_code]) return 0; - -#ifdef XKB - if (noXkbExtension) -#endif - { - numEvents += GetKeyboardValuatorEvents(events, pDev, - KeyRelease, key_code, - first_valuator, num_valuators, - valuators); - events += numEvents; - } } ms = GetTimeInMillis(); |