summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorSooChan Lim <sc1.lim@samsung.com>2012-09-03 13:49:35 +0900
committerSooChan Lim <sc1.lim@samsung.com>2012-09-03 13:49:35 +0900
commit24e9b74658090e50e2e3df0085634ac1a286743f (patch)
tree909b4f8260df0b4f7e483fd6bde7ad270dd6583d /Xi
parent81e7ca3a7bc8a8f96ca7c4aad9e662b4eff526e6 (diff)
downloadxorg-server-2.0-panda.tar.gz
xorg-server-2.0-panda.tar.bz2
xorg-server-2.0-panda.zip
Change-Id: I2558f492e0dbb69994ab1d5269f52784d7d13fa7
Diffstat (limited to 'Xi')
-rw-r--r--Xi/chgdctl.c25
-rw-r--r--Xi/chgptr.h6
-rw-r--r--Xi/exevents.c316
-rw-r--r--Xi/extinit.c60
-rw-r--r--Xi/getbmap.c16
-rw-r--r--Xi/getdctl.c12
-rw-r--r--Xi/getfctl.c14
-rw-r--r--Xi/getfocus.c12
-rw-r--r--Xi/getkmap.c14
-rw-r--r--Xi/getmmap.c16
-rw-r--r--Xi/getprop.c14
-rw-r--r--Xi/getselev.c16
-rw-r--r--Xi/getvers.c19
-rw-r--r--Xi/grabdev.c12
-rw-r--r--Xi/grabdevb.c15
-rw-r--r--Xi/grabdevk.c15
-rw-r--r--Xi/gtmotion.c20
-rw-r--r--Xi/listdev.c13
-rw-r--r--Xi/opendev.c17
-rw-r--r--Xi/queryst.c16
-rw-r--r--Xi/setbmap.c14
-rw-r--r--Xi/setdval.c14
-rw-r--r--Xi/setmmap.c12
-rw-r--r--Xi/setmode.c12
-rw-r--r--Xi/stubs.c1
-rw-r--r--Xi/xichangehierarchy.c6
-rw-r--r--Xi/xigetclientpointer.c16
-rw-r--r--Xi/xigrabdev.c14
-rw-r--r--Xi/xipassivegrab.c18
-rw-r--r--Xi/xiproperty.c364
-rw-r--r--Xi/xiquerydevice.c17
-rw-r--r--Xi/xiquerypointer.c21
-rw-r--r--Xi/xiqueryversion.c49
-rw-r--r--Xi/xiselectev.c22
-rw-r--r--Xi/xisetdevfocus.c12
35 files changed, 518 insertions, 722 deletions
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index ff5d69a..9fe69a5 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -113,7 +113,6 @@ ProcXChangeDeviceControl(ClientPtr client)
AxisInfoPtr a;
CARD32 *resolution;
xDeviceEnableCtl *e;
- devicePresenceNotify dpn;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -123,10 +122,12 @@ ProcXChangeDeviceControl(ClientPtr client)
if (ret != Success)
goto out;
- rep.repType = X_Reply;
- rep.RepType = X_ChangeDeviceControl;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xChangeDeviceControlReply) {
+ .repType = X_Reply,
+ .RepType = X_ChangeDeviceControl,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
switch (stuff->control) {
case DEVICE_RESOLUTION:
@@ -209,11 +210,13 @@ ProcXChangeDeviceControl(ClientPtr client)
out:
if (ret == Success) {
- dpn.type = DevicePresenceNotify;
- dpn.time = currentTime.milliseconds;
- dpn.devchange = DeviceControlChanged;
- dpn.deviceid = dev->id;
- dpn.control = stuff->control;
+ devicePresenceNotify dpn = {
+ .type = DevicePresenceNotify,
+ .time = currentTime.milliseconds,
+ .devchange = DeviceControlChanged,
+ .deviceid = dev->id,
+ .control = stuff->control
+ };
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
@@ -236,5 +239,5 @@ SRepXChangeDeviceControl(ClientPtr client, int size,
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/chgptr.h b/Xi/chgptr.h
index 47265b3..275511f 100644
--- a/Xi/chgptr.h
+++ b/Xi/chgptr.h
@@ -39,10 +39,4 @@ int ProcXChangePointerDevice(ClientPtr /* client */
void DeleteFocusClassDeviceStruct(DeviceIntPtr /* dev */
);
-void SendEventToAllWindows(DeviceIntPtr /* dev */ ,
- Mask /* mask */ ,
- xEvent * /* ev */ ,
- int /* count */
- );
-
#endif /* CHGPTR_H */
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 37ed5c7..494d07e 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -269,8 +269,6 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
}
}
else if (to->intfeed && !from->intfeed) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->intfeed = to->intfeed;
to->intfeed = NULL;
@@ -301,8 +299,6 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
}
}
else if (to->stringfeed && !from->stringfeed) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->stringfeed = to->stringfeed;
to->stringfeed = NULL;
@@ -334,8 +330,6 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
}
}
else if (to->bell && !from->bell) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->bell = to->bell;
to->bell = NULL;
@@ -369,8 +363,6 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
}
}
else if (to->leds && !from->leds) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->leds = to->leds;
to->leds = NULL;
@@ -417,8 +409,6 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
}
}
else if (to->kbdfeed && !from->kbdfeed) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->kbdfeed = to->kbdfeed;
to->kbdfeed = NULL;
@@ -437,8 +427,6 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
CopyKeyClass(from, to);
}
else if (to->key && !from->key) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->key = to->key;
to->key = NULL;
@@ -494,8 +482,6 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
}
}
else if (to->focus) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->focus = to->focus;
to->focus = NULL;
@@ -536,8 +522,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
}
}
else if (to->ptrfeed && !from->ptrfeed) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->ptrfeed = to->ptrfeed;
to->ptrfeed = NULL;
@@ -564,8 +548,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
v->sourceid = from->id;
}
else if (to->valuator && !from->valuator) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->valuator = to->valuator;
to->valuator = NULL;
@@ -601,8 +583,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
to->button->sourceid = from->id;
}
else if (to->button && !from->button) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->button = to->button;
to->button = NULL;
@@ -624,8 +604,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
to->proximity->sourceid = from->id;
}
else if (to->proximity) {
- ClassesPtr classes;
-
classes = to->unused_classes;
classes->proximity = to->proximity;
to->proximity = NULL;
@@ -948,10 +926,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
else if (event->type == ET_ProximityOut)
device->proximity->in_proximity = FALSE;
else if (event->type == ET_TouchBegin) {
- BUG_WARN(!b || !v);
- BUG_WARN(!t);
+ BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
+ BUG_RETURN_VAL(!t, DONT_PROCESS);
- if (!b || !t || !b->map[key])
+ if (!b->map[key])
return DONT_PROCESS;
if (!(event->flags & TOUCH_POINTER_EMULATED) ||
@@ -963,10 +941,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
UpdateDeviceMotionMask(device, t->state, DeviceButtonMotionMask);
}
else if (event->type == ET_TouchEnd) {
- BUG_WARN(!b || !v);
- BUG_WARN(!t);
+ BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
+ BUG_RETURN_VAL(!t, DONT_PROCESS);
- if (!b || !t || t->buttonsDown <= 0 || !b->map[key])
+ if (t->buttonsDown <= 0 || !b->map[key])
return DONT_PROCESS;
if (!(event->flags & TOUCH_POINTER_EMULATED))
@@ -1288,7 +1266,7 @@ ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
else
ti->listeners[0].state = LISTENER_HAS_ACCEPTED;
}
- else { /* this is the very first ownership event for a grab */
+ else { /* this is the very first ownership event for a grab */
DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
}
}
@@ -1378,9 +1356,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
break;
- BUG_WARN(!iclients);
- if (!iclients)
- return FALSE;
+
+ BUG_RETURN_VAL(!iclients, FALSE);
*mask = iclients->xi2mask;
*client = rClient(iclients);
@@ -1393,9 +1370,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
wOtherInputMasks(*win)->inputClients, next)
if (iclients->mask[dev->id] & xi_filter)
break;
- BUG_WARN(!iclients);
- if (!iclients)
- return FALSE;
+ BUG_RETURN_VAL(!iclients, FALSE);
*client = rClient(iclients);
}
@@ -1436,9 +1411,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
return Success;
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
- BUG_WARN(nevents == 0);
- if (nevents == 0)
- return BadValue;
+ BUG_RETURN_VAL(nevents == 0, BadValue);
if (nevents > 1)
ptrev = &button;
@@ -1461,9 +1434,9 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (grab->ownerEvents) {
WindowPtr focus = NullWindow;
- WindowPtr win = dev->spriteInfo->sprite->win;
+ WindowPtr sprite_win = dev->spriteInfo->sprite->win;
- deliveries = DeliverDeviceEvents(win, ptrev, grab, focus, dev);
+ deliveries = DeliverDeviceEvents(sprite_win, ptrev, grab, focus, dev);
}
if (!deliveries)
@@ -1494,7 +1467,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
* the event.
*/
if (!devgrab && dev->deviceGrab.grab && dev->deviceGrab.implicitGrab) {
- TouchListener *listener;
+ TouchListener *l;
devgrab = dev->deviceGrab.grab;
@@ -1504,13 +1477,13 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
* selection. Implicit grab activation occurs through delivering an
* event selection. Thus, we update the last listener in the array.
*/
- listener = &ti->listeners[ti->num_listeners - 1];
- listener->listener = devgrab->resource;
+ l = &ti->listeners[ti->num_listeners - 1];
+ l->listener = devgrab->resource;
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
- listener->type = LISTENER_POINTER_GRAB;
+ l->type = LISTENER_POINTER_GRAB;
else
- listener->type = LISTENER_GRAB;
+ l->type = LISTENER_GRAB;
}
}
@@ -1723,7 +1696,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
GetSpritePosition(device, &rootX, &rootY);
event->root_x = rootX;
event->root_y = rootY;
- NoticeEventTime((InternalEvent *) event);
+ NoticeEventTime((InternalEvent *) event, device);
event->corestate = corestate;
key = event->detail.key;
break;
@@ -1915,6 +1888,12 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (normal_end)
listener->state = LISTENER_HAS_END;
}
+ else if (ev->device_event.flags & TOUCH_ACCEPT) {
+ /* Touch has been accepted by its owner, which is not this listener */
+ if (listener->state != LISTENER_HAS_END)
+ rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
+ listener->state = LISTENER_HAS_END;
+ }
out:
return rc;
@@ -2114,240 +2093,6 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type,
return TRUE;
}
-static void
-FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
- ButtonClassPtr b, ValuatorClassPtr v, int first)
-{
- ev->type = DeviceStateNotify;
- ev->deviceid = dev->id;
- ev->time = currentTime.milliseconds;
- ev->classes_reported = 0;
- ev->num_keys = 0;
- ev->num_buttons = 0;
- ev->num_valuators = 0;
-
- if (b) {
- ev->classes_reported |= (1 << ButtonClass);
- ev->num_buttons = b->numButtons;
- memcpy((char *) ev->buttons, (char *) b->down, 4);
- }
- else if (k) {
- ev->classes_reported |= (1 << KeyClass);
- ev->num_keys = k->xkbInfo->desc->max_key_code -
- k->xkbInfo->desc->min_key_code;
- memmove((char *) &ev->keys[0], (char *) k->down, 4);
- }
- if (v) {
- int nval = v->numAxes - first;
-
- ev->classes_reported |= (1 << ValuatorClass);
- ev->classes_reported |= valuator_get_mode(dev, 0) << ModeBitsShift;
- ev->num_valuators = nval < 3 ? nval : 3;
- switch (ev->num_valuators) {
- case 3:
- ev->valuator2 = v->axisVal[first + 2];
- case 2:
- ev->valuator1 = v->axisVal[first + 1];
- case 1:
- ev->valuator0 = v->axisVal[first];
- break;
- }
- }
-}
-
-static void
-FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v,
- int first)
-{
- int nval = v->numAxes - first;
-
- ev->type = DeviceValuator;
- ev->deviceid = dev->id;
- ev->num_valuators = nval < 3 ? nval : 3;
- ev->first_valuator = first;
- switch (ev->num_valuators) {
- case 3:
- ev->valuator2 = v->axisVal[first + 2];
- case 2:
- ev->valuator1 = v->axisVal[first + 1];
- case 1:
- ev->valuator0 = v->axisVal[first];
- break;
- }
- first += ev->num_valuators;
-}
-
-static void
-DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win)
-{
- int evcount = 1;
- deviceStateNotify *ev, *sev;
- deviceKeyStateNotify *kev;
- deviceButtonStateNotify *bev;
-
- KeyClassPtr k;
- ButtonClassPtr b;
- ValuatorClassPtr v;
- int nval = 0, nkeys = 0, nbuttons = 0, first = 0;
-
- if (!(wOtherInputMasks(win)) ||
- !(wOtherInputMasks(win)->inputEvents[dev->id] & DeviceStateNotifyMask))
- return;
-
- if ((b = dev->button) != NULL) {
- nbuttons = b->numButtons;
- if (nbuttons > 32)
- evcount++;
- }
- if ((k = dev->key) != NULL) {
- nkeys = k->xkbInfo->desc->max_key_code - k->xkbInfo->desc->min_key_code;
- if (nkeys > 32)
- evcount++;
- if (nbuttons > 0) {
- evcount++;
- }
- }
- if ((v = dev->valuator) != NULL) {
- nval = v->numAxes;
-
- if (nval > 3)
- evcount++;
- if (nval > 6) {
- if (!(k && b))
- evcount++;
- if (nval > 9)
- evcount += ((nval - 7) / 3);
- }
- }
-
- sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent));
- FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first);
-
- if (b != NULL) {
- FixDeviceStateNotify(dev, ev++, NULL, b, v, first);
- first += 3;
- nval -= 3;
- if (nbuttons > 32) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- bev = (deviceButtonStateNotify *) ev++;
- bev->type = DeviceButtonStateNotify;
- bev->deviceid = dev->id;
- memcpy((char *) &bev->buttons[4], (char *) &b->down[4],
- DOWN_LENGTH - 4);
- }
- if (nval > 0) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
- first += 3;
- nval -= 3;
- }
- }
-
- if (k != NULL) {
- FixDeviceStateNotify(dev, ev++, k, NULL, v, first);
- first += 3;
- nval -= 3;
- if (nkeys > 32) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- kev = (deviceKeyStateNotify *) ev++;
- kev->type = DeviceKeyStateNotify;
- kev->deviceid = dev->id;
- memmove((char *) &kev->keys[0], (char *) &k->down[4], 28);
- }
- if (nval > 0) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
- first += 3;
- nval -= 3;
- }
- }
-
- while (nval > 0) {
- FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first);
- first += 3;
- nval -= 3;
- if (nval > 0) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
- first += 3;
- nval -= 3;
- }
- }
-
- DeliverEventsToWindow(dev, win, (xEvent *) sev, evcount,
- DeviceStateNotifyMask, NullGrab);
- free(sev);
-}
-
-void
-DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
- WindowPtr pWin)
-{
- deviceFocus event;
- xXIFocusInEvent *xi2event;
- DeviceIntPtr mouse;
- int btlen, len, i;
-
- mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER);
-
- /* XI 2 event */
- btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0;
- btlen = bytes_to_int32(btlen);
- len = sizeof(xXIFocusInEvent) + btlen * 4;
-
- xi2event = calloc(1, len);
- xi2event->type = GenericEvent;
- xi2event->extension = IReqCode;
- xi2event->evtype = type;
- xi2event->length = bytes_to_int32(len - sizeof(xEvent));
- xi2event->buttons_len = btlen;
- xi2event->detail = detail;
- xi2event->time = currentTime.milliseconds;
- xi2event->deviceid = dev->id;
- xi2event->sourceid = dev->id; /* a device doesn't change focus by itself */
- xi2event->mode = mode;
- xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
- xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
-
- for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
- if (BitIsOn(mouse->button->down, i))
- SetBit(&xi2event[1], mouse->button->map[i]);
-
- if (dev->key) {
- xi2event->mods.base_mods = dev->key->xkbInfo->state.base_mods;
- xi2event->mods.latched_mods = dev->key->xkbInfo->state.latched_mods;
- xi2event->mods.locked_mods = dev->key->xkbInfo->state.locked_mods;
- xi2event->mods.effective_mods = dev->key->xkbInfo->state.mods;
-
- xi2event->group.base_group = dev->key->xkbInfo->state.base_group;
- xi2event->group.latched_group = dev->key->xkbInfo->state.latched_group;
- xi2event->group.locked_group = dev->key->xkbInfo->state.locked_group;
- xi2event->group.effective_group = dev->key->xkbInfo->state.group;
- }
-
- FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent *) xi2event, pWin,
- None, FALSE);
-
- DeliverEventsToWindow(dev, pWin, (xEvent *) xi2event, 1,
- GetEventFilter(dev, (xEvent *) xi2event), NullGrab);
-
- free(xi2event);
-
- /* XI 1.x event */
- event.deviceid = dev->id;
- event.mode = mode;
- event.type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut;
- event.detail = detail;
- event.window = pWin->drawable.id;
- event.time = currentTime.milliseconds;
-
- DeliverEventsToWindow(dev, pWin, (xEvent *) &event, 1,
- DeviceFocusChangeMask, NullGrab);
-
- if (event.type == DeviceFocusIn)
- DeliverStateNotifyEvent(dev, pWin);
-}
-
int
CheckGrabValues(ClientPtr client, GrabParameters *param)
{
@@ -2573,12 +2318,11 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
check = (mask & exclusivemasks);
if (wOtherInputMasks(pWin)) {
- if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) { /* It is illegal for two different
- * clients to select on any of the
- * events for maskcheck. However,
- * it is OK, for some client to
- * continue selecting on one of those
- * events. */
+ if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) {
+ /* It is illegal for two different clients to select on any of
+ * the events for maskcheck. However, it is OK, for some client
+ * to continue selecting on one of those events.
+ */
for (others = wOtherInputMasks(pWin)->inputClients; others;
others = others->next) {
if (!SameClient(others, client) && (check &
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 4483076..7e30755 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -49,8 +49,6 @@ SOFTWARE.
* Dispatch routines and initialization routines for the X input extension.
*
*/
-#define ARRAY_SIZE(_a) (sizeof((_a)) / sizeof((_a)[0]))
-
#define NUMTYPES 15
#ifdef HAVE_DIX_CONFIG_H
@@ -150,10 +148,8 @@ const Mask ChangeDeviceNotifyMask = (1L << 16);
const Mask DeviceButtonGrabMask = (1L << 17);
const Mask DeviceOwnerGrabButtonMask = (1L << 17);
const Mask DevicePresenceNotifyMask = (1L << 18);
-const Mask DeviceEnterWindowMask = (1L << 18);
-const Mask DeviceLeaveWindowMask = (1L << 19);
-const Mask DevicePropertyNotifyMask = (1L << 20);
-const Mask XIAllMasks = (1L << 21) - 1;
+const Mask DevicePropertyNotifyMask = (1L << 19);
+const Mask XIAllMasks = (1L << 20) - 1;
int ExtEventIndex;
Mask ExtExclusiveMasks[EMASKSIZE];
@@ -162,25 +158,25 @@ static struct dev_type {
Atom type;
const char *name;
} dev_type[] = {
- {
- 0, XI_KEYBOARD}, {
- 0, XI_MOUSE}, {
- 0, XI_TABLET}, {
- 0, XI_TOUCHSCREEN}, {
- 0, XI_TOUCHPAD}, {
- 0, XI_BARCODE}, {
- 0, XI_BUTTONBOX}, {
- 0, XI_KNOB_BOX}, {
- 0, XI_ONE_KNOB}, {
- 0, XI_NINE_KNOB}, {
- 0, XI_TRACKBALL}, {
- 0, XI_QUADRATURE}, {
- 0, XI_ID_MODULE}, {
- 0, XI_SPACEBALL}, {
- 0, XI_DATAGLOVE}, {
- 0, XI_EYETRACKER}, {
- 0, XI_CURSORKEYS}, {
-0, XI_FOOTMOUSE}};
+ {0, XI_KEYBOARD},
+ {0, XI_MOUSE},
+ {0, XI_TABLET},
+ {0, XI_TOUCHSCREEN},
+ {0, XI_TOUCHPAD},
+ {0, XI_BARCODE},
+ {0, XI_BUTTONBOX},
+ {0, XI_KNOB_BOX},
+ {0, XI_ONE_KNOB},
+ {0, XI_NINE_KNOB},
+ {0, XI_TRACKBALL},
+ {0, XI_QUADRATURE},
+ {0, XI_ID_MODULE},
+ {0, XI_SPACEBALL},
+ {0, XI_DATAGLOVE},
+ {0, XI_EYETRACKER},
+ {0, XI_CURSORKEYS},
+ {0, XI_FOOTMOUSE}
+};
CARD8 event_base[numInputClasses];
XExtEventInfo EventInfo[32];
@@ -365,7 +361,7 @@ RESTYPE RT_INPUTCLIENT;
extern XExtensionVersion XIVersion;
-Mask PropagateMask[MAXDEVICES];
+Mask PropagateMask[EMASKSIZE];
/*****************************************************************
*
@@ -438,8 +434,9 @@ SProcIDispatch(ClientPtr client)
static void
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
- /* All we look at is the type field */
-{ /* This is common to all replies */
+{
+ /* All we look at is the type field */
+ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
SRepXGetExtensionVersion(client, len,
(xGetExtensionVersionReply *) rep);
@@ -1137,6 +1134,9 @@ IResetProc(ExtensionEntry * unused)
EventSwapVector[DevicePresenceNotify] = NotImplemented;
EventSwapVector[DevicePropertyNotify] = NotImplemented;
RestoreExtensionEvents();
+
+ free(xi_all_devices.name);
+ free(xi_all_master_devices.name);
}
/***********************************************************************
@@ -1298,9 +1298,9 @@ XInputExtensionInit(void)
memset(&xi_all_devices, 0, sizeof(xi_all_devices));
memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
xi_all_devices.id = XIAllDevices;
- xi_all_devices.name = "XIAllDevices";
+ xi_all_devices.name = strdup("XIAllDevices");
xi_all_master_devices.id = XIAllMasterDevices;
- xi_all_master_devices.name = "XIAllMasterDevices";
+ xi_all_master_devices.name = strdup("XIAllMasterDevices");
inputInfo.all_devices = &xi_all_devices;
inputInfo.all_master_devices = &xi_all_master_devices;
diff --git a/Xi/getbmap.c b/Xi/getbmap.c
index a0ec1a6..49b8688 100644
--- a/Xi/getbmap.c
+++ b/Xi/getbmap.c
@@ -92,11 +92,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
REQUEST(xGetDeviceButtonMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceButtonMapping;
- rep.nElts = 0;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetDeviceButtonMappingReply) {
+ .repType = X_Reply,
+ .RepType = X_GetDeviceButtonMapping,
+ .sequenceNumber = client->sequence,
+ .nElts = 0,
+ .length = 0
+ };
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
@@ -109,7 +111,7 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
rep.nElts = b->numButtons;
rep.length = bytes_to_int32(rep.nElts);
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
- (void) WriteToClient(client, rep.nElts, (char *) &b->map[1]);
+ WriteToClient(client, rep.nElts, &b->map[1]);
return Success;
}
@@ -126,5 +128,5 @@ SRepXGetDeviceButtonMapping(ClientPtr client, int size,
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 4d66a4d..6f73e09 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -158,7 +158,7 @@ SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
/***********************************************************************
@@ -182,10 +182,12 @@ ProcXGetDeviceControl(ClientPtr client)
if (rc != Success)
return rc;
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceControl;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetDeviceControlReply) {
+ .repType = X_Reply,
+ .RepType = X_GetDeviceControl,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
switch (stuff->control) {
case DEVICE_RESOLUTION:
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index 2772c0c..599b2ef 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -265,7 +265,7 @@ SRepXGetFeedbackControl(ClientPtr client, int size,
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_feedbacks);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
/***********************************************************************
@@ -295,11 +295,13 @@ ProcXGetFeedbackControl(ClientPtr client)
if (rc != Success)
return rc;
- rep.repType = X_Reply;
- rep.RepType = X_GetFeedbackControl;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.num_feedbacks = 0;
+ rep = (xGetFeedbackControlReply) {
+ .repType = X_Reply,
+ .RepType = X_GetFeedbackControl,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .num_feedbacks = 0
+ };
for (k = dev->kbdfeed; k; k = k->next) {
rep.num_feedbacks++;
diff --git a/Xi/getfocus.c b/Xi/getfocus.c
index ba36e37..40546cb 100644
--- a/Xi/getfocus.c
+++ b/Xi/getfocus.c
@@ -99,10 +99,12 @@ ProcXGetDeviceFocus(ClientPtr client)
if (!dev->focus)
return BadDevice;
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceFocus;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetDeviceFocusReply) {
+ .repType = X_Reply,
+ .RepType = X_GetDeviceFocus,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
focus = dev->focus;
@@ -135,5 +137,5 @@ SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
swapl(&rep->length);
swapl(&rep->focus);
swapl(&rep->time);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/getkmap.c b/Xi/getkmap.c
index 006be62..87c1977 100644
--- a/Xi/getkmap.c
+++ b/Xi/getkmap.c
@@ -119,11 +119,13 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
if (!syms)
return BadAlloc;
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceKeyMapping;
- rep.sequenceNumber = client->sequence;
- rep.keySymsPerKeyCode = syms->mapWidth;
- rep.length = (syms->mapWidth * stuff->count); /* KeySyms are 4 bytes */
+ rep = (xGetDeviceKeyMappingReply) {
+ .repType = X_Reply,
+ .RepType = X_GetDeviceKeyMapping,
+ .sequenceNumber = client->sequence,
+ .keySymsPerKeyCode = syms->mapWidth,
+ .length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */
+ };
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
@@ -150,5 +152,5 @@ SRepXGetDeviceKeyMapping(ClientPtr client, int size,
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/getmmap.c b/Xi/getmmap.c
index 3f84243..f07f2bb 100644
--- a/Xi/getmmap.c
+++ b/Xi/getmmap.c
@@ -101,15 +101,17 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
if (ret != Success)
return ret;
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceModifierMapping;
- rep.numKeyPerModifier = max_keys_per_mod;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetDeviceModifierMappingReply) {
+ .repType = X_Reply,
+ .RepType = X_GetDeviceModifierMapping,
+ .sequenceNumber = client->sequence,
+ .numKeyPerModifier = max_keys_per_mod,
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
- rep.length = max_keys_per_mod << 1;
+ .length = max_keys_per_mod << 1
+ };
WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
- WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
+ WriteToClient(client, max_keys_per_mod * 8, modkeymap);
free(modkeymap);
@@ -129,5 +131,5 @@ SRepXGetDeviceModifierMapping(ClientPtr client, int size,
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/getprop.c b/Xi/getprop.c
index b7b9e6b..4d6ce63 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.c
@@ -101,11 +101,13 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
REQUEST(xGetDeviceDontPropagateListReq);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceDontPropagateList;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.count = 0;
+ rep = (xGetDeviceDontPropagateListReply) {
+ .repType = X_Reply,
+ .RepType = X_GetDeviceDontPropagateList,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .count = 0
+ };
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
@@ -178,5 +180,5 @@ SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->count);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/getselev.c b/Xi/getselev.c
index 253c87f..60a46c2 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -102,12 +102,14 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
REQUEST(xGetSelectedExtensionEventsReq);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
- rep.repType = X_Reply;
- rep.RepType = X_GetSelectedExtensionEvents;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.this_client_count = 0;
- rep.all_clients_count = 0;
+ rep = (xGetSelectedExtensionEventsReply) {
+ .repType = X_Reply,
+ .RepType = X_GetSelectedExtensionEvents,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .this_client_count = 0,
+ .all_clients_count = 0
+ };
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
@@ -170,5 +172,5 @@ SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
swapl(&rep->length);
swaps(&rep->this_client_count);
swaps(&rep->all_clients_count);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/getvers.c b/Xi/getvers.c
index eb52c5b..829e695 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -98,14 +98,15 @@ ProcXGetExtensionVersion(ClientPtr client)
stuff->nbytes))
return BadLength;
- memset(&rep, 0, sizeof(xGetExtensionVersionReply));
- rep.repType = X_Reply;
- rep.RepType = X_GetExtensionVersion;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.present = TRUE;
- rep.major_version = XIVersion.major_version;
- rep.minor_version = XIVersion.minor_version;
+ rep = (xGetExtensionVersionReply) {
+ .repType = X_Reply,
+ .RepType = X_GetExtensionVersion,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .major_version = XIVersion.major_version,
+ .minor_version = XIVersion.minor_version,
+ .present = TRUE
+ };
WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
@@ -127,5 +128,5 @@ SRepXGetExtensionVersion(ClientPtr client, int size,
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/grabdev.c b/Xi/grabdev.c
index c904a97..443ef56 100644
--- a/Xi/grabdev.c
+++ b/Xi/grabdev.c
@@ -113,10 +113,12 @@ ProcXGrabDevice(ClientPtr client)
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
- rep.repType = X_Reply;
- rep.RepType = X_GrabDevice;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
+ rep = (xGrabDeviceReply) {
+ .repType = X_Reply,
+ .RepType = X_GrabDevice,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ };
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (rc != Success)
@@ -211,5 +213,5 @@ SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
index 0f0e975..8b4ae69 100644
--- a/Xi/grabdevb.c
+++ b/Xi/grabdevb.c
@@ -137,13 +137,14 @@ ProcXGrabDeviceButton(ClientPtr client)
X_GrabDeviceButton)) != Success)
return ret;
- memset(&param, 0, sizeof(param));
- param.grabtype = XI;
- param.ownerEvents = stuff->ownerEvents;
- param.this_device_mode = stuff->this_device_mode;
- param.other_devices_mode = stuff->other_devices_mode;
- param.grabWindow = stuff->grabWindow;
- param.modifiers = stuff->modifiers;
+ param = (GrabParameters) {
+ .grabtype = XI,
+ .ownerEvents = stuff->ownerEvents,
+ .this_device_mode = stuff->this_device_mode,
+ .other_devices_mode = stuff->other_devices_mode,
+ .grabWindow = stuff->grabWindow,
+ .modifiers = stuff->modifiers
+ };
mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabButton(client, dev, mdev, stuff->button, &param, XI, &mask);
diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
index b755182..8694f9e 100644
--- a/Xi/grabdevk.c
+++ b/Xi/grabdevk.c
@@ -135,13 +135,14 @@ ProcXGrabDeviceKey(ClientPtr client)
X_GrabDeviceKey)) != Success)
return ret;
- memset(&param, 0, sizeof(param));
- param.grabtype = XI;
- param.ownerEvents = stuff->ownerEvents;
- param.this_device_mode = stuff->this_device_mode;
- param.other_devices_mode = stuff->other_devices_mode;
- param.grabWindow = stuff->grabWindow;
- param.modifiers = stuff->modifiers;
+ param = (GrabParameters) {
+ .grabtype = XI,
+ .ownerEvents = stuff->ownerEvents,
+ .this_device_mode = stuff->this_device_mode,
+ .other_devices_mode = stuff->other_devices_mode,
+ .grabWindow = stuff->grabWindow,
+ .modifiers = stuff->modifiers
+ };
mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabKey(client, dev, mdev, stuff->key, &param, XI, &mask);
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 48bc79a..4642b19 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -110,13 +110,15 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
if (dev->valuator->motionHintWindow)
MaybeStopDeviceHint(dev, client);
axes = v->numAxes;
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceMotionEvents;
- rep.sequenceNumber = client->sequence;
- rep.nEvents = 0;
- rep.axes = axes;
- rep.mode = Absolute; /* XXX we don't do relative at the moment */
- rep.length = 0;
+ rep = (xGetDeviceMotionEventsReply) {
+ .repType = X_Reply,
+ .RepType = X_GetDeviceMotionEvents,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .nEvents = 0,
+ .axes = axes,
+ .mode = Absolute /* XXX we don't do relative at the moment */
+ };
start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop);
if (CompareTimeStamps(start, stop) == LATER ||
@@ -147,7 +149,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
bufptr++;
}
}
- WriteToClient(client, length * 4, (char *) coords);
+ WriteToClient(client, length * 4, coords);
}
free(coords);
return Success;
@@ -167,5 +169,5 @@ SRepXGetDeviceMotionEvents(ClientPtr client, int size,
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->nEvents);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/listdev.c b/Xi/listdev.c
index a02112f..014c61d 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -342,11 +342,12 @@ ProcXListInputDevices(ClientPtr client)
REQUEST_SIZE_MATCH(xListInputDevicesReq);
- memset(&rep, 0, sizeof(xListInputDevicesReply));
- rep.repType = X_Reply;
- rep.RepType = X_ListInputDevices;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xListInputDevicesReply) {
+ .repType = X_Reply,
+ .RepType = X_ListInputDevices,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
/* allocate space for saving skip value */
skip = calloc(sizeof(Bool), inputInfo.numDevices);
@@ -417,5 +418,5 @@ SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/opendev.c b/Xi/opendev.c
index e7c00a2..6708bad 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -117,10 +117,6 @@ ProcXOpenDevice(ClientPtr client)
if (status != Success)
return status;
- memset(&rep, 0, sizeof(xOpenDeviceReply));
- rep.repType = X_Reply;
- rep.RepType = X_OpenDevice;
- rep.sequenceNumber = client->sequence;
if (dev->key != NULL) {
evbase[j].class = KeyClass;
evbase[j++].event_type_base = event_base[KeyClass];
@@ -148,10 +144,15 @@ ProcXOpenDevice(ClientPtr client)
}
evbase[j].class = OtherClass;
evbase[j++].event_type_base = event_base[OtherClass];
- rep.length = bytes_to_int32(j * sizeof(xInputClassInfo));
- rep.num_classes = j;
+ rep = (xOpenDeviceReply) {
+ .repType = X_Reply,
+ .RepType = X_OpenDevice,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(j * sizeof(xInputClassInfo)),
+ .num_classes = j
+ };
WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
- WriteToClient(client, j * sizeof(xInputClassInfo), (char *) evbase);
+ WriteToClient(client, j * sizeof(xInputClassInfo), evbase);
return Success;
}
@@ -167,5 +168,5 @@ SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/queryst.c b/Xi/queryst.c
index ffb6de0..04a652b 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -87,11 +87,6 @@ ProcXQueryDeviceState(ClientPtr client)
REQUEST(xQueryDeviceStateReq);
REQUEST_SIZE_MATCH(xQueryDeviceStateReq);
- rep.repType = X_Reply;
- rep.RepType = X_QueryDeviceState;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
if (rc != Success && rc != BadAccess)
return rc;
@@ -163,8 +158,13 @@ ProcXQueryDeviceState(ClientPtr client)
}
}
- rep.num_classes = num_classes;
- rep.length = bytes_to_int32(total_length);
+ rep = (xQueryDeviceStateReply) {
+ .repType = X_Reply,
+ .RepType = X_QueryDeviceState,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(total_length),
+ .num_classes = num_classes
+ };
WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
WriteToClient(client, total_length, savbuf);
@@ -184,5 +184,5 @@ SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/setbmap.c b/Xi/setbmap.c
index 110f5e9..9479655 100644
--- a/Xi/setbmap.c
+++ b/Xi/setbmap.c
@@ -100,11 +100,13 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
if (ret != Success)
return ret;
- rep.repType = X_Reply;
- rep.RepType = X_SetDeviceButtonMapping;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.status = MappingSuccess;
+ rep = (xSetDeviceButtonMappingReply) {
+ .repType = X_Reply,
+ .RepType = X_SetDeviceButtonMapping,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .status = MappingSuccess
+ };
ret =
ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length,
@@ -134,5 +136,5 @@ SRepXSetDeviceButtonMapping(ClientPtr client, int size,
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/setdval.c b/Xi/setdval.c
index 542f20d..4c9c99f 100644
--- a/Xi/setdval.c
+++ b/Xi/setdval.c
@@ -92,11 +92,13 @@ ProcXSetDeviceValuators(ClientPtr client)
REQUEST(xSetDeviceValuatorsReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq);
- rep.repType = X_Reply;
- rep.RepType = X_SetDeviceValuators;
- rep.length = 0;
- rep.status = Success;
- rep.sequenceNumber = client->sequence;
+ rep = (xSetDeviceValuatorsReply) {
+ .repType = X_Reply,
+ .RepType = X_SetDeviceValuators,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .status = Success
+ };
if (stuff->length != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
stuff->num_valuators)
@@ -138,5 +140,5 @@ SRepXSetDeviceValuators(ClientPtr client, int size,
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/setmmap.c b/Xi/setmmap.c
index 36845d7..1320cfe 100644
--- a/Xi/setmmap.c
+++ b/Xi/setmmap.c
@@ -98,10 +98,12 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
(stuff->numKeyPerModifier << 1))
return BadLength;
- rep.repType = X_Reply;
- rep.RepType = X_SetDeviceModifierMapping;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xSetDeviceModifierMappingReply) {
+ .repType = X_Reply,
+ .RepType = X_SetDeviceModifierMapping,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
@@ -140,5 +142,5 @@ SRepXSetDeviceModifierMapping(ClientPtr client, int size,
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/setmode.c b/Xi/setmode.c
index a7bf1ea..5356552 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -92,10 +92,12 @@ ProcXSetDeviceMode(ClientPtr client)
REQUEST(xSetDeviceModeReq);
REQUEST_SIZE_MATCH(xSetDeviceModeReq);
- rep.repType = X_Reply;
- rep.RepType = X_SetDeviceMode;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xSetDeviceModeReply) {
+ .repType = X_Reply,
+ .RepType = X_SetDeviceMode,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
if (rc != Success)
@@ -137,5 +139,5 @@ SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 8baa5a0..39bee7c 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -141,4 +141,5 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
void
DeleteInputDeviceRequest(DeviceIntPtr dev)
{
+ RemoveDevice(dev, TRUE);
}
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 756aaac..89f16d8 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -293,12 +293,6 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
}
}
- /* can't disable until we removed pairing */
- keybd->spriteInfo->paired = NULL;
- ptr->spriteInfo->paired = NULL;
- XTestptr->spriteInfo->paired = NULL;
- XTestkeybd->spriteInfo->paired = NULL;
-
/* disable the remove the devices, XTest devices must be done first
else the sprites they rely on will be destroyed */
DisableDevice(XTestptr, FALSE);
diff --git a/Xi/xigetclientpointer.c b/Xi/xigetclientpointer.c
index 07dbf18..3c90d58 100644
--- a/Xi/xigetclientpointer.c
+++ b/Xi/xigetclientpointer.c
@@ -75,12 +75,14 @@ ProcXIGetClientPointer(ClientPtr client)
else
winclient = client;
- rep.repType = X_Reply;
- rep.RepType = X_XIGetClientPointer;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.set = (winclient->clientPtr != NULL);
- rep.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0;
+ rep = (xXIGetClientPointerReply) {
+ .repType = X_Reply,
+ .RepType = X_XIGetClientPointer,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .set = (winclient->clientPtr != NULL),
+ .deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
+ };
WriteReplyToClient(client, sizeof(xXIGetClientPointerReply), &rep);
return Success;
@@ -100,5 +102,5 @@ SRepXIGetClientPointer(ClientPtr client, int size,
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->deviceid);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
index 8d2cf0b..09186e8 100644
--- a/Xi/xigrabdev.c
+++ b/Xi/xigrabdev.c
@@ -104,11 +104,13 @@ ProcXIGrabDevice(ClientPtr client)
if (ret != Success)
return ret;
- rep.repType = X_Reply;
- rep.RepType = X_XIGrabDevice;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.status = status;
+ rep = (xXIGrabDeviceReply) {
+ .repType = X_Reply,
+ .RepType = X_XIGrabDevice,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .status = status
+ };
WriteReplyToClient(client, sizeof(rep), &rep);
return ret;
@@ -156,5 +158,5 @@ SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 7130328..ddab53d 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -78,7 +78,13 @@ int
ProcXIPassiveGrabDevice(ClientPtr client)
{
DeviceIntPtr dev, mod_dev;
- xXIPassiveGrabDeviceReply rep;
+ xXIPassiveGrabDeviceReply rep = {
+ .repType = X_Reply,
+ .RepType = X_XIPassiveGrabDevice,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .num_modifiers = 0
+ };
int i, ret = Success;
uint32_t *modifiers;
xXIGrabModifierInfo *modifiers_failed;
@@ -137,12 +143,6 @@ ProcXIPassiveGrabDevice(ClientPtr client)
xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid,
(unsigned char *) &stuff[1], mask_len * 4);
- rep.repType = X_Reply;
- rep.RepType = X_XIPassiveGrabDevice;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.num_modifiers = 0;
-
memset(&param, 0, sizeof(param));
param.grabtype = XI2;
param.ownerEvents = stuff->owner_events;
@@ -224,7 +224,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
WriteReplyToClient(client, sizeof(rep), &rep);
if (rep.num_modifiers)
- WriteToClient(client, rep.length * 4, (char *) modifiers_failed);
+ WriteToClient(client, rep.length * 4, modifiers_failed);
free(modifiers_failed);
out:
@@ -240,7 +240,7 @@ SRepXIPassiveGrabDevice(ClientPtr client, int size,
swapl(&rep->length);
swaps(&rep->num_modifiers);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
int
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index e17efe4..43351bc 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -49,132 +49,131 @@ static struct dev_properties {
Atom type;
const char *name;
} dev_properties[] = {
- {
- 0, XI_PROP_ENABLED}, {
- 0, XI_PROP_XTEST_DEVICE}, {
- 0, XATOM_FLOAT}, {
- 0, ACCEL_PROP_PROFILE_NUMBER}, {
- 0, ACCEL_PROP_CONSTANT_DECELERATION}, {
- 0, ACCEL_PROP_ADAPTIVE_DECELERATION}, {
- 0, ACCEL_PROP_VELOCITY_SCALING}, {
- 0, AXIS_LABEL_PROP}, {
- 0, AXIS_LABEL_PROP_REL_X}, {
- 0, AXIS_LABEL_PROP_REL_Y}, {
- 0, AXIS_LABEL_PROP_REL_Z}, {
- 0, AXIS_LABEL_PROP_REL_RX}, {
- 0, AXIS_LABEL_PROP_REL_RY}, {
- 0, AXIS_LABEL_PROP_REL_RZ}, {
- 0, AXIS_LABEL_PROP_REL_HWHEEL}, {
- 0, AXIS_LABEL_PROP_REL_DIAL}, {
- 0, AXIS_LABEL_PROP_REL_WHEEL}, {
- 0, AXIS_LABEL_PROP_REL_MISC}, {
- 0, AXIS_LABEL_PROP_REL_VSCROLL}, {
- 0, AXIS_LABEL_PROP_REL_HSCROLL}, {
- 0, AXIS_LABEL_PROP_ABS_X}, {
- 0, AXIS_LABEL_PROP_ABS_Y}, {
- 0, AXIS_LABEL_PROP_ABS_Z}, {
- 0, AXIS_LABEL_PROP_ABS_RX}, {
- 0, AXIS_LABEL_PROP_ABS_RY}, {
- 0, AXIS_LABEL_PROP_ABS_RZ}, {
- 0, AXIS_LABEL_PROP_ABS_THROTTLE}, {
- 0, AXIS_LABEL_PROP_ABS_RUDDER}, {
- 0, AXIS_LABEL_PROP_ABS_WHEEL}, {
- 0, AXIS_LABEL_PROP_ABS_GAS}, {
- 0, AXIS_LABEL_PROP_ABS_BRAKE}, {
- 0, AXIS_LABEL_PROP_ABS_HAT0X}, {
- 0, AXIS_LABEL_PROP_ABS_HAT0Y}, {
- 0, AXIS_LABEL_PROP_ABS_HAT1X}, {
- 0, AXIS_LABEL_PROP_ABS_HAT1Y}, {
- 0, AXIS_LABEL_PROP_ABS_HAT2X}, {
- 0, AXIS_LABEL_PROP_ABS_HAT2Y}, {
- 0, AXIS_LABEL_PROP_ABS_HAT3X}, {
- 0, AXIS_LABEL_PROP_ABS_HAT3Y}, {
- 0, AXIS_LABEL_PROP_ABS_PRESSURE}, {
- 0, AXIS_LABEL_PROP_ABS_DISTANCE}, {
- 0, AXIS_LABEL_PROP_ABS_TILT_X}, {
- 0, AXIS_LABEL_PROP_ABS_TILT_Y}, {
- 0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH}, {
- 0, AXIS_LABEL_PROP_ABS_VOLUME}, {
- 0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR}, {
- 0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR}, {
- 0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR}, {
- 0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR}, {
- 0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION}, {
- 0, AXIS_LABEL_PROP_ABS_MT_POSITION_X}, {
- 0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y}, {
- 0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE}, {
- 0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID}, {
- 0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID}, {
- 0, AXIS_LABEL_PROP_ABS_MT_PRESSURE}, {
- 0, AXIS_LABEL_PROP_ABS_MISC}, {
- 0, BTN_LABEL_PROP}, {
- 0, BTN_LABEL_PROP_BTN_UNKNOWN}, {
- 0, BTN_LABEL_PROP_BTN_WHEEL_UP}, {
- 0, BTN_LABEL_PROP_BTN_WHEEL_DOWN}, {
- 0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT}, {
- 0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT}, {
- 0, BTN_LABEL_PROP_BTN_0}, {
- 0, BTN_LABEL_PROP_BTN_1}, {
- 0, BTN_LABEL_PROP_BTN_2}, {
- 0, BTN_LABEL_PROP_BTN_3}, {
- 0, BTN_LABEL_PROP_BTN_4}, {
- 0, BTN_LABEL_PROP_BTN_5}, {
- 0, BTN_LABEL_PROP_BTN_6}, {
- 0, BTN_LABEL_PROP_BTN_7}, {
- 0, BTN_LABEL_PROP_BTN_8}, {
- 0, BTN_LABEL_PROP_BTN_9}, {
- 0, BTN_LABEL_PROP_BTN_LEFT}, {
- 0, BTN_LABEL_PROP_BTN_RIGHT}, {
- 0, BTN_LABEL_PROP_BTN_MIDDLE}, {
- 0, BTN_LABEL_PROP_BTN_SIDE}, {
- 0, BTN_LABEL_PROP_BTN_EXTRA}, {
- 0, BTN_LABEL_PROP_BTN_FORWARD}, {
- 0, BTN_LABEL_PROP_BTN_BACK}, {
- 0, BTN_LABEL_PROP_BTN_TASK}, {
- 0, BTN_LABEL_PROP_BTN_TRIGGER}, {
- 0, BTN_LABEL_PROP_BTN_THUMB}, {
- 0, BTN_LABEL_PROP_BTN_THUMB2}, {
- 0, BTN_LABEL_PROP_BTN_TOP}, {
- 0, BTN_LABEL_PROP_BTN_TOP2}, {
- 0, BTN_LABEL_PROP_BTN_PINKIE}, {
- 0, BTN_LABEL_PROP_BTN_BASE}, {
- 0, BTN_LABEL_PROP_BTN_BASE2}, {
- 0, BTN_LABEL_PROP_BTN_BASE3}, {
- 0, BTN_LABEL_PROP_BTN_BASE4}, {
- 0, BTN_LABEL_PROP_BTN_BASE5}, {
- 0, BTN_LABEL_PROP_BTN_BASE6}, {
- 0, BTN_LABEL_PROP_BTN_DEAD}, {
- 0, BTN_LABEL_PROP_BTN_A}, {
- 0, BTN_LABEL_PROP_BTN_B}, {
- 0, BTN_LABEL_PROP_BTN_C}, {
- 0, BTN_LABEL_PROP_BTN_X}, {
- 0, BTN_LABEL_PROP_BTN_Y}, {
- 0, BTN_LABEL_PROP_BTN_Z}, {
- 0, BTN_LABEL_PROP_BTN_TL}, {
- 0, BTN_LABEL_PROP_BTN_TR}, {
- 0, BTN_LABEL_PROP_BTN_TL2}, {
- 0, BTN_LABEL_PROP_BTN_TR2}, {
- 0, BTN_LABEL_PROP_BTN_SELECT}, {
- 0, BTN_LABEL_PROP_BTN_START}, {
- 0, BTN_LABEL_PROP_BTN_MODE}, {
- 0, BTN_LABEL_PROP_BTN_THUMBL}, {
- 0, BTN_LABEL_PROP_BTN_THUMBR}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_PEN}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_RUBBER}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_BRUSH}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_PENCIL}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_FINGER}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_MOUSE}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_LENS}, {
- 0, BTN_LABEL_PROP_BTN_TOUCH}, {
- 0, BTN_LABEL_PROP_BTN_STYLUS}, {
- 0, BTN_LABEL_PROP_BTN_STYLUS2}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP}, {
- 0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP}, {
- 0, BTN_LABEL_PROP_BTN_GEAR_DOWN}, {
- 0, BTN_LABEL_PROP_BTN_GEAR_UP}, {
- 0, XI_PROP_TRANSFORM}
+ {0, XI_PROP_ENABLED},
+ {0, XI_PROP_XTEST_DEVICE},
+ {0, XATOM_FLOAT},
+ {0, ACCEL_PROP_PROFILE_NUMBER},
+ {0, ACCEL_PROP_CONSTANT_DECELERATION},
+ {0, ACCEL_PROP_ADAPTIVE_DECELERATION},
+ {0, ACCEL_PROP_VELOCITY_SCALING},
+ {0, AXIS_LABEL_PROP},
+ {0, AXIS_LABEL_PROP_REL_X},
+ {0, AXIS_LABEL_PROP_REL_Y},
+ {0, AXIS_LABEL_PROP_REL_Z},
+ {0, AXIS_LABEL_PROP_REL_RX},
+ {0, AXIS_LABEL_PROP_REL_RY},
+ {0, AXIS_LABEL_PROP_REL_RZ},
+ {0, AXIS_LABEL_PROP_REL_HWHEEL},
+ {0, AXIS_LABEL_PROP_REL_DIAL},
+ {0, AXIS_LABEL_PROP_REL_WHEEL},
+ {0, AXIS_LABEL_PROP_REL_MISC},
+ {0, AXIS_LABEL_PROP_REL_VSCROLL},
+ {0, AXIS_LABEL_PROP_REL_HSCROLL},
+ {0, AXIS_LABEL_PROP_ABS_X},
+ {0, AXIS_LABEL_PROP_ABS_Y},
+ {0, AXIS_LABEL_PROP_ABS_Z},
+ {0, AXIS_LABEL_PROP_ABS_RX},
+ {0, AXIS_LABEL_PROP_ABS_RY},
+ {0, AXIS_LABEL_PROP_ABS_RZ},
+ {0, AXIS_LABEL_PROP_ABS_THROTTLE},
+ {0, AXIS_LABEL_PROP_ABS_RUDDER},
+ {0, AXIS_LABEL_PROP_ABS_WHEEL},
+ {0, AXIS_LABEL_PROP_ABS_GAS},
+ {0, AXIS_LABEL_PROP_ABS_BRAKE},
+ {0, AXIS_LABEL_PROP_ABS_HAT0X},
+ {0, AXIS_LABEL_PROP_ABS_HAT0Y},
+ {0, AXIS_LABEL_PROP_ABS_HAT1X},
+ {0, AXIS_LABEL_PROP_ABS_HAT1Y},
+ {0, AXIS_LABEL_PROP_ABS_HAT2X},
+ {0, AXIS_LABEL_PROP_ABS_HAT2Y},
+ {0, AXIS_LABEL_PROP_ABS_HAT3X},
+ {0, AXIS_LABEL_PROP_ABS_HAT3Y},
+ {0, AXIS_LABEL_PROP_ABS_PRESSURE},
+ {0, AXIS_LABEL_PROP_ABS_DISTANCE},
+ {0, AXIS_LABEL_PROP_ABS_TILT_X},
+ {0, AXIS_LABEL_PROP_ABS_TILT_Y},
+ {0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH},
+ {0, AXIS_LABEL_PROP_ABS_VOLUME},
+ {0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR},
+ {0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR},
+ {0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR},
+ {0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR},
+ {0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION},
+ {0, AXIS_LABEL_PROP_ABS_MT_POSITION_X},
+ {0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y},
+ {0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE},
+ {0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID},
+ {0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID},
+ {0, AXIS_LABEL_PROP_ABS_MT_PRESSURE},
+ {0, AXIS_LABEL_PROP_ABS_MISC},
+ {0, BTN_LABEL_PROP},
+ {0, BTN_LABEL_PROP_BTN_UNKNOWN},
+ {0, BTN_LABEL_PROP_BTN_WHEEL_UP},
+ {0, BTN_LABEL_PROP_BTN_WHEEL_DOWN},
+ {0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT},
+ {0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT},
+ {0, BTN_LABEL_PROP_BTN_0},
+ {0, BTN_LABEL_PROP_BTN_1},
+ {0, BTN_LABEL_PROP_BTN_2},
+ {0, BTN_LABEL_PROP_BTN_3},
+ {0, BTN_LABEL_PROP_BTN_4},
+ {0, BTN_LABEL_PROP_BTN_5},
+ {0, BTN_LABEL_PROP_BTN_6},
+ {0, BTN_LABEL_PROP_BTN_7},
+ {0, BTN_LABEL_PROP_BTN_8},
+ {0, BTN_LABEL_PROP_BTN_9},
+ {0, BTN_LABEL_PROP_BTN_LEFT},
+ {0, BTN_LABEL_PROP_BTN_RIGHT},
+ {0, BTN_LABEL_PROP_BTN_MIDDLE},
+ {0, BTN_LABEL_PROP_BTN_SIDE},
+ {0, BTN_LABEL_PROP_BTN_EXTRA},
+ {0, BTN_LABEL_PROP_BTN_FORWARD},
+ {0, BTN_LABEL_PROP_BTN_BACK},
+ {0, BTN_LABEL_PROP_BTN_TASK},
+ {0, BTN_LABEL_PROP_BTN_TRIGGER},
+ {0, BTN_LABEL_PROP_BTN_THUMB},
+ {0, BTN_LABEL_PROP_BTN_THUMB2},
+ {0, BTN_LABEL_PROP_BTN_TOP},
+ {0, BTN_LABEL_PROP_BTN_TOP2},
+ {0, BTN_LABEL_PROP_BTN_PINKIE},
+ {0, BTN_LABEL_PROP_BTN_BASE},
+ {0, BTN_LABEL_PROP_BTN_BASE2},
+ {0, BTN_LABEL_PROP_BTN_BASE3},
+ {0, BTN_LABEL_PROP_BTN_BASE4},
+ {0, BTN_LABEL_PROP_BTN_BASE5},
+ {0, BTN_LABEL_PROP_BTN_BASE6},
+ {0, BTN_LABEL_PROP_BTN_DEAD},
+ {0, BTN_LABEL_PROP_BTN_A},
+ {0, BTN_LABEL_PROP_BTN_B},
+ {0, BTN_LABEL_PROP_BTN_C},
+ {0, BTN_LABEL_PROP_BTN_X},
+ {0, BTN_LABEL_PROP_BTN_Y},
+ {0, BTN_LABEL_PROP_BTN_Z},
+ {0, BTN_LABEL_PROP_BTN_TL},
+ {0, BTN_LABEL_PROP_BTN_TR},
+ {0, BTN_LABEL_PROP_BTN_TL2},
+ {0, BTN_LABEL_PROP_BTN_TR2},
+ {0, BTN_LABEL_PROP_BTN_SELECT},
+ {0, BTN_LABEL_PROP_BTN_START},
+ {0, BTN_LABEL_PROP_BTN_MODE},
+ {0, BTN_LABEL_PROP_BTN_THUMBL},
+ {0, BTN_LABEL_PROP_BTN_THUMBR},
+ {0, BTN_LABEL_PROP_BTN_TOOL_PEN},
+ {0, BTN_LABEL_PROP_BTN_TOOL_RUBBER},
+ {0, BTN_LABEL_PROP_BTN_TOOL_BRUSH},
+ {0, BTN_LABEL_PROP_BTN_TOOL_PENCIL},
+ {0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH},
+ {0, BTN_LABEL_PROP_BTN_TOOL_FINGER},
+ {0, BTN_LABEL_PROP_BTN_TOOL_MOUSE},
+ {0, BTN_LABEL_PROP_BTN_TOOL_LENS},
+ {0, BTN_LABEL_PROP_BTN_TOUCH},
+ {0, BTN_LABEL_PROP_BTN_STYLUS},
+ {0, BTN_LABEL_PROP_BTN_STYLUS2},
+ {0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP},
+ {0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP},
+ {0, BTN_LABEL_PROP_BTN_GEAR_DOWN},
+ {0, BTN_LABEL_PROP_BTN_GEAR_UP},
+ {0, XI_PROP_TRANSFORM}
};
static long XIPropHandlerID = 1;
@@ -182,30 +181,27 @@ static long XIPropHandlerID = 1;
static void
send_property_event(DeviceIntPtr dev, Atom property, int what)
{
- devicePropertyNotify event;
- xXIPropertyEvent xi2;
- int state;
+ int state = (what == XIPropertyDeleted) ? PropertyDelete : PropertyNewValue;
+ devicePropertyNotify event = {
+ .type = DevicePropertyNotify,
+ .deviceid = dev->id,
+ .state = state,
+ .atom = property,
+ .time = currentTime.milliseconds
+ };
+ xXIPropertyEvent xi2 = {
+ .type = GenericEvent,
+ .extension = IReqCode,
+ .length = 0,
+ .evtype = XI_PropertyEvent,
+ .deviceid = dev->id,
+ .time = currentTime.milliseconds,
+ .property = property,
+ .what = what
+ };
- if (what == XIPropertyDeleted)
- state = PropertyDelete;
- else
- state = PropertyNewValue;
-
- event.type = DevicePropertyNotify;
- event.deviceid = dev->id;
- event.state = state;
- event.atom = property;
- event.time = currentTime.milliseconds;
SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent *) &event, 1);
- xi2.type = GenericEvent;
- xi2.extension = IReqCode;
- xi2.length = 0;
- xi2.evtype = XI_PropertyEvent;
- xi2.deviceid = dev->id;
- xi2.time = currentTime.milliseconds;
- xi2.property = property;
- xi2.what = what;
SendEventToAllWindows(dev, GetEventFilter(dev, (xEvent *) &xi2),
(xEvent *) &xi2, 1);
}
@@ -754,7 +750,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
break;
}
if (new_data)
- memcpy((char *) new_data, (char *) value, len * size_in_bytes);
+ memcpy((char *) new_data, value, len * size_in_bytes);
if (old_data)
memcpy((char *) old_data, (char *) prop_value->data,
prop_value->size * size_in_bytes);
@@ -774,6 +770,8 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
&new_value, checkonly);
if (checkonly && rc != Success) {
free(new_value.data);
+ if (add)
+ XIDestroyDeviceProperty(prop);
return rc;
}
}
@@ -864,11 +862,13 @@ ProcXListDeviceProperties(ClientPtr client)
if (rc != Success)
return rc;
- rep.repType = X_Reply;
- rep.RepType = X_ListDeviceProperties;
- rep.length = natoms;
- rep.sequenceNumber = client->sequence;
- rep.nAtoms = natoms;
+ rep = (xListDevicePropertiesReply) {
+ .repType = X_Reply,
+ .RepType = X_ListDeviceProperties,
+ .sequenceNumber = client->sequence,
+ .length = natoms,
+ .nAtoms = natoms
+ };
WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
if (natoms) {
@@ -958,15 +958,17 @@ ProcXGetDeviceProperty(ClientPtr client)
if (rc != Success)
return rc;
- reply.repType = X_Reply;
- reply.RepType = X_GetDeviceProperty;
- reply.sequenceNumber = client->sequence;
- reply.deviceid = dev->id;
- reply.nItems = nitems;
- reply.format = format;
- reply.bytesAfter = bytes_after;
- reply.propertyType = type;
- reply.length = bytes_to_int32(length);
+ reply = (xGetDevicePropertyReply) {
+ .repType = X_Reply,
+ .RepType = X_GetDeviceProperty,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(length),
+ .propertyType = type,
+ .bytesAfter = bytes_after,
+ .nItems = nitems,
+ .format = format,
+ .deviceid = dev->id
+ };
if (stuff->delete && (reply.bytesAfter == 0))
send_property_event(dev, stuff->property, XIPropertyDeleted);
@@ -1063,7 +1065,7 @@ SRepXListDeviceProperties(ClientPtr client, int size,
swapl(&rep->length);
swaps(&rep->nAtoms);
/* properties will be swapped later, see ProcXListDeviceProperties */
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
void
@@ -1076,7 +1078,7 @@ SRepXGetDeviceProperty(ClientPtr client, int size,
swapl(&rep->bytesAfter);
swapl(&rep->nItems);
/* data will be swapped, see ProcXGetDeviceProperty */
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
/* XI2 Request/reply handling */
@@ -1100,11 +1102,13 @@ ProcXIListProperties(ClientPtr client)
if (rc != Success)
return rc;
- rep.repType = X_Reply;
- rep.RepType = X_XIListProperties;
- rep.length = natoms;
- rep.sequenceNumber = client->sequence;
- rep.num_properties = natoms;
+ rep = (xXIListPropertiesReply) {
+ .repType = X_Reply,
+ .RepType = X_XIListProperties,
+ .sequenceNumber = client->sequence,
+ .length = natoms,
+ .num_properties = natoms
+ };
WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep);
if (natoms) {
@@ -1194,14 +1198,16 @@ ProcXIGetProperty(ClientPtr client)
if (rc != Success)
return rc;
- reply.repType = X_Reply;
- reply.RepType = X_XIGetProperty;
- reply.sequenceNumber = client->sequence;
- reply.num_items = nitems;
- reply.format = format;
- reply.bytes_after = bytes_after;
- reply.type = type;
- reply.length = bytes_to_int32(length);
+ reply = (xXIGetPropertyReply) {
+ .repType = X_Reply,
+ .RepType = X_XIGetProperty,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(length),
+ .type = type,
+ .bytes_after = bytes_after,
+ .num_items = nitems,
+ .format = format
+ };
if (length && stuff->delete && (reply.bytes_after == 0))
send_property_event(dev, stuff->property, XIPropertyDeleted);
@@ -1300,7 +1306,7 @@ SRepXIListProperties(ClientPtr client, int size, xXIListPropertiesReply * rep)
swapl(&rep->length);
swaps(&rep->num_properties);
/* properties will be swapped later, see ProcXIListProperties */
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
void
@@ -1312,5 +1318,5 @@ SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep)
swapl(&rep->bytes_after);
swapl(&rep->num_items);
/* data will be swapped, see ProcXIGetProperty */
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index 749bc24..85c1dd8 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -107,12 +107,13 @@ ProcXIQueryDevice(ClientPtr client)
return BadAlloc;
}
- memset(&rep, 0, sizeof(xXIQueryDeviceReply));
- rep.repType = X_Reply;
- rep.RepType = X_XIQueryDevice;
- rep.sequenceNumber = client->sequence;
- rep.length = len / 4;
- rep.num_devices = 0;
+ rep = (xXIQueryDeviceReply) {
+ .repType = X_Reply,
+ .RepType = X_XIQueryDevice,
+ .sequenceNumber = client->sequence,
+ .length = len / 4,
+ .num_devices = 0
+ };
ptr = info;
if (dev) {
@@ -162,7 +163,7 @@ SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply * rep)
/* Device info is already swapped, see ProcXIQueryDevice */
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
/**
@@ -430,7 +431,7 @@ ListTouchInfo(DeviceIntPtr dev, xXITouchInfo * touch)
{
touch->type = XITouchClass;
touch->length = sizeof(xXITouchInfo) >> 2;
- touch->sourceid = touch->sourceid;
+ touch->sourceid = dev->touch->sourceid;
touch->mode = dev->touch->mode;
touch->num_touches = dev->touch->num_touches;
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index 169436e..7e6852d 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -121,15 +121,16 @@ ProcXIQueryPointer(ClientPtr client)
pSprite = pDev->spriteInfo->sprite;
- memset(&rep, 0, sizeof(rep));
- rep.repType = X_Reply;
- rep.RepType = X_XIQueryPointer;
- rep.length = 6;
- rep.sequenceNumber = client->sequence;
- rep.root = (GetCurrentRootWindow(pDev))->drawable.id;
- rep.root_x = FP1616(pSprite->hot.x, 0);
- rep.root_y = FP1616(pSprite->hot.y, 0);
- rep.child = None;
+ rep = (xXIQueryPointerReply) {
+ .repType = X_Reply,
+ .RepType = X_XIQueryPointer,
+ .sequenceNumber = client->sequence,
+ .length = 6,
+ .root = (GetCurrentRootWindow(pDev))->drawable.id,
+ .root_x = FP1616(pSprite->hot.x, 0),
+ .root_y = FP1616(pSprite->hot.y, 0),
+ .child = None
+ };
if (kbd) {
state = &kbd->key->xkbInfo->state;
@@ -219,5 +220,5 @@ SRepXIQueryPointer(ClientPtr client, int size, xXIQueryPointerReply * rep)
swapl(&rep->win_y);
swaps(&rep->buttons_len);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/xiqueryversion.c b/Xi/xiqueryversion.c
index 95a8efa..b807a53 100644
--- a/Xi/xiqueryversion.c
+++ b/Xi/xiqueryversion.c
@@ -70,26 +70,37 @@ ProcXIQueryVersion(ClientPtr client)
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
- if (version_compare(XIVersion.major_version, XIVersion.minor_version,
- stuff->major_version, stuff->minor_version) > 0) {
- major = stuff->major_version;
- minor = stuff->minor_version;
+ if (pXIClient->major_version) {
+ if (version_compare(stuff->major_version, stuff->minor_version,
+ pXIClient->major_version, pXIClient->minor_version) < 0) {
+ client->errorValue = stuff->major_version;
+ return BadValue;
+ }
+ major = pXIClient->major_version;
+ minor = pXIClient->minor_version;
+ } else {
+ if (version_compare(XIVersion.major_version, XIVersion.minor_version,
+ stuff->major_version, stuff->minor_version) > 0) {
+ major = stuff->major_version;
+ minor = stuff->minor_version;
+ }
+ else {
+ major = XIVersion.major_version;
+ minor = XIVersion.minor_version;
+ }
+
+ pXIClient->major_version = major;
+ pXIClient->minor_version = minor;
}
- else {
- major = XIVersion.major_version;
- minor = XIVersion.minor_version;
- }
-
- pXIClient->major_version = major;
- pXIClient->minor_version = minor;
- memset(&rep, 0, sizeof(xXIQueryVersionReply));
- rep.repType = X_Reply;
- rep.RepType = X_XIQueryVersion;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.major_version = major;
- rep.minor_version = minor;
+ rep = (xXIQueryVersionReply) {
+ .repType = X_Reply,
+ .RepType = X_XIQueryVersion,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .major_version = major,
+ .minor_version = minor
+ };
WriteReplyToClient(client, sizeof(xXIQueryVersionReply), &rep);
@@ -116,5 +127,5 @@ SRepXIQueryVersion(ClientPtr client, int size, xXIQueryVersionReply * rep)
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
- WriteToClient(client, size, (char *) rep);
+ WriteToClient(client, size, rep);
}
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 43a67c8..0e45cb8 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -175,17 +175,17 @@ ProcXISelectEvents(ClientPtr client)
if (inputMasks)
iclient = inputMasks->inputClients;
for (; iclient; iclient = iclient->next) {
- DeviceIntPtr dummy;
+ DeviceIntPtr tmp;
if (CLIENT_ID(iclient->resource) == client->index)
continue;
- dixLookupDevice(&dummy, evmask->deviceid, serverClient,
+ dixLookupDevice(&tmp, evmask->deviceid, serverClient,
DixReadAccess);
- if (!dummy)
+ if (!tmp)
return BadImplementation; /* this shouldn't happen */
- if (xi2mask_isset(iclient->xi2mask, dummy, XI_TouchBegin))
+ if (xi2mask_isset(iclient->xi2mask, tmp, XI_TouchBegin))
return BadAccess;
}
}
@@ -260,11 +260,13 @@ ProcXIGetSelectedEvents(ClientPtr client)
if (rc != Success)
return rc;
- reply.repType = X_Reply;
- reply.RepType = X_XIGetSelectedEvents;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.num_masks = 0;
+ reply = (xXIGetSelectedEventsReply) {
+ .repType = X_Reply,
+ .RepType = X_XIGetSelectedEvents,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .num_masks = 0
+ };
masks = wOtherInputMasks(win);
if (masks) {
@@ -335,5 +337,5 @@ SRepXIGetSelectedEvents(ClientPtr client,
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_masks);
- WriteToClient(client, len, (char *) rep);
+ WriteToClient(client, len, rep);
}
diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c
index b52c9cc..372ec24 100644
--- a/Xi/xisetdevfocus.c
+++ b/Xi/xisetdevfocus.c
@@ -97,10 +97,12 @@ ProcXIGetFocus(ClientPtr client)
if (!dev->focus)
return BadDevice;
- rep.repType = X_Reply;
- rep.RepType = X_XIGetFocus;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xXIGetFocusReply) {
+ .repType = X_Reply,
+ .RepType = X_XIGetFocus,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
if (dev->focus->win == NoneWin)
rep.focus = None;
@@ -121,5 +123,5 @@ SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply * rep)
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->focus);
- WriteToClient(client, len, (char *) rep);
+ WriteToClient(client, len, rep);
}