diff options
author | marha <marha@users.sourceforge.net> | 2011-12-16 20:45:15 +0100 |
---|---|---|
committer | Marc Haesen <marc@hc-consult.be> | 2011-12-16 20:45:15 +0100 |
commit | 47913e82955ec8e2b1ba4d4b145497dede9163b5 (patch) | |
tree | d23c322caf26864270171d54eb2805cee2721e4d /xorg-server/dix | |
parent | 53d28537755790ee4625dc16f560cad5aa93f56b (diff) | |
download | vcxsrv-47913e82955ec8e2b1ba4d4b145497dede9163b5.tar.gz vcxsrv-47913e82955ec8e2b1ba4d4b145497dede9163b5.tar.bz2 vcxsrv-47913e82955ec8e2b1ba4d4b145497dede9163b5.zip |
xserver git update 16 dec 2011
Diffstat (limited to 'xorg-server/dix')
-rw-r--r-- | xorg-server/dix/cursor.c | 2 | ||||
-rw-r--r-- | xorg-server/dix/devices.c | 1 | ||||
-rw-r--r-- | xorg-server/dix/dispatch.c | 5 | ||||
-rw-r--r-- | xorg-server/dix/dixutils.c | 4 | ||||
-rw-r--r-- | xorg-server/dix/eventconvert.c | 16 | ||||
-rw-r--r-- | xorg-server/dix/events.c | 812 | ||||
-rw-r--r-- | xorg-server/dix/extension.c | 3 | ||||
-rw-r--r-- | xorg-server/dix/getevents.c | 38 | ||||
-rw-r--r-- | xorg-server/dix/grabs.c | 82 | ||||
-rw-r--r-- | xorg-server/dix/inpututils.c | 60 | ||||
-rw-r--r-- | xorg-server/dix/registry.c | 673 | ||||
-rw-r--r-- | xorg-server/dix/resource.c | 2 | ||||
-rw-r--r-- | xorg-server/dix/tables.c | 1972 |
13 files changed, 1927 insertions, 1743 deletions
diff --git a/xorg-server/dix/cursor.c b/xorg-server/dix/cursor.c index f29cb1125..6bff44723 100644 --- a/xorg-server/dix/cursor.c +++ b/xorg-server/dix/cursor.c @@ -152,7 +152,7 @@ CheckForEmptyMask(CursorBitsPtr bits) if (bits->argb) { CARD32 *argb = bits->argb; - int n = bits->width * bits->height; + n = bits->width * bits->height; while (n--) if (*argb++ & 0xff000000) return; } diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index e448eab62..9ca8fe055 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -275,6 +275,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab; dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab; dev->deviceGrab.activeGrab = AllocGrab(); + dev->deviceGrab.sync.event = calloc(1, sizeof(DeviceEvent)); XkbSetExtension(dev, ProcessKeyboardEvent); diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index b39271fd9..048dff652 100644 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -3600,7 +3600,7 @@ ProcInitialConnection(ClientPtr client) } static int -SendConnSetup(ClientPtr client, char *reason) +SendConnSetup(ClientPtr client, const char *reason) { xWindowRoot *root; int i; @@ -3699,7 +3699,8 @@ SendConnSetup(ClientPtr client, char *reason) int ProcEstablishConnection(ClientPtr client) { - char *reason, *auth_proto, *auth_string; + const char *reason; + char *auth_proto, *auth_string; xConnClientPrefix *prefix; REQUEST(xReq); diff --git a/xorg-server/dix/dixutils.c b/xorg-server/dix/dixutils.c index 1e3134663..00bbde67c 100644 --- a/xorg-server/dix/dixutils.c +++ b/xorg-server/dix/dixutils.c @@ -167,8 +167,8 @@ ISOLatin1ToLower (unsigned char source) int -CompareISOLatin1Lowered(unsigned char *s1, int s1len, - unsigned char *s2, int s2len) +CompareISOLatin1Lowered(const unsigned char *s1, int s1len, + const unsigned char *s2, int s2len) { unsigned char c1, c2; diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c index c9da39685..67b420a63 100644 --- a/xorg-server/dix/eventconvert.c +++ b/xorg-server/dix/eventconvert.c @@ -647,7 +647,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi) xde = (xXIDeviceEvent*)*xi; xde->type = GenericEvent; xde->extension = IReqCode; - xde->evtype = GetXI2Type((InternalEvent*)ev); + xde->evtype = GetXI2Type(ev->type); xde->time = ev->time; xde->length = bytes_to_int32(len - sizeof(xEvent)); xde->detail = ev->detail.button; @@ -714,7 +714,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi) raw = (xXIRawEvent*)*xi; raw->type = GenericEvent; raw->extension = IReqCode; - raw->evtype = GetXI2Type((InternalEvent*)ev); + raw->evtype = GetXI2Type(ev->type); raw->time = ev->time; raw->length = bytes_to_int32(len - sizeof(xEvent)); raw->detail = ev->detail.button; @@ -746,10 +746,10 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi) * equivalent exists. */ int -GetCoreType(InternalEvent *event) +GetCoreType(enum EventType type) { int coretype = 0; - switch(event->any.type) + switch(type) { case ET_Motion: coretype = MotionNotify; break; case ET_ButtonPress: coretype = ButtonPress; break; @@ -767,10 +767,10 @@ GetCoreType(InternalEvent *event) * equivalent exists. */ int -GetXIType(InternalEvent *event) +GetXIType(enum EventType type) { int xitype = 0; - switch(event->any.type) + switch(type) { case ET_Motion: xitype = DeviceMotionNotify; break; case ET_ButtonPress: xitype = DeviceButtonPress; break; @@ -790,11 +790,11 @@ GetXIType(InternalEvent *event) * equivalent exists. */ int -GetXI2Type(InternalEvent *event) +GetXI2Type(enum EventType type) { int xi2type = 0; - switch(event->any.type) + switch(type) { case ET_Motion: xi2type = XI_Motion; break; case ET_ButtonPress: xi2type = XI_ButtonPress; break; diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c index 59caa918f..8dff29973 100644 --- a/xorg-server/dix/events.c +++ b/xorg-server/dix/events.c @@ -190,7 +190,7 @@ core_get_type(const xEvent *event) static inline int xi2_get_type(const xEvent *event) { - xGenericEvent* e = (xGenericEvent*)event; + const xGenericEvent* e = (const xGenericEvent*)event; return (e->type != GenericEvent || e->extension != IReqCode) ? 0 : e->evtype; } @@ -367,9 +367,9 @@ extern int DeviceMotionNotify; * time a button is pressed, the filter is modified to also contain the * matching ButtonXMotion mask. */ -static Mask filters[MAXDEVICES][128]; +Mask event_filters[MAXDEVICES][MAXEVENTS]; -static const Mask default_filter[128] = +static const Mask default_filter[MAXEVENTS] = { NoSuchEvent, /* 0 */ NoSuchEvent, /* 1 */ @@ -408,18 +408,6 @@ static const Mask default_filter[128] = CantBeFiltered /* MappingNotify */ }; -static inline Mask -GetEventFilterMask(DeviceIntPtr dev, int evtype) -{ - return filters[dev ? dev->id : 0][evtype]; -} - -static inline Mask -GetXI2EventFilterMask(int evtype) -{ - return (1 << (evtype % 8)); -} - /** * For the given event, return the matching event filter. This filter may then * be AND'ed with the selected event mask. @@ -441,9 +429,9 @@ GetEventFilter(DeviceIntPtr dev, xEvent *event) int evtype = 0; if (event->u.u.type != GenericEvent) - return GetEventFilterMask(dev, event->u.u.type); + return event_get_filter_from_type(dev, event->u.u.type); else if ((evtype = xi2_get_type(event))) - return GetXI2EventFilterMask(evtype); + return event_get_filter_from_xi2type(evtype); ErrorF("[dix] Unknown event type %d. No filter\n", event->u.u.type); return 0; } @@ -452,14 +440,14 @@ GetEventFilter(DeviceIntPtr dev, xEvent *event) * Return the single byte of the device's XI2 mask that contains the mask * for the event_type. */ -static int +int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type) { /* we just return the matching filter because that's the only use * for this mask anyway. */ if (xi2mask_isset(mask, dev, event_type)) - return GetXI2EventFilterMask(event_type); + return event_get_filter_from_xi2type(event_type); else return 0; } @@ -679,13 +667,13 @@ SetMaskForEvent(int deviceid, Mask mask, int event) { if (deviceid < 0 || deviceid >= MAXDEVICES) FatalError("SetMaskForEvent: bogus device id"); - filters[deviceid][event] = mask; + event_filters[deviceid][event] = mask; } void SetCriticalEvent(int event) { - if (event >= 128) + if (event >= MAXEVENTS) FatalError("SetCriticalEvent: bogus event number"); criticalEvents[event >> 3] |= 1 << (event & 7); } @@ -1484,7 +1472,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, Bool isPassive = autoGrab & ~ImplicitGrabMask; /* slave devices need to float for the duration of the grab. */ - if (grab->grabtype == GRABTYPE_XI2 && + if (grab->grabtype == XI2 && !(autoGrab & ImplicitGrabMask) && !IsMaster(mouse)) DetachFromMaster(mouse); @@ -1543,7 +1531,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) if (grab->cursor) FreeCursor(grab->cursor, (Cursor)0); - if (!wasImplicit && grab->grabtype == GRABTYPE_XI2) + if (!wasImplicit && grab->grabtype == XI2) ReattachToOldMaster(mouse); ComputeFreezes(); @@ -1561,7 +1549,7 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool pass WindowPtr oldWin; /* slave devices need to float for the duration of the grab. */ - if (grab->grabtype == GRABTYPE_XI2 && + if (grab->grabtype == XI2 && !(passive & ImplicitGrabMask) && !IsMaster(keybd)) DetachFromMaster(keybd); @@ -1616,7 +1604,7 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd) } DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); - if (!wasImplicit && grab->grabtype == GRABTYPE_XI2) + if (!wasImplicit && grab->grabtype == XI2) ReattachToOldMaster(keybd); ComputeFreezes(); @@ -1974,14 +1962,14 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win, GrabPtr tempGrab; OtherInputMasks *inputMasks; CARD8 type = event->u.u.type; - GrabType grabtype; + enum InputLevel grabtype; if (type == ButtonPress) - grabtype = GRABTYPE_CORE; + grabtype = CORE; else if (type == DeviceButtonPress) - grabtype = GRABTYPE_XI; + grabtype = XI; else if ((type = xi2_get_type(event)) == XI_ButtonPress) - grabtype = GRABTYPE_XI2; + grabtype = XI2; else return FALSE; @@ -2014,13 +2002,6 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win, return TRUE; } -enum EventDeliveryState { - EVENT_DELIVERED, /**< Event has been delivered to a client */ - EVENT_NOT_DELIVERED, /**< Event was not delivered to any client */ - EVENT_SKIP, /**< Event can be discarded by the caller */ - EVENT_REJECTED, /**< Event was rejected for delivery to the client */ -}; - /** * Attempt event delivery to the client owning the window. */ @@ -2539,29 +2520,29 @@ FixUpEventFromWindow( * client. * * @param[in] dev The device this event is being sent for. - * @param[in] event The event that is to be sent. + * @param[in] evtype The event type of the event that is to be sent. * @param[in] win The current event window. * * @return Bitmask of ::EVENT_XI2_MASK, ::EVENT_XI1_MASK, ::EVENT_CORE_MASK, and * ::EVENT_DONT_PROPAGATE_MASK. */ int -EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win) +EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win) { int rc = 0; int filter = 0; int type; OtherInputMasks *inputMasks = wOtherInputMasks(win); - if ((type = GetXI2Type(event)) != 0) + if ((type = GetXI2Type(evtype)) != 0) { if (inputMasks && xi2mask_isset(inputMasks->xi2mask, dev, type)) rc |= EVENT_XI2_MASK; } - if ((type = GetXIType(event)) != 0) + if ((type = GetXIType(evtype)) != 0) { - filter = GetEventFilterMask(dev, type); + filter = event_get_filter_from_type(dev, type); /* Check for XI mask */ if (inputMasks && @@ -2575,9 +2556,9 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win) } - if ((type = GetCoreType(event)) != 0) + if ((type = GetCoreType(evtype)) != 0) { - filter = GetEventFilterMask(dev, type); + filter = event_get_filter_from_type(dev, type); /* Check for core mask */ if ((win->deliverableEvents & filter) && @@ -2592,6 +2573,57 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win) return rc; } +static int +DeliverEvent(DeviceIntPtr dev, xEvent *xE, int count, + WindowPtr win, Window child, GrabPtr grab) +{ + SpritePtr pSprite = dev->spriteInfo->sprite; + Mask filter; + int deliveries = 0; + + if (XaceHook(XACE_SEND_ACCESS, NULL, dev, win, xE, count) == Success) { + filter = GetEventFilter(dev, xE); + FixUpEventFromWindow(pSprite, xE, win, child, FALSE); + deliveries = DeliverEventsToWindow(dev, win, xE, count, + filter, grab); + } + + return deliveries; +} + +static int +DeliverOneEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level, + WindowPtr win, Window child, GrabPtr grab) +{ + xEvent *xE = NULL; + int count = 0; + int deliveries = 0; + int rc; + + switch(level) + { + case XI2: + rc = EventToXI2(event, &xE); + count = 1; + break; + case XI: + rc = EventToXI(event, &xE, &count); + break; + case CORE: + rc = EventToCore(event, &xE, &count); + break; + } + + if (rc == Success) + { + deliveries = DeliverEvent(dev, xE, count, win, child, grab); + free(xE); + } else + BUG_WARN_MSG(rc != BadMatch, "%s: conversion to level %d failed with rc %d\n", + dev->name, level, rc); + return deliveries; +} + /** * Deliver events caused by input devices. * @@ -2615,90 +2647,53 @@ int DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, WindowPtr stopAt, DeviceIntPtr dev) { - SpritePtr pSprite = dev->spriteInfo->sprite; Window child = None; - Mask filter; int deliveries = 0; - xEvent *xE = NULL, *core = NULL; - int rc, mask, count = 0; + int mask; verify_internal_event(event); while (pWin) { - if ((mask = EventIsDeliverable(dev, event, pWin))) + if ((mask = EventIsDeliverable(dev, event->any.type, pWin))) { /* XI2 events first */ if (mask & EVENT_XI2_MASK) { - xEvent *xi2 = NULL; - rc = EventToXI2(event, &xi2); - if (rc == Success) - { - /* XXX: XACE */ - filter = GetEventFilter(dev, xi2); - FixUpEventFromWindow(pSprite, xi2, pWin, child, FALSE); - deliveries = DeliverEventsToWindow(dev, pWin, xi2, 1, - filter, grab); - free(xi2); - if (deliveries > 0) - goto unwind; - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI2 conversion failed in DDE (%d).\n", - dev->name, rc); + deliveries = DeliverOneEvent(event, dev, XI2, pWin, child, grab); + if (deliveries > 0) + break; } /* XI events */ if (mask & EVENT_XI1_MASK) { - rc = EventToXI(event, &xE, &count); - if (rc == Success) { - if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count) == Success) { - filter = GetEventFilter(dev, xE); - FixUpEventFromWindow(pSprite, xE, pWin, child, FALSE); - deliveries = DeliverEventsToWindow(dev, pWin, xE, count, - filter, grab); - if (deliveries > 0) - goto unwind; - } - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI conversion failed in DDE (%d, %d). Skipping delivery.\n", - dev->name, event->any.type, rc); + deliveries = DeliverOneEvent(event, dev, XI, pWin, child, grab); + if (deliveries > 0) + break; } /* Core event */ if ((mask & EVENT_CORE_MASK) && IsMaster(dev) && dev->coreEvents) { - rc = EventToCore(event, &core, &count); - if (rc == Success) { - if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, core, count) == Success) { - filter = GetEventFilter(dev, core); - FixUpEventFromWindow(pSprite, core, pWin, child, FALSE); - deliveries = DeliverEventsToWindow(dev, pWin, core, - count, filter, grab); - if (deliveries > 0) - goto unwind; - } - } else if (rc != BadMatch) - ErrorF("[dix] %s: Core conversion failed in DDE (%d, %d).\n", - dev->name, event->any.type, rc); + deliveries = DeliverOneEvent(event, dev, CORE, pWin, child, grab); + if (deliveries > 0) + break; } - if ((deliveries < 0) || (pWin == stopAt) || - (mask & EVENT_DONT_PROPAGATE_MASK)) - { - deliveries = 0; - goto unwind; - } + } + + if ((deliveries < 0) || (pWin == stopAt) || + (mask & EVENT_DONT_PROPAGATE_MASK)) + { + deliveries = 0; + break; } child = pWin->drawable.id; pWin = pWin->parent; } -unwind: - free(core); - free(xE); return deliveries; } @@ -3629,6 +3624,257 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin) } /** + * Activate the given passive grab. If the grab is activated successfully, the + * event has been delivered to the client. + * + * @param device The device of the event to check. + * @param grab The grab to check. + * @param event The current device event. + * + * @return Whether the grab has been activated. + */ +Bool +ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event) +{ + SpritePtr pSprite = device->spriteInfo->sprite; + GrabInfoPtr grabinfo = &device->deviceGrab; + xEvent *xE = NULL; + int count; + int rc; + + /* The only consumers of corestate are Xi 1.x and core events, which + * are guaranteed to come from DeviceEvents. */ + if (grab->grabtype == XI || grab->grabtype == CORE) + { + DeviceIntPtr gdev; + + event->device_event.corestate &= 0x1f00; + + if (grab->grabtype == CORE) + gdev = GetMaster(device, KEYBOARD_OR_FLOAT); + else + gdev = grab->modifierDevice; + + if (gdev && gdev->key && gdev->key->xkbInfo) + event->device_event.corestate |= + gdev->key->xkbInfo->state.grab_mods & (~0x1f00); + } + + if (grab->grabtype == CORE) + { + rc = EventToCore(event, &xE, &count); + if (rc != Success) + { + BUG_WARN_MSG(rc != BadMatch,"[dix] %s: core conversion failed" + "(%d, %d).\n", device->name, event->any.type, rc); + return FALSE; + } + } else if (grab->grabtype == XI2) + { + rc = EventToXI2(event, &xE); + if (rc != Success) + { + if (rc != BadMatch) + BUG_WARN_MSG(rc != BadMatch,"[dix] %s: XI2 conversion failed" + "(%d, %d).\n", device->name, event->any.type, rc); + return FALSE; + } + count = 1; + } else + { + rc = EventToXI(event, &xE, &count); + if (rc != Success) + { + if (rc != BadMatch) + BUG_WARN_MSG(rc != BadMatch,"[dix] %s: XI conversion failed" + "(%d, %d).\n", device->name, event->any.type, rc); + return FALSE; + } + } + + (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE); + + if (xE) + { + FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); + + /* XXX: XACE? */ + TryClientEvents(rClient(grab), device, xE, count, + GetEventFilter(device, xE), + GetEventFilter(device, xE), grab); + } + + if (grabinfo->sync.state == FROZEN_NO_EVENT) + grabinfo->sync.state = FROZEN_WITH_EVENT; + *grabinfo->sync.event = event->device_event; + + free(xE); + return TRUE; +} + +static BOOL +CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab) +{ + DeviceIntPtr other; + BOOL interfering = FALSE; + + for (other = inputInfo.devices; other; other = other->next) + { + GrabPtr othergrab = other->deviceGrab.grab; + if (othergrab && othergrab->grabtype == CORE && + SameClient(grab, rClient(othergrab)) && + ((IsPointerDevice(grab->device) && + IsPointerDevice(othergrab->device)) || + (IsKeyboardDevice(grab->device) && + IsKeyboardDevice(othergrab->device)))) + { + interfering = TRUE; + break; + } + } + + return interfering; +} + +enum MatchFlags { + NO_MATCH = 0x0, + CORE_MATCH = 0x1, + XI_MATCH = 0x2, + XI2_MATCH = 0x4, +}; + +/** + * Match the grab against the temporary grab on the given input level. + * Modifies the temporary grab pointer. + * + * @param grab The grab to match against + * @param tmp The temporary grab to use for matching + * @param level The input level we want to match on + * @param event_type Wire protocol event type + * + * @return The respective matched flag or 0 for no match + */ +static enum MatchFlags +MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level, int event_type) +{ + enum MatchFlags match; + BOOL ignore_device = FALSE; + int grabtype; + int evtype; + + switch(level) + { + case XI2: + grabtype = XI2; + evtype = GetXI2Type(event_type); + BUG_WARN(!evtype); + match = XI2_MATCH; + break; + case XI: + grabtype = XI; + evtype = GetXIType(event_type); + match = XI_MATCH; + break; + case CORE: + grabtype = CORE; + evtype = GetCoreType(event_type); + match = CORE_MATCH; + ignore_device = TRUE; + break; + } + + tmp->grabtype = grabtype; + tmp->type = evtype; + + if (tmp->type && GrabMatchesSecond(tmp, grab, ignore_device)) + return match; + + return NO_MATCH; +} + +/** + * Check an individual grab against an event to determine if a passive grab + * should be activated. + * + * @param device The device of the event to check. + * @param grab The grab to check. + * @param event The current device event. + * @param checkCore Check for core grabs too. + * @param tempGrab A pre-allocated temporary grab record for matching. This + * must have the window and device values filled in. + * + * @return Whether the grab matches the event. + */ +static Bool +CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event, + Bool checkCore, GrabPtr tempGrab) +{ + DeviceIntPtr gdev; + XkbSrvInfoPtr xkbi = NULL; + enum MatchFlags match = 0; + + gdev = grab->modifierDevice; + if (grab->grabtype == CORE) + { + gdev = GetMaster(device, KEYBOARD_OR_FLOAT); + } else if (grab->grabtype == XI2) + { + /* if the device is an attached slave device, gdev must be the + * attached master keyboard. Since the slave may have been + * reattached after the grab, the modifier device may not be the + * same. */ + if (!IsMaster(grab->device) && !IsFloating(device)) + gdev = GetMaster(device, MASTER_KEYBOARD); + } + + if (gdev && gdev->key) + xkbi= gdev->key->xkbInfo; + tempGrab->modifierDevice = grab->modifierDevice; + tempGrab->modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0; + + /* Check for XI2 and XI grabs first */ + match = MatchForType(grab, tempGrab, XI2, GetXI2Type(event->any.type)); + + if (!match) + match = MatchForType(grab, tempGrab, XI, GetXIType(event->any.type)); + + if (!match && checkCore) + match = MatchForType(grab, tempGrab, CORE, GetCoreType(event->any.type)); + + if (!match || (grab->confineTo && + (!grab->confineTo->realized || + !BorderSizeNotEmpty(device, grab->confineTo)))) + return FALSE; + + /* In some cases a passive core grab may exist, but the client + * already has a core grab on some other device. In this case we + * must not get the grab, otherwise we may never ungrab the + * device. + */ + + if (grab->grabtype == CORE) + { + /* A passive grab may have been created for a different device + than it is assigned to at this point in time. + Update the grab's device and modifier device to reflect the + current state. + Since XGrabDeviceButton requires to specify the + modifierDevice explicitly, we don't override this choice. + */ + if (grab->type < GenericEvent) + { + grab->device = device; + grab->modifierDevice = GetMaster(device, MASTER_KEYBOARD); + } + + if (CoreGrabInterferes(device, grab)) + return FALSE; + } + + return TRUE; +} + +/** * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a * passive grab set on the window to be activated. * If activate is true and a passive grab is found, it will be activated, @@ -3649,14 +3895,8 @@ CheckPassiveGrabsOnWindow( BOOL checkCore, BOOL activate) { - SpritePtr pSprite = device->spriteInfo->sprite; GrabPtr grab = wPassiveGrabs(pWin); GrabPtr tempGrab; - GrabInfoPtr grabinfo; -#define CORE_MATCH 0x1 -#define XI_MATCH 0x2 -#define XI2_MATCH 0x4 - int match = 0; if (!grab) return NULL; @@ -3684,185 +3924,20 @@ CheckPassiveGrabsOnWindow( tempGrab->detail.pMask = NULL; tempGrab->modifiersDetail.pMask = NULL; tempGrab->next = NULL; + for (; grab; grab = grab->next) { - DeviceIntPtr gdev; - XkbSrvInfoPtr xkbi = NULL; - xEvent *xE = NULL; - int count, rc; - - gdev= grab->modifierDevice; - if (grab->grabtype == GRABTYPE_CORE) - { - gdev = GetMaster(device, KEYBOARD_OR_FLOAT); - } else if (grab->grabtype == GRABTYPE_XI2) - { - /* if the device is an attached slave device, gdev must be the - * attached master keyboard. Since the slave may have been - * reattached after the grab, the modifier device may not be the - * same. */ - if (!IsMaster(grab->device) && !IsFloating(device)) - gdev = GetMaster(device, MASTER_KEYBOARD); - } - - - if (gdev && gdev->key) - xkbi= gdev->key->xkbInfo; - tempGrab->modifierDevice = grab->modifierDevice; - tempGrab->modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0; - - /* Check for XI2 and XI grabs first */ - tempGrab->type = GetXI2Type(event); - tempGrab->grabtype = GRABTYPE_XI2; - if (GrabMatchesSecond(tempGrab, grab, FALSE)) - match = XI2_MATCH; - - if (!match) - { - tempGrab->grabtype = GRABTYPE_XI; - if ((tempGrab->type = GetXIType(event)) && - (GrabMatchesSecond(tempGrab, grab, FALSE))) - match = XI_MATCH; - } - - /* Check for a core grab (ignore the device when comparing) */ - if (!match && checkCore) - { - tempGrab->grabtype = GRABTYPE_CORE; - if ((tempGrab->type = GetCoreType(event)) && - (GrabMatchesSecond(tempGrab, grab, TRUE))) - match = CORE_MATCH; - } - - if (!match || (grab->confineTo && - (!grab->confineTo->realized || - !BorderSizeNotEmpty(device, grab->confineTo)))) + if (!CheckPassiveGrab(device, grab, event, checkCore, tempGrab)) continue; - grabinfo = &device->deviceGrab; - /* In some cases a passive core grab may exist, but the client - * already has a core grab on some other device. In this case we - * must not get the grab, otherwise we may never ungrab the - * device. - */ - - if (grab->grabtype == GRABTYPE_CORE) - { - DeviceIntPtr other; - BOOL interfering = FALSE; - - /* A passive grab may have been created for a different device - than it is assigned to at this point in time. - Update the grab's device and modifier device to reflect the - current state. - Since XGrabDeviceButton requires to specify the - modifierDevice explicitly, we don't override this choice. - */ - if (tempGrab->type < GenericEvent) - { - grab->device = device; - grab->modifierDevice = GetMaster(device, MASTER_KEYBOARD); - } - - for (other = inputInfo.devices; other; other = other->next) - { - GrabPtr othergrab = other->deviceGrab.grab; - if (othergrab && othergrab->grabtype == GRABTYPE_CORE && - SameClient(grab, rClient(othergrab)) && - ((IsPointerDevice(grab->device) && - IsPointerDevice(othergrab->device)) || - (IsKeyboardDevice(grab->device) && - IsKeyboardDevice(othergrab->device)))) - { - interfering = TRUE; - break; - } - } - if (interfering) - continue; - } - - if (!activate) - break; - else if (!GetXIType(event) && !GetCoreType(event)) - { - ErrorF("Event type %d in CheckPassiveGrabsOnWindow is neither" - " XI 1.x nor core\n", event->any.type); - grab = NULL; - break; - } - - /* The only consumers of corestate are Xi 1.x and core events, which - * are guaranteed to come from DeviceEvents. */ - if (match & (XI_MATCH | CORE_MATCH)) - { - event->device_event.corestate &= 0x1f00; - event->device_event.corestate |= tempGrab->modifiersDetail.exact & - (~0x1f00); - } - - if (match & CORE_MATCH) - { - rc = EventToCore(event, &xE, &count); - if (rc != Success) - { - if (rc != BadMatch) - ErrorF("[dix] %s: core conversion failed in CPGFW " - "(%d, %d).\n", device->name, event->any.type, rc); - continue; - } - } else if (match & XI2_MATCH) - { - rc = EventToXI2(event, &xE); - if (rc != Success) - { - if (rc != BadMatch) - ErrorF("[dix] %s: XI2 conversion failed in CPGFW " - "(%d, %d).\n", device->name, event->any.type, rc); - continue; - } - count = 1; - } else - { - rc = EventToXI(event, &xE, &count); - if (rc != Success) - { - if (rc != BadMatch) - ErrorF("[dix] %s: XI conversion failed in CPGFW " - "(%d, %d).\n", device->name, event->any.type, rc); - continue; - } - } - - (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE); - - if (xE) - { - FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); - - /* XXX: XACE? */ - TryClientEvents(rClient(grab), device, xE, count, - GetEventFilter(device, xE), - GetEventFilter(device, xE), grab); - } - - if (grabinfo->sync.state == FROZEN_NO_EVENT) - { - if (!grabinfo->sync.event) - grabinfo->sync.event = calloc(1, sizeof(DeviceEvent)); - *grabinfo->sync.event = event->device_event; - grabinfo->sync.state = FROZEN_WITH_EVENT; - } + if (activate && !ActivatePassiveGrab(device, grab, event)) + continue; - free(xE); break; } FreeGrab(tempGrab); return grab; -#undef CORE_MATCH -#undef XI_MATCH -#undef XI2_MATCH } /** @@ -4048,6 +4123,75 @@ unwind: return; } + +int +DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level) +{ + SpritePtr pSprite = dev->spriteInfo->sprite; + int rc; + xEvent *xE = NULL; + int count = 0; + int deliveries = 0; + Mask mask; + GrabInfoPtr grabinfo = &dev->deviceGrab; + GrabPtr grab = grabinfo->grab; + Mask filter; + + switch(level) + { + case XI2: + rc = EventToXI2(event, &xE); + count = 1; + if (rc == Success) + { + int evtype = xi2_get_type(xE); + mask = xi2mask_isset(grab->xi2mask, dev, evtype); + filter = 1; + } + break; + case XI: + if (grabinfo->fromPassiveGrab && grabinfo->implicitGrab) + mask = grab->deviceMask; + else + mask = grab->eventMask; + rc = EventToXI(event, &xE, &count); + if (rc == Success) + filter = GetEventFilter(dev, xE); + break; + case CORE: + rc = EventToCore(event, &xE, &count); + mask = grab->eventMask; + if (rc == Success) + filter = GetEventFilter(dev, xE); + break; + default: + BUG_WARN_MSG(1, "Invalid input level %d\n", level); + return 0; + } + + if (rc == Success) + { + FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); + if (XaceHook(XACE_SEND_ACCESS, 0, dev, + grab->window, xE, count) || + XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), + grab->window, xE, count)) + deliveries = 1; /* don't send, but pretend we did */ + else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE)) + { + deliveries = TryClientEvents(rClient(grab), dev, + xE, count, mask, filter, + grab); + } + } else + BUG_WARN_MSG(rc != BadMatch, "%s: conversion to mode %d failed on %d with %d\n", + dev->name, level, event->any.type, rc); + + free(xE); + return deliveries; +} + + /** * Deliver an event from a device that is currently grabbed. Uses * DeliverDeviceEvents() for further delivery if a ownerEvents is set on the @@ -4067,10 +4211,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, DeviceIntPtr dev; SpritePtr pSprite = thisDev->spriteInfo->sprite; BOOL sendCore = FALSE; - int rc, count = 0; - xEvent *xi = NULL; - xEvent *xi2 = NULL; - xEvent *core = NULL; grabinfo = &thisDev->deviceGrab; grab = grabinfo->grab; @@ -4078,6 +4218,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, if (grab->ownerEvents) { WindowPtr focus; + WindowPtr win; /* Hack: Some pointer device have a focus class. So we need to check * for the type of event, to see if we really want to deliver it to @@ -4094,99 +4235,40 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, else focus = PointerRootWin; if (focus == PointerRootWin) - deliveries = DeliverDeviceEvents(pSprite->win, event, grab, - NullWindow, thisDev); - else if (focus && (focus == pSprite->win || - IsParent(focus, pSprite->win))) - deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus, - thisDev); + { + win = pSprite->win; + focus = NullWindow; + } else if (focus && (focus == pSprite->win || + IsParent(focus, pSprite->win))) + win = pSprite->win; else if (focus) - deliveries = DeliverDeviceEvents(focus, event, grab, focus, - thisDev); + win = focus; + + deliveries = DeliverDeviceEvents(win, event, grab, focus, thisDev); } if (!deliveries) { - Mask mask; - /* XXX: In theory, we could pass the internal events through to * everything and only convert just before hitting the wire. We can't * do that yet, so DGE is the last stop for internal events. From here * onwards, we deal with core/XI events. */ - mask = grab->eventMask; - sendCore = (IsMaster(thisDev) && thisDev->coreEvents); /* try core event */ - if (sendCore && grab->grabtype == GRABTYPE_CORE) + if (sendCore && grab->grabtype == CORE) { - rc = EventToCore(event, &core, &count); - if (rc == Success) - { - FixUpEventFromWindow(pSprite, core, grab->window, None, TRUE); - if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, - grab->window, core, count) || - XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), - grab->window, core, count)) - deliveries = 1; /* don't send, but pretend we did */ - else if (!IsInterferingGrab(rClient(grab), thisDev, core)) - { - deliveries = TryClientEvents(rClient(grab), thisDev, - core, count, mask, - GetEventFilter(thisDev, core), - grab); - } - } else if (rc != BadMatch) - ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n"); + deliveries = DeliverOneGrabbedEvent(event, thisDev, CORE); } if (!deliveries) { - rc = EventToXI2(event, &xi2); - if (rc == Success) - { - int evtype = xi2_get_type(xi2); - mask = xi2mask_isset(grab->xi2mask, thisDev, evtype); - /* try XI2 event */ - FixUpEventFromWindow(pSprite, xi2, grab->window, None, TRUE); - /* XXX: XACE */ - deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask, 1, grab); - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI2 conversion failed in DGE (%d, %d). Skipping delivery.\n", - thisDev->name, event->any.type, rc); + deliveries = DeliverOneGrabbedEvent(event, thisDev, XI2); } if (!deliveries) { - rc = EventToXI(event, &xi, &count); - if (rc == Success) - { - /* try XI event */ - if (grabinfo->fromPassiveGrab && - grabinfo->implicitGrab) - mask = grab->deviceMask; - else - mask = grab->eventMask; - - FixUpEventFromWindow(pSprite, xi, grab->window, None, TRUE); - - if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, - grab->window, xi, count) || - XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), - grab->window, xi, count)) - deliveries = 1; /* don't send, but pretend we did */ - else - { - deliveries = - TryClientEvents(rClient(grab), thisDev, - xi, count, - mask, - GetEventFilter(thisDev, xi), - grab); - } - } else if (rc != BadMatch) - ErrorF("[dix] %s: XI conversion failed in DGE (%d, %d). Skipping delivery.\n", - thisDev->name, event->any.type, rc); + deliveries = DeliverOneGrabbedEvent(event, thisDev, XI); } if (deliveries && (event->any.type == ET_Motion)) @@ -4212,17 +4294,11 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, case FREEZE_NEXT_EVENT: grabinfo->sync.state = FROZEN_WITH_EVENT; FreezeThaw(thisDev, TRUE); - if (!grabinfo->sync.event) - grabinfo->sync.event = calloc(1, sizeof(InternalEvent)); *grabinfo->sync.event = event->device_event; break; } } - free(core); - free(xi); - free(xi2); - return deliveries; } @@ -4876,7 +4952,7 @@ ProcGrabPointer(ClientPtr client) rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, - &mask, GRABTYPE_CORE, stuff->cursor, + &mask, CORE, stuff->cursor, stuff->confineTo, &rep.status); if (rc != Success) return rc; @@ -5084,9 +5160,9 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, tempGrab->ownerEvents = ownerEvents; tempGrab->keyboardMode = keyboard_mode; tempGrab->pointerMode = pointer_mode; - if (grabtype == GRABTYPE_CORE) + if (grabtype == CORE) tempGrab->eventMask = mask->core; - else if (grabtype == GRABTYPE_XI) + else if (grabtype == XI) tempGrab->eventMask = mask->xi; else xi2mask_merge(tempGrab->xi2mask, mask->xi2mask); @@ -5123,7 +5199,7 @@ ProcGrabKeyboard(ClientPtr client) result = GrabDevice(client, keyboard, stuff->pointerMode, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, - stuff->time, &mask, GRABTYPE_CORE, None, None, + stuff->time, &mask, CORE, None, None, &rep.status); if (result != Success) @@ -5156,7 +5232,7 @@ ProcUngrabKeyboard(ClientPtr client) time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) && - (grab) && SameClient(grab, client) && grab->grabtype == GRABTYPE_CORE) + (grab) && SameClient(grab, client) && grab->grabtype == CORE) (*device->deviceGrab.DeactivateGrab)(device); return Success; } @@ -5262,7 +5338,7 @@ InitEvents(void) inputInfo.pointer = (DeviceIntPtr)NULL; for (i = 0; i < MAXDEVICES; i++) { - memcpy(&filters[i], default_filter, sizeof(default_filter)); + memcpy(&event_filters[i], default_filter, sizeof(default_filter)); } syncEvents.replayDev = (DeviceIntPtr)NULL; @@ -5448,7 +5524,7 @@ ProcUngrabKey(ClientPtr client) tempGrab->modifiersDetail.pMask = NULL; tempGrab->modifierDevice = keybd; tempGrab->type = KeyPress; - tempGrab->grabtype = GRABTYPE_CORE; + tempGrab->grabtype = CORE; tempGrab->detail.exact = stuff->key; tempGrab->detail.pMask = NULL; tempGrab->next = NULL; @@ -5481,7 +5557,7 @@ ProcGrabKey(ClientPtr client) REQUEST_SIZE_MATCH(xGrabKeyReq); memset(¶m, 0, sizeof(param)); - param.grabtype = GRABTYPE_CORE; + param.grabtype = CORE; param.ownerEvents = stuff->ownerEvents; param.this_device_mode = stuff->keyboardMode; param.other_devices_mode = stuff->pointerMode; @@ -5505,7 +5581,7 @@ ProcGrabKey(ClientPtr client) mask.core = (KeyPressMask | KeyReleaseMask); - grab = CreateGrab(client->index, keybd, keybd, pWin, GRABTYPE_CORE, &mask, + grab = CreateGrab(client->index, keybd, keybd, pWin, CORE, &mask, ¶m, KeyPress, stuff->key, NullWindow, NullCursor); if (!grab) return BadAlloc; @@ -5596,7 +5672,7 @@ ProcGrabButton(ClientPtr client) return rc; memset(¶m, 0, sizeof(param)); - param.grabtype = GRABTYPE_CORE; + param.grabtype = CORE; param.ownerEvents = stuff->ownerEvents; param.this_device_mode = stuff->keyboardMode; param.other_devices_mode = stuff->pointerMode; @@ -5605,7 +5681,7 @@ ProcGrabButton(ClientPtr client) mask.core = stuff->eventMask; grab = CreateGrab(client->index, ptr, modifierDevice, pWin, - GRABTYPE_CORE, &mask, ¶m, ButtonPress, + CORE, &mask, ¶m, ButtonPress, stuff->button, confineTo, cursor); if (!grab) return BadAlloc; @@ -5650,7 +5726,7 @@ ProcUngrabButton(ClientPtr client) tempGrab->modifierDevice = GetMaster(ptr, MASTER_KEYBOARD); tempGrab->type = ButtonPress; tempGrab->detail.exact = stuff->button; - tempGrab->grabtype = GRABTYPE_CORE; + tempGrab->grabtype = CORE; tempGrab->detail.pMask = NULL; tempGrab->next = NULL; @@ -6057,7 +6133,7 @@ PickPointer(ClientPtr client) for(it = inputInfo.devices; it; it = it->next) { GrabPtr grab = it->deviceGrab.grab; - if (grab && grab->grabtype == GRABTYPE_CORE && SameClient(grab, client)) + if (grab && grab->grabtype == CORE && SameClient(grab, client)) { it = GetMaster(it, MASTER_POINTER); return it; /* Always return a core grabbed device */ diff --git a/xorg-server/dix/extension.c b/xorg-server/dix/extension.c index cc516b6ba..af9ba312d 100644 --- a/xorg-server/dix/extension.c +++ b/xorg-server/dix/extension.c @@ -61,7 +61,6 @@ SOFTWARE. #include "registry.h" #include "xace.h" -#define LAST_EVENT 128 #define LAST_ERROR 255 static ExtensionEntry **extensions = (ExtensionEntry **)NULL; @@ -82,7 +81,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors, if (!MainProc || !SwappedMainProc || !MinorOpcodeProc) return((ExtensionEntry *) NULL); - if ((lastEvent + NumEvents > LAST_EVENT) || + if ((lastEvent + NumEvents > MAXEVENTS) || (unsigned)(lastError + NumErrors > LAST_ERROR)) { LogMessage(X_ERROR, "Not enabling extension %s: maximum number of " "events or errors exceeded.\n", name); diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index 8798f6418..57d8c17c6 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -1094,6 +1094,30 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask) valuator_mask_set_double(mask, 1, y); } +static void +storeLastValuators(DeviceIntPtr dev, ValuatorMask *mask, + int xaxis, int yaxis, + double devx, double devy) +{ + int i; + + /* store desktop-wide in last.valuators */ + if (valuator_mask_isset(mask, xaxis)) + dev->last.valuators[0] = devx; + if (valuator_mask_isset(mask, yaxis)) + dev->last.valuators[1] = devy; + + for (i = 0; i < valuator_mask_size(mask); i++) + { + if (i == xaxis || i == yaxis) + continue; + + if (valuator_mask_isset(mask, i)) + dev->last.valuators[i] = valuator_mask_get_double(mask, i); + } + +} + /** * Generate internal events representing this pointer event and enqueue them * on the event queue. @@ -1162,7 +1186,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons, CARD32 ms, int flags, const ValuatorMask *mask_in) { - int num_events = 1, i; + int num_events = 1; DeviceEvent *event; RawDeviceEvent *raw; double screenx = 0.0, screeny = 0.0; /* desktop coordinate system */ @@ -1237,17 +1261,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, clipValuators(pDev, &mask); - /* store desktop-wide in last.valuators */ - if (valuator_mask_isset(&mask, 0)) - pDev->last.valuators[0] = devx; - if (valuator_mask_isset(&mask, 1)) - pDev->last.valuators[1] = devy; - - for (i = 2; i < valuator_mask_size(&mask); i++) - { - if (valuator_mask_isset(&mask, i)) - pDev->last.valuators[i] = valuator_mask_get_double(&mask, i); - } + storeLastValuators(pDev, &mask, 0, 1, devx, devy); /* Update the MD's co-ordinates, which are always in desktop space. */ if (!IsMaster(pDev) || !IsFloating(pDev)) { diff --git a/xorg-server/dix/grabs.c b/xorg-server/dix/grabs.c index aced130a7..da014dfc3 100644 --- a/xorg-server/dix/grabs.c +++ b/xorg-server/dix/grabs.c @@ -60,7 +60,9 @@ SOFTWARE. #include "dixgrabs.h" #include "xace.h" #include "exevents.h" +#include "exglobals.h" #include "inpututils.h" +#include "client.h" #define BITMASK(i) (((Mask)1) << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) @@ -77,25 +79,41 @@ PrintDeviceGrabInfo(DeviceIntPtr dev) int i, j; GrabInfoPtr devGrab = &dev->deviceGrab; GrabPtr grab = devGrab->grab; + Bool clientIdPrinted = FALSE; - ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):", + ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):\n", (unsigned long) grab->resource, - (grab->grabtype == GRABTYPE_XI2) ? "xi2" : - ((grab->grabtype == GRABTYPE_CORE) ? "core" : "xi1"), + (grab->grabtype == XI2) ? "xi2" : + ((grab->grabtype == CORE) ? "core" : "xi1"), dev->name, dev->id); client = clients[CLIENT_ID(grab->resource)]; - if (client && GetLocalClientCreds(client, &lcc) != -1) + if (client) { - ErrorF(" client pid %ld uid %ld gid %ld\n", - (lcc->fieldsSet & LCC_PID_SET) ? (long) lcc->pid : 0, - (lcc->fieldsSet & LCC_UID_SET) ? (long) lcc->euid : 0, - (lcc->fieldsSet & LCC_GID_SET) ? (long) lcc->egid : 0); - FreeLocalClientCreds(lcc); + pid_t clientpid = GetClientPid(client); + const char *cmdname = GetClientCmdName(client); + const char *cmdargs = GetClientCmdArgs(client); + + if ((clientpid > 0) && (cmdname != NULL)) + { + ErrorF(" client pid %ld %s %s\n", + (long) clientpid, cmdname, cmdargs ? cmdargs : ""); + clientIdPrinted = TRUE; + } + else if (GetLocalClientCreds(client, &lcc) != -1) + { + ErrorF(" client pid %ld uid %ld gid %ld\n", + (lcc->fieldsSet & LCC_PID_SET) ? (long) lcc->pid : 0, + (lcc->fieldsSet & LCC_UID_SET) ? (long) lcc->euid : 0, + (lcc->fieldsSet & LCC_GID_SET) ? (long) lcc->egid : 0); + FreeLocalClientCreds(lcc); + clientIdPrinted = TRUE; + } } - else + if (!clientIdPrinted) { - ErrorF(" (no client information available)\n"); + ErrorF(" (no client information available for client %d)\n", + CLIENT_ID(grab->resource)); } /* XXX is this even correct? */ @@ -110,18 +128,18 @@ PrintDeviceGrabInfo(DeviceIntPtr dev) devGrab->sync.frozen ? "frozen" : "thawed", devGrab->sync.state); - if (grab->grabtype == GRABTYPE_CORE) + if (grab->grabtype == CORE) { ErrorF(" core event mask 0x%lx\n", (unsigned long) grab->eventMask); } - else if (grab->grabtype == GRABTYPE_XI) + else if (grab->grabtype == XI) { ErrorF(" xi1 event mask 0x%lx\n", devGrab->implicitGrab ? (unsigned long) grab->deviceMask : (unsigned long) grab->eventMask); } - else if (grab->grabtype == GRABTYPE_XI2) + else if (grab->grabtype == XI2) { for (i = 0; i < xi2mask_num_masks(grab->xi2mask); i++) { @@ -205,7 +223,7 @@ CreateGrab( DeviceIntPtr device, DeviceIntPtr modDevice, WindowPtr window, - GrabType grabtype, + enum InputLevel grabtype, GrabMask *mask, GrabParameters *param, int type, @@ -237,7 +255,7 @@ CreateGrab( grab->cursor = cursor; grab->next = NULL; - if (grabtype == GRABTYPE_XI2) + if (grabtype == XI2) xi2mask_merge(grab->xi2mask, mask->xi2mask); if (cursor) cursor->refcnt++; @@ -409,7 +427,7 @@ DetailSupersedesSecond( static Bool GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab) { - unsigned int any_modifier = (pFirstGrab->grabtype == GRABTYPE_XI2) ? + unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ? (unsigned int)XIAnyModifier : (unsigned int)AnyModifier; if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail, @@ -440,14 +458,14 @@ GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab) Bool GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice) { - unsigned int any_modifier = (pFirstGrab->grabtype == GRABTYPE_XI2) ? + unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ? (unsigned int)XIAnyModifier : (unsigned int)AnyModifier; if (pFirstGrab->grabtype != pSecondGrab->grabtype) return FALSE; - if (pFirstGrab->grabtype == GRABTYPE_XI2) + if (pFirstGrab->grabtype == XI2) { if (pFirstGrab->device == inputInfo.all_devices || pSecondGrab->device == inputInfo.all_devices) @@ -499,7 +517,7 @@ GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice) static Bool GrabsAreIdentical(GrabPtr pFirstGrab, GrabPtr pSecondGrab) { - unsigned int any_modifier = (pFirstGrab->grabtype == GRABTYPE_XI2) ? + unsigned int any_modifier = (pFirstGrab->grabtype == XI2) ? (unsigned int)XIAnyModifier : (unsigned int)AnyModifier; @@ -549,7 +567,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab) for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) { - if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == GRABTYPE_CORE))) + if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == CORE))) { if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource)) { @@ -627,9 +645,9 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) return FALSE; } - any_modifier = (pMinuendGrab->grabtype == GRABTYPE_XI2) ? + any_modifier = (pMinuendGrab->grabtype == XI2) ? (unsigned int)XIAnyModifier : (unsigned int)AnyModifier; - any_key = (pMinuendGrab->grabtype == GRABTYPE_XI2) ? + any_key = (pMinuendGrab->grabtype == XI2) ? (unsigned int)XIAnyKeycode : (unsigned int)AnyKey; ndels = nadds = nups = 0; ok = TRUE; @@ -639,7 +657,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) { if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource)) || !GrabMatchesSecond(grab, pMinuendGrab, - (grab->grabtype == GRABTYPE_CORE))) + (grab->grabtype == CORE))) continue; if (GrabSupersedesSecond(pMinuendGrab, grab)) { @@ -737,3 +755,19 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) #undef UPDATE } + +Bool +GrabIsPointerGrab(GrabPtr grab) +{ + return (grab->type == ButtonPress || + grab->type == DeviceButtonPress || + grab->type == XI_ButtonPress); +} + +Bool +GrabIsKeyboardGrab(GrabPtr grab) +{ + return (grab->type == KeyPress || + grab->type == DeviceKeyPress || + grab->type == XI_KeyPress); +} diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c index 60f9fa0a8..8cd4d5921 100644 --- a/xorg-server/dix/inpututils.c +++ b/xorg-server/dix/inpututils.c @@ -626,7 +626,7 @@ void verify_internal_event(const InternalEvent *ev) if (ev && ev->any.header != ET_Internal) { int i; - unsigned char *data = (unsigned char*)ev; + const unsigned char *data = (const unsigned char*)ev; ErrorF("dix: invalid event type %d\n", ev->any.header); @@ -657,6 +657,64 @@ void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms) event->sourceid = dev->id; } +int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd) +{ + int corestate; + /* core state needs to be assembled BEFORE the device is updated. */ + corestate = (kbd && kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0; + corestate |= (mouse && mouse->button) ? (mouse->button->state) : 0; + return corestate; +} + +void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event) +{ + int i; + + for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) + if (BitIsOn(mouse->button->down, i)) + SetBit(event->buttons, i); + + if (kbd && kbd->key) + { + XkbStatePtr state; + /* we need the state before the event happens */ + if (event->type == ET_KeyPress || event->type == ET_KeyRelease) + state = &kbd->key->xkbInfo->prev_state; + else + state = &kbd->key->xkbInfo->state; + + event->mods.base = state->base_mods; + event->mods.latched = state->latched_mods; + event->mods.locked = state->locked_mods; + event->mods.effective = state->mods; + + event->group.base = state->base_group; + event->group.latched = state->latched_group; + event->group.locked = state->locked_group; + event->group.effective = state->group; + } +} + +/** + * Return the event filter mask for the given device and the given core or + * XI1 protocol type. + */ +Mask +event_get_filter_from_type(DeviceIntPtr dev, int evtype) +{ + return event_filters[dev ? dev->id : 0][evtype]; +} + +/** + * Return the event filter mask for the given device and the given core or + * XI2 protocol type. + */ +Mask +event_get_filter_from_xi2type(int evtype) +{ + return (1 << (evtype % 8)); +} + Bool point_on_screen(ScreenPtr pScreen, int x, int y) { diff --git a/xorg-server/dix/registry.c b/xorg-server/dix/registry.c index 9a83ff74e..5ab25ad70 100644 --- a/xorg-server/dix/registry.c +++ b/xorg-server/dix/registry.c @@ -1,336 +1,337 @@ -/************************************************************
-
-Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-this permission notice appear in supporting documentation. This permission
-notice shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifdef XREGISTRY
-
-#include <stdlib.h>
-#include <string.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "resource.h"
-#include "registry.h"
-
-#define BASE_SIZE 16
-#define CORE "X11"
-#define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt"
-
-#define PROT_COMMENT '#'
-#define PROT_REQUEST 'R'
-#define PROT_EVENT 'V'
-#define PROT_ERROR 'E'
-
-static FILE *fh;
-
-static char ***requests, **events, **errors, **resources;
-static unsigned nmajor, *nminor, nevent, nerror, nresource;
-
-/*
- * File parsing routines
- */
-static int double_size(void *p, unsigned n, unsigned size)
-{
- char **ptr = (char **)p;
- unsigned s, f;
-
- if (n) {
- s = n * size;
- n *= 2 * size;
- f = n;
- } else {
- s = 0;
- n = f = BASE_SIZE * size;
- }
-
- *ptr = realloc(*ptr, n);
- if (!*ptr) {
- dixResetRegistry();
- return FALSE;
- }
- memset(*ptr + s, 0, f - s);
- return TRUE;
-}
-
-static void
-RegisterRequestName(unsigned major, unsigned minor, char *name)
-{
- while (major >= nmajor) {
- if (!double_size(&requests, nmajor, sizeof(char **)))
- return;
- if (!double_size(&nminor, nmajor, sizeof(unsigned)))
- return;
- nmajor = nmajor ? nmajor * 2 : BASE_SIZE;
- }
- while (minor >= nminor[major]) {
- if (!double_size(requests+major, nminor[major], sizeof(char *)))
- return;
- nminor[major] = nminor[major] ? nminor[major] * 2 : BASE_SIZE;
- }
-
- free(requests[major][minor]);
- requests[major][minor] = name;
-}
-
-static void
-RegisterEventName(unsigned event, char *name) {
- while (event >= nevent) {
- if (!double_size(&events, nevent, sizeof(char *)))
- return;
- nevent = nevent ? nevent * 2 : BASE_SIZE;
- }
-
- free(events[event]);
- events[event] = name;
-}
-
-static void
-RegisterErrorName(unsigned error, char *name) {
- while (error >= nerror) {
- if (!double_size(&errors, nerror, sizeof(char *)))
- return;
- nerror = nerror ? nerror * 2 : BASE_SIZE;
- }
-
- free(errors[error]);
- errors[error] = name;
-}
-
-void
-RegisterExtensionNames(ExtensionEntry *extEntry)
-{
- char buf[256], *lineobj, *ptr;
- unsigned offset;
-
- if (fh == NULL)
- return;
-
- rewind(fh);
-
- while (fgets(buf, sizeof(buf), fh)) {
- lineobj = NULL;
- ptr = strchr(buf, '\n');
- if (ptr)
- *ptr = 0;
-
- /* Check for comments or empty lines */
- switch (buf[0]) {
- case PROT_REQUEST:
- case PROT_EVENT:
- case PROT_ERROR:
- break;
- case PROT_COMMENT:
- case '\0':
- continue;
- default:
- goto invalid;
- }
-
- /* Check for space character in the fifth position */
- ptr = strchr(buf, ' ');
- if (!ptr || ptr != buf + 4)
- goto invalid;
-
- /* Duplicate the string after the space */
- lineobj = strdup(ptr + 1);
- if (!lineobj)
- continue;
-
- /* Check for a colon somewhere on the line */
- ptr = strchr(buf, ':');
- if (!ptr)
- goto invalid;
-
- /* Compare the part before colon with the target extension name */
- *ptr = 0;
- if (strcmp(buf + 5, extEntry->name))
- goto skip;
-
- /* Get the opcode for the request, event, or error */
- offset = strtol(buf + 1, &ptr, 10);
- if (offset == 0 && ptr == buf + 1)
- goto invalid;
-
- /* Save the strdup result in the registry */
- switch(buf[0]) {
- case PROT_REQUEST:
- if (extEntry->base)
- RegisterRequestName(extEntry->base, offset, lineobj);
- else
- RegisterRequestName(offset, 0, lineobj);
- continue;
- case PROT_EVENT:
- RegisterEventName(extEntry->eventBase + offset, lineobj);
- continue;
- case PROT_ERROR:
- RegisterErrorName(extEntry->errorBase + offset, lineobj);
- continue;
- }
-
- invalid:
- LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
- skip:
- free(lineobj);
- }
-}
-
-/*
- * Registration functions
- */
-
-void
-RegisterResourceName(RESTYPE resource, char *name)
-{
- resource &= TypeMask;
-
- while (resource >= nresource) {
- if (!double_size(&resources, nresource, sizeof(char *)))
- return;
- nresource = nresource ? nresource * 2 : BASE_SIZE;
- }
-
- resources[resource] = name;
-}
-
-/*
- * Lookup functions
- */
-
-const char *
-LookupRequestName(int major, int minor)
-{
- if (major >= nmajor)
- return XREGISTRY_UNKNOWN;
- if (minor >= nminor[major])
- return XREGISTRY_UNKNOWN;
-
- return requests[major][minor] ? requests[major][minor] : XREGISTRY_UNKNOWN;
-}
-
-const char *
-LookupMajorName(int major)
-{
- if (major < 128) {
- const char *retval;
-
- if (major >= nmajor)
- return XREGISTRY_UNKNOWN;
- if (0 >= nminor[major])
- return XREGISTRY_UNKNOWN;
-
- retval = requests[major][0];
- return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN;
- } else {
- ExtensionEntry *extEntry = GetExtensionEntry(major);
- return extEntry ? extEntry->name : XREGISTRY_UNKNOWN;
- }
-}
-
-const char *
-LookupEventName(int event)
-{
- event &= 127;
- if (event >= nevent)
- return XREGISTRY_UNKNOWN;
-
- return events[event] ? events[event] : XREGISTRY_UNKNOWN;
-}
-
-const char *
-LookupErrorName(int error)
-{
- if (error >= nerror)
- return XREGISTRY_UNKNOWN;
-
- return errors[error] ? errors[error] : XREGISTRY_UNKNOWN;
-}
-
-const char *
-LookupResourceName(RESTYPE resource)
-{
- resource &= TypeMask;
- if (resource >= nresource)
- return XREGISTRY_UNKNOWN;
-
- return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
-}
-
-/*
- * Setup and teardown
- */
-void
-dixResetRegistry(void)
-{
- ExtensionEntry extEntry;
-
- /* Free all memory */
- while (nmajor--) {
- while (nminor[nmajor])
- free(requests[nmajor][--nminor[nmajor]]);
- free(requests[nmajor]);
- }
- free(requests);
- free(nminor);
-
- while (nevent--)
- free(events[nevent]);
- free(events);
-
- while (nerror--)
- free(errors[nerror]);
- free(errors);
-
- free(resources);
-
- requests = NULL;
- nminor = NULL;
- events = NULL;
- errors = NULL;
- resources = NULL;
-
- nmajor = nevent = nerror = nresource = 0;
-
- /* Open the protocol file */
- if (fh)
- fclose(fh);
- fh = fopen(FILENAME, "r");
- if (!fh)
- LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME "\n");
-
- /* Add built-in resources */
- RegisterResourceName(RT_NONE, "NONE");
- RegisterResourceName(RT_WINDOW, "WINDOW");
- RegisterResourceName(RT_PIXMAP, "PIXMAP");
- RegisterResourceName(RT_GC, "GC");
- RegisterResourceName(RT_FONT, "FONT");
- RegisterResourceName(RT_CURSOR, "CURSOR");
- RegisterResourceName(RT_COLORMAP, "COLORMAP");
- RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
- RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");
- RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
-
- /* Add the core protocol */
- memset(&extEntry, 0, sizeof(extEntry));
- extEntry.name = CORE;
- RegisterExtensionNames(&extEntry);
-}
-
-#endif /* XREGISTRY */
+/************************************************************ + +Author: Eamon Walsh <ewalsh@tycho.nsa.gov> + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +this permission notice appear in supporting documentation. This permission +notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +********************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#ifdef XREGISTRY + +#include <stdlib.h> +#include <string.h> +#include <X11/X.h> +#include <X11/Xproto.h> +#include "resource.h" +#include "registry.h" + +#define BASE_SIZE 16 +#define CORE "X11" +#define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt" + +#define PROT_COMMENT '#' +#define PROT_REQUEST 'R' +#define PROT_EVENT 'V' +#define PROT_ERROR 'E' + +static FILE *fh; + +static char ***requests, **events, **errors; +static const char **resources; +static unsigned nmajor, *nminor, nevent, nerror, nresource; + +/* + * File parsing routines + */ +static int double_size(void *p, unsigned n, unsigned size) +{ + char **ptr = (char **)p; + unsigned s, f; + + if (n) { + s = n * size; + n *= 2 * size; + f = n; + } else { + s = 0; + n = f = BASE_SIZE * size; + } + + *ptr = realloc(*ptr, n); + if (!*ptr) { + dixResetRegistry(); + return FALSE; + } + memset(*ptr + s, 0, f - s); + return TRUE; +} + +static void +RegisterRequestName(unsigned major, unsigned minor, char *name) +{ + while (major >= nmajor) { + if (!double_size(&requests, nmajor, sizeof(char **))) + return; + if (!double_size(&nminor, nmajor, sizeof(unsigned))) + return; + nmajor = nmajor ? nmajor * 2 : BASE_SIZE; + } + while (minor >= nminor[major]) { + if (!double_size(requests+major, nminor[major], sizeof(char *))) + return; + nminor[major] = nminor[major] ? nminor[major] * 2 : BASE_SIZE; + } + + free(requests[major][minor]); + requests[major][minor] = name; +} + +static void +RegisterEventName(unsigned event, char *name) { + while (event >= nevent) { + if (!double_size(&events, nevent, sizeof(char *))) + return; + nevent = nevent ? nevent * 2 : BASE_SIZE; + } + + free(events[event]); + events[event] = name; +} + +static void +RegisterErrorName(unsigned error, char *name) { + while (error >= nerror) { + if (!double_size(&errors, nerror, sizeof(char *))) + return; + nerror = nerror ? nerror * 2 : BASE_SIZE; + } + + free(errors[error]); + errors[error] = name; +} + +void +RegisterExtensionNames(ExtensionEntry *extEntry) +{ + char buf[256], *lineobj, *ptr; + unsigned offset; + + if (fh == NULL) + return; + + rewind(fh); + + while (fgets(buf, sizeof(buf), fh)) { + lineobj = NULL; + ptr = strchr(buf, '\n'); + if (ptr) + *ptr = 0; + + /* Check for comments or empty lines */ + switch (buf[0]) { + case PROT_REQUEST: + case PROT_EVENT: + case PROT_ERROR: + break; + case PROT_COMMENT: + case '\0': + continue; + default: + goto invalid; + } + + /* Check for space character in the fifth position */ + ptr = strchr(buf, ' '); + if (!ptr || ptr != buf + 4) + goto invalid; + + /* Duplicate the string after the space */ + lineobj = strdup(ptr + 1); + if (!lineobj) + continue; + + /* Check for a colon somewhere on the line */ + ptr = strchr(buf, ':'); + if (!ptr) + goto invalid; + + /* Compare the part before colon with the target extension name */ + *ptr = 0; + if (strcmp(buf + 5, extEntry->name)) + goto skip; + + /* Get the opcode for the request, event, or error */ + offset = strtol(buf + 1, &ptr, 10); + if (offset == 0 && ptr == buf + 1) + goto invalid; + + /* Save the strdup result in the registry */ + switch(buf[0]) { + case PROT_REQUEST: + if (extEntry->base) + RegisterRequestName(extEntry->base, offset, lineobj); + else + RegisterRequestName(offset, 0, lineobj); + continue; + case PROT_EVENT: + RegisterEventName(extEntry->eventBase + offset, lineobj); + continue; + case PROT_ERROR: + RegisterErrorName(extEntry->errorBase + offset, lineobj); + continue; + } + + invalid: + LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); + skip: + free(lineobj); + } +} + +/* + * Registration functions + */ + +void +RegisterResourceName(RESTYPE resource, const char *name) +{ + resource &= TypeMask; + + while (resource >= nresource) { + if (!double_size(&resources, nresource, sizeof(char *))) + return; + nresource = nresource ? nresource * 2 : BASE_SIZE; + } + + resources[resource] = name; +} + +/* + * Lookup functions + */ + +const char * +LookupRequestName(int major, int minor) +{ + if (major >= nmajor) + return XREGISTRY_UNKNOWN; + if (minor >= nminor[major]) + return XREGISTRY_UNKNOWN; + + return requests[major][minor] ? requests[major][minor] : XREGISTRY_UNKNOWN; +} + +const char * +LookupMajorName(int major) +{ + if (major < 128) { + const char *retval; + + if (major >= nmajor) + return XREGISTRY_UNKNOWN; + if (0 >= nminor[major]) + return XREGISTRY_UNKNOWN; + + retval = requests[major][0]; + return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN; + } else { + ExtensionEntry *extEntry = GetExtensionEntry(major); + return extEntry ? extEntry->name : XREGISTRY_UNKNOWN; + } +} + +const char * +LookupEventName(int event) +{ + event &= 127; + if (event >= nevent) + return XREGISTRY_UNKNOWN; + + return events[event] ? events[event] : XREGISTRY_UNKNOWN; +} + +const char * +LookupErrorName(int error) +{ + if (error >= nerror) + return XREGISTRY_UNKNOWN; + + return errors[error] ? errors[error] : XREGISTRY_UNKNOWN; +} + +const char * +LookupResourceName(RESTYPE resource) +{ + resource &= TypeMask; + if (resource >= nresource) + return XREGISTRY_UNKNOWN; + + return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN; +} + +/* + * Setup and teardown + */ +void +dixResetRegistry(void) +{ + ExtensionEntry extEntry; + + /* Free all memory */ + while (nmajor--) { + while (nminor[nmajor]) + free(requests[nmajor][--nminor[nmajor]]); + free(requests[nmajor]); + } + free(requests); + free(nminor); + + while (nevent--) + free(events[nevent]); + free(events); + + while (nerror--) + free(errors[nerror]); + free(errors); + + free(resources); + + requests = NULL; + nminor = NULL; + events = NULL; + errors = NULL; + resources = NULL; + + nmajor = nevent = nerror = nresource = 0; + + /* Open the protocol file */ + if (fh) + fclose(fh); + fh = fopen(FILENAME, "r"); + if (!fh) + LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME "\n"); + + /* Add built-in resources */ + RegisterResourceName(RT_NONE, "NONE"); + RegisterResourceName(RT_WINDOW, "WINDOW"); + RegisterResourceName(RT_PIXMAP, "PIXMAP"); + RegisterResourceName(RT_GC, "GC"); + RegisterResourceName(RT_FONT, "FONT"); + RegisterResourceName(RT_CURSOR, "CURSOR"); + RegisterResourceName(RT_COLORMAP, "COLORMAP"); + RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY"); + RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT"); + RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB"); + + /* Add the core protocol */ + memset(&extEntry, 0, sizeof(extEntry)); + extEntry.name = CORE; + RegisterExtensionNames(&extEntry); +} + +#endif /* XREGISTRY */ diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c index eb9f0492a..be8a8f81b 100644 --- a/xorg-server/dix/resource.c +++ b/xorg-server/dix/resource.c @@ -242,7 +242,7 @@ CallResourceStateCallback(ResourceState state, ResourceRec *res) } RESTYPE -CreateNewResourceType(DeleteType deleteFunc, char *name) +CreateNewResourceType(DeleteType deleteFunc, const char *name) { RESTYPE next = lastResourceType + 1; struct ResourceType *types; diff --git a/xorg-server/dix/tables.c b/xorg-server/dix/tables.c index a11423187..45ae2a9d1 100644 --- a/xorg-server/dix/tables.c +++ b/xorg-server/dix/tables.c @@ -1,986 +1,986 @@ -/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "windowstr.h"
-#include "extnsionst.h"
-#include "dixstruct.h"
-#include "dixevents.h"
-#include "dispatch.h"
-#include "swaprep.h"
-#include "swapreq.h"
-
-int (* InitialVector[3]) (
- ClientPtr /* client */
- ) =
-{
- 0,
- ProcInitialConnection,
- ProcEstablishConnection
-};
-
-int (* ProcVector[256]) (
- ClientPtr /* client */
- ) =
-{
- ProcBadRequest,
- ProcCreateWindow,
- ProcChangeWindowAttributes,
- ProcGetWindowAttributes,
- ProcDestroyWindow,
- ProcDestroySubwindows, /* 5 */
- ProcChangeSaveSet,
- ProcReparentWindow,
- ProcMapWindow,
- ProcMapSubwindows,
- ProcUnmapWindow, /* 10 */
- ProcUnmapSubwindows,
- ProcConfigureWindow,
- ProcCirculateWindow,
- ProcGetGeometry,
- ProcQueryTree, /* 15 */
- ProcInternAtom,
- ProcGetAtomName,
- ProcChangeProperty,
- ProcDeleteProperty,
- ProcGetProperty, /* 20 */
- ProcListProperties,
- ProcSetSelectionOwner,
- ProcGetSelectionOwner,
- ProcConvertSelection,
- ProcSendEvent, /* 25 */
- ProcGrabPointer,
- ProcUngrabPointer,
- ProcGrabButton,
- ProcUngrabButton,
- ProcChangeActivePointerGrab, /* 30 */
- ProcGrabKeyboard,
- ProcUngrabKeyboard,
- ProcGrabKey,
- ProcUngrabKey,
- ProcAllowEvents, /* 35 */
- ProcGrabServer,
- ProcUngrabServer,
- ProcQueryPointer,
- ProcGetMotionEvents,
- ProcTranslateCoords, /* 40 */
- ProcWarpPointer,
- ProcSetInputFocus,
- ProcGetInputFocus,
- ProcQueryKeymap,
- ProcOpenFont, /* 45 */
- ProcCloseFont,
- ProcQueryFont,
- ProcQueryTextExtents,
- ProcListFonts,
- ProcListFontsWithInfo, /* 50 */
- ProcSetFontPath,
- ProcGetFontPath,
- ProcCreatePixmap,
- ProcFreePixmap,
- ProcCreateGC, /* 55 */
- ProcChangeGC,
- ProcCopyGC,
- ProcSetDashes,
- ProcSetClipRectangles,
- ProcFreeGC, /* 60 */
- ProcClearToBackground,
- ProcCopyArea,
- ProcCopyPlane,
- ProcPolyPoint,
- ProcPolyLine, /* 65 */
- ProcPolySegment,
- ProcPolyRectangle,
- ProcPolyArc,
- ProcFillPoly,
- ProcPolyFillRectangle, /* 70 */
- ProcPolyFillArc,
- ProcPutImage,
- ProcGetImage,
- ProcPolyText,
- ProcPolyText, /* 75 */
- ProcImageText8,
- ProcImageText16,
- ProcCreateColormap,
- ProcFreeColormap,
- ProcCopyColormapAndFree, /* 80 */
- ProcInstallColormap,
- ProcUninstallColormap,
- ProcListInstalledColormaps,
- ProcAllocColor,
- ProcAllocNamedColor, /* 85 */
- ProcAllocColorCells,
- ProcAllocColorPlanes,
- ProcFreeColors,
- ProcStoreColors,
- ProcStoreNamedColor, /* 90 */
- ProcQueryColors,
- ProcLookupColor,
- ProcCreateCursor,
- ProcCreateGlyphCursor,
- ProcFreeCursor, /* 95 */
- ProcRecolorCursor,
- ProcQueryBestSize,
- ProcQueryExtension,
- ProcListExtensions,
- ProcChangeKeyboardMapping, /* 100 */
- ProcGetKeyboardMapping,
- ProcChangeKeyboardControl,
- ProcGetKeyboardControl,
- ProcBell,
- ProcChangePointerControl, /* 105 */
- ProcGetPointerControl,
- ProcSetScreenSaver,
- ProcGetScreenSaver,
- ProcChangeHosts,
- ProcListHosts, /* 110 */
- ProcChangeAccessControl,
- ProcChangeCloseDownMode,
- ProcKillClient,
- ProcRotateProperties,
- ProcForceScreenSaver, /* 115 */
- ProcSetPointerMapping,
- ProcGetPointerMapping,
- ProcSetModifierMapping,
- ProcGetModifierMapping,
- ProcBadRequest, /* 120 */
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest, /* 125 */
- ProcBadRequest,
- ProcNoOperation,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest
-};
-
-int (* SwappedProcVector[256]) (
- ClientPtr /* client */
- ) =
-{
- ProcBadRequest,
- SProcCreateWindow,
- SProcChangeWindowAttributes,
- SProcResourceReq, /* GetWindowAttributes */
- SProcResourceReq, /* DestroyWindow */
- SProcResourceReq, /* 5 DestroySubwindows */
- SProcResourceReq, /* SProcChangeSaveSet, */
- SProcReparentWindow,
- SProcResourceReq, /* MapWindow */
- SProcResourceReq, /* MapSubwindows */
- SProcResourceReq, /* 10 UnmapWindow */
- SProcResourceReq, /* UnmapSubwindows */
- SProcConfigureWindow,
- SProcResourceReq, /* SProcCirculateWindow, */
- SProcResourceReq, /* GetGeometry */
- SProcResourceReq, /* 15 QueryTree */
- SProcInternAtom,
- SProcResourceReq, /* SProcGetAtomName, */
- SProcChangeProperty,
- SProcDeleteProperty,
- SProcGetProperty, /* 20 */
- SProcResourceReq, /* SProcListProperties, */
- SProcSetSelectionOwner,
- SProcResourceReq, /* SProcGetSelectionOwner, */
- SProcConvertSelection,
- SProcSendEvent, /* 25 */
- SProcGrabPointer,
- SProcResourceReq, /* SProcUngrabPointer, */
- SProcGrabButton,
- SProcUngrabButton,
- SProcChangeActivePointerGrab, /* 30 */
- SProcGrabKeyboard,
- SProcResourceReq, /* SProcUngrabKeyboard, */
- SProcGrabKey,
- SProcUngrabKey,
- SProcResourceReq, /* 35 SProcAllowEvents, */
- SProcSimpleReq, /* SProcGrabServer, */
- SProcSimpleReq, /* SProcUngrabServer, */
- SProcResourceReq, /* SProcQueryPointer, */
- SProcGetMotionEvents,
- SProcTranslateCoords, /*40 */
- SProcWarpPointer,
- SProcSetInputFocus,
- SProcSimpleReq, /* SProcGetInputFocus, */
- SProcSimpleReq, /* QueryKeymap, */
- SProcOpenFont, /* 45 */
- SProcResourceReq, /* SProcCloseFont, */
- SProcResourceReq, /* SProcQueryFont, */
- SProcResourceReq, /* SProcQueryTextExtents, */
- SProcListFonts,
- SProcListFontsWithInfo, /* 50 */
- SProcSetFontPath,
- SProcSimpleReq, /* GetFontPath, */
- SProcCreatePixmap,
- SProcResourceReq, /* SProcFreePixmap, */
- SProcCreateGC, /* 55 */
- SProcChangeGC,
- SProcCopyGC,
- SProcSetDashes,
- SProcSetClipRectangles,
- SProcResourceReq, /* 60 SProcFreeGC, */
- SProcClearToBackground,
- SProcCopyArea,
- SProcCopyPlane,
- SProcPoly, /* PolyPoint, */
- SProcPoly, /* 65 PolyLine */
- SProcPoly, /* PolySegment, */
- SProcPoly, /* PolyRectangle, */
- SProcPoly, /* PolyArc, */
- SProcFillPoly,
- SProcPoly, /* 70 PolyFillRectangle */
- SProcPoly, /* PolyFillArc, */
- SProcPutImage,
- SProcGetImage,
- SProcPolyText,
- SProcPolyText, /* 75 */
- SProcImageText,
- SProcImageText,
- SProcCreateColormap,
- SProcResourceReq, /* SProcFreeColormap, */
- SProcCopyColormapAndFree, /* 80 */
- SProcResourceReq, /* SProcInstallColormap, */
- SProcResourceReq, /* SProcUninstallColormap, */
- SProcResourceReq, /* SProcListInstalledColormaps, */
- SProcAllocColor,
- SProcAllocNamedColor, /* 85 */
- SProcAllocColorCells,
- SProcAllocColorPlanes,
- SProcFreeColors,
- SProcStoreColors,
- SProcStoreNamedColor, /* 90 */
- SProcQueryColors,
- SProcLookupColor,
- SProcCreateCursor,
- SProcCreateGlyphCursor,
- SProcResourceReq, /* 95 SProcFreeCursor, */
- SProcRecolorCursor,
- SProcQueryBestSize,
- SProcQueryExtension,
- SProcSimpleReq, /* ListExtensions, */
- SProcChangeKeyboardMapping, /* 100 */
- SProcSimpleReq, /* GetKeyboardMapping, */
- SProcChangeKeyboardControl,
- SProcSimpleReq, /* GetKeyboardControl, */
- SProcSimpleReq, /* Bell, */
- SProcChangePointerControl, /* 105 */
- SProcSimpleReq, /* GetPointerControl, */
- SProcSetScreenSaver,
- SProcSimpleReq, /* GetScreenSaver, */
- SProcChangeHosts,
- SProcSimpleReq, /* 110 ListHosts, */
- SProcSimpleReq, /* SProcChangeAccessControl, */
- SProcSimpleReq, /* SProcChangeCloseDownMode, */
- SProcResourceReq, /* SProcKillClient, */
- SProcRotateProperties,
- SProcSimpleReq, /* 115 ForceScreenSaver */
- SProcSimpleReq, /* SetPointerMapping, */
- SProcSimpleReq, /* GetPointerMapping, */
- SProcSimpleReq, /* SetModifierMapping, */
- SProcSimpleReq, /* GetModifierMapping, */
- ProcBadRequest, /* 120 */
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest, /* 125 */
- ProcBadRequest,
- SProcNoOperation,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest,
- ProcBadRequest
-};
-
-EventSwapPtr EventSwapVector[128] =
-{
- (EventSwapPtr)SErrorEvent,
- NotImplemented,
- SKeyButtonPtrEvent,
- SKeyButtonPtrEvent,
- SKeyButtonPtrEvent,
- SKeyButtonPtrEvent, /* 5 */
- SKeyButtonPtrEvent,
- SEnterLeaveEvent,
- SEnterLeaveEvent,
- SFocusEvent,
- SFocusEvent, /* 10 */
- SKeymapNotifyEvent,
- SExposeEvent,
- SGraphicsExposureEvent,
- SNoExposureEvent,
- SVisibilityEvent, /* 15 */
- SCreateNotifyEvent,
- SDestroyNotifyEvent,
- SUnmapNotifyEvent,
- SMapNotifyEvent,
- SMapRequestEvent, /* 20 */
- SReparentEvent,
- SConfigureNotifyEvent,
- SConfigureRequestEvent,
- SGravityEvent,
- SResizeRequestEvent, /* 25 */
- SCirculateEvent,
- SCirculateEvent,
- SPropertyEvent,
- SSelectionClearEvent,
- SSelectionRequestEvent, /* 30 */
- SSelectionNotifyEvent,
- SColormapEvent,
- SClientMessageEvent,
- SMappingEvent,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented
-};
-
-
-ReplySwapPtr ReplySwapVector[256] =
-{
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- (ReplySwapPtr)SGetWindowAttributesReply,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 5 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 10 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- (ReplySwapPtr)SGetGeometryReply,
- (ReplySwapPtr)SQueryTreeReply, /* 15 */
- (ReplySwapPtr)SInternAtomReply,
- (ReplySwapPtr)SGetAtomNameReply,
- ReplyNotSwappd,
- ReplyNotSwappd,
- (ReplySwapPtr)SGetPropertyReply, /* 20 */
- (ReplySwapPtr)SListPropertiesReply,
- ReplyNotSwappd,
- (ReplySwapPtr)SGetSelectionOwnerReply,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 25 */
- (ReplySwapPtr)SGenericReply, /* SGrabPointerReply, */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 30 */
- (ReplySwapPtr)SGenericReply, /* SGrabKeyboardReply, */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 35 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- (ReplySwapPtr)SQueryPointerReply,
- (ReplySwapPtr)SGetMotionEventsReply,
- (ReplySwapPtr)STranslateCoordsReply, /* 40 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- (ReplySwapPtr)SGetInputFocusReply,
- (ReplySwapPtr)SQueryKeymapReply,
- ReplyNotSwappd, /* 45 */
- ReplyNotSwappd,
- (ReplySwapPtr)SQueryFontReply,
- (ReplySwapPtr)SQueryTextExtentsReply,
- (ReplySwapPtr)SListFontsReply,
- (ReplySwapPtr)SListFontsWithInfoReply, /* 50 */
- ReplyNotSwappd,
- (ReplySwapPtr)SGetFontPathReply,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 55 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 60 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 65 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 70 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- (ReplySwapPtr)SGetImageReply,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 75 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 80 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- (ReplySwapPtr)SListInstalledColormapsReply,
- (ReplySwapPtr)SAllocColorReply,
- (ReplySwapPtr)SAllocNamedColorReply, /* 85 */
- (ReplySwapPtr)SAllocColorCellsReply,
- (ReplySwapPtr)SAllocColorPlanesReply,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 90 */
- (ReplySwapPtr)SQueryColorsReply,
- (ReplySwapPtr)SLookupColorReply,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 95 */
- ReplyNotSwappd,
- (ReplySwapPtr)SQueryBestSizeReply,
- (ReplySwapPtr)SGenericReply, /* SQueryExtensionReply, */
- (ReplySwapPtr)SListExtensionsReply,
- ReplyNotSwappd, /* 100 */
- (ReplySwapPtr)SGetKeyboardMappingReply,
- ReplyNotSwappd,
- (ReplySwapPtr)SGetKeyboardControlReply,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 105 */
- (ReplySwapPtr)SGetPointerControlReply,
- ReplyNotSwappd,
- (ReplySwapPtr)SGetScreenSaverReply,
- ReplyNotSwappd,
- (ReplySwapPtr)SListHostsReply, /* 110 */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd, /* 115 */
- (ReplySwapPtr)SGenericReply, /* SetPointerMapping */
- (ReplySwapPtr)SGetPointerMappingReply,
- (ReplySwapPtr)SGenericReply, /* SetModifierMapping */
- (ReplySwapPtr)SGetModifierMappingReply, /* 119 */
- ReplyNotSwappd, /* 120 */
- ReplyNotSwappd, /* 121 */
- ReplyNotSwappd, /* 122 */
- ReplyNotSwappd, /* 123 */
- ReplyNotSwappd, /* 124 */
- ReplyNotSwappd, /* 125 */
- ReplyNotSwappd, /* 126 */
- ReplyNotSwappd, /* NoOperation */
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd,
- ReplyNotSwappd
-};
+/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "windowstr.h" +#include "extnsionst.h" +#include "dixstruct.h" +#include "dixevents.h" +#include "dispatch.h" +#include "swaprep.h" +#include "swapreq.h" + +int (* InitialVector[3]) ( + ClientPtr /* client */ + ) = +{ + 0, + ProcInitialConnection, + ProcEstablishConnection +}; + +int (* ProcVector[256]) ( + ClientPtr /* client */ + ) = +{ + ProcBadRequest, + ProcCreateWindow, + ProcChangeWindowAttributes, + ProcGetWindowAttributes, + ProcDestroyWindow, + ProcDestroySubwindows, /* 5 */ + ProcChangeSaveSet, + ProcReparentWindow, + ProcMapWindow, + ProcMapSubwindows, + ProcUnmapWindow, /* 10 */ + ProcUnmapSubwindows, + ProcConfigureWindow, + ProcCirculateWindow, + ProcGetGeometry, + ProcQueryTree, /* 15 */ + ProcInternAtom, + ProcGetAtomName, + ProcChangeProperty, + ProcDeleteProperty, + ProcGetProperty, /* 20 */ + ProcListProperties, + ProcSetSelectionOwner, + ProcGetSelectionOwner, + ProcConvertSelection, + ProcSendEvent, /* 25 */ + ProcGrabPointer, + ProcUngrabPointer, + ProcGrabButton, + ProcUngrabButton, + ProcChangeActivePointerGrab, /* 30 */ + ProcGrabKeyboard, + ProcUngrabKeyboard, + ProcGrabKey, + ProcUngrabKey, + ProcAllowEvents, /* 35 */ + ProcGrabServer, + ProcUngrabServer, + ProcQueryPointer, + ProcGetMotionEvents, + ProcTranslateCoords, /* 40 */ + ProcWarpPointer, + ProcSetInputFocus, + ProcGetInputFocus, + ProcQueryKeymap, + ProcOpenFont, /* 45 */ + ProcCloseFont, + ProcQueryFont, + ProcQueryTextExtents, + ProcListFonts, + ProcListFontsWithInfo, /* 50 */ + ProcSetFontPath, + ProcGetFontPath, + ProcCreatePixmap, + ProcFreePixmap, + ProcCreateGC, /* 55 */ + ProcChangeGC, + ProcCopyGC, + ProcSetDashes, + ProcSetClipRectangles, + ProcFreeGC, /* 60 */ + ProcClearToBackground, + ProcCopyArea, + ProcCopyPlane, + ProcPolyPoint, + ProcPolyLine, /* 65 */ + ProcPolySegment, + ProcPolyRectangle, + ProcPolyArc, + ProcFillPoly, + ProcPolyFillRectangle, /* 70 */ + ProcPolyFillArc, + ProcPutImage, + ProcGetImage, + ProcPolyText, + ProcPolyText, /* 75 */ + ProcImageText8, + ProcImageText16, + ProcCreateColormap, + ProcFreeColormap, + ProcCopyColormapAndFree, /* 80 */ + ProcInstallColormap, + ProcUninstallColormap, + ProcListInstalledColormaps, + ProcAllocColor, + ProcAllocNamedColor, /* 85 */ + ProcAllocColorCells, + ProcAllocColorPlanes, + ProcFreeColors, + ProcStoreColors, + ProcStoreNamedColor, /* 90 */ + ProcQueryColors, + ProcLookupColor, + ProcCreateCursor, + ProcCreateGlyphCursor, + ProcFreeCursor, /* 95 */ + ProcRecolorCursor, + ProcQueryBestSize, + ProcQueryExtension, + ProcListExtensions, + ProcChangeKeyboardMapping, /* 100 */ + ProcGetKeyboardMapping, + ProcChangeKeyboardControl, + ProcGetKeyboardControl, + ProcBell, + ProcChangePointerControl, /* 105 */ + ProcGetPointerControl, + ProcSetScreenSaver, + ProcGetScreenSaver, + ProcChangeHosts, + ProcListHosts, /* 110 */ + ProcChangeAccessControl, + ProcChangeCloseDownMode, + ProcKillClient, + ProcRotateProperties, + ProcForceScreenSaver, /* 115 */ + ProcSetPointerMapping, + ProcGetPointerMapping, + ProcSetModifierMapping, + ProcGetModifierMapping, + ProcBadRequest, /* 120 */ + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, /* 125 */ + ProcBadRequest, + ProcNoOperation, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest +}; + +int (* SwappedProcVector[256]) ( + ClientPtr /* client */ + ) = +{ + ProcBadRequest, + SProcCreateWindow, + SProcChangeWindowAttributes, + SProcResourceReq, /* GetWindowAttributes */ + SProcResourceReq, /* DestroyWindow */ + SProcResourceReq, /* 5 DestroySubwindows */ + SProcResourceReq, /* SProcChangeSaveSet, */ + SProcReparentWindow, + SProcResourceReq, /* MapWindow */ + SProcResourceReq, /* MapSubwindows */ + SProcResourceReq, /* 10 UnmapWindow */ + SProcResourceReq, /* UnmapSubwindows */ + SProcConfigureWindow, + SProcResourceReq, /* SProcCirculateWindow, */ + SProcResourceReq, /* GetGeometry */ + SProcResourceReq, /* 15 QueryTree */ + SProcInternAtom, + SProcResourceReq, /* SProcGetAtomName, */ + SProcChangeProperty, + SProcDeleteProperty, + SProcGetProperty, /* 20 */ + SProcResourceReq, /* SProcListProperties, */ + SProcSetSelectionOwner, + SProcResourceReq, /* SProcGetSelectionOwner, */ + SProcConvertSelection, + SProcSendEvent, /* 25 */ + SProcGrabPointer, + SProcResourceReq, /* SProcUngrabPointer, */ + SProcGrabButton, + SProcUngrabButton, + SProcChangeActivePointerGrab, /* 30 */ + SProcGrabKeyboard, + SProcResourceReq, /* SProcUngrabKeyboard, */ + SProcGrabKey, + SProcUngrabKey, + SProcResourceReq, /* 35 SProcAllowEvents, */ + SProcSimpleReq, /* SProcGrabServer, */ + SProcSimpleReq, /* SProcUngrabServer, */ + SProcResourceReq, /* SProcQueryPointer, */ + SProcGetMotionEvents, + SProcTranslateCoords, /*40 */ + SProcWarpPointer, + SProcSetInputFocus, + SProcSimpleReq, /* SProcGetInputFocus, */ + SProcSimpleReq, /* QueryKeymap, */ + SProcOpenFont, /* 45 */ + SProcResourceReq, /* SProcCloseFont, */ + SProcResourceReq, /* SProcQueryFont, */ + SProcResourceReq, /* SProcQueryTextExtents, */ + SProcListFonts, + SProcListFontsWithInfo, /* 50 */ + SProcSetFontPath, + SProcSimpleReq, /* GetFontPath, */ + SProcCreatePixmap, + SProcResourceReq, /* SProcFreePixmap, */ + SProcCreateGC, /* 55 */ + SProcChangeGC, + SProcCopyGC, + SProcSetDashes, + SProcSetClipRectangles, + SProcResourceReq, /* 60 SProcFreeGC, */ + SProcClearToBackground, + SProcCopyArea, + SProcCopyPlane, + SProcPoly, /* PolyPoint, */ + SProcPoly, /* 65 PolyLine */ + SProcPoly, /* PolySegment, */ + SProcPoly, /* PolyRectangle, */ + SProcPoly, /* PolyArc, */ + SProcFillPoly, + SProcPoly, /* 70 PolyFillRectangle */ + SProcPoly, /* PolyFillArc, */ + SProcPutImage, + SProcGetImage, + SProcPolyText, + SProcPolyText, /* 75 */ + SProcImageText, + SProcImageText, + SProcCreateColormap, + SProcResourceReq, /* SProcFreeColormap, */ + SProcCopyColormapAndFree, /* 80 */ + SProcResourceReq, /* SProcInstallColormap, */ + SProcResourceReq, /* SProcUninstallColormap, */ + SProcResourceReq, /* SProcListInstalledColormaps, */ + SProcAllocColor, + SProcAllocNamedColor, /* 85 */ + SProcAllocColorCells, + SProcAllocColorPlanes, + SProcFreeColors, + SProcStoreColors, + SProcStoreNamedColor, /* 90 */ + SProcQueryColors, + SProcLookupColor, + SProcCreateCursor, + SProcCreateGlyphCursor, + SProcResourceReq, /* 95 SProcFreeCursor, */ + SProcRecolorCursor, + SProcQueryBestSize, + SProcQueryExtension, + SProcSimpleReq, /* ListExtensions, */ + SProcChangeKeyboardMapping, /* 100 */ + SProcSimpleReq, /* GetKeyboardMapping, */ + SProcChangeKeyboardControl, + SProcSimpleReq, /* GetKeyboardControl, */ + SProcSimpleReq, /* Bell, */ + SProcChangePointerControl, /* 105 */ + SProcSimpleReq, /* GetPointerControl, */ + SProcSetScreenSaver, + SProcSimpleReq, /* GetScreenSaver, */ + SProcChangeHosts, + SProcSimpleReq, /* 110 ListHosts, */ + SProcSimpleReq, /* SProcChangeAccessControl, */ + SProcSimpleReq, /* SProcChangeCloseDownMode, */ + SProcResourceReq, /* SProcKillClient, */ + SProcRotateProperties, + SProcSimpleReq, /* 115 ForceScreenSaver */ + SProcSimpleReq, /* SetPointerMapping, */ + SProcSimpleReq, /* GetPointerMapping, */ + SProcSimpleReq, /* SetModifierMapping, */ + SProcSimpleReq, /* GetModifierMapping, */ + ProcBadRequest, /* 120 */ + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, /* 125 */ + ProcBadRequest, + SProcNoOperation, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest, + ProcBadRequest +}; + +EventSwapPtr EventSwapVector[MAXEVENTS] = +{ + (EventSwapPtr)SErrorEvent, + NotImplemented, + SKeyButtonPtrEvent, + SKeyButtonPtrEvent, + SKeyButtonPtrEvent, + SKeyButtonPtrEvent, /* 5 */ + SKeyButtonPtrEvent, + SEnterLeaveEvent, + SEnterLeaveEvent, + SFocusEvent, + SFocusEvent, /* 10 */ + SKeymapNotifyEvent, + SExposeEvent, + SGraphicsExposureEvent, + SNoExposureEvent, + SVisibilityEvent, /* 15 */ + SCreateNotifyEvent, + SDestroyNotifyEvent, + SUnmapNotifyEvent, + SMapNotifyEvent, + SMapRequestEvent, /* 20 */ + SReparentEvent, + SConfigureNotifyEvent, + SConfigureRequestEvent, + SGravityEvent, + SResizeRequestEvent, /* 25 */ + SCirculateEvent, + SCirculateEvent, + SPropertyEvent, + SSelectionClearEvent, + SSelectionRequestEvent, /* 30 */ + SSelectionNotifyEvent, + SColormapEvent, + SClientMessageEvent, + SMappingEvent, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented +}; + + +ReplySwapPtr ReplySwapVector[256] = +{ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + (ReplySwapPtr)SGetWindowAttributesReply, + ReplyNotSwappd, + ReplyNotSwappd, /* 5 */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 10 */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + (ReplySwapPtr)SGetGeometryReply, + (ReplySwapPtr)SQueryTreeReply, /* 15 */ + (ReplySwapPtr)SInternAtomReply, + (ReplySwapPtr)SGetAtomNameReply, + ReplyNotSwappd, + ReplyNotSwappd, + (ReplySwapPtr)SGetPropertyReply, /* 20 */ + (ReplySwapPtr)SListPropertiesReply, + ReplyNotSwappd, + (ReplySwapPtr)SGetSelectionOwnerReply, + ReplyNotSwappd, + ReplyNotSwappd, /* 25 */ + (ReplySwapPtr)SGenericReply, /* SGrabPointerReply, */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 30 */ + (ReplySwapPtr)SGenericReply, /* SGrabKeyboardReply, */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 35 */ + ReplyNotSwappd, + ReplyNotSwappd, + (ReplySwapPtr)SQueryPointerReply, + (ReplySwapPtr)SGetMotionEventsReply, + (ReplySwapPtr)STranslateCoordsReply, /* 40 */ + ReplyNotSwappd, + ReplyNotSwappd, + (ReplySwapPtr)SGetInputFocusReply, + (ReplySwapPtr)SQueryKeymapReply, + ReplyNotSwappd, /* 45 */ + ReplyNotSwappd, + (ReplySwapPtr)SQueryFontReply, + (ReplySwapPtr)SQueryTextExtentsReply, + (ReplySwapPtr)SListFontsReply, + (ReplySwapPtr)SListFontsWithInfoReply, /* 50 */ + ReplyNotSwappd, + (ReplySwapPtr)SGetFontPathReply, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 55 */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 60 */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 65 */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 70 */ + ReplyNotSwappd, + ReplyNotSwappd, + (ReplySwapPtr)SGetImageReply, + ReplyNotSwappd, + ReplyNotSwappd, /* 75 */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 80 */ + ReplyNotSwappd, + ReplyNotSwappd, + (ReplySwapPtr)SListInstalledColormapsReply, + (ReplySwapPtr)SAllocColorReply, + (ReplySwapPtr)SAllocNamedColorReply, /* 85 */ + (ReplySwapPtr)SAllocColorCellsReply, + (ReplySwapPtr)SAllocColorPlanesReply, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 90 */ + (ReplySwapPtr)SQueryColorsReply, + (ReplySwapPtr)SLookupColorReply, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 95 */ + ReplyNotSwappd, + (ReplySwapPtr)SQueryBestSizeReply, + (ReplySwapPtr)SGenericReply, /* SQueryExtensionReply, */ + (ReplySwapPtr)SListExtensionsReply, + ReplyNotSwappd, /* 100 */ + (ReplySwapPtr)SGetKeyboardMappingReply, + ReplyNotSwappd, + (ReplySwapPtr)SGetKeyboardControlReply, + ReplyNotSwappd, + ReplyNotSwappd, /* 105 */ + (ReplySwapPtr)SGetPointerControlReply, + ReplyNotSwappd, + (ReplySwapPtr)SGetScreenSaverReply, + ReplyNotSwappd, + (ReplySwapPtr)SListHostsReply, /* 110 */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, /* 115 */ + (ReplySwapPtr)SGenericReply, /* SetPointerMapping */ + (ReplySwapPtr)SGetPointerMappingReply, + (ReplySwapPtr)SGenericReply, /* SetModifierMapping */ + (ReplySwapPtr)SGetModifierMappingReply, /* 119 */ + ReplyNotSwappd, /* 120 */ + ReplyNotSwappd, /* 121 */ + ReplyNotSwappd, /* 122 */ + ReplyNotSwappd, /* 123 */ + ReplyNotSwappd, /* 124 */ + ReplyNotSwappd, /* 125 */ + ReplyNotSwappd, /* 126 */ + ReplyNotSwappd, /* NoOperation */ + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd, + ReplyNotSwappd +}; |