aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-22 15:20:09 +0200
committermarha <marha@users.sourceforge.net>2011-09-22 15:20:09 +0200
commitc1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (patch)
tree8874978d314129a4f47ee575b076c2d8eb1a8738 /xorg-server/Xi
parent37466741e35c5eb3b204863a5023bf8d192efc06 (diff)
downloadvcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.tar.gz
vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.tar.bz2
vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.zip
libxtrans libX11 libX11 libXext mesa xserver git update 22 sep 2011
Diffstat (limited to 'xorg-server/Xi')
-rw-r--r--xorg-server/Xi/allowev.c6
-rw-r--r--xorg-server/Xi/chgdctl.c15
-rw-r--r--xorg-server/Xi/chgfctl.c52
-rw-r--r--xorg-server/Xi/chgkbd.c4
-rw-r--r--xorg-server/Xi/chgkmap.c3
-rw-r--r--xorg-server/Xi/chgprop.c8
-rw-r--r--xorg-server/Xi/chgptr.c4
-rw-r--r--xorg-server/Xi/closedev.c330
-rw-r--r--xorg-server/Xi/devbell.c4
-rw-r--r--xorg-server/Xi/extinit.c238
-rw-r--r--xorg-server/Xi/getbmap.c10
-rw-r--r--xorg-server/Xi/getdctl.c33
-rw-r--r--xorg-server/Xi/getfctl.c722
-rw-r--r--xorg-server/Xi/getfocus.c14
-rw-r--r--xorg-server/Xi/getkmap.c312
-rw-r--r--xorg-server/Xi/getmmap.c270
-rw-r--r--xorg-server/Xi/getprop.c14
-rw-r--r--xorg-server/Xi/getselev.c16
-rw-r--r--xorg-server/Xi/getvers.c16
-rw-r--r--xorg-server/Xi/grabdev.c16
-rw-r--r--xorg-server/Xi/grabdevb.c10
-rw-r--r--xorg-server/Xi/grabdevk.c10
-rw-r--r--xorg-server/Xi/gtmotion.c348
-rw-r--r--xorg-server/Xi/listdev.c856
-rw-r--r--xorg-server/Xi/opendev.c344
-rw-r--r--xorg-server/Xi/queryst.c379
-rw-r--r--xorg-server/Xi/selectev.c8
-rw-r--r--xorg-server/Xi/sendexev.c311
-rw-r--r--xorg-server/Xi/setbmap.c10
-rw-r--r--xorg-server/Xi/setdval.c10
-rw-r--r--xorg-server/Xi/setfocus.c8
-rw-r--r--xorg-server/Xi/setmmap.c10
-rw-r--r--xorg-server/Xi/setmode.c288
-rw-r--r--xorg-server/Xi/ungrdev.c6
-rw-r--r--xorg-server/Xi/ungrdevb.c8
-rw-r--r--xorg-server/Xi/ungrdevk.c8
-rw-r--r--xorg-server/Xi/xiallowev.c8
-rw-r--r--xorg-server/Xi/xichangecursor.c224
-rw-r--r--xorg-server/Xi/xichangehierarchy.c11
-rw-r--r--xorg-server/Xi/xigetclientpointer.c12
-rw-r--r--xorg-server/Xi/xigrabdev.c316
-rw-r--r--xorg-server/Xi/xipassivegrab.c47
-rw-r--r--xorg-server/Xi/xiproperty.c2710
-rw-r--r--xorg-server/Xi/xiquerydevice.c66
-rw-r--r--xorg-server/Xi/xiquerypointer.c28
-rw-r--r--xorg-server/Xi/xiqueryversion.c17
-rw-r--r--xorg-server/Xi/xiselectev.c614
-rw-r--r--xorg-server/Xi/xisetclientpointer.c8
-rw-r--r--xorg-server/Xi/xisetdevfocus.c23
-rw-r--r--xorg-server/Xi/xiwarppointer.c22
50 files changed, 4294 insertions, 4513 deletions
diff --git a/xorg-server/Xi/allowev.c b/xorg-server/Xi/allowev.c
index 96f3b543c..ff9e667b0 100644
--- a/xorg-server/Xi/allowev.c
+++ b/xorg-server/Xi/allowev.c
@@ -72,12 +72,10 @@ SOFTWARE.
int
SProcXAllowDeviceEvents(ClientPtr client)
{
- char n;
-
REQUEST(xAllowDeviceEventsReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
- swapl(&stuff->time, n);
+ swapl(&stuff->time);
return (ProcXAllowDeviceEvents(client));
}
diff --git a/xorg-server/Xi/chgdctl.c b/xorg-server/Xi/chgdctl.c
index 4c4aebac6..ca697d9d8 100644
--- a/xorg-server/Xi/chgdctl.c
+++ b/xorg-server/Xi/chgdctl.c
@@ -74,16 +74,15 @@ SOFTWARE.
int
SProcXChangeDeviceControl(ClientPtr client)
{
- char n;
xDeviceCtl *ctl;
REQUEST(xChangeDeviceControlReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
- swaps(&stuff->control, n);
+ swaps(&stuff->control);
ctl = (xDeviceCtl*)&stuff[1];
- swaps(&ctl->control, n);
- swaps(&ctl->length, n);
+ swaps(&ctl->control);
+ swaps(&ctl->length);
switch(stuff->control) {
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
@@ -230,9 +229,7 @@ void
SRepXChangeDeviceControl(ClientPtr client, int size,
xChangeDeviceControlReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/chgfctl.c b/xorg-server/Xi/chgfctl.c
index 9189702c1..f818cd0ce 100644
--- a/xorg-server/Xi/chgfctl.c
+++ b/xorg-server/Xi/chgfctl.c
@@ -74,12 +74,10 @@ SOFTWARE.
int
SProcXChangeFeedbackControl(ClientPtr client)
{
- char n;
-
REQUEST(xChangeFeedbackControlReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
- swapl(&stuff->mask, n);
+ swapl(&stuff->mask);
return (ProcXChangeFeedbackControl(client));
}
@@ -93,17 +91,16 @@ static int
ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
KbdFeedbackPtr k, xKbdFeedbackCtl * f)
{
- char n;
KeybdCtrl kctrl;
int t;
int key = DO_ALL;
if (client->swapped) {
- swaps(&f->length, n);
- swaps(&f->pitch, n);
- swaps(&f->duration, n);
- swapl(&f->led_mask, n);
- swapl(&f->led_values, n);
+ swaps(&f->length);
+ swaps(&f->pitch);
+ swaps(&f->duration);
+ swapl(&f->led_mask);
+ swapl(&f->led_values);
}
kctrl = k->ctrl;
@@ -210,14 +207,13 @@ static int
ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
PtrFeedbackPtr p, xPtrFeedbackCtl * f)
{
- char n;
PtrCtrl pctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length, n);
- swaps(&f->num, n);
- swaps(&f->denom, n);
- swaps(&f->thresh, n);
+ swaps(&f->length);
+ swaps(&f->num);
+ swaps(&f->denom);
+ swaps(&f->thresh);
}
pctrl = p->ctrl;
@@ -276,11 +272,9 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, IntegerFeedbackPtr i,
xIntegerFeedbackCtl * f)
{
- char n;
-
if (client->swapped) {
- swaps(&f->length, n);
- swapl(&f->int_to_display, n);
+ swaps(&f->length);
+ swapl(&f->int_to_display);
}
i->ctrl.integer_displayed = f->int_to_display;
@@ -299,13 +293,12 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, StringFeedbackPtr s,
xStringFeedbackCtl * f)
{
- char n;
int i, j;
KeySym *syms, *sup_syms;
syms = (KeySym *) (f + 1);
if (client->swapped) {
- swaps(&f->length, n); /* swapped num_keysyms in calling proc */
+ swaps(&f->length); /* swapped num_keysyms in calling proc */
SwapLongs((CARD32 *) syms, f->num_keysyms);
}
@@ -339,14 +332,13 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, BellFeedbackPtr b,
xBellFeedbackCtl * f)
{
- char n;
int t;
BellCtrl bctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length, n);
- swaps(&f->pitch, n);
- swaps(&f->duration, n);
+ swaps(&f->length);
+ swaps(&f->pitch);
+ swaps(&f->duration);
}
bctrl = b->ctrl;
@@ -397,13 +389,12 @@ static int
ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
LedFeedbackPtr l, xLedFeedbackCtl * f)
{
- char n;
LedCtrl lctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length, n);
- swapl(&f->led_values, n);
- swapl(&f->led_mask, n);
+ swaps(&f->length);
+ swapl(&f->led_values);
+ swapl(&f->led_mask);
}
f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
@@ -467,11 +458,10 @@ ProcXChangeFeedbackControl(ClientPtr client)
break;
case StringFeedbackClass:
{
- char n;
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
if (client->swapped) {
- swaps(&f->num_keysyms, n);
+ swaps(&f->num_keysyms);
}
if (len != (bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
return BadLength;
diff --git a/xorg-server/Xi/chgkbd.c b/xorg-server/Xi/chgkbd.c
index f9fd09902..d8139193f 100644
--- a/xorg-server/Xi/chgkbd.c
+++ b/xorg-server/Xi/chgkbd.c
@@ -75,10 +75,8 @@ SOFTWARE.
int
SProcXChangeKeyboardDevice(ClientPtr client)
{
- char n;
-
REQUEST(xChangeKeyboardDeviceReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
return (ProcXChangeKeyboardDevice(client));
}
diff --git a/xorg-server/Xi/chgkmap.c b/xorg-server/Xi/chgkmap.c
index e4b9e154c..32caa2d02 100644
--- a/xorg-server/Xi/chgkmap.c
+++ b/xorg-server/Xi/chgkmap.c
@@ -72,11 +72,10 @@ SOFTWARE.
int
SProcXChangeDeviceKeyMapping(ClientPtr client)
{
- char n;
unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
diff --git a/xorg-server/Xi/chgprop.c b/xorg-server/Xi/chgprop.c
index d24a24638..a9f833c25 100644
--- a/xorg-server/Xi/chgprop.c
+++ b/xorg-server/Xi/chgprop.c
@@ -74,13 +74,11 @@ SOFTWARE.
int
SProcXChangeDeviceDontPropagateList(ClientPtr client)
{
- char n;
-
REQUEST(xChangeDeviceDontPropagateListReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
- swapl(&stuff->window, n);
- swaps(&stuff->count, n);
+ swapl(&stuff->window);
+ swaps(&stuff->count);
REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
diff --git a/xorg-server/Xi/chgptr.c b/xorg-server/Xi/chgptr.c
index 6a4fbc342..ee04ab662 100644
--- a/xorg-server/Xi/chgptr.c
+++ b/xorg-server/Xi/chgptr.c
@@ -77,10 +77,8 @@ SOFTWARE.
int
SProcXChangePointerDevice(ClientPtr client)
{
- char n;
-
REQUEST(xChangePointerDeviceReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
return (ProcXChangePointerDevice(client));
}
diff --git a/xorg-server/Xi/closedev.c b/xorg-server/Xi/closedev.c
index 60f5aebe5..54ada55f5 100644
--- a/xorg-server/Xi/closedev.c
+++ b/xorg-server/Xi/closedev.c
@@ -1,166 +1,164 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/***********************************************************************
- *
- * Extension function to close an extension input device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include "scrnintstr.h" /* screen structure */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "XIstubs.h"
-#include "exglobals.h"
-
-#include "closedev.h"
-
-/***********************************************************************
- *
- * This procedure closes an input device.
- *
- */
-
-int
-SProcXCloseDevice(ClientPtr client)
-{
- char n;
-
- REQUEST(xCloseDeviceReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xCloseDeviceReq);
- return (ProcXCloseDevice(client));
-}
-
-/***********************************************************************
- *
- * Clear out event selections and passive grabs from a window for the
- * specified device.
- *
- */
-
-static void
-DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
-{
- InputClientsPtr others;
- OtherInputMasks *pOthers;
- GrabPtr grab, next;
-
- if ((pOthers = wOtherInputMasks(pWin)) != 0)
- for (others = pOthers->inputClients; others; others = others->next)
- if (SameClient(others, client))
- others->mask[dev->id] = NoEventMask;
-
- for (grab = wPassiveGrabs(pWin); grab; grab = next) {
- next = grab->next;
- if ((grab->device == dev) &&
- (client->clientAsMask == CLIENT_BITS(grab->resource)))
- FreeResource(grab->resource, RT_NONE);
- }
-}
-
-/***********************************************************************
- *
- * Walk througth the window tree, deleting event selections for this client
- * from this device from all windows.
- *
- */
-
-static void
-DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client)
-{
- WindowPtr p2;
-
- while (p1) {
- p2 = p1->firstChild;
- DeleteDeviceEvents(dev, p1, client);
- DeleteEventsFromChildren(dev, p2, client);
- p1 = p1->nextSib;
- }
-}
-
-/***********************************************************************
- *
- * This procedure closes an input device.
- *
- */
-
-int
-ProcXCloseDevice(ClientPtr client)
-{
- int rc, i;
- WindowPtr pWin, p1;
- DeviceIntPtr d;
-
- REQUEST(xCloseDeviceReq);
- REQUEST_SIZE_MATCH(xCloseDeviceReq);
-
- rc = dixLookupDevice(&d, stuff->deviceid, client, DixUseAccess);
- if (rc != Success)
- return rc;
-
- if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client))
- (*d->deviceGrab.DeactivateGrab) (d); /* release active grab */
-
- /* Remove event selections from all windows for events from this device
- * and selected by this client.
- * Delete passive grabs from all windows for this device. */
-
- for (i = 0; i < screenInfo.numScreens; i++) {
- pWin = screenInfo.screens[i]->root;
- DeleteDeviceEvents(d, pWin, client);
- p1 = pWin->firstChild;
- DeleteEventsFromChildren(d, p1, client);
- }
-
- return Success;
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * Extension function to close an extension input device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+#include "exglobals.h"
+
+#include "closedev.h"
+
+/***********************************************************************
+ *
+ * This procedure closes an input device.
+ *
+ */
+
+int
+SProcXCloseDevice(ClientPtr client)
+{
+ REQUEST(xCloseDeviceReq);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xCloseDeviceReq);
+ return (ProcXCloseDevice(client));
+}
+
+/***********************************************************************
+ *
+ * Clear out event selections and passive grabs from a window for the
+ * specified device.
+ *
+ */
+
+static void
+DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
+{
+ InputClientsPtr others;
+ OtherInputMasks *pOthers;
+ GrabPtr grab, next;
+
+ if ((pOthers = wOtherInputMasks(pWin)) != 0)
+ for (others = pOthers->inputClients; others; others = others->next)
+ if (SameClient(others, client))
+ others->mask[dev->id] = NoEventMask;
+
+ for (grab = wPassiveGrabs(pWin); grab; grab = next) {
+ next = grab->next;
+ if ((grab->device == dev) &&
+ (client->clientAsMask == CLIENT_BITS(grab->resource)))
+ FreeResource(grab->resource, RT_NONE);
+ }
+}
+
+/***********************************************************************
+ *
+ * Walk througth the window tree, deleting event selections for this client
+ * from this device from all windows.
+ *
+ */
+
+static void
+DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client)
+{
+ WindowPtr p2;
+
+ while (p1) {
+ p2 = p1->firstChild;
+ DeleteDeviceEvents(dev, p1, client);
+ DeleteEventsFromChildren(dev, p2, client);
+ p1 = p1->nextSib;
+ }
+}
+
+/***********************************************************************
+ *
+ * This procedure closes an input device.
+ *
+ */
+
+int
+ProcXCloseDevice(ClientPtr client)
+{
+ int rc, i;
+ WindowPtr pWin, p1;
+ DeviceIntPtr d;
+
+ REQUEST(xCloseDeviceReq);
+ REQUEST_SIZE_MATCH(xCloseDeviceReq);
+
+ rc = dixLookupDevice(&d, stuff->deviceid, client, DixUseAccess);
+ if (rc != Success)
+ return rc;
+
+ if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client))
+ (*d->deviceGrab.DeactivateGrab) (d); /* release active grab */
+
+ /* Remove event selections from all windows for events from this device
+ * and selected by this client.
+ * Delete passive grabs from all windows for this device. */
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pWin = screenInfo.screens[i]->root;
+ DeleteDeviceEvents(d, pWin, client);
+ p1 = pWin->firstChild;
+ DeleteEventsFromChildren(d, p1, client);
+ }
+
+ return Success;
+}
diff --git a/xorg-server/Xi/devbell.c b/xorg-server/Xi/devbell.c
index 539da1814..881524260 100644
--- a/xorg-server/Xi/devbell.c
+++ b/xorg-server/Xi/devbell.c
@@ -71,10 +71,8 @@ SOFTWARE.
int
SProcXDeviceBell(ClientPtr client)
{
- char n;
-
REQUEST(xDeviceBellReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return (ProcXDeviceBell(client));
}
diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c
index 0905e1877..7724f5f5a 100644
--- a/xorg-server/Xi/extinit.c
+++ b/xorg-server/Xi/extinit.c
@@ -533,43 +533,39 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
static void
SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
{
- char n;
int i;
INT32 *ip B32;
*to = *from;
- swaps(&to->sequenceNumber, n);
- swaps(&to->device_state, n);
+ swaps(&to->sequenceNumber);
+ swaps(&to->device_state);
ip = &to->valuator0;
for (i = 0; i < 6; i++) {
- swapl((ip + i), n); /* macro - braces are required */
+ swapl(ip + i);
}
}
static void
SEventFocus(deviceFocus * from, deviceFocus * to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
- swapl(&to->window, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->time);
+ swapl(&to->window);
}
static void
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
{
int i;
- char n;
INT32 *ip B32;
*to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->time);
ip = &to->valuator0;
for (i = 0; i < 3; i++) {
- swapl((ip + i), n); /* macro - braces are required */
+ swapl(ip + i);
}
}
@@ -577,93 +573,78 @@ static void
SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
deviceKeyStateNotify * to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber, n);
+ swaps(&to->sequenceNumber);
}
static void
SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
deviceButtonStateNotify * to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber, n);
+ swaps(&to->sequenceNumber);
}
static void
SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->time);
}
static void
SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->time, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->time);
}
static void
SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->time, n);
- swaps(&to->control, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->time);
+ swaps(&to->control);
}
static void
SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->time, n);
- swapl(&to->atom, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->time);
+ swapl(&to->atom);
}
static void
SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber,n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->root, n);
- swapl(&to->event, n);
- swapl(&to->child, n);
- swapl(&to->root_x, n);
- swapl(&to->root_y, n);
- swapl(&to->event_x, n);
- swapl(&to->event_y, n);
- swaps(&to->sourceid, n);
- swaps(&to->buttons_len, n);
- swapl(&to->mods.base_mods, n);
- swapl(&to->mods.latched_mods, n);
- swapl(&to->mods.locked_mods, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->length);
+ swaps(&to->evtype);
+ swaps(&to->deviceid);
+ swapl(&to->time);
+ swapl(&to->root);
+ swapl(&to->event);
+ swapl(&to->child);
+ swapl(&to->root_x);
+ swapl(&to->root_y);
+ swapl(&to->event_x);
+ swapl(&to->event_y);
+ swaps(&to->sourceid);
+ swaps(&to->buttons_len);
+ swapl(&to->mods.base_mods);
+ swapl(&to->mods.latched_mods);
+ swapl(&to->mods.locked_mods);
}
static void
SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
{
- char n;
int i, j;
xXIAnyInfo *any;
@@ -682,8 +663,8 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
xXIKeyInfo *ki = (xXIKeyInfo*)any;
uint32_t *key = (uint32_t*)&ki[1];
for (j = 0; j < ki->num_keycodes; j++, key++)
- swapl(key, n);
- swaps(&ki->num_keycodes, n);
+ swapl(key);
+ swaps(&ki->num_keycodes);
}
break;
case ButtonClass:
@@ -692,71 +673,70 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +
pad_to_int32(bits_to_bytes(bi->num_buttons)));
for (j = 0; j < bi->num_buttons; j++)
- swapl(&labels[j], n);
- swaps(&bi->num_buttons, n);
+ swapl(&labels[j]);
+ swaps(&bi->num_buttons);
}
break;
case ValuatorClass:
{
xXIValuatorInfo* ai = (xXIValuatorInfo*)any;
- swapl(&ai->label, n);
- swapl(&ai->min.integral, n);
- swapl(&ai->min.frac, n);
- swapl(&ai->max.integral, n);
- swapl(&ai->max.frac, n);
- swapl(&ai->resolution, n);
- swaps(&ai->number, n);
+ swapl(&ai->label);
+ swapl(&ai->min.integral);
+ swapl(&ai->min.frac);
+ swapl(&ai->max.integral);
+ swapl(&ai->max.frac);
+ swapl(&ai->resolution);
+ swaps(&ai->number);
}
break;
}
- swaps(&any->type, n);
- swaps(&any->length, n);
- swaps(&any->sourceid, n);
+ swaps(&any->type);
+ swaps(&any->length);
+ swaps(&any->sourceid);
any = (xXIAnyInfo*)((char*)any + length * 4);
}
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swaps(&to->num_classes, n);
- swaps(&to->sourceid, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->length);
+ swaps(&to->evtype);
+ swaps(&to->deviceid);
+ swapl(&to->time);
+ swaps(&to->num_classes);
+ swaps(&to->sourceid);
}
static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
{
int i;
- char n;
char *ptr;
char *vmask;
memcpy(to, from, sizeof(xEvent) + from->length * 4);
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->detail, n);
- swapl(&to->root, n);
- swapl(&to->event, n);
- swapl(&to->child, n);
- swapl(&to->root_x, n);
- swapl(&to->root_y, n);
- swapl(&to->event_x, n);
- swapl(&to->event_y, n);
- swaps(&to->buttons_len, n);
- swaps(&to->valuators_len, n);
- swaps(&to->sourceid, n);
- swapl(&to->mods.base_mods, n);
- swapl(&to->mods.latched_mods, n);
- swapl(&to->mods.locked_mods, n);
- swapl(&to->mods.effective_mods, n);
- swapl(&to->flags, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->length);
+ swaps(&to->evtype);
+ swaps(&to->deviceid);
+ swapl(&to->time);
+ swapl(&to->detail);
+ swapl(&to->root);
+ swapl(&to->event);
+ swapl(&to->child);
+ swapl(&to->root_x);
+ swapl(&to->root_y);
+ swapl(&to->event_x);
+ swapl(&to->event_y);
+ swaps(&to->buttons_len);
+ swaps(&to->valuators_len);
+ swaps(&to->sourceid);
+ swapl(&to->mods.base_mods);
+ swapl(&to->mods.latched_mods);
+ swapl(&to->mods.locked_mods);
+ swapl(&to->mods.effective_mods);
+ swapl(&to->flags);
ptr = (char*)(&to[1]);
ptr += from->buttons_len * 4;
@@ -766,9 +746,9 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
{
if (BitIsOn(vmask, i))
{
- swapl(((uint32_t*)ptr), n);
+ swapl(((uint32_t *)ptr));
ptr += 4;
- swapl(((uint32_t*)ptr), n);
+ swapl(((uint32_t *)ptr));
ptr += 4;
}
}
@@ -778,55 +758,51 @@ static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
xXIHierarchyEvent *to)
{
int i;
- char n;
xXIHierarchyInfo *info;
*to = *from;
memcpy(&to[1], &from[1], from->length * 4);
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->flags, n);
- swaps(&to->num_info, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->length);
+ swaps(&to->evtype);
+ swaps(&to->deviceid);
+ swapl(&to->time);
+ swapl(&to->flags);
+ swaps(&to->num_info);
info = (xXIHierarchyInfo*)&to[1];
for (i = 0; i< from->num_info; i++)
{
- swaps(&info->deviceid, n);
- swaps(&info->attachment, n);
+ swaps(&info->deviceid);
+ swaps(&info->attachment);
info++;
}
}
static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
{
- char n;
-
*to = *from;
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->property, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->length);
+ swaps(&to->evtype);
+ swaps(&to->deviceid);
+ swapl(&to->property);
}
static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
{
- char n;
int i;
FP3232 *values;
unsigned char *mask;
memcpy(to, from, sizeof(xEvent) + from->length * 4);
- swaps(&to->sequenceNumber, n);
- swapl(&to->length, n);
- swaps(&to->evtype, n);
- swaps(&to->deviceid, n);
- swapl(&to->time, n);
- swapl(&to->detail, n);
+ swaps(&to->sequenceNumber);
+ swapl(&to->length);
+ swaps(&to->evtype);
+ swaps(&to->deviceid);
+ swapl(&to->time);
+ swapl(&to->detail);
mask = (unsigned char*)&to[1];
@@ -841,16 +817,16 @@ static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
* they were in aAbBcC order because it's easier and really
* doesn't matter.
*/
- swapl(&values->integral, n);
- swapl(&values->frac, n);
+ swapl(&values->integral);
+ swapl(&values->frac);
values++;
- swapl(&values->integral, n);
- swapl(&values->frac, n);
+ swapl(&values->integral);
+ swapl(&values->frac);
values++;
}
}
- swaps(&to->valuators_len, n);
+ swaps(&to->valuators_len);
}
diff --git a/xorg-server/Xi/getbmap.c b/xorg-server/Xi/getbmap.c
index e2d58972a..b7054f7d2 100644
--- a/xorg-server/Xi/getbmap.c
+++ b/xorg-server/Xi/getbmap.c
@@ -70,10 +70,8 @@ SOFTWARE.
int
SProcXGetDeviceButtonMapping(ClientPtr client)
{
- char n;
-
REQUEST(xGetDeviceButtonMappingReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return (ProcXGetDeviceButtonMapping(client));
}
@@ -126,9 +124,7 @@ void
SRepXGetDeviceButtonMapping(ClientPtr client, int size,
xGetDeviceButtonMappingReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/getdctl.c b/xorg-server/Xi/getdctl.c
index 4e04b8b06..6090b814a 100644
--- a/xorg-server/Xi/getdctl.c
+++ b/xorg-server/Xi/getdctl.c
@@ -71,12 +71,10 @@ SOFTWARE.
int
SProcXGetDeviceControl(ClientPtr client)
{
- char n;
-
REQUEST(xGetDeviceControlReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
- swaps(&stuff->control, n);
+ swaps(&stuff->control);
return (ProcXGetDeviceControl(client));
}
@@ -90,7 +88,6 @@ static void
CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
int length)
{
- char n;
AxisInfoPtr a;
xDeviceResolutionState *r;
int i, *iptr;
@@ -108,19 +105,18 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->max_resolution;
if (client->swapped) {
- swaps(&r->control, n);
- swaps(&r->length, n);
- swapl(&r->num_valuators, n);
+ swaps(&r->control);
+ swaps(&r->length);
+ swapl(&r->num_valuators);
iptr = (int *)buf;
for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
- swapl(iptr, n);
+ swapl(iptr);
}
}
}
static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
{
- char n;
xDeviceCoreState *c = (xDeviceCoreState *) buf;
c->control = DEVICE_CORE;
@@ -129,15 +125,13 @@ static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
if (client->swapped) {
- swaps(&c->control, n);
- swaps(&c->length, n);
- swaps(&c->status, n);
+ swaps(&c->control);
+ swaps(&c->length);
}
}
static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
{
- char n;
xDeviceEnableState *e = (xDeviceEnableState *) buf;
e->control = DEVICE_ENABLE;
@@ -145,9 +139,8 @@ static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
e->enable = dev->enabled;
if (client->swapped) {
- swaps(&e->control, n);
- swaps(&e->length, n);
- swaps(&e->enable, n);
+ swaps(&e->control);
+ swaps(&e->length);
}
}
@@ -161,10 +154,8 @@ static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
void
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/getfctl.c b/xorg-server/Xi/getfctl.c
index 99b94158c..ea80a879d 100644
--- a/xorg-server/Xi/getfctl.c
+++ b/xorg-server/Xi/getfctl.c
@@ -1,366 +1,356 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/********************************************************************
- *
- * Get feedback control attributes for an extension device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "exglobals.h"
-
-#include "getfctl.h"
-
-/***********************************************************************
- *
- * This procedure gets the control attributes for an extension device,
- * for clients on machines with a different byte ordering than the server.
- *
- */
-
-int
-SProcXGetFeedbackControl(ClientPtr client)
-{
- char n;
-
- REQUEST(xGetFeedbackControlReq);
- swaps(&stuff->length, n);
- return (ProcXGetFeedbackControl(client));
-}
-
-/***********************************************************************
- *
- * This procedure copies KbdFeedbackClass data, swapping if necessary.
- *
- */
-
-static void
-CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
-{
- int i;
- char n;
- xKbdFeedbackState *k2;
-
- k2 = (xKbdFeedbackState *) * buf;
- k2->class = KbdFeedbackClass;
- k2->length = sizeof(xKbdFeedbackState);
- k2->id = k->ctrl.id;
- k2->click = k->ctrl.click;
- k2->percent = k->ctrl.bell;
- k2->pitch = k->ctrl.bell_pitch;
- k2->duration = k->ctrl.bell_duration;
- k2->led_mask = k->ctrl.leds;
- k2->global_auto_repeat = k->ctrl.autoRepeat;
- for (i = 0; i < 32; i++)
- k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
- if (client->swapped) {
- swaps(&k2->length, n);
- swaps(&k2->pitch, n);
- swaps(&k2->duration, n);
- swapl(&k2->led_mask, n);
- swapl(&k2->led_values, n);
- }
- *buf += sizeof(xKbdFeedbackState);
-}
-
-/***********************************************************************
- *
- * This procedure copies PtrFeedbackClass data, swapping if necessary.
- *
- */
-
-static void
-CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
-{
- char n;
- xPtrFeedbackState *p2;
-
- p2 = (xPtrFeedbackState *) * buf;
- p2->class = PtrFeedbackClass;
- p2->length = sizeof(xPtrFeedbackState);
- p2->id = p->ctrl.id;
- p2->accelNum = p->ctrl.num;
- p2->accelDenom = p->ctrl.den;
- p2->threshold = p->ctrl.threshold;
- if (client->swapped) {
- swaps(&p2->length, n);
- swaps(&p2->accelNum, n);
- swaps(&p2->accelDenom, n);
- swaps(&p2->threshold, n);
- }
- *buf += sizeof(xPtrFeedbackState);
-}
-
-/***********************************************************************
- *
- * This procedure copies IntegerFeedbackClass data, swapping if necessary.
- *
- */
-
-static void
-CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
-{
- char n;
- xIntegerFeedbackState *i2;
-
- i2 = (xIntegerFeedbackState *) * buf;
- i2->class = IntegerFeedbackClass;
- i2->length = sizeof(xIntegerFeedbackState);
- i2->id = i->ctrl.id;
- i2->resolution = i->ctrl.resolution;
- i2->min_value = i->ctrl.min_value;
- i2->max_value = i->ctrl.max_value;
- if (client->swapped) {
- swaps(&i2->length, n);
- swapl(&i2->resolution, n);
- swapl(&i2->min_value, n);
- swapl(&i2->max_value, n);
- }
- *buf += sizeof(xIntegerFeedbackState);
-}
-
-/***********************************************************************
- *
- * This procedure copies StringFeedbackClass data, swapping if necessary.
- *
- */
-
-static void
-CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
-{
- int i;
- char n;
- xStringFeedbackState *s2;
- KeySym *kptr;
-
- s2 = (xStringFeedbackState *) * buf;
- s2->class = StringFeedbackClass;
- s2->length = sizeof(xStringFeedbackState) +
- s->ctrl.num_symbols_supported * sizeof(KeySym);
- s2->id = s->ctrl.id;
- s2->max_symbols = s->ctrl.max_symbols;
- s2->num_syms_supported = s->ctrl.num_symbols_supported;
- *buf += sizeof(xStringFeedbackState);
- kptr = (KeySym *) (*buf);
- for (i = 0; i < s->ctrl.num_symbols_supported; i++)
- *kptr++ = *(s->ctrl.symbols_supported + i);
- if (client->swapped) {
- swaps(&s2->length, n);
- swaps(&s2->max_symbols, n);
- swaps(&s2->num_syms_supported, n);
- kptr = (KeySym *) (*buf);
- for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
- swapl(kptr, n);
- }
- }
- *buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
-}
-
-/***********************************************************************
- *
- * This procedure copies LedFeedbackClass data, swapping if necessary.
- *
- */
-
-static void
-CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
-{
- char n;
- xLedFeedbackState *l2;
-
- l2 = (xLedFeedbackState *) * buf;
- l2->class = LedFeedbackClass;
- l2->length = sizeof(xLedFeedbackState);
- l2->id = l->ctrl.id;
- l2->led_values = l->ctrl.led_values;
- l2->led_mask = l->ctrl.led_mask;
- if (client->swapped) {
- swaps(&l2->length, n);
- swapl(&l2->led_values, n);
- swapl(&l2->led_mask, n);
- }
- *buf += sizeof(xLedFeedbackState);
-}
-
-/***********************************************************************
- *
- * This procedure copies BellFeedbackClass data, swapping if necessary.
- *
- */
-
-static void
-CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
-{
- char n;
- xBellFeedbackState *b2;
-
- b2 = (xBellFeedbackState *) * buf;
- b2->class = BellFeedbackClass;
- b2->length = sizeof(xBellFeedbackState);
- b2->id = b->ctrl.id;
- b2->percent = b->ctrl.percent;
- b2->pitch = b->ctrl.pitch;
- b2->duration = b->ctrl.duration;
- if (client->swapped) {
- swaps(&b2->length, n);
- swaps(&b2->pitch, n);
- swaps(&b2->duration, n);
- }
- *buf += sizeof(xBellFeedbackState);
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the xGetFeedbackControl function,
- * if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXGetFeedbackControl(ClientPtr client, int size,
- xGetFeedbackControlReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->num_feedbacks, n);
- WriteToClient(client, size, (char *)rep);
-}
-
-/***********************************************************************
- *
- * Get the feedback control state.
- *
- */
-
-int
-ProcXGetFeedbackControl(ClientPtr client)
-{
- int rc, total_length = 0;
- char *buf, *savbuf;
- DeviceIntPtr dev;
- KbdFeedbackPtr k;
- PtrFeedbackPtr p;
- IntegerFeedbackPtr i;
- StringFeedbackPtr s;
- BellFeedbackPtr b;
- LedFeedbackPtr l;
- xGetFeedbackControlReply rep;
-
- REQUEST(xGetFeedbackControlReq);
- REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
-
- rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- rep.repType = X_Reply;
- rep.RepType = X_GetFeedbackControl;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.num_feedbacks = 0;
-
- for (k = dev->kbdfeed; k; k = k->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xKbdFeedbackState);
- }
- for (p = dev->ptrfeed; p; p = p->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xPtrFeedbackState);
- }
- for (s = dev->stringfeed; s; s = s->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xStringFeedbackState) +
- (s->ctrl.num_symbols_supported * sizeof(KeySym));
- }
- for (i = dev->intfeed; i; i = i->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xIntegerFeedbackState);
- }
- for (l = dev->leds; l; l = l->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xLedFeedbackState);
- }
- for (b = dev->bell; b; b = b->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xBellFeedbackState);
- }
-
- if (total_length == 0)
- return BadMatch;
-
- buf = (char *)malloc(total_length);
- if (!buf)
- return BadAlloc;
- savbuf = buf;
-
- for (k = dev->kbdfeed; k; k = k->next)
- CopySwapKbdFeedback(client, k, &buf);
- for (p = dev->ptrfeed; p; p = p->next)
- CopySwapPtrFeedback(client, p, &buf);
- for (s = dev->stringfeed; s; s = s->next)
- CopySwapStringFeedback(client, s, &buf);
- for (i = dev->intfeed; i; i = i->next)
- CopySwapIntegerFeedback(client, i, &buf);
- for (l = dev->leds; l; l = l->next)
- CopySwapLedFeedback(client, l, &buf);
- for (b = dev->bell; b; b = b->next)
- CopySwapBellFeedback(client, b, &buf);
-
- rep.length = bytes_to_int32(total_length);
- WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
- WriteToClient(client, total_length, savbuf);
- free(savbuf);
- return Success;
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/********************************************************************
+ *
+ * Get feedback control attributes for an extension device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exglobals.h"
+
+#include "getfctl.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the control attributes for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXGetFeedbackControl(ClientPtr client)
+{
+ REQUEST(xGetFeedbackControlReq);
+ swaps(&stuff->length);
+ return (ProcXGetFeedbackControl(client));
+}
+
+/***********************************************************************
+ *
+ * This procedure copies KbdFeedbackClass data, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
+{
+ int i;
+ xKbdFeedbackState *k2;
+
+ k2 = (xKbdFeedbackState *) * buf;
+ k2->class = KbdFeedbackClass;
+ k2->length = sizeof(xKbdFeedbackState);
+ k2->id = k->ctrl.id;
+ k2->click = k->ctrl.click;
+ k2->percent = k->ctrl.bell;
+ k2->pitch = k->ctrl.bell_pitch;
+ k2->duration = k->ctrl.bell_duration;
+ k2->led_mask = k->ctrl.leds;
+ k2->global_auto_repeat = k->ctrl.autoRepeat;
+ for (i = 0; i < 32; i++)
+ k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
+ if (client->swapped) {
+ swaps(&k2->length);
+ swaps(&k2->pitch);
+ swaps(&k2->duration);
+ swapl(&k2->led_mask);
+ swapl(&k2->led_values);
+ }
+ *buf += sizeof(xKbdFeedbackState);
+}
+
+/***********************************************************************
+ *
+ * This procedure copies PtrFeedbackClass data, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
+{
+ xPtrFeedbackState *p2;
+
+ p2 = (xPtrFeedbackState *) * buf;
+ p2->class = PtrFeedbackClass;
+ p2->length = sizeof(xPtrFeedbackState);
+ p2->id = p->ctrl.id;
+ p2->accelNum = p->ctrl.num;
+ p2->accelDenom = p->ctrl.den;
+ p2->threshold = p->ctrl.threshold;
+ if (client->swapped) {
+ swaps(&p2->length);
+ swaps(&p2->accelNum);
+ swaps(&p2->accelDenom);
+ swaps(&p2->threshold);
+ }
+ *buf += sizeof(xPtrFeedbackState);
+}
+
+/***********************************************************************
+ *
+ * This procedure copies IntegerFeedbackClass data, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
+{
+ xIntegerFeedbackState *i2;
+
+ i2 = (xIntegerFeedbackState *) * buf;
+ i2->class = IntegerFeedbackClass;
+ i2->length = sizeof(xIntegerFeedbackState);
+ i2->id = i->ctrl.id;
+ i2->resolution = i->ctrl.resolution;
+ i2->min_value = i->ctrl.min_value;
+ i2->max_value = i->ctrl.max_value;
+ if (client->swapped) {
+ swaps(&i2->length);
+ swapl(&i2->resolution);
+ swapl(&i2->min_value);
+ swapl(&i2->max_value);
+ }
+ *buf += sizeof(xIntegerFeedbackState);
+}
+
+/***********************************************************************
+ *
+ * This procedure copies StringFeedbackClass data, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
+{
+ int i;
+ xStringFeedbackState *s2;
+ KeySym *kptr;
+
+ s2 = (xStringFeedbackState *) * buf;
+ s2->class = StringFeedbackClass;
+ s2->length = sizeof(xStringFeedbackState) +
+ s->ctrl.num_symbols_supported * sizeof(KeySym);
+ s2->id = s->ctrl.id;
+ s2->max_symbols = s->ctrl.max_symbols;
+ s2->num_syms_supported = s->ctrl.num_symbols_supported;
+ *buf += sizeof(xStringFeedbackState);
+ kptr = (KeySym *) (*buf);
+ for (i = 0; i < s->ctrl.num_symbols_supported; i++)
+ *kptr++ = *(s->ctrl.symbols_supported + i);
+ if (client->swapped) {
+ swaps(&s2->length);
+ swaps(&s2->max_symbols);
+ swaps(&s2->num_syms_supported);
+ kptr = (KeySym *) (*buf);
+ for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
+ swapl(kptr);
+ }
+ }
+ *buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
+}
+
+/***********************************************************************
+ *
+ * This procedure copies LedFeedbackClass data, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
+{
+ xLedFeedbackState *l2;
+
+ l2 = (xLedFeedbackState *) * buf;
+ l2->class = LedFeedbackClass;
+ l2->length = sizeof(xLedFeedbackState);
+ l2->id = l->ctrl.id;
+ l2->led_values = l->ctrl.led_values;
+ l2->led_mask = l->ctrl.led_mask;
+ if (client->swapped) {
+ swaps(&l2->length);
+ swapl(&l2->led_values);
+ swapl(&l2->led_mask);
+ }
+ *buf += sizeof(xLedFeedbackState);
+}
+
+/***********************************************************************
+ *
+ * This procedure copies BellFeedbackClass data, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
+{
+ xBellFeedbackState *b2;
+
+ b2 = (xBellFeedbackState *) * buf;
+ b2->class = BellFeedbackClass;
+ b2->length = sizeof(xBellFeedbackState);
+ b2->id = b->ctrl.id;
+ b2->percent = b->ctrl.percent;
+ b2->pitch = b->ctrl.pitch;
+ b2->duration = b->ctrl.duration;
+ if (client->swapped) {
+ swaps(&b2->length);
+ swaps(&b2->pitch);
+ swaps(&b2->duration);
+ }
+ *buf += sizeof(xBellFeedbackState);
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the xGetFeedbackControl function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetFeedbackControl(ClientPtr client, int size,
+ xGetFeedbackControlReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_feedbacks);
+ WriteToClient(client, size, (char *)rep);
+}
+
+/***********************************************************************
+ *
+ * Get the feedback control state.
+ *
+ */
+
+int
+ProcXGetFeedbackControl(ClientPtr client)
+{
+ int rc, total_length = 0;
+ char *buf, *savbuf;
+ DeviceIntPtr dev;
+ KbdFeedbackPtr k;
+ PtrFeedbackPtr p;
+ IntegerFeedbackPtr i;
+ StringFeedbackPtr s;
+ BellFeedbackPtr b;
+ LedFeedbackPtr l;
+ xGetFeedbackControlReply rep;
+
+ REQUEST(xGetFeedbackControlReq);
+ REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
+
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetFeedbackControl;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.num_feedbacks = 0;
+
+ for (k = dev->kbdfeed; k; k = k->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xKbdFeedbackState);
+ }
+ for (p = dev->ptrfeed; p; p = p->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xPtrFeedbackState);
+ }
+ for (s = dev->stringfeed; s; s = s->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xStringFeedbackState) +
+ (s->ctrl.num_symbols_supported * sizeof(KeySym));
+ }
+ for (i = dev->intfeed; i; i = i->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xIntegerFeedbackState);
+ }
+ for (l = dev->leds; l; l = l->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xLedFeedbackState);
+ }
+ for (b = dev->bell; b; b = b->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xBellFeedbackState);
+ }
+
+ if (total_length == 0)
+ return BadMatch;
+
+ buf = (char *)malloc(total_length);
+ if (!buf)
+ return BadAlloc;
+ savbuf = buf;
+
+ for (k = dev->kbdfeed; k; k = k->next)
+ CopySwapKbdFeedback(client, k, &buf);
+ for (p = dev->ptrfeed; p; p = p->next)
+ CopySwapPtrFeedback(client, p, &buf);
+ for (s = dev->stringfeed; s; s = s->next)
+ CopySwapStringFeedback(client, s, &buf);
+ for (i = dev->intfeed; i; i = i->next)
+ CopySwapIntegerFeedback(client, i, &buf);
+ for (l = dev->leds; l; l = l->next)
+ CopySwapLedFeedback(client, l, &buf);
+ for (b = dev->bell; b; b = b->next)
+ CopySwapBellFeedback(client, b, &buf);
+
+ rep.length = bytes_to_int32(total_length);
+ WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
+ WriteToClient(client, total_length, savbuf);
+ free(savbuf);
+ return Success;
+}
diff --git a/xorg-server/Xi/getfocus.c b/xorg-server/Xi/getfocus.c
index 69eadde87..676850df1 100644
--- a/xorg-server/Xi/getfocus.c
+++ b/xorg-server/Xi/getfocus.c
@@ -71,10 +71,8 @@ SOFTWARE.
int
SProcXGetDeviceFocus(ClientPtr client)
{
- char n;
-
REQUEST(xGetDeviceFocusReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return (ProcXGetDeviceFocus(client));
}
@@ -133,11 +131,9 @@ ProcXGetDeviceFocus(ClientPtr client)
void
SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->focus, n);
- swapl(&rep->time, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->focus);
+ swapl(&rep->time);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/getkmap.c b/xorg-server/Xi/getkmap.c
index 6672ed32c..2501ec05a 100644
--- a/xorg-server/Xi/getkmap.c
+++ b/xorg-server/Xi/getkmap.c
@@ -1,158 +1,154 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/********************************************************************
- *
- * Get the key mapping for an extension device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "exglobals.h"
-#include "swaprep.h"
-#include "xkbsrv.h"
-#include "xkbstr.h"
-
-#include "getkmap.h"
-
-/***********************************************************************
- *
- * This procedure gets the key mapping for an extension device,
- * for clients on machines with a different byte ordering than the server.
- *
- */
-
-int
-SProcXGetDeviceKeyMapping(ClientPtr client)
-{
- char n;
-
- REQUEST(xGetDeviceKeyMappingReq);
- swaps(&stuff->length, n);
- return (ProcXGetDeviceKeyMapping(client));
-}
-
-/***********************************************************************
- *
- * Get the device key mapping.
- *
- */
-
-int
-ProcXGetDeviceKeyMapping(ClientPtr client)
-{
- xGetDeviceKeyMappingReply rep;
- DeviceIntPtr dev;
- XkbDescPtr xkb;
- KeySymsPtr syms;
- int rc;
-
- REQUEST(xGetDeviceKeyMappingReq);
- REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
-
- rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
- if (dev->key == NULL)
- return BadMatch;
- xkb = dev->key->xkbInfo->desc;
-
- if (stuff->firstKeyCode < xkb->min_key_code ||
- stuff->firstKeyCode > xkb->max_key_code) {
- client->errorValue = stuff->firstKeyCode;
- return BadValue;
- }
-
- if (stuff->firstKeyCode + stuff->count > xkb->max_key_code + 1) {
- client->errorValue = stuff->count;
- return BadValue;
- }
-
- syms = XkbGetCoreMap(dev);
- 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 */
- WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
-
- client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
- WriteSwappedDataToClient(client,
- syms->mapWidth * stuff->count * sizeof(KeySym),
- &syms->map[syms->mapWidth * (stuff->firstKeyCode -
- syms->minKeyCode)]);
- free(syms->map);
- free(syms);
-
- return Success;
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XGetDeviceKeyMapping function,
- * if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXGetDeviceKeyMapping(ClientPtr client, int size,
- xGetDeviceKeyMappingReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/********************************************************************
+ *
+ * Get the key mapping for an extension device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exglobals.h"
+#include "swaprep.h"
+#include "xkbsrv.h"
+#include "xkbstr.h"
+
+#include "getkmap.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the key mapping for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXGetDeviceKeyMapping(ClientPtr client)
+{
+ REQUEST(xGetDeviceKeyMappingReq);
+ swaps(&stuff->length);
+ return (ProcXGetDeviceKeyMapping(client));
+}
+
+/***********************************************************************
+ *
+ * Get the device key mapping.
+ *
+ */
+
+int
+ProcXGetDeviceKeyMapping(ClientPtr client)
+{
+ xGetDeviceKeyMappingReply rep;
+ DeviceIntPtr dev;
+ XkbDescPtr xkb;
+ KeySymsPtr syms;
+ int rc;
+
+ REQUEST(xGetDeviceKeyMappingReq);
+ REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
+
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+ if (dev->key == NULL)
+ return BadMatch;
+ xkb = dev->key->xkbInfo->desc;
+
+ if (stuff->firstKeyCode < xkb->min_key_code ||
+ stuff->firstKeyCode > xkb->max_key_code) {
+ client->errorValue = stuff->firstKeyCode;
+ return BadValue;
+ }
+
+ if (stuff->firstKeyCode + stuff->count > xkb->max_key_code + 1) {
+ client->errorValue = stuff->count;
+ return BadValue;
+ }
+
+ syms = XkbGetCoreMap(dev);
+ 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 */
+ WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
+
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
+ WriteSwappedDataToClient(client,
+ syms->mapWidth * stuff->count * sizeof(KeySym),
+ &syms->map[syms->mapWidth * (stuff->firstKeyCode -
+ syms->minKeyCode)]);
+ free(syms->map);
+ free(syms);
+
+ return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetDeviceKeyMapping function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceKeyMapping(ClientPtr client, int size,
+ xGetDeviceKeyMappingReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ WriteToClient(client, size, (char *)rep);
+}
diff --git a/xorg-server/Xi/getmmap.c b/xorg-server/Xi/getmmap.c
index 96e9643fc..4eee00679 100644
--- a/xorg-server/Xi/getmmap.c
+++ b/xorg-server/Xi/getmmap.c
@@ -1,137 +1,133 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/********************************************************************
- *
- * Get the modifier mapping for an extension device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h> /* Request macro */
-#include "exglobals.h"
-
-#include "getmmap.h"
-
-/***********************************************************************
- *
- * This procedure gets the modifier mapping for an extension device,
- * for clients on machines with a different byte ordering than the server.
- *
- */
-
-int
-SProcXGetDeviceModifierMapping(ClientPtr client)
-{
- char n;
-
- REQUEST(xGetDeviceModifierMappingReq);
- swaps(&stuff->length, n);
- return (ProcXGetDeviceModifierMapping(client));
-}
-
-/***********************************************************************
- *
- * Get the device Modifier mapping.
- *
- */
-
-int
-ProcXGetDeviceModifierMapping(ClientPtr client)
-{
- DeviceIntPtr dev;
- xGetDeviceModifierMappingReply rep;
- KeyCode *modkeymap = NULL;
- int ret, max_keys_per_mod;
-
- REQUEST(xGetDeviceModifierMappingReq);
- REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
-
- ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
- if (ret != Success)
- return ret;
-
- ret = generate_modkeymap(client, dev, &modkeymap, &max_keys_per_mod);
- if (ret != Success)
- return ret;
-
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceModifierMapping;
- rep.numKeyPerModifier = max_keys_per_mod;
- rep.sequenceNumber = client->sequence;
- /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
- rep.length = max_keys_per_mod << 1;
-
- WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
- WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
-
- free(modkeymap);
-
- return Success;
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XGetDeviceModifierMapping function,
- * if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXGetDeviceModifierMapping(ClientPtr client, int size,
- xGetDeviceModifierMappingReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/********************************************************************
+ *
+ * Get the modifier mapping for an extension device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h> /* Request macro */
+#include "exglobals.h"
+
+#include "getmmap.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the modifier mapping for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXGetDeviceModifierMapping(ClientPtr client)
+{
+ REQUEST(xGetDeviceModifierMappingReq);
+ swaps(&stuff->length);
+ return (ProcXGetDeviceModifierMapping(client));
+}
+
+/***********************************************************************
+ *
+ * Get the device Modifier mapping.
+ *
+ */
+
+int
+ProcXGetDeviceModifierMapping(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ xGetDeviceModifierMappingReply rep;
+ KeyCode *modkeymap = NULL;
+ int ret, max_keys_per_mod;
+
+ REQUEST(xGetDeviceModifierMappingReq);
+ REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
+
+ ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
+ if (ret != Success)
+ return ret;
+
+ ret = generate_modkeymap(client, dev, &modkeymap, &max_keys_per_mod);
+ if (ret != Success)
+ return ret;
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceModifierMapping;
+ rep.numKeyPerModifier = max_keys_per_mod;
+ rep.sequenceNumber = client->sequence;
+ /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
+ rep.length = max_keys_per_mod << 1;
+
+ WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
+ WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
+
+ free(modkeymap);
+
+ return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetDeviceModifierMapping function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceModifierMapping(ClientPtr client, int size,
+ xGetDeviceModifierMappingReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ WriteToClient(client, size, (char *)rep);
+}
diff --git a/xorg-server/Xi/getprop.c b/xorg-server/Xi/getprop.c
index 5e102627d..11afd3784 100644
--- a/xorg-server/Xi/getprop.c
+++ b/xorg-server/Xi/getprop.c
@@ -75,12 +75,10 @@ extern int ExtEventIndex;
int
SProcXGetDeviceDontPropagateList(ClientPtr client)
{
- char n;
-
REQUEST(xGetDeviceDontPropagateListReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
- swapl(&stuff->window, n);
+ swapl(&stuff->window);
return (ProcXGetDeviceDontPropagateList(client));
}
@@ -178,10 +176,8 @@ void
SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
xGetDeviceDontPropagateListReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->count, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->count);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/getselev.c b/xorg-server/Xi/getselev.c
index 7304738b3..b316e2364 100644
--- a/xorg-server/Xi/getselev.c
+++ b/xorg-server/Xi/getselev.c
@@ -73,12 +73,10 @@ SOFTWARE.
int
SProcXGetSelectedExtensionEvents(ClientPtr client)
{
- char n;
-
REQUEST(xGetSelectedExtensionEventsReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
- swapl(&stuff->window, n);
+ swapl(&stuff->window);
return (ProcXGetSelectedExtensionEvents(client));
}
@@ -168,11 +166,9 @@ void
SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
xGetSelectedExtensionEventsReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->this_client_count, n);
- swaps(&rep->all_clients_count, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->this_client_count);
+ swaps(&rep->all_clients_count);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/getvers.c b/xorg-server/Xi/getvers.c
index c8e9ebca6..8bea1c4b9 100644
--- a/xorg-server/Xi/getvers.c
+++ b/xorg-server/Xi/getvers.c
@@ -73,12 +73,10 @@ XExtensionVersion XIVersion;
int
SProcXGetExtensionVersion(ClientPtr client)
{
- char n;
-
REQUEST(xGetExtensionVersionReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
- swaps(&stuff->nbytes, n);
+ swaps(&stuff->nbytes);
return (ProcXGetExtensionVersion(client));
}
@@ -125,11 +123,9 @@ void
SRepXGetExtensionVersion(ClientPtr client, int size,
xGetExtensionVersionReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->major_version, n);
- swaps(&rep->minor_version, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->major_version);
+ swaps(&rep->minor_version);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/grabdev.c b/xorg-server/Xi/grabdev.c
index 925c9a6d2..4572c33fc 100644
--- a/xorg-server/Xi/grabdev.c
+++ b/xorg-server/Xi/grabdev.c
@@ -75,14 +75,12 @@ extern int ExtEventIndex;
int
SProcXGrabDevice(ClientPtr client)
{
- char n;
-
REQUEST(xGrabDeviceReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
- swapl(&stuff->grabWindow, n);
- swapl(&stuff->time, n);
- swaps(&stuff->event_count, n);
+ swapl(&stuff->grabWindow);
+ swapl(&stuff->time);
+ swaps(&stuff->event_count);
if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
@@ -210,9 +208,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
void
SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/grabdevb.c b/xorg-server/Xi/grabdevb.c
index e235f5313..2897d410b 100644
--- a/xorg-server/Xi/grabdevb.c
+++ b/xorg-server/Xi/grabdevb.c
@@ -74,14 +74,12 @@ SOFTWARE.
int
SProcXGrabDeviceButton(ClientPtr client)
{
- char n;
-
REQUEST(xGrabDeviceButtonReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
- swapl(&stuff->grabWindow, n);
- swaps(&stuff->modifiers, n);
- swaps(&stuff->event_count, n);
+ swapl(&stuff->grabWindow);
+ swaps(&stuff->modifiers);
+ swaps(&stuff->event_count);
REQUEST_FIXED_SIZE(xGrabDeviceButtonReq,
stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
diff --git a/xorg-server/Xi/grabdevk.c b/xorg-server/Xi/grabdevk.c
index b34867b5f..cedd90d9c 100644
--- a/xorg-server/Xi/grabdevk.c
+++ b/xorg-server/Xi/grabdevk.c
@@ -74,14 +74,12 @@ SOFTWARE.
int
SProcXGrabDeviceKey(ClientPtr client)
{
- char n;
-
REQUEST(xGrabDeviceKeyReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
- swapl(&stuff->grabWindow, n);
- swaps(&stuff->modifiers, n);
- swaps(&stuff->event_count, n);
+ swapl(&stuff->grabWindow);
+ swaps(&stuff->modifiers);
+ swaps(&stuff->event_count);
REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return (ProcXGrabDeviceKey(client));
diff --git a/xorg-server/Xi/gtmotion.c b/xorg-server/Xi/gtmotion.c
index ae69a3c92..34f167b40 100644
--- a/xorg-server/Xi/gtmotion.c
+++ b/xorg-server/Xi/gtmotion.c
@@ -1,177 +1,171 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/***********************************************************************
- *
- * Request to get the motion history from an extension device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "exevents.h"
-#include "exglobals.h"
-
-#include "gtmotion.h"
-
-/***********************************************************************
- *
- * Swap the request if server and client have different byte ordering.
- *
- */
-
-int
-SProcXGetDeviceMotionEvents(ClientPtr client)
-{
- char n;
-
- REQUEST(xGetDeviceMotionEventsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
- swapl(&stuff->start, n);
- swapl(&stuff->stop, n);
- return (ProcXGetDeviceMotionEvents(client));
-}
-
-/****************************************************************************
- *
- * Get the motion history for an extension pointer devices.
- *
- */
-
-int
-ProcXGetDeviceMotionEvents(ClientPtr client)
-{
- INT32 *coords = NULL, *bufptr;
- xGetDeviceMotionEventsReply rep;
- unsigned long i;
- int rc, num_events, axes, size = 0;
- unsigned long nEvents;
- DeviceIntPtr dev;
- TimeStamp start, stop;
- int length = 0;
- ValuatorClassPtr v;
-
- REQUEST(xGetDeviceMotionEventsReq);
-
- REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
- rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
- if (rc != Success)
- return rc;
- v = dev->valuator;
- if (v == NULL || v->numAxes == 0)
- return BadMatch;
- 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;
- start = ClientTimeToServerTime(stuff->start);
- stop = ClientTimeToServerTime(stuff->stop);
- if (CompareTimeStamps(start, stop) == LATER ||
- CompareTimeStamps(start, currentTime) == LATER) {
- WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
- return Success;
- }
- if (CompareTimeStamps(stop, currentTime) == LATER)
- stop = currentTime;
- num_events = v->numMotionEvents;
- if (num_events) {
- size = sizeof(Time) + (axes * sizeof(INT32));
- rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords,/* XXX */
- start.milliseconds, stop.milliseconds,
- (ScreenPtr) NULL, FALSE);
- }
- if (rep.nEvents > 0) {
- length = bytes_to_int32(rep.nEvents * size);
- rep.length = length;
- }
- nEvents = rep.nEvents;
- WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
- if (nEvents) {
- if (client->swapped) {
- char n;
-
- bufptr = coords;
- for (i = 0; i < nEvents * (axes + 1); i++) {
- swapl(bufptr, n);
- bufptr++;
- }
- }
- WriteToClient(client, length * 4, (char *)coords);
- }
- free(coords);
- return Success;
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XGetDeviceMotionEvents function,
- * if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXGetDeviceMotionEvents(ClientPtr client, int size,
- xGetDeviceMotionEventsReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->nEvents, n);
- WriteToClient(client, size, (char *)rep);
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * Request to get the motion history from an extension device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "gtmotion.h"
+
+/***********************************************************************
+ *
+ * Swap the request if server and client have different byte ordering.
+ *
+ */
+
+int
+SProcXGetDeviceMotionEvents(ClientPtr client)
+{
+ REQUEST(xGetDeviceMotionEventsReq);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
+ swapl(&stuff->start);
+ swapl(&stuff->stop);
+ return (ProcXGetDeviceMotionEvents(client));
+}
+
+/****************************************************************************
+ *
+ * Get the motion history for an extension pointer devices.
+ *
+ */
+
+int
+ProcXGetDeviceMotionEvents(ClientPtr client)
+{
+ INT32 *coords = NULL, *bufptr;
+ xGetDeviceMotionEventsReply rep;
+ unsigned long i;
+ int rc, num_events, axes, size = 0;
+ unsigned long nEvents;
+ DeviceIntPtr dev;
+ TimeStamp start, stop;
+ int length = 0;
+ ValuatorClassPtr v;
+
+ REQUEST(xGetDeviceMotionEventsReq);
+
+ REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+ v = dev->valuator;
+ if (v == NULL || v->numAxes == 0)
+ return BadMatch;
+ 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;
+ start = ClientTimeToServerTime(stuff->start);
+ stop = ClientTimeToServerTime(stuff->stop);
+ if (CompareTimeStamps(start, stop) == LATER ||
+ CompareTimeStamps(start, currentTime) == LATER) {
+ WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
+ return Success;
+ }
+ if (CompareTimeStamps(stop, currentTime) == LATER)
+ stop = currentTime;
+ num_events = v->numMotionEvents;
+ if (num_events) {
+ size = sizeof(Time) + (axes * sizeof(INT32));
+ rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords,/* XXX */
+ start.milliseconds, stop.milliseconds,
+ (ScreenPtr) NULL, FALSE);
+ }
+ if (rep.nEvents > 0) {
+ length = bytes_to_int32(rep.nEvents * size);
+ rep.length = length;
+ }
+ nEvents = rep.nEvents;
+ WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
+ if (nEvents) {
+ if (client->swapped) {
+ bufptr = coords;
+ for (i = 0; i < nEvents * (axes + 1); i++) {
+ swapl(bufptr);
+ bufptr++;
+ }
+ }
+ WriteToClient(client, length * 4, (char *)coords);
+ }
+ free(coords);
+ return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetDeviceMotionEvents function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceMotionEvents(ClientPtr client, int size,
+ xGetDeviceMotionEventsReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->nEvents);
+ WriteToClient(client, size, (char *)rep);
+}
diff --git a/xorg-server/Xi/listdev.c b/xorg-server/Xi/listdev.c
index da7529f1e..1b3081d96 100644
--- a/xorg-server/Xi/listdev.c
+++ b/xorg-server/Xi/listdev.c
@@ -1,432 +1,424 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/***********************************************************************
- *
- * Extension function to list the available input devices.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "XIstubs.h"
-#include "extnsionst.h"
-#include "exevents.h"
-#include "xace.h"
-#include "xkbsrv.h"
-#include "xkbstr.h"
-
-#include "listdev.h"
-
-
-/***********************************************************************
- *
- * This procedure lists the input devices available to the server.
- *
- */
-
-int
-SProcXListInputDevices(ClientPtr client)
-{
- char n;
-
- REQUEST(xListInputDevicesReq);
- swaps(&stuff->length, n);
- return (ProcXListInputDevices(client));
-}
-
-/***********************************************************************
- *
- * This procedure calculates the size of the information to be returned
- * for an input device.
- *
- */
-
-static void
-SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
-{
- int chunks;
-
- *namesize += 1;
- if (d->name)
- *namesize += strlen(d->name);
- if (d->key != NULL)
- *size += sizeof(xKeyInfo);
- if (d->button != NULL)
- *size += sizeof(xButtonInfo);
- if (d->valuator != NULL) {
- chunks = ((int)d->valuator->numAxes + 19) / VPC;
- *size += (chunks * sizeof(xValuatorInfo) +
- d->valuator->numAxes * sizeof(xAxisInfo));
- }
-}
-
-/***********************************************************************
- *
- * This procedure copies data to the DeviceInfo struct, swapping if necessary.
- *
- * We need the extra byte in the allocated buffer, because the trailing null
- * hammers one extra byte, which is overwritten by the next name except for
- * the last name copied.
- *
- */
-
-static void
-CopyDeviceName(char **namebuf, char *name)
-{
- char *nameptr = (char *)*namebuf;
-
- if (name) {
- *nameptr++ = strlen(name);
- strcpy(nameptr, name);
- *namebuf += (strlen(name) + 1);
- } else {
- *nameptr++ = 0;
- *namebuf += 1;
- }
-}
-
-/***********************************************************************
- *
- * This procedure copies ButtonClass information, swapping if necessary.
- *
- */
-
-static void
-CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
-{
- char n;
- xButtonInfoPtr b2;
-
- b2 = (xButtonInfoPtr) * buf;
- b2->class = ButtonClass;
- b2->length = sizeof(xButtonInfo);
- b2->num_buttons = b->numButtons;
- if (client && client->swapped) {
- swaps(&b2->num_buttons, n); /* macro - braces are required */
- }
- *buf += sizeof(xButtonInfo);
-}
-
-/***********************************************************************
- *
- * This procedure copies data to the DeviceInfo struct, swapping if necessary.
- *
- */
-
-static void
-CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
- char **buf)
-{
- char n;
- xDeviceInfoPtr dev;
-
- dev = (xDeviceInfoPtr) * buf;
-
- dev->id = d->id;
- dev->type = d->xinput_type;
- dev->num_classes = num_classes;
- if (IsMaster(d) && IsKeyboardDevice(d))
- dev->use = IsXKeyboard;
- else if (IsMaster(d) && IsPointerDevice(d))
- dev->use = IsXPointer;
- else if (d->valuator && d->button)
- dev->use = IsXExtensionPointer;
- else if (d->key && d->kbdfeed)
- dev->use = IsXExtensionKeyboard;
- else
- dev->use = IsXExtensionDevice;
-
- if (client->swapped) {
- swapl(&dev->type, n); /* macro - braces are required */
- }
- *buf += sizeof(xDeviceInfo);
-}
-
-/***********************************************************************
- *
- * This procedure copies KeyClass information, swapping if necessary.
- *
- */
-
-static void
-CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf)
-{
- char n;
- xKeyInfoPtr k2;
-
- k2 = (xKeyInfoPtr) * buf;
- k2->class = KeyClass;
- k2->length = sizeof(xKeyInfo);
- k2->min_keycode = k->xkbInfo->desc->min_key_code;
- k2->max_keycode = k->xkbInfo->desc->max_key_code;
- k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
- if (client && client->swapped) {
- swaps(&k2->num_keys, n);
- }
- *buf += sizeof(xKeyInfo);
-}
-
-/***********************************************************************
- *
- * This procedure copies ValuatorClass information, swapping if necessary.
- *
- * Devices may have up to 255 valuators. The length of a ValuatorClass is
- * defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo).
- * The maximum length is therefore (8 + 255 * 12) = 3068. However, the
- * length field is one byte. If a device has more than 20 valuators, we
- * must therefore return multiple valuator classes to the client.
- *
- */
-
-static int
-CopySwapValuatorClass(ClientPtr client, DeviceIntPtr dev, char **buf)
-{
- int i, j, axes, t_axes;
- char n;
- ValuatorClassPtr v = dev->valuator;
- xValuatorInfoPtr v2;
- AxisInfo *a;
- xAxisInfoPtr a2;
-
- for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC);
- i++, axes -= VPC) {
- t_axes = axes < VPC ? axes : VPC;
- if (t_axes < 0)
- t_axes = v->numAxes % VPC;
- v2 = (xValuatorInfoPtr) * buf;
- v2->class = ValuatorClass;
- v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo);
- v2->num_axes = t_axes;
- v2->mode = valuator_get_mode(dev, 0);
- v2->motion_buffer_size = v->numMotionEvents;
- if (client && client->swapped) {
- swapl(&v2->motion_buffer_size, n);
- }
- *buf += sizeof(xValuatorInfo);
- a = v->axes + (VPC * i);
- a2 = (xAxisInfoPtr) * buf;
- for (j = 0; j < t_axes; j++) {
- a2->min_value = a->min_value;
- a2->max_value = a->max_value;
- a2->resolution = a->resolution;
- if (client && client->swapped) {
- swapl(&a2->min_value, n);
- swapl(&a2->max_value, n);
- swapl(&a2->resolution, n);
- }
- a2++;
- a++;
- *buf += sizeof(xAxisInfo);
- }
- }
- return i;
-}
-
-static void
-CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
- char** classbuf)
-{
- if (dev->key != NULL) {
- CopySwapKeyClass(client, dev->key, classbuf);
- (*num_classes)++;
- }
- if (dev->button != NULL) {
- CopySwapButtonClass(client, dev->button, classbuf);
- (*num_classes)++;
- }
- if (dev->valuator != NULL) {
- (*num_classes) +=
- CopySwapValuatorClass(client, dev, classbuf);
- }
-}
-
-/***********************************************************************
- *
- * This procedure lists information to be returned for an input device.
- *
- */
-
-static void
-ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
- char **devbuf, char **classbuf, char **namebuf)
-{
- CopyDeviceName(namebuf, d->name);
- CopySwapDevice(client, d, 0, devbuf);
- CopySwapClasses(client, d, &dev->num_classes, classbuf);
-}
-
-/***********************************************************************
- *
- * This procedure checks if a device should be left off the list.
- *
- */
-
-static Bool
-ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
-{
- /* don't send master devices other than VCP/VCK */
- if (!IsMaster(d) || d == inputInfo.pointer || d == inputInfo.keyboard)
- {
- int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
- if (rc == Success)
- return FALSE;
- }
- return TRUE;
-}
-
-
-/***********************************************************************
- *
- * This procedure lists the input devices available to the server.
- *
- * If this request is called by a client that has not issued a
- * GetExtensionVersion request with major/minor version set, we don't send the
- * complete device list. Instead, we only send the VCP, the VCK and floating
- * SDs. This resembles the setup found on XI 1.x machines.
- */
-
-int
-ProcXListInputDevices(ClientPtr client)
-{
- xListInputDevicesReply rep;
- int numdevs = 0;
- int namesize = 1; /* need 1 extra byte for strcpy */
- int i = 0, size = 0;
- int total_length;
- char *devbuf, *classbuf, *namebuf, *savbuf;
- Bool *skip;
- xDeviceInfo *dev;
- DeviceIntPtr d;
-
- REQUEST_SIZE_MATCH(xListInputDevicesReq);
-
- memset(&rep, 0, sizeof(xListInputDevicesReply));
- rep.repType = X_Reply;
- rep.RepType = X_ListInputDevices;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- /* allocate space for saving skip value */
- skip = calloc(sizeof(Bool), inputInfo.numDevices);
- if (!skip)
- return BadAlloc;
-
- /* figure out which devices to skip */
- numdevs = 0;
- for (d = inputInfo.devices; d; d = d->next, i++) {
- skip[i] = ShouldSkipDevice(client, d);
- if (skip[i])
- continue;
-
- SizeDeviceInfo(d, &namesize, &size);
- numdevs++;
- }
-
- for (d = inputInfo.off_devices; d; d = d->next, i++) {
- skip[i] = ShouldSkipDevice(client, d);
- if (skip[i])
- continue;
-
- SizeDeviceInfo(d, &namesize, &size);
- numdevs++;
- }
-
- /* allocate space for reply */
- total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
- devbuf = (char *)calloc(1, total_length);
- classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
- namebuf = classbuf + size;
- savbuf = devbuf;
-
- /* fill in and send reply */
- i = 0;
- dev = (xDeviceInfoPtr) devbuf;
- for (d = inputInfo.devices; d; d = d->next, i++) {
- if (skip[i])
- continue;
-
- ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
- }
-
- for (d = inputInfo.off_devices; d; d = d->next, i++) {
- if (skip[i])
- continue;
-
- ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
- }
- rep.ndevices = numdevs;
- rep.length = bytes_to_int32(total_length);
- WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
- WriteToClient(client, total_length, savbuf);
- free(savbuf);
- free(skip);
- return Success;
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XListInputDevices function,
- * if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * Extension function to list the available input devices.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "exevents.h"
+#include "xace.h"
+#include "xkbsrv.h"
+#include "xkbstr.h"
+
+#include "listdev.h"
+
+
+/***********************************************************************
+ *
+ * This procedure lists the input devices available to the server.
+ *
+ */
+
+int
+SProcXListInputDevices(ClientPtr client)
+{
+ REQUEST(xListInputDevicesReq);
+ swaps(&stuff->length);
+ return (ProcXListInputDevices(client));
+}
+
+/***********************************************************************
+ *
+ * This procedure calculates the size of the information to be returned
+ * for an input device.
+ *
+ */
+
+static void
+SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
+{
+ int chunks;
+
+ *namesize += 1;
+ if (d->name)
+ *namesize += strlen(d->name);
+ if (d->key != NULL)
+ *size += sizeof(xKeyInfo);
+ if (d->button != NULL)
+ *size += sizeof(xButtonInfo);
+ if (d->valuator != NULL) {
+ chunks = ((int)d->valuator->numAxes + 19) / VPC;
+ *size += (chunks * sizeof(xValuatorInfo) +
+ d->valuator->numAxes * sizeof(xAxisInfo));
+ }
+}
+
+/***********************************************************************
+ *
+ * This procedure copies data to the DeviceInfo struct, swapping if necessary.
+ *
+ * We need the extra byte in the allocated buffer, because the trailing null
+ * hammers one extra byte, which is overwritten by the next name except for
+ * the last name copied.
+ *
+ */
+
+static void
+CopyDeviceName(char **namebuf, char *name)
+{
+ char *nameptr = (char *)*namebuf;
+
+ if (name) {
+ *nameptr++ = strlen(name);
+ strcpy(nameptr, name);
+ *namebuf += (strlen(name) + 1);
+ } else {
+ *nameptr++ = 0;
+ *namebuf += 1;
+ }
+}
+
+/***********************************************************************
+ *
+ * This procedure copies ButtonClass information, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
+{
+ xButtonInfoPtr b2;
+
+ b2 = (xButtonInfoPtr) * buf;
+ b2->class = ButtonClass;
+ b2->length = sizeof(xButtonInfo);
+ b2->num_buttons = b->numButtons;
+ if (client && client->swapped) {
+ swaps(&b2->num_buttons);
+ }
+ *buf += sizeof(xButtonInfo);
+}
+
+/***********************************************************************
+ *
+ * This procedure copies data to the DeviceInfo struct, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
+ char **buf)
+{
+ xDeviceInfoPtr dev;
+
+ dev = (xDeviceInfoPtr) * buf;
+
+ dev->id = d->id;
+ dev->type = d->xinput_type;
+ dev->num_classes = num_classes;
+ if (IsMaster(d) && IsKeyboardDevice(d))
+ dev->use = IsXKeyboard;
+ else if (IsMaster(d) && IsPointerDevice(d))
+ dev->use = IsXPointer;
+ else if (d->valuator && d->button)
+ dev->use = IsXExtensionPointer;
+ else if (d->key && d->kbdfeed)
+ dev->use = IsXExtensionKeyboard;
+ else
+ dev->use = IsXExtensionDevice;
+
+ if (client->swapped) {
+ swapl(&dev->type);
+ }
+ *buf += sizeof(xDeviceInfo);
+}
+
+/***********************************************************************
+ *
+ * This procedure copies KeyClass information, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf)
+{
+ xKeyInfoPtr k2;
+
+ k2 = (xKeyInfoPtr) * buf;
+ k2->class = KeyClass;
+ k2->length = sizeof(xKeyInfo);
+ k2->min_keycode = k->xkbInfo->desc->min_key_code;
+ k2->max_keycode = k->xkbInfo->desc->max_key_code;
+ k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
+ if (client && client->swapped) {
+ swaps(&k2->num_keys);
+ }
+ *buf += sizeof(xKeyInfo);
+}
+
+/***********************************************************************
+ *
+ * This procedure copies ValuatorClass information, swapping if necessary.
+ *
+ * Devices may have up to 255 valuators. The length of a ValuatorClass is
+ * defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo).
+ * The maximum length is therefore (8 + 255 * 12) = 3068. However, the
+ * length field is one byte. If a device has more than 20 valuators, we
+ * must therefore return multiple valuator classes to the client.
+ *
+ */
+
+static int
+CopySwapValuatorClass(ClientPtr client, DeviceIntPtr dev, char **buf)
+{
+ int i, j, axes, t_axes;
+ ValuatorClassPtr v = dev->valuator;
+ xValuatorInfoPtr v2;
+ AxisInfo *a;
+ xAxisInfoPtr a2;
+
+ for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC);
+ i++, axes -= VPC) {
+ t_axes = axes < VPC ? axes : VPC;
+ if (t_axes < 0)
+ t_axes = v->numAxes % VPC;
+ v2 = (xValuatorInfoPtr) * buf;
+ v2->class = ValuatorClass;
+ v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo);
+ v2->num_axes = t_axes;
+ v2->mode = valuator_get_mode(dev, 0);
+ v2->motion_buffer_size = v->numMotionEvents;
+ if (client && client->swapped) {
+ swapl(&v2->motion_buffer_size);
+ }
+ *buf += sizeof(xValuatorInfo);
+ a = v->axes + (VPC * i);
+ a2 = (xAxisInfoPtr) * buf;
+ for (j = 0; j < t_axes; j++) {
+ a2->min_value = a->min_value;
+ a2->max_value = a->max_value;
+ a2->resolution = a->resolution;
+ if (client && client->swapped) {
+ swapl(&a2->min_value);
+ swapl(&a2->max_value);
+ swapl(&a2->resolution);
+ }
+ a2++;
+ a++;
+ *buf += sizeof(xAxisInfo);
+ }
+ }
+ return i;
+}
+
+static void
+CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
+ char** classbuf)
+{
+ if (dev->key != NULL) {
+ CopySwapKeyClass(client, dev->key, classbuf);
+ (*num_classes)++;
+ }
+ if (dev->button != NULL) {
+ CopySwapButtonClass(client, dev->button, classbuf);
+ (*num_classes)++;
+ }
+ if (dev->valuator != NULL) {
+ (*num_classes) +=
+ CopySwapValuatorClass(client, dev, classbuf);
+ }
+}
+
+/***********************************************************************
+ *
+ * This procedure lists information to be returned for an input device.
+ *
+ */
+
+static void
+ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
+ char **devbuf, char **classbuf, char **namebuf)
+{
+ CopyDeviceName(namebuf, d->name);
+ CopySwapDevice(client, d, 0, devbuf);
+ CopySwapClasses(client, d, &dev->num_classes, classbuf);
+}
+
+/***********************************************************************
+ *
+ * This procedure checks if a device should be left off the list.
+ *
+ */
+
+static Bool
+ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
+{
+ /* don't send master devices other than VCP/VCK */
+ if (!IsMaster(d) || d == inputInfo.pointer || d == inputInfo.keyboard)
+ {
+ int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
+ if (rc == Success)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+/***********************************************************************
+ *
+ * This procedure lists the input devices available to the server.
+ *
+ * If this request is called by a client that has not issued a
+ * GetExtensionVersion request with major/minor version set, we don't send the
+ * complete device list. Instead, we only send the VCP, the VCK and floating
+ * SDs. This resembles the setup found on XI 1.x machines.
+ */
+
+int
+ProcXListInputDevices(ClientPtr client)
+{
+ xListInputDevicesReply rep;
+ int numdevs = 0;
+ int namesize = 1; /* need 1 extra byte for strcpy */
+ int i = 0, size = 0;
+ int total_length;
+ char *devbuf, *classbuf, *namebuf, *savbuf;
+ Bool *skip;
+ xDeviceInfo *dev;
+ DeviceIntPtr d;
+
+ REQUEST_SIZE_MATCH(xListInputDevicesReq);
+
+ memset(&rep, 0, sizeof(xListInputDevicesReply));
+ rep.repType = X_Reply;
+ rep.RepType = X_ListInputDevices;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ /* allocate space for saving skip value */
+ skip = calloc(sizeof(Bool), inputInfo.numDevices);
+ if (!skip)
+ return BadAlloc;
+
+ /* figure out which devices to skip */
+ numdevs = 0;
+ for (d = inputInfo.devices; d; d = d->next, i++) {
+ skip[i] = ShouldSkipDevice(client, d);
+ if (skip[i])
+ continue;
+
+ SizeDeviceInfo(d, &namesize, &size);
+ numdevs++;
+ }
+
+ for (d = inputInfo.off_devices; d; d = d->next, i++) {
+ skip[i] = ShouldSkipDevice(client, d);
+ if (skip[i])
+ continue;
+
+ SizeDeviceInfo(d, &namesize, &size);
+ numdevs++;
+ }
+
+ /* allocate space for reply */
+ total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
+ devbuf = (char *)calloc(1, total_length);
+ classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
+ namebuf = classbuf + size;
+ savbuf = devbuf;
+
+ /* fill in and send reply */
+ i = 0;
+ dev = (xDeviceInfoPtr) devbuf;
+ for (d = inputInfo.devices; d; d = d->next, i++) {
+ if (skip[i])
+ continue;
+
+ ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
+ }
+
+ for (d = inputInfo.off_devices; d; d = d->next, i++) {
+ if (skip[i])
+ continue;
+
+ ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
+ }
+ rep.ndevices = numdevs;
+ rep.length = bytes_to_int32(total_length);
+ WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
+ WriteToClient(client, total_length, savbuf);
+ free(savbuf);
+ free(skip);
+ return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XListInputDevices function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ WriteToClient(client, size, (char *)rep);
+}
diff --git a/xorg-server/Xi/opendev.c b/xorg-server/Xi/opendev.c
index 273cb2404..ba0d30436 100644
--- a/xorg-server/Xi/opendev.c
+++ b/xorg-server/Xi/opendev.c
@@ -1,174 +1,170 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/***********************************************************************
- *
- * Request to open an extension input device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "XIstubs.h"
-#include "windowstr.h" /* window structure */
-#include "exglobals.h"
-#include "exevents.h"
-
-#include "opendev.h"
-
-extern CARD8 event_base[];
-
-/***********************************************************************
- *
- * This procedure swaps the request if the server and client have different
- * byte orderings.
- *
- */
-
-int
-SProcXOpenDevice(ClientPtr client)
-{
- char n;
-
- REQUEST(xOpenDeviceReq);
- swaps(&stuff->length, n);
- return (ProcXOpenDevice(client));
-}
-
-/***********************************************************************
- *
- * This procedure causes the server to open an input device.
- *
- */
-
-int
-ProcXOpenDevice(ClientPtr client)
-{
- xInputClassInfo evbase[numInputClasses];
- int j = 0;
- int status = Success;
- xOpenDeviceReply rep;
- DeviceIntPtr dev;
-
- REQUEST(xOpenDeviceReq);
- REQUEST_SIZE_MATCH(xOpenDeviceReq);
-
- status = dixLookupDevice(&dev, stuff->deviceid, client, DixUseAccess);
-
- if (status == BadDevice) { /* not open */
- for (dev = inputInfo.off_devices; dev; dev = dev->next)
- if (dev->id == stuff->deviceid)
- break;
- if (dev == NULL)
- return BadDevice;
- } else if (status != Success)
- return status;
-
- if (IsMaster(dev))
- return BadDevice;
-
- 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];
- }
- if (dev->button != NULL) {
- evbase[j].class = ButtonClass;
- evbase[j++].event_type_base = event_base[ButtonClass];
- }
- if (dev->valuator != NULL) {
- evbase[j].class = ValuatorClass;
- evbase[j++].event_type_base = event_base[ValuatorClass];
- }
- if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL ||
- dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) {
- evbase[j].class = FeedbackClass;
- evbase[j++].event_type_base = event_base[FeedbackClass];
- }
- if (dev->focus != NULL) {
- evbase[j].class = FocusClass;
- evbase[j++].event_type_base = event_base[FocusClass];
- }
- if (dev->proximity != NULL) {
- evbase[j].class = ProximityClass;
- evbase[j++].event_type_base = event_base[ProximityClass];
- }
- evbase[j].class = OtherClass;
- evbase[j++].event_type_base = event_base[OtherClass];
- rep.length = bytes_to_int32(j * sizeof(xInputClassInfo));
- rep.num_classes = j;
- WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
- WriteToClient(client, j * sizeof(xInputClassInfo), (char *)evbase);
- return Success;
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XOpenDevice function,
- * if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * Request to open an extension input device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+#include "windowstr.h" /* window structure */
+#include "exglobals.h"
+#include "exevents.h"
+
+#include "opendev.h"
+
+extern CARD8 event_base[];
+
+/***********************************************************************
+ *
+ * This procedure swaps the request if the server and client have different
+ * byte orderings.
+ *
+ */
+
+int
+SProcXOpenDevice(ClientPtr client)
+{
+ REQUEST(xOpenDeviceReq);
+ swaps(&stuff->length);
+ return (ProcXOpenDevice(client));
+}
+
+/***********************************************************************
+ *
+ * This procedure causes the server to open an input device.
+ *
+ */
+
+int
+ProcXOpenDevice(ClientPtr client)
+{
+ xInputClassInfo evbase[numInputClasses];
+ int j = 0;
+ int status = Success;
+ xOpenDeviceReply rep;
+ DeviceIntPtr dev;
+
+ REQUEST(xOpenDeviceReq);
+ REQUEST_SIZE_MATCH(xOpenDeviceReq);
+
+ status = dixLookupDevice(&dev, stuff->deviceid, client, DixUseAccess);
+
+ if (status == BadDevice) { /* not open */
+ for (dev = inputInfo.off_devices; dev; dev = dev->next)
+ if (dev->id == stuff->deviceid)
+ break;
+ if (dev == NULL)
+ return BadDevice;
+ } else if (status != Success)
+ return status;
+
+ if (IsMaster(dev))
+ return BadDevice;
+
+ 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];
+ }
+ if (dev->button != NULL) {
+ evbase[j].class = ButtonClass;
+ evbase[j++].event_type_base = event_base[ButtonClass];
+ }
+ if (dev->valuator != NULL) {
+ evbase[j].class = ValuatorClass;
+ evbase[j++].event_type_base = event_base[ValuatorClass];
+ }
+ if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL ||
+ dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) {
+ evbase[j].class = FeedbackClass;
+ evbase[j++].event_type_base = event_base[FeedbackClass];
+ }
+ if (dev->focus != NULL) {
+ evbase[j].class = FocusClass;
+ evbase[j++].event_type_base = event_base[FocusClass];
+ }
+ if (dev->proximity != NULL) {
+ evbase[j].class = ProximityClass;
+ evbase[j++].event_type_base = event_base[ProximityClass];
+ }
+ evbase[j].class = OtherClass;
+ evbase[j++].event_type_base = event_base[OtherClass];
+ rep.length = bytes_to_int32(j * sizeof(xInputClassInfo));
+ rep.num_classes = j;
+ WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
+ WriteToClient(client, j * sizeof(xInputClassInfo), (char *)evbase);
+ return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XOpenDevice function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ WriteToClient(client, size, (char *)rep);
+}
diff --git a/xorg-server/Xi/queryst.c b/xorg-server/Xi/queryst.c
index 4810ed7f1..8c3bdcf97 100644
--- a/xorg-server/Xi/queryst.c
+++ b/xorg-server/Xi/queryst.c
@@ -1,192 +1,187 @@
-/*
-
-Copyright 1998, 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.
-
-*/
-
-/***********************************************************************
- *
- * Request to query the state of an extension input device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "exevents.h"
-#include "exglobals.h"
-#include "xkbsrv.h"
-#include "xkbstr.h"
-
-#include "queryst.h"
-
-/***********************************************************************
- *
- * This procedure allows a client to query the state of a device.
- *
- */
-
-int
-SProcXQueryDeviceState(ClientPtr client)
-{
- char n;
-
- REQUEST(xQueryDeviceStateReq);
- swaps(&stuff->length, n);
- return (ProcXQueryDeviceState(client));
-}
-
-/***********************************************************************
- *
- * This procedure allows frozen events to be routed.
- *
- */
-
-int
-ProcXQueryDeviceState(ClientPtr client)
-{
- char n;
- int rc, i;
- int num_classes = 0;
- int total_length = 0;
- char *buf, *savbuf;
- KeyClassPtr k;
- xKeyState *tk;
- ButtonClassPtr b;
- xButtonState *tb;
- ValuatorClassPtr v;
- xValuatorState *tv;
- xQueryDeviceStateReply rep;
- DeviceIntPtr dev;
- double *values;
-
- 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;
-
- v = dev->valuator;
- if (v != NULL && v->motionHintWindow != NULL)
- MaybeStopDeviceHint(dev, client);
-
- k = dev->key;
- if (k != NULL) {
- total_length += sizeof(xKeyState);
- num_classes++;
- }
-
- b = dev->button;
- if (b != NULL) {
- total_length += sizeof(xButtonState);
- num_classes++;
- }
-
- if (v != NULL) {
- total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
- num_classes++;
- }
- buf = (char *)calloc(total_length, 1);
- if (!buf)
- return BadAlloc;
- savbuf = buf;
-
- if (k != NULL) {
- tk = (xKeyState *) buf;
- tk->class = KeyClass;
- tk->length = sizeof(xKeyState);
- tk->num_keys = k->xkbInfo->desc->max_key_code -
- k->xkbInfo->desc->min_key_code + 1;
- if (rc != BadAccess)
- for (i = 0; i < 32; i++)
- tk->keys[i] = k->down[i];
- buf += sizeof(xKeyState);
- }
-
- if (b != NULL) {
- tb = (xButtonState *) buf;
- tb->class = ButtonClass;
- tb->length = sizeof(xButtonState);
- tb->num_buttons = b->numButtons;
- if (rc != BadAccess)
- memcpy(tb->buttons, b->down, sizeof(b->down));
- buf += sizeof(xButtonState);
- }
-
- if (v != NULL) {
- tv = (xValuatorState *) buf;
- tv->class = ValuatorClass;
- tv->length = sizeof(xValuatorState) + v->numAxes * 4;
- tv->num_valuators = v->numAxes;
- tv->mode = valuator_get_mode(dev, 0);
- tv->mode |= (dev->proximity && !dev->proximity->in_proximity) ? OutOfProximity : 0;
- buf += sizeof(xValuatorState);
- for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
- if (rc != BadAccess)
- *((int *)buf) = *values;
- values++;
- if (client->swapped) {
- swapl((int *)buf, n); /* macro - braces needed */
- }
- buf += sizeof(int);
- }
- }
-
- rep.num_classes = num_classes;
- rep.length = bytes_to_int32(total_length);
- WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
- if (total_length > 0)
- WriteToClient(client, total_length, savbuf);
- free(savbuf);
- return Success;
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XQueryDeviceState function,
- * if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
+/*
+
+Copyright 1998, 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.
+
+*/
+
+/***********************************************************************
+ *
+ * Request to query the state of an extension input device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exevents.h"
+#include "exglobals.h"
+#include "xkbsrv.h"
+#include "xkbstr.h"
+
+#include "queryst.h"
+
+/***********************************************************************
+ *
+ * This procedure allows a client to query the state of a device.
+ *
+ */
+
+int
+SProcXQueryDeviceState(ClientPtr client)
+{
+ REQUEST(xQueryDeviceStateReq);
+ swaps(&stuff->length);
+ return (ProcXQueryDeviceState(client));
+}
+
+/***********************************************************************
+ *
+ * This procedure allows frozen events to be routed.
+ *
+ */
+
+int
+ProcXQueryDeviceState(ClientPtr client)
+{
+ int rc, i;
+ int num_classes = 0;
+ int total_length = 0;
+ char *buf, *savbuf;
+ KeyClassPtr k;
+ xKeyState *tk;
+ ButtonClassPtr b;
+ xButtonState *tb;
+ ValuatorClassPtr v;
+ xValuatorState *tv;
+ xQueryDeviceStateReply rep;
+ DeviceIntPtr dev;
+ double *values;
+
+ 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;
+
+ v = dev->valuator;
+ if (v != NULL && v->motionHintWindow != NULL)
+ MaybeStopDeviceHint(dev, client);
+
+ k = dev->key;
+ if (k != NULL) {
+ total_length += sizeof(xKeyState);
+ num_classes++;
+ }
+
+ b = dev->button;
+ if (b != NULL) {
+ total_length += sizeof(xButtonState);
+ num_classes++;
+ }
+
+ if (v != NULL) {
+ total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
+ num_classes++;
+ }
+ buf = (char *)calloc(total_length, 1);
+ if (!buf)
+ return BadAlloc;
+ savbuf = buf;
+
+ if (k != NULL) {
+ tk = (xKeyState *) buf;
+ tk->class = KeyClass;
+ tk->length = sizeof(xKeyState);
+ tk->num_keys = k->xkbInfo->desc->max_key_code -
+ k->xkbInfo->desc->min_key_code + 1;
+ if (rc != BadAccess)
+ for (i = 0; i < 32; i++)
+ tk->keys[i] = k->down[i];
+ buf += sizeof(xKeyState);
+ }
+
+ if (b != NULL) {
+ tb = (xButtonState *) buf;
+ tb->class = ButtonClass;
+ tb->length = sizeof(xButtonState);
+ tb->num_buttons = b->numButtons;
+ if (rc != BadAccess)
+ memcpy(tb->buttons, b->down, sizeof(b->down));
+ buf += sizeof(xButtonState);
+ }
+
+ if (v != NULL) {
+ tv = (xValuatorState *) buf;
+ tv->class = ValuatorClass;
+ tv->length = sizeof(xValuatorState) + v->numAxes * 4;
+ tv->num_valuators = v->numAxes;
+ tv->mode = valuator_get_mode(dev, 0);
+ tv->mode |= (dev->proximity && !dev->proximity->in_proximity) ? OutOfProximity : 0;
+ buf += sizeof(xValuatorState);
+ for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
+ if (rc != BadAccess)
+ *((int *)buf) = *values;
+ values++;
+ if (client->swapped) {
+ swapl((int *)buf);
+ }
+ buf += sizeof(int);
+ }
+ }
+
+ rep.num_classes = num_classes;
+ rep.length = bytes_to_int32(total_length);
+ WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
+ if (total_length > 0)
+ WriteToClient(client, total_length, savbuf);
+ free(savbuf);
+ return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XQueryDeviceState function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ WriteToClient(client, size, (char *)rep);
+}
diff --git a/xorg-server/Xi/selectev.c b/xorg-server/Xi/selectev.c
index 031e602ad..4c2c2fe05 100644
--- a/xorg-server/Xi/selectev.c
+++ b/xorg-server/Xi/selectev.c
@@ -123,13 +123,11 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
int
SProcXSelectExtensionEvent(ClientPtr client)
{
- char n;
-
REQUEST(xSelectExtensionEventReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
- swapl(&stuff->window, n);
- swaps(&stuff->count, n);
+ swapl(&stuff->window);
+ swaps(&stuff->count);
REQUEST_FIXED_SIZE(xSelectExtensionEventReq,
stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
diff --git a/xorg-server/Xi/sendexev.c b/xorg-server/Xi/sendexev.c
index 59fe93db7..4770c28d1 100644
--- a/xorg-server/Xi/sendexev.c
+++ b/xorg-server/Xi/sendexev.c
@@ -1,156 +1,155 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/***********************************************************************
- *
- * Request to send an extension event.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* Window */
-#include "extnsionst.h" /* EventSwapPtr */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "exevents.h"
-#include "exglobals.h"
-
-#include "grabdev.h"
-#include "sendexev.h"
-
-extern int lastEvent; /* Defined in extension.c */
-
-/***********************************************************************
- *
- * Handle requests from clients with a different byte order than us.
- *
- */
-
-int
-SProcXSendExtensionEvent(ClientPtr client)
-{
- char n;
- CARD32 *p;
- int i;
- xEvent eventT;
- xEvent *eventP;
- EventSwapPtr proc;
-
- REQUEST(xSendExtensionEventReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
- swapl(&stuff->destination, n);
- swaps(&stuff->count, n);
-
- if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
- bytes_to_int32(stuff->num_events * sizeof(xEvent)))
- return BadLength;
-
- eventP = (xEvent *) & stuff[1];
- for (i = 0; i < stuff->num_events; i++, eventP++) {
- proc = EventSwapVector[eventP->u.u.type & 0177];
- if (proc == NotImplemented) /* no swapping proc; invalid event type? */
- return BadValue;
- (*proc) (eventP, &eventT);
- *eventP = eventT;
- }
-
- p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
- SwapLongs(p, stuff->count);
- return (ProcXSendExtensionEvent(client));
-}
-
-/***********************************************************************
- *
- * Send an event to some client, as if it had come from an extension input
- * device.
- *
- */
-
-int
-ProcXSendExtensionEvent(ClientPtr client)
-{
- int ret;
- DeviceIntPtr dev;
- xEvent *first;
- XEventClass *list;
- struct tmask tmp[EMASKSIZE];
-
- REQUEST(xSendExtensionEventReq);
- REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
-
- if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
- (stuff->num_events * bytes_to_int32(sizeof(xEvent))))
- return BadLength;
-
- ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
- if (ret != Success)
- return ret;
-
- /* The client's event type must be one defined by an extension. */
-
- first = ((xEvent *) & stuff[1]);
- if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
- (first->u.u.type < lastEvent))) {
- client->errorValue = first->u.u.type;
- return BadValue;
- }
-
- list = (XEventClass *) (first + stuff->num_events);
- if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
- X_SendExtensionEvent)) != Success)
- return ret;
-
- ret = (SendEvent(client, dev, stuff->destination,
- stuff->propagate, (xEvent *) & stuff[1],
- tmp[stuff->deviceid].mask, stuff->num_events));
-
- return ret;
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * Request to send an extension event.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* Window */
+#include "extnsionst.h" /* EventSwapPtr */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "grabdev.h"
+#include "sendexev.h"
+
+extern int lastEvent; /* Defined in extension.c */
+
+/***********************************************************************
+ *
+ * Handle requests from clients with a different byte order than us.
+ *
+ */
+
+int
+SProcXSendExtensionEvent(ClientPtr client)
+{
+ CARD32 *p;
+ int i;
+ xEvent eventT;
+ xEvent *eventP;
+ EventSwapPtr proc;
+
+ REQUEST(xSendExtensionEventReq);
+ swaps(&stuff->length);
+ REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
+ swapl(&stuff->destination);
+ swaps(&stuff->count);
+
+ if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
+ bytes_to_int32(stuff->num_events * sizeof(xEvent)))
+ return BadLength;
+
+ eventP = (xEvent *) & stuff[1];
+ for (i = 0; i < stuff->num_events; i++, eventP++) {
+ proc = EventSwapVector[eventP->u.u.type & 0177];
+ if (proc == NotImplemented) /* no swapping proc; invalid event type? */
+ return BadValue;
+ (*proc) (eventP, &eventT);
+ *eventP = eventT;
+ }
+
+ p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
+ SwapLongs(p, stuff->count);
+ return (ProcXSendExtensionEvent(client));
+}
+
+/***********************************************************************
+ *
+ * Send an event to some client, as if it had come from an extension input
+ * device.
+ *
+ */
+
+int
+ProcXSendExtensionEvent(ClientPtr client)
+{
+ int ret;
+ DeviceIntPtr dev;
+ xEvent *first;
+ XEventClass *list;
+ struct tmask tmp[EMASKSIZE];
+
+ REQUEST(xSendExtensionEventReq);
+ REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
+
+ if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
+ (stuff->num_events * bytes_to_int32(sizeof(xEvent))))
+ return BadLength;
+
+ ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
+ if (ret != Success)
+ return ret;
+
+ /* The client's event type must be one defined by an extension. */
+
+ first = ((xEvent *) & stuff[1]);
+ if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
+ (first->u.u.type < lastEvent))) {
+ client->errorValue = first->u.u.type;
+ return BadValue;
+ }
+
+ list = (XEventClass *) (first + stuff->num_events);
+ if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
+ X_SendExtensionEvent)) != Success)
+ return ret;
+
+ ret = (SendEvent(client, dev, stuff->destination,
+ stuff->propagate, (xEvent *) & stuff[1],
+ tmp[stuff->deviceid].mask, stuff->num_events));
+
+ return ret;
+}
diff --git a/xorg-server/Xi/setbmap.c b/xorg-server/Xi/setbmap.c
index 37c40e408..2a8f5d3b7 100644
--- a/xorg-server/Xi/setbmap.c
+++ b/xorg-server/Xi/setbmap.c
@@ -71,10 +71,8 @@ SOFTWARE.
int
SProcXSetDeviceButtonMapping(ClientPtr client)
{
- char n;
-
REQUEST(xSetDeviceButtonMappingReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return (ProcXSetDeviceButtonMapping(client));
}
@@ -132,9 +130,7 @@ void
SRepXSetDeviceButtonMapping(ClientPtr client, int size,
xSetDeviceButtonMappingReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/setdval.c b/xorg-server/Xi/setdval.c
index b384f0d3c..ea17852f7 100644
--- a/xorg-server/Xi/setdval.c
+++ b/xorg-server/Xi/setdval.c
@@ -71,10 +71,8 @@ SOFTWARE.
int
SProcXSetDeviceValuators(ClientPtr client)
{
- char n;
-
REQUEST(xSetDeviceValuatorsReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return (ProcXSetDeviceValuators(client));
}
@@ -138,9 +136,7 @@ void
SRepXSetDeviceValuators(ClientPtr client, int size,
xSetDeviceValuatorsReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/setfocus.c b/xorg-server/Xi/setfocus.c
index 03bc37acb..feec3fc35 100644
--- a/xorg-server/Xi/setfocus.c
+++ b/xorg-server/Xi/setfocus.c
@@ -74,13 +74,11 @@ SOFTWARE.
int
SProcXSetDeviceFocus(ClientPtr client)
{
- char n;
-
REQUEST(xSetDeviceFocusReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
- swapl(&stuff->focus, n);
- swapl(&stuff->time, n);
+ swapl(&stuff->focus);
+ swapl(&stuff->time);
return (ProcXSetDeviceFocus(client));
}
diff --git a/xorg-server/Xi/setmmap.c b/xorg-server/Xi/setmmap.c
index cbe5dc8c5..dc6d828a1 100644
--- a/xorg-server/Xi/setmmap.c
+++ b/xorg-server/Xi/setmmap.c
@@ -73,10 +73,8 @@ SOFTWARE.
int
SProcXSetDeviceModifierMapping(ClientPtr client)
{
- char n;
-
REQUEST(xSetDeviceModifierMappingReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return (ProcXSetDeviceModifierMapping(client));
}
@@ -140,9 +138,7 @@ void
SRepXSetDeviceModifierMapping(ClientPtr client, int size,
xSetDeviceModifierMappingReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/setmode.c b/xorg-server/Xi/setmode.c
index 9f88eacf6..80ee764b0 100644
--- a/xorg-server/Xi/setmode.c
+++ b/xorg-server/Xi/setmode.c
@@ -1,146 +1,142 @@
-/************************************************************
-
-Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
-
- 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 Hewlett-Packard not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-HEWLETT-PACKARD 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.
-
-********************************************************/
-
-/***********************************************************************
- *
- * Request to change the mode of an extension input device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "XIstubs.h"
-#include "exglobals.h"
-
-#include "setmode.h"
-
-/***********************************************************************
- *
- * Handle a request from a client with a different byte order.
- *
- */
-
-int
-SProcXSetDeviceMode(ClientPtr client)
-{
- char n;
-
- REQUEST(xSetDeviceModeReq);
- swaps(&stuff->length, n);
- return (ProcXSetDeviceMode(client));
-}
-
-/***********************************************************************
- *
- * This procedure sets the mode of a device.
- *
- */
-
-int
-ProcXSetDeviceMode(ClientPtr client)
-{
- DeviceIntPtr dev;
- xSetDeviceModeReply rep;
- int rc;
-
- REQUEST(xSetDeviceModeReq);
- REQUEST_SIZE_MATCH(xSetDeviceModeReq);
-
- rep.repType = X_Reply;
- rep.RepType = X_SetDeviceMode;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
- if (rc != Success)
- return rc;
- if (dev->valuator == NULL)
- return BadMatch;
- if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))
- rep.status = AlreadyGrabbed;
- else
- rep.status = SetDeviceMode(client, dev, stuff->mode);
-
- if (rep.status == Success)
- valuator_set_mode(dev, VALUATOR_MODE_ALL_AXES, stuff->mode);
- else if (rep.status != AlreadyGrabbed)
- {
- switch(rep.status) {
- case BadMatch:
- case BadImplementation:
- case BadAlloc:
- break;
- default:
- rep.status = BadMode;
- }
- return rep.status;
- }
-
- WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
- return Success;
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XSetDeviceMode function,
- * if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
+/************************************************************
+
+Copyright 1989, 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 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ 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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * Request to change the mode of an extension input device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+#include "exglobals.h"
+
+#include "setmode.h"
+
+/***********************************************************************
+ *
+ * Handle a request from a client with a different byte order.
+ *
+ */
+
+int
+SProcXSetDeviceMode(ClientPtr client)
+{
+ REQUEST(xSetDeviceModeReq);
+ swaps(&stuff->length);
+ return (ProcXSetDeviceMode(client));
+}
+
+/***********************************************************************
+ *
+ * This procedure sets the mode of a device.
+ *
+ */
+
+int
+ProcXSetDeviceMode(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ xSetDeviceModeReply rep;
+ int rc;
+
+ REQUEST(xSetDeviceModeReq);
+ REQUEST_SIZE_MATCH(xSetDeviceModeReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_SetDeviceMode;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
+ if (dev->valuator == NULL)
+ return BadMatch;
+ if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))
+ rep.status = AlreadyGrabbed;
+ else
+ rep.status = SetDeviceMode(client, dev, stuff->mode);
+
+ if (rep.status == Success)
+ valuator_set_mode(dev, VALUATOR_MODE_ALL_AXES, stuff->mode);
+ else if (rep.status != AlreadyGrabbed)
+ {
+ switch(rep.status) {
+ case BadMatch:
+ case BadImplementation:
+ case BadAlloc:
+ break;
+ default:
+ rep.status = BadMode;
+ }
+ return rep.status;
+ }
+
+ WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
+ return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XSetDeviceMode function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ WriteToClient(client, size, (char *)rep);
+}
diff --git a/xorg-server/Xi/ungrdev.c b/xorg-server/Xi/ungrdev.c
index a09c3d024..bc66cfc4b 100644
--- a/xorg-server/Xi/ungrdev.c
+++ b/xorg-server/Xi/ungrdev.c
@@ -70,12 +70,10 @@ SOFTWARE.
int
SProcXUngrabDevice(ClientPtr client)
{
- char n;
-
REQUEST(xUngrabDeviceReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
- swapl(&stuff->time, n);
+ swapl(&stuff->time);
return (ProcXUngrabDevice(client));
}
diff --git a/xorg-server/Xi/ungrdevb.c b/xorg-server/Xi/ungrdevb.c
index 4e93f1ae3..9e9ece47a 100644
--- a/xorg-server/Xi/ungrdevb.c
+++ b/xorg-server/Xi/ungrdevb.c
@@ -76,13 +76,11 @@ SOFTWARE.
int
SProcXUngrabDeviceButton(ClientPtr client)
{
- char n;
-
REQUEST(xUngrabDeviceButtonReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
- swapl(&stuff->grabWindow, n);
- swaps(&stuff->modifiers, n);
+ swapl(&stuff->grabWindow);
+ swaps(&stuff->modifiers);
return (ProcXUngrabDeviceButton(client));
}
diff --git a/xorg-server/Xi/ungrdevk.c b/xorg-server/Xi/ungrdevk.c
index 3b4d6260e..526347db4 100644
--- a/xorg-server/Xi/ungrdevk.c
+++ b/xorg-server/Xi/ungrdevk.c
@@ -78,13 +78,11 @@ SOFTWARE.
int
SProcXUngrabDeviceKey(ClientPtr client)
{
- char n;
-
REQUEST(xUngrabDeviceKeyReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
- swapl(&stuff->grabWindow, n);
- swaps(&stuff->modifiers, n);
+ swapl(&stuff->grabWindow);
+ swaps(&stuff->modifiers);
return (ProcXUngrabDeviceKey(client));
}
diff --git a/xorg-server/Xi/xiallowev.c b/xorg-server/Xi/xiallowev.c
index 3077e1a44..0d45b3654 100644
--- a/xorg-server/Xi/xiallowev.c
+++ b/xorg-server/Xi/xiallowev.c
@@ -44,13 +44,11 @@
int
SProcXIAllowEvents(ClientPtr client)
{
- char n;
-
REQUEST(xXIAllowEventsReq);
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->time, n);
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->time);
return ProcXIAllowEvents(client);
}
diff --git a/xorg-server/Xi/xichangecursor.c b/xorg-server/Xi/xichangecursor.c
index 2d58fa529..48f51f3b5 100644
--- a/xorg-server/Xi/xichangecursor.c
+++ b/xorg-server/Xi/xichangecursor.c
@@ -1,113 +1,111 @@
-/*
- * Copyright 2007-2008 Peter Hutterer
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- * Author: Peter Hutterer, University of South Australia, NICTA
- */
-
-/***********************************************************************
- *
- * Request to change a given device pointer's cursor.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include "scrnintstr.h" /* screen structure */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XI2proto.h>
-#include "extnsionst.h"
-#include "exevents.h"
-#include "exglobals.h"
-#include "input.h"
-
-#include "xichangecursor.h"
-
-/***********************************************************************
- *
- * This procedure allows a client to set one pointer's cursor.
- *
- */
-
-int
-SProcXIChangeCursor(ClientPtr client)
-{
- char n;
-
- REQUEST(xXIChangeCursorReq);
- swaps(&stuff->length, n);
- swapl(&stuff->win, n);
- swapl(&stuff->cursor, n);
- swaps(&stuff->deviceid, n);
- REQUEST_SIZE_MATCH(xXIChangeCursorReq);
- return (ProcXIChangeCursor(client));
-}
-
-int ProcXIChangeCursor(ClientPtr client)
-{
- int rc;
- WindowPtr pWin = NULL;
- DeviceIntPtr pDev = NULL;
- CursorPtr pCursor = NULL;
-
- REQUEST(xXIChangeCursorReq);
- REQUEST_SIZE_MATCH(xXIChangeCursorReq);
-
- rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess);
- if (rc != Success)
- return rc;
-
- if (!IsMaster(pDev) || !IsPointerDevice(pDev))
- return BadDevice;
-
- if (stuff->win != None)
- {
- rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
- if (rc != Success)
- return rc;
- }
-
- if (stuff->cursor == None)
- {
- if (pWin == pWin->drawable.pScreen->root)
- pCursor = rootCursor;
- else
- pCursor = (CursorPtr)None;
- }
- else
- {
- rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor,
- RT_CURSOR, client, DixUseAccess);
- if (rc != Success)
- return rc;
- }
-
- ChangeWindowDeviceCursor(pWin, pDev, pCursor);
-
- return Success;
-}
-
+/*
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, University of South Australia, NICTA
+ */
+
+/***********************************************************************
+ *
+ * Request to change a given device pointer's cursor.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XI2proto.h>
+#include "extnsionst.h"
+#include "exevents.h"
+#include "exglobals.h"
+#include "input.h"
+
+#include "xichangecursor.h"
+
+/***********************************************************************
+ *
+ * This procedure allows a client to set one pointer's cursor.
+ *
+ */
+
+int
+SProcXIChangeCursor(ClientPtr client)
+{
+ REQUEST(xXIChangeCursorReq);
+ swaps(&stuff->length);
+ swapl(&stuff->win);
+ swapl(&stuff->cursor);
+ swaps(&stuff->deviceid);
+ REQUEST_SIZE_MATCH(xXIChangeCursorReq);
+ return (ProcXIChangeCursor(client));
+}
+
+int ProcXIChangeCursor(ClientPtr client)
+{
+ int rc;
+ WindowPtr pWin = NULL;
+ DeviceIntPtr pDev = NULL;
+ CursorPtr pCursor = NULL;
+
+ REQUEST(xXIChangeCursorReq);
+ REQUEST_SIZE_MATCH(xXIChangeCursorReq);
+
+ rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ if (!IsMaster(pDev) || !IsPointerDevice(pDev))
+ return BadDevice;
+
+ if (stuff->win != None)
+ {
+ rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
+ }
+
+ if (stuff->cursor == None)
+ {
+ if (pWin == pWin->drawable.pScreen->root)
+ pCursor = rootCursor;
+ else
+ pCursor = (CursorPtr)None;
+ }
+ else
+ {
+ rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor,
+ RT_CURSOR, client, DixUseAccess);
+ if (rc != Success)
+ return rc;
+ }
+
+ ChangeWindowDeviceCursor(pWin, pDev, pCursor);
+
+ return Success;
+}
+
diff --git a/xorg-server/Xi/xichangehierarchy.c b/xorg-server/Xi/xichangehierarchy.c
index 96ead6fcd..614d23116 100644
--- a/xorg-server/Xi/xichangehierarchy.c
+++ b/xorg-server/Xi/xichangehierarchy.c
@@ -133,10 +133,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
int SProcXIChangeHierarchy(ClientPtr client)
{
- char n;
-
REQUEST(xXIChangeHierarchyReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
return (ProcXIChangeHierarchy(client));
}
@@ -424,7 +422,6 @@ ProcXIChangeHierarchy(ClientPtr client)
{
xXIAnyHierarchyChangeInfo *any;
int required_len = sizeof(xXIChangeHierarchyReq);
- char n;
int rc = Success;
int flags[MAXDEVICES] = {0};
@@ -437,8 +434,8 @@ ProcXIChangeHierarchy(ClientPtr client)
any = (xXIAnyHierarchyChangeInfo*)&stuff[1];
while(stuff->num_changes--)
{
- SWAPIF(swapl(&any->type, n));
- SWAPIF(swaps(&any->length, n));
+ SWAPIF(swaps(&any->type));
+ SWAPIF(swaps(&any->length));
required_len += any->length;
if ((stuff->length * 4) < required_len)
@@ -449,7 +446,7 @@ ProcXIChangeHierarchy(ClientPtr client)
case XIAddMaster:
{
xXIAddMasterInfo* c = (xXIAddMasterInfo*)any;
- SWAPIF(swaps(&c->name_len, n));
+ SWAPIF(swaps(&c->name_len));
rc = add_master(client, c, flags);
if (rc != Success)
diff --git a/xorg-server/Xi/xigetclientpointer.c b/xorg-server/Xi/xigetclientpointer.c
index 401e89fb4..1124ae08c 100644
--- a/xorg-server/Xi/xigetclientpointer.c
+++ b/xorg-server/Xi/xigetclientpointer.c
@@ -49,11 +49,10 @@
int
SProcXIGetClientPointer(ClientPtr client)
{
- char n;
REQUEST(xXIGetClientPointerReq);
- swaps(&stuff->length, n);
- swapl(&stuff->win, n);
+ swaps(&stuff->length);
+ swapl(&stuff->win);
return ProcXIGetClientPointer(client);
}
@@ -97,10 +96,9 @@ void
SRepXIGetClientPointer(ClientPtr client, int size,
xXIGetClientPointerReply* rep)
{
- char n;
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->deviceid, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->deviceid);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/xigrabdev.c b/xorg-server/Xi/xigrabdev.c
index 05c732c89..a9b655c0e 100644
--- a/xorg-server/Xi/xigrabdev.c
+++ b/xorg-server/Xi/xigrabdev.c
@@ -1,161 +1,155 @@
-/*
- * Copyright © 2009 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- * Author: Peter Hutterer
- */
-
-/***********************************************************************
- *
- * Request to grab or ungrab input device.
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "inputstr.h" /* DeviceIntPtr */
-#include "windowstr.h" /* window structure */
-#include <X11/extensions/XI2.h>
-#include <X11/extensions/XI2proto.h>
-
-#include "exglobals.h" /* BadDevice */
-#include "exevents.h"
-#include "xigrabdev.h"
-
-int
-SProcXIGrabDevice(ClientPtr client)
-{
- char n;
-
- REQUEST(xXIGrabDeviceReq);
-
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->grab_window, n);
- swapl(&stuff->cursor, n);
- swapl(&stuff->time, n);
- swaps(&stuff->mask_len, n);
-
- return ProcXIGrabDevice(client);
-}
-
-int
-ProcXIGrabDevice(ClientPtr client)
-{
- DeviceIntPtr dev;
- xXIGrabDeviceReply rep;
- int ret = Success;
- uint8_t status;
- GrabMask mask;
- int mask_len;
-
- REQUEST(xXIGrabDeviceReq);
- REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq);
-
- ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
- if (ret != Success)
- return ret;
-
- if (!IsMaster(dev))
- stuff->paired_device_mode = GrabModeAsync;
-
- if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
- stuff->mask_len * 4) != Success)
- return BadValue;
-
- mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4);
- memset(mask.xi2mask, 0, sizeof(mask.xi2mask));
- memcpy(mask.xi2mask, (char*)&stuff[1], mask_len);
-
- ret = GrabDevice(client, dev, stuff->grab_mode,
- stuff->paired_device_mode,
- stuff->grab_window,
- stuff->owner_events,
- stuff->time,
- &mask,
- GRABTYPE_XI2,
- stuff->cursor,
- None /* confineTo */,
- &status);
-
- if (ret != Success)
- return ret;
-
- rep.repType = X_Reply;
- rep.RepType = X_XIGrabDevice;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.status = status;
-
-
- WriteReplyToClient(client, sizeof(rep), &rep);
- return ret;
-}
-
-int
-SProcXIUngrabDevice(ClientPtr client)
-{
- char n;
-
- REQUEST(xXIUngrabDeviceReq);
-
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->time, n);
-
- return ProcXIUngrabDevice(client);
-}
-
-int
-ProcXIUngrabDevice(ClientPtr client)
-{
- DeviceIntPtr dev;
- GrabPtr grab;
- int ret = Success;
- TimeStamp time;
-
- REQUEST(xXIUngrabDeviceReq);
-
- ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
- if (ret != Success)
- return ret;
-
- grab = dev->deviceGrab.grab;
-
- time = ClientTimeToServerTime(stuff->time);
- if ((CompareTimeStamps(time, currentTime) != LATER) &&
- (CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) &&
- (grab) && SameClient(grab, client) && grab->grabtype == GRABTYPE_XI2)
- (*dev->deviceGrab.DeactivateGrab) (dev);
-
- return Success;
-}
-
-void SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer
+ */
+
+/***********************************************************************
+ *
+ * Request to grab or ungrab input device.
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/XI2proto.h>
+
+#include "exglobals.h" /* BadDevice */
+#include "exevents.h"
+#include "xigrabdev.h"
+
+int
+SProcXIGrabDevice(ClientPtr client)
+{
+ REQUEST(xXIGrabDeviceReq);
+
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->grab_window);
+ swapl(&stuff->cursor);
+ swapl(&stuff->time);
+ swaps(&stuff->mask_len);
+
+ return ProcXIGrabDevice(client);
+}
+
+int
+ProcXIGrabDevice(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ xXIGrabDeviceReply rep;
+ int ret = Success;
+ uint8_t status;
+ GrabMask mask;
+ int mask_len;
+
+ REQUEST(xXIGrabDeviceReq);
+ REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq);
+
+ ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
+ if (ret != Success)
+ return ret;
+
+ if (!IsMaster(dev))
+ stuff->paired_device_mode = GrabModeAsync;
+
+ if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
+ stuff->mask_len * 4) != Success)
+ return BadValue;
+
+ mask_len = min(sizeof(mask.xi2mask[stuff->deviceid]), stuff->mask_len * 4);
+ memset(mask.xi2mask, 0, sizeof(mask.xi2mask));
+ memcpy(mask.xi2mask, (char*)&stuff[1], mask_len);
+
+ ret = GrabDevice(client, dev, stuff->grab_mode,
+ stuff->paired_device_mode,
+ stuff->grab_window,
+ stuff->owner_events,
+ stuff->time,
+ &mask,
+ GRABTYPE_XI2,
+ stuff->cursor,
+ None /* confineTo */,
+ &status);
+
+ if (ret != Success)
+ return ret;
+
+ rep.repType = X_Reply;
+ rep.RepType = X_XIGrabDevice;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.status = status;
+
+
+ WriteReplyToClient(client, sizeof(rep), &rep);
+ return ret;
+}
+
+int
+SProcXIUngrabDevice(ClientPtr client)
+{
+ REQUEST(xXIUngrabDeviceReq);
+
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->time);
+
+ return ProcXIUngrabDevice(client);
+}
+
+int
+ProcXIUngrabDevice(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ GrabPtr grab;
+ int ret = Success;
+ TimeStamp time;
+
+ REQUEST(xXIUngrabDeviceReq);
+
+ ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
+ if (ret != Success)
+ return ret;
+
+ grab = dev->deviceGrab.grab;
+
+ time = ClientTimeToServerTime(stuff->time);
+ if ((CompareTimeStamps(time, currentTime) != LATER) &&
+ (CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) &&
+ (grab) && SameClient(grab, client) && grab->grabtype == GRABTYPE_XI2)
+ (*dev->deviceGrab.DeactivateGrab) (dev);
+
+ return Success;
+}
+
+void SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ WriteToClient(client, size, (char *)rep);
+}
diff --git a/xorg-server/Xi/xipassivegrab.c b/xorg-server/Xi/xipassivegrab.c
index ae4343344..6b4574854 100644
--- a/xorg-server/Xi/xipassivegrab.c
+++ b/xorg-server/Xi/xipassivegrab.c
@@ -49,27 +49,26 @@ int
SProcXIPassiveGrabDevice(ClientPtr client)
{
int i;
- char n;
xXIModifierInfo *mods;
REQUEST(xXIPassiveGrabDeviceReq);
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->grab_window, n);
- swapl(&stuff->cursor, n);
- swapl(&stuff->time, n);
- swapl(&stuff->detail, n);
- swaps(&stuff->mask_len, n);
- swaps(&stuff->num_modifiers, n);
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->grab_window);
+ swapl(&stuff->cursor);
+ swapl(&stuff->time);
+ swapl(&stuff->detail);
+ swaps(&stuff->mask_len);
+ swaps(&stuff->num_modifiers);
mods = (xXIModifierInfo*)&stuff[1];
for (i = 0; i < stuff->num_modifiers; i++, mods++)
{
- swapl(&mods->base_mods, n);
- swapl(&mods->latched_mods, n);
- swapl(&mods->locked_mods, n);
+ swapl(&mods->base_mods);
+ swapl(&mods->latched_mods);
+ swapl(&mods->locked_mods);
}
return ProcXIPassiveGrabDevice(client);
@@ -88,7 +87,6 @@ ProcXIPassiveGrabDevice(ClientPtr client)
GrabParameters param;
void *tmp;
int mask_len;
- int n;
REQUEST(xXIPassiveGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
@@ -198,7 +196,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
info->status = status;
info->modifiers = *modifiers;
if (client->swapped)
- swapl(&info->modifiers, n);
+ swapl(&info->modifiers);
rep.num_modifiers++;
rep.length += bytes_to_int32(sizeof(xXIGrabModifierInfo));
@@ -217,11 +215,9 @@ void
SRepXIPassiveGrabDevice(ClientPtr client, int size,
xXIPassiveGrabDeviceReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->num_modifiers, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_modifiers);
WriteToClient(client, size, (char *)rep);
}
@@ -229,22 +225,21 @@ SRepXIPassiveGrabDevice(ClientPtr client, int size,
int
SProcXIPassiveUngrabDevice(ClientPtr client)
{
- char n;
int i;
uint32_t *modifiers;
REQUEST(xXIPassiveUngrabDeviceReq);
- swaps(&stuff->length, n);
- swapl(&stuff->grab_window, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->detail, n);
- swaps(&stuff->num_modifiers, n);
+ swaps(&stuff->length);
+ swapl(&stuff->grab_window);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->detail);
+ swaps(&stuff->num_modifiers);
modifiers = (uint32_t*)&stuff[1];
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
- swapl(modifiers, n);
+ swapl(modifiers);
return ProcXIPassiveUngrabDevice(client);
}
diff --git a/xorg-server/Xi/xiproperty.c b/xorg-server/Xi/xiproperty.c
index b10891d1c..fa0d81188 100644
--- a/xorg-server/Xi/xiproperty.c
+++ b/xorg-server/Xi/xiproperty.c
@@ -1,1362 +1,1348 @@
-/*
- * Copyright © 2006 Keith Packard
- * Copyright © 2008 Peter Hutterer
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WAXIANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WAXIANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- */
-
-/* This code is a modified version of randr/rrproperty.c */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "dix.h"
-#include "inputstr.h"
-#include <X11/extensions/XI.h>
-#include <X11/Xatom.h>
-#include <X11/extensions/XIproto.h>
-#include <X11/extensions/XI2proto.h>
-#include "exglobals.h"
-#include "exevents.h"
-#include "swaprep.h"
-
-#include "xiproperty.h"
-#include "xserver-properties.h"
-
-/**
- * Properties used or alloced from inside the server.
- */
-static struct dev_properties
-{
- Atom type;
- 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_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;
-
-static void send_property_event(DeviceIntPtr dev, Atom property, int what)
-{
- devicePropertyNotify event;
- xXIPropertyEvent xi2;
- int state;
-
- 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);
-}
-
-static int list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
-{
- XIPropertyPtr prop;
- Atom *atoms = NULL;
- int nprops = 0;
-
- for (prop = dev->properties.properties; prop; prop = prop->next)
- nprops++;
- if (nprops)
- {
- Atom *a;
-
- atoms = malloc(nprops * sizeof(Atom));
- if(!atoms)
- return BadAlloc;
- a = atoms;
- for (prop = dev->properties.properties; prop; prop = prop->next, a++)
- *a = prop->propertyName;
- }
-
- *natoms = nprops;
- *atoms_return = atoms;
- return Success;
-}
-
-static int
-get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
- BOOL delete, int offset, int length,
- int *bytes_after, Atom *type_return, int *format, int *nitems,
- int *length_return, char **data)
-{
- unsigned long n, len, ind;
- int rc;
- XIPropertyPtr prop;
- XIPropertyValuePtr prop_value;
-
- if (!ValidAtom(property))
- {
- client->errorValue = property;
- return BadAtom;
- }
- if ((delete != xTrue) && (delete != xFalse))
- {
- client->errorValue = delete;
- return BadValue;
- }
-
- if ((type != AnyPropertyType) && !ValidAtom(type))
- {
- client->errorValue = type;
- return BadAtom;
- }
-
- for (prop = dev->properties.properties; prop; prop = prop->next)
- if (prop->propertyName == property)
- break;
-
- if (!prop)
- {
- *bytes_after = 0;
- *type_return = None;
- *format = 0;
- *nitems = 0;
- *length_return = 0;
- return Success;
- }
-
- rc = XIGetDeviceProperty(dev, property, &prop_value);
- if (rc != Success)
- {
- client->errorValue = property;
- return rc;
- }
-
- /* If the request type and actual type don't match. Return the
- property information, but not the data. */
-
- if (((type != prop_value->type) && (type != AnyPropertyType)))
- {
- *bytes_after = prop_value->size;
- *format = prop_value->format;
- *length_return = 0;
- *nitems = 0;
- *type_return = prop_value->type;
- return Success;
- }
-
- /* Return type, format, value to client */
- n = (prop_value->format/8) * prop_value->size; /* size (bytes) of prop */
- ind = offset << 2;
-
- /* If offset is invalid such that it causes "len" to
- be negative, it's a value error. */
-
- if (n < ind)
- {
- client->errorValue = offset;
- return BadValue;
- }
-
- len = min(n - ind, 4 * length);
-
- *bytes_after = n - (ind + len);
- *format = prop_value->format;
- *length_return = len;
- if (prop_value->format)
- *nitems = len / (prop_value->format / 8);
- else
- *nitems = 0;
- *type_return = prop_value->type;
-
- *data = (char*)prop_value->data + ind;
-
- return Success;
-}
-
-static int
-check_change_property(ClientPtr client, Atom property, Atom type, int format,
- int mode, int nitems)
-{
- if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
- (mode != PropModePrepend))
- {
- client->errorValue = mode;
- return BadValue;
- }
- if ((format != 8) && (format != 16) && (format != 32))
- {
- client->errorValue = format;
- return BadValue;
- }
-
- if (!ValidAtom(property))
- {
- client->errorValue = property;
- return BadAtom;
- }
- if (!ValidAtom(type))
- {
- client->errorValue = type;
- return BadAtom;
- }
-
- return Success;
-}
-
-static int
-change_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
- int format, int mode, int len, void *data)
-{
- int rc = Success;
-
- rc = XIChangeDeviceProperty(dev, property, type, format, mode, len, data, TRUE);
- if (rc != Success)
- client->errorValue = property;
-
- return rc;
-}
-
-/**
- * Return the atom assigned to the specified string or 0 if the atom isn't known
- * to the DIX.
- *
- * If name is NULL, None is returned.
- */
-Atom
-XIGetKnownProperty(char *name)
-{
- int i;
-
- if (!name)
- return None;
-
- for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
- {
- if (strcmp(name, dev_properties[i].name) == 0){
- if (dev_properties[i].type == None){
- dev_properties[i].type =
- MakeAtom(dev_properties[i].name,
- strlen(dev_properties[i].name),
- TRUE);
- }
-
- return dev_properties[i].type;
- }
- }
-
- return 0;
-}
-
-void
-XIResetProperties(void)
-{
- int i;
-
- for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
- dev_properties[i].type = None;
-}
-
-/**
- * Convert the given property's value(s) into @nelem_return integer values and
- * store them in @buf_return. If @nelem_return is larger than the number of
- * values in the property, @nelem_return is set to the number of values in the
- * property.
- *
- * If *@buf_return is NULL and @nelem_return is 0, memory is allocated
- * automatically and must be freed by the caller.
- *
- * Possible return codes.
- * Success ... No error.
- * BadMatch ... Wrong atom type, atom is not XA_INTEGER
- * BadAlloc ... NULL passed as buffer and allocation failed.
- * BadLength ... @buff is NULL but @nelem_return is non-zero.
- *
- * @param val The property value
- * @param nelem_return The maximum number of elements to return.
- * @param buf_return Pointer to an array of at least @nelem_return values.
- * @return Success or the error code if an error occured.
- */
-_X_EXPORT int
-XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
-{
- int i;
- int *buf;
-
- if (val->type != XA_INTEGER)
- return BadMatch;
- if (!*buf_return && *nelem_return)
- return BadLength;
-
- switch(val->format)
- {
- case 8:
- case 16:
- case 32:
- break;
- default:
- return BadValue;
- }
-
- buf = *buf_return;
-
- if (!buf && !(*nelem_return))
- {
- buf = calloc(val->size, sizeof(int));
- if (!buf)
- return BadAlloc;
- *buf_return = buf;
- *nelem_return = val->size;
- } else if (val->size < *nelem_return)
- *nelem_return = val->size;
-
- for (i = 0; i < val->size && i < *nelem_return; i++)
- {
- switch(val->format)
- {
- case 8: buf[i] = ((CARD8*)val->data)[i]; break;
- case 16: buf[i] = ((CARD16*)val->data)[i]; break;
- case 32: buf[i] = ((CARD32*)val->data)[i]; break;
- }
- }
-
- return Success;
-}
-
-/**
- * Convert the given property's value(s) into @nelem_return float values and
- * store them in @buf_return. If @nelem_return is larger than the number of
- * values in the property, @nelem_return is set to the number of values in the
- * property.
- *
- * If *@buf_return is NULL and @nelem_return is 0, memory is allocated
- * automatically and must be freed by the caller.
- *
- * Possible errors returned:
- * Success
- * BadMatch ... Wrong atom type, atom is not XA_FLOAT
- * BadValue ... Wrong format, format is not 32
- * BadAlloc ... NULL passed as buffer and allocation failed.
- * BadLength ... @buff is NULL but @nelem_return is non-zero.
- *
- * @param val The property value
- * @param nelem_return The maximum number of elements to return.
- * @param buf_return Pointer to an array of at least @nelem_return values.
- * @return Success or the error code if an error occured.
- */
-_X_EXPORT int
-XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
-{
- int i;
- float *buf;
-
- if (!val->type || val->type != XIGetKnownProperty(XATOM_FLOAT))
- return BadMatch;
-
- if (val->format != 32)
- return BadValue;
- if (!*buf_return && *nelem_return)
- return BadLength;
-
- buf = *buf_return;
-
- if (!buf && !(*nelem_return))
- {
- buf = calloc(val->size, sizeof(float));
- if (!buf)
- return BadAlloc;
- *buf_return = buf;
- *nelem_return = val->size;
- } else if (val->size < *nelem_return)
- *nelem_return = val->size;
-
- for (i = 0; i < val->size && i < *nelem_return; i++)
- buf[i] = ((float*)val->data)[i];
-
- return Success;
-}
-
-/* Registers a new property handler on the given device and returns a unique
- * identifier for this handler. This identifier is required to unregister the
- * property handler again.
- * @return The handler's identifier or 0 if an error occured.
- */
-long
-XIRegisterPropertyHandler(DeviceIntPtr dev,
- int (*SetProperty) (DeviceIntPtr dev,
- Atom property,
- XIPropertyValuePtr prop,
- BOOL checkonly),
- int (*GetProperty) (DeviceIntPtr dev,
- Atom property),
- int (*DeleteProperty) (DeviceIntPtr dev,
- Atom property))
-{
- XIPropertyHandlerPtr new_handler;
-
- new_handler = calloc(1, sizeof(XIPropertyHandler));
- if (!new_handler)
- return 0;
-
- new_handler->id = XIPropHandlerID++;
- new_handler->SetProperty = SetProperty;
- new_handler->GetProperty = GetProperty;
- new_handler->DeleteProperty = DeleteProperty;
- new_handler->next = dev->properties.handlers;
- dev->properties.handlers = new_handler;
-
- return new_handler->id;
-}
-
-void
-XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
-{
- XIPropertyHandlerPtr curr, prev = NULL;
-
- curr = dev->properties.handlers;
- while(curr && curr->id != id)
- {
- prev = curr;
- curr = curr->next;
- }
-
- if (!curr)
- return;
-
- if (!prev) /* first one */
- dev->properties.handlers = curr->next;
- else
- prev->next = curr->next;
-
- free(curr);
-}
-
-static XIPropertyPtr
-XICreateDeviceProperty (Atom property)
-{
- XIPropertyPtr prop;
-
- prop = (XIPropertyPtr)malloc(sizeof(XIPropertyRec));
- if (!prop)
- return NULL;
-
- prop->next = NULL;
- prop->propertyName = property;
- prop->value.type = None;
- prop->value.format = 0;
- prop->value.size = 0;
- prop->value.data = NULL;
- prop->deletable = TRUE;
-
- return prop;
-}
-
-static XIPropertyPtr
-XIFetchDeviceProperty(DeviceIntPtr dev, Atom property)
-{
- XIPropertyPtr prop;
-
- for (prop = dev->properties.properties; prop; prop = prop->next)
- if (prop->propertyName == property)
- return prop;
- return NULL;
-}
-
-static void
-XIDestroyDeviceProperty (XIPropertyPtr prop)
-{
- free(prop->value.data);
- free(prop);
-}
-
-/* This function destroys all of the device's property-related stuff,
- * including removing all device handlers.
- * DO NOT CALL FROM THE DRIVER.
- */
-void
-XIDeleteAllDeviceProperties (DeviceIntPtr device)
-{
- XIPropertyPtr prop, next;
- XIPropertyHandlerPtr curr_handler, next_handler;
-
- for (prop = device->properties.properties; prop; prop = next)
- {
- next = prop->next;
- send_property_event(device, prop->propertyName, XIPropertyDeleted);
- XIDestroyDeviceProperty(prop);
- }
-
- device->properties.properties = NULL;
-
- /* Now free all handlers */
- curr_handler = device->properties.handlers;
- while(curr_handler)
- {
- next_handler = curr_handler->next;
- free(curr_handler);
- curr_handler = next_handler;
- }
-
- device->properties.handlers = NULL;
-}
-
-
-int
-XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
-{
- XIPropertyPtr prop, *prev;
- int rc = Success;
-
- for (prev = &device->properties.properties; (prop = *prev); prev = &(prop->next))
- if (prop->propertyName == property)
- break;
-
- if (!prop)
- return Success;
-
- if (fromClient && !prop->deletable)
- return BadAccess;
-
- /* Ask handlers if we may delete the property */
- if (device->properties.handlers)
- {
- XIPropertyHandlerPtr handler = device->properties.handlers;
- while(handler)
- {
- if (handler->DeleteProperty)
- rc = handler->DeleteProperty(device, prop->propertyName);
- if (rc != Success)
- return rc;
- handler = handler->next;
- }
- }
-
- if (prop)
- {
- *prev = prop->next;
- send_property_event(device, prop->propertyName, XIPropertyDeleted);
- XIDestroyDeviceProperty (prop);
- }
-
- return Success;
-}
-
-int
-XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
- int format, int mode, unsigned long len,
- const pointer value, Bool sendevent)
-{
- XIPropertyPtr prop;
- int size_in_bytes;
- int total_size;
- unsigned long total_len;
- XIPropertyValuePtr prop_value;
- XIPropertyValueRec new_value;
- Bool add = FALSE;
- int rc;
-
- size_in_bytes = format >> 3;
-
- /* first see if property already exists */
- prop = XIFetchDeviceProperty (dev, property);
- if (!prop) /* just add to list */
- {
- prop = XICreateDeviceProperty (property);
- if (!prop)
- return BadAlloc;
- add = TRUE;
- mode = PropModeReplace;
- }
- prop_value = &prop->value;
-
- /* To append or prepend to a property the request format and type
- must match those of the already defined property. The
- existing format and type are irrelevant when using the mode
- "PropModeReplace" since they will be written over. */
-
- if ((format != prop_value->format) && (mode != PropModeReplace))
- return BadMatch;
- if ((prop_value->type != type) && (mode != PropModeReplace))
- return BadMatch;
- new_value = *prop_value;
- if (mode == PropModeReplace)
- total_len = len;
- else
- total_len = prop_value->size + len;
-
- if (mode == PropModeReplace || len > 0)
- {
- pointer new_data = NULL, old_data = NULL;
-
- total_size = total_len * size_in_bytes;
- new_value.data = (pointer)malloc(total_size);
- if (!new_value.data && total_size)
- {
- if (add)
- XIDestroyDeviceProperty (prop);
- return BadAlloc;
- }
- new_value.size = len;
- new_value.type = type;
- new_value.format = format;
-
- switch (mode) {
- case PropModeReplace:
- new_data = new_value.data;
- old_data = NULL;
- break;
- case PropModeAppend:
- new_data = (pointer) (((char *) new_value.data) +
- (prop_value->size * size_in_bytes));
- old_data = new_value.data;
- break;
- case PropModePrepend:
- new_data = new_value.data;
- old_data = (pointer) (((char *) new_value.data) +
- (prop_value->size * size_in_bytes));
- break;
- }
- if (new_data)
- memcpy ((char *) new_data, (char *) value, len * size_in_bytes);
- if (old_data)
- memcpy ((char *) old_data, (char *) prop_value->data,
- prop_value->size * size_in_bytes);
-
- if (dev->properties.handlers)
- {
- XIPropertyHandlerPtr handler;
- BOOL checkonly = TRUE;
- /* run through all handlers with checkonly TRUE, then again with
- * checkonly FALSE. Handlers MUST return error codes on the
- * checkonly run, errors on the second run are ignored */
- do
- {
- handler = dev->properties.handlers;
- while(handler)
- {
- if (handler->SetProperty)
- {
- rc = handler->SetProperty(dev, prop->propertyName,
- &new_value, checkonly);
- if (checkonly && rc != Success)
- {
- free(new_value.data);
- return rc;
- }
- }
- handler = handler->next;
- }
- checkonly = !checkonly;
- } while (!checkonly);
- }
- free(prop_value->data);
- *prop_value = new_value;
- } else if (len == 0)
- {
- /* do nothing */
- }
-
- if (add)
- {
- prop->next = dev->properties.properties;
- dev->properties.properties = prop;
- }
-
- if (sendevent)
- send_property_event(dev, prop->propertyName,
- (add) ? XIPropertyCreated : XIPropertyModified);
-
- return Success;
-}
-
-int
-XIGetDeviceProperty (DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
-{
- XIPropertyPtr prop = XIFetchDeviceProperty (dev, property);
- int rc;
-
- if (!prop)
- {
- *value = NULL;
- return BadAtom;
- }
-
- /* If we can, try to update the property value first */
- if (dev->properties.handlers)
- {
- XIPropertyHandlerPtr handler = dev->properties.handlers;
- while(handler)
- {
- if (handler->GetProperty)
- {
- rc = handler->GetProperty(dev, prop->propertyName);
- if (rc != Success)
- {
- *value = NULL;
- return rc;
- }
- }
- handler = handler->next;
- }
- }
-
- *value = &prop->value;
- return Success;
-}
-
-int
-XISetDevicePropertyDeletable(DeviceIntPtr dev, Atom property, Bool deletable)
-{
- XIPropertyPtr prop = XIFetchDeviceProperty(dev, property);
-
- if (!prop)
- return BadAtom;
-
- prop->deletable = deletable;
- return Success;
-}
-
-int
-ProcXListDeviceProperties (ClientPtr client)
-{
- Atom *atoms;
- xListDevicePropertiesReply rep;
- int natoms;
- DeviceIntPtr dev;
- int rc = Success;
-
- REQUEST(xListDevicePropertiesReq);
- REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
-
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
- if (rc != Success)
- return rc;
-
- rc = list_atoms(dev, &natoms, &atoms);
- if (rc != Success)
- return rc;
-
- rep.repType = X_Reply;
- rep.RepType = X_ListDeviceProperties;
- rep.length = natoms;
- rep.sequenceNumber = client->sequence;
- rep.nAtoms = natoms;
-
- WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
- if (natoms)
- {
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
- WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
- free(atoms);
- }
- return rc;
-}
-
-int
-ProcXChangeDeviceProperty (ClientPtr client)
-{
- REQUEST(xChangeDevicePropertyReq);
- DeviceIntPtr dev;
- unsigned long len;
- int totalSize;
- int rc;
-
- REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
- UpdateCurrentTime();
-
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
- if (rc != Success)
- return rc;
-
- rc = check_change_property(client, stuff->property, stuff->type,
- stuff->format, stuff->mode, stuff->nUnits);
-
- len = stuff->nUnits;
- if (len > (bytes_to_int32(0xffffffff - sizeof(xChangeDevicePropertyReq))))
- return BadLength;
-
- totalSize = len * (stuff->format/8);
- REQUEST_FIXED_SIZE(xChangeDevicePropertyReq, totalSize);
-
- rc = change_property(client, dev, stuff->property, stuff->type,
- stuff->format, stuff->mode, len, (void*)&stuff[1]);
- return rc;
-}
-
-int
-ProcXDeleteDeviceProperty (ClientPtr client)
-{
- REQUEST(xDeleteDevicePropertyReq);
- DeviceIntPtr dev;
- int rc;
-
- REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
- UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
- if (rc != Success)
- return rc;
-
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
- }
-
- rc = XIDeleteDeviceProperty(dev, stuff->property, TRUE);
- return rc;
-}
-
-int
-ProcXGetDeviceProperty (ClientPtr client)
-{
- REQUEST(xGetDevicePropertyReq);
- DeviceIntPtr dev;
- int length;
- int rc, format, nitems, bytes_after;
- char *data;
- Atom type;
- xGetDevicePropertyReply reply;
-
- REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
- if (stuff->delete)
- UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client,
- stuff->delete ? DixSetPropAccess :
- DixGetPropAccess);
- if (rc != Success)
- return rc;
-
- rc = get_property(client, dev, stuff->property, stuff->type,
- stuff->delete, stuff->longOffset, stuff->longLength,
- &bytes_after, &type, &format, &nitems, &length, &data);
-
- 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);
-
- if (stuff->delete && (reply.bytesAfter == 0))
- send_property_event(dev, stuff->property, XIPropertyDeleted);
-
- WriteReplyToClient(client, sizeof(xGenericReply), &reply);
-
- if (length)
- {
- switch (reply.format) {
- case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
- default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
- }
- WriteSwappedDataToClient(client, length, data);
- }
-
- /* delete the Property */
- if (stuff->delete && (reply.bytesAfter == 0))
- {
- XIPropertyPtr prop, *prev;
- for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
- {
- if (prop->propertyName == stuff->property)
- {
- *prev = prop->next;
- XIDestroyDeviceProperty(prop);
- break;
- }
- }
- }
- return Success;
-}
-
-
-int
-SProcXListDeviceProperties (ClientPtr client)
-{
- char n;
- REQUEST(xListDevicePropertiesReq);
-
- swaps(&stuff->length, n);
-
- REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
- return (ProcXListDeviceProperties(client));
-}
-
-int
-SProcXChangeDeviceProperty (ClientPtr client)
-{
- char n;
- REQUEST(xChangeDevicePropertyReq);
-
- REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
- swaps(&stuff->length, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->nUnits, n);
- return (ProcXChangeDeviceProperty(client));
-}
-
-int
-SProcXDeleteDeviceProperty (ClientPtr client)
-{
- char n;
- REQUEST(xDeleteDevicePropertyReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->property, n);
- REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
- return (ProcXDeleteDeviceProperty(client));
-}
-
-int
-SProcXGetDeviceProperty (ClientPtr client)
-{
- char n;
- REQUEST(xGetDevicePropertyReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->longOffset, n);
- swapl(&stuff->longLength, n);
- REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
- return (ProcXGetDeviceProperty(client));
-}
-
-
-/* Reply swapping */
-
-void
-SRepXListDeviceProperties(ClientPtr client, int size,
- xListDevicePropertiesReply *rep)
-{
- char n;
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->nAtoms, n);
- /* properties will be swapped later, see ProcXListDeviceProperties */
- WriteToClient(client, size, (char*)rep);
-}
-
-void
-SRepXGetDeviceProperty(ClientPtr client, int size,
- xGetDevicePropertyReply *rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->propertyType, n);
- swapl(&rep->bytesAfter, n);
- swapl(&rep->nItems, n);
- /* data will be swapped, see ProcXGetDeviceProperty */
- WriteToClient(client, size, (char*)rep);
-}
-
-/* XI2 Request/reply handling */
-int
-ProcXIListProperties(ClientPtr client)
-{
- Atom *atoms;
- xXIListPropertiesReply rep;
- int natoms;
- DeviceIntPtr dev;
- int rc = Success;
-
- REQUEST(xXIListPropertiesReq);
- REQUEST_SIZE_MATCH(xXIListPropertiesReq);
-
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
- if (rc != Success)
- return rc;
-
- rc = list_atoms(dev, &natoms, &atoms);
- if (rc != Success)
- return rc;
-
- rep.repType = X_Reply;
- rep.RepType = X_XIListProperties;
- rep.length = natoms;
- rep.sequenceNumber = client->sequence;
- rep.num_properties = natoms;
-
- WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep);
- if (natoms)
- {
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
- WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
- free(atoms);
- }
- return rc;
-}
-
-int
-ProcXIChangeProperty(ClientPtr client)
-{
- int rc;
- DeviceIntPtr dev;
- int totalSize;
- unsigned long len;
-
- REQUEST(xXIChangePropertyReq);
- REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
- UpdateCurrentTime();
-
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
- if (rc != Success)
- return rc;
-
- rc = check_change_property(client, stuff->property, stuff->type,
- stuff->format, stuff->mode, stuff->num_items);
- len = stuff->num_items;
- if (len > bytes_to_int32(0xffffffff - sizeof(xXIChangePropertyReq)))
- return BadLength;
-
- totalSize = len * (stuff->format/8);
- REQUEST_FIXED_SIZE(xXIChangePropertyReq, totalSize);
-
- rc = change_property(client, dev, stuff->property, stuff->type,
- stuff->format, stuff->mode, len, (void*)&stuff[1]);
- return rc;
-}
-
-int
-ProcXIDeleteProperty(ClientPtr client)
-{
- DeviceIntPtr dev;
- int rc;
- REQUEST(xXIDeletePropertyReq);
-
- REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
- UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
- if (rc != Success)
- return rc;
-
- if (!ValidAtom(stuff->property))
- {
- client->errorValue = stuff->property;
- return BadAtom;
- }
-
- rc = XIDeleteDeviceProperty(dev, stuff->property, TRUE);
- return rc;
-}
-
-
-int
-ProcXIGetProperty(ClientPtr client)
-{
- REQUEST(xXIGetPropertyReq);
- DeviceIntPtr dev;
- xXIGetPropertyReply reply;
- int length;
- int rc, format, nitems, bytes_after;
- char *data;
- Atom type;
-
- REQUEST_SIZE_MATCH(xXIGetPropertyReq);
- if (stuff->delete)
- UpdateCurrentTime();
- rc = dixLookupDevice (&dev, stuff->deviceid, client,
- stuff->delete ? DixSetPropAccess :
- DixGetPropAccess);
- if (rc != Success)
- return rc;
-
- rc = get_property(client, dev, stuff->property, stuff->type,
- stuff->delete, stuff->offset, stuff->len,
- &bytes_after, &type, &format, &nitems, &length, &data);
-
- 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);
-
- if (length && stuff->delete && (reply.bytes_after == 0))
- send_property_event(dev, stuff->property, XIPropertyDeleted);
-
- WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &reply);
-
- if (length)
- {
- switch (reply.format) {
- case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
- default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
- }
- WriteSwappedDataToClient(client, length, data);
- }
-
- /* delete the Property */
- if (stuff->delete && (reply.bytes_after == 0))
- {
- XIPropertyPtr prop, *prev;
- for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
- {
- if (prop->propertyName == stuff->property)
- {
- *prev = prop->next;
- XIDestroyDeviceProperty(prop);
- break;
- }
- }
- }
-
- return Success;
-}
-
-int
-SProcXIListProperties(ClientPtr client)
-{
- char n;
- REQUEST(xXIListPropertiesReq);
-
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
-
- REQUEST_SIZE_MATCH(xXIListPropertiesReq);
- return (ProcXIListProperties(client));
-}
-
-int
-SProcXIChangeProperty(ClientPtr client)
-{
- char n;
- REQUEST(xXIChangePropertyReq);
-
- REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->num_items, n);
- return (ProcXIChangeProperty(client));
-}
-
-int
-SProcXIDeleteProperty(ClientPtr client)
-{
- char n;
- REQUEST(xXIDeletePropertyReq);
-
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->property, n);
- REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
- return (ProcXIDeleteProperty(client));
-}
-
-int
-SProcXIGetProperty(ClientPtr client)
-{
- char n;
- REQUEST(xXIGetPropertyReq);
-
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->offset, n);
- swapl(&stuff->len, n);
- REQUEST_SIZE_MATCH(xXIGetPropertyReq);
- return (ProcXIGetProperty(client));
-}
-
-
-void
-SRepXIListProperties(ClientPtr client, int size,
- xXIListPropertiesReply *rep)
-{
- char n;
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->num_properties, n);
- /* properties will be swapped later, see ProcXIListProperties */
- WriteToClient(client, size, (char*)rep);
-}
-
-void
-SRepXIGetProperty(ClientPtr client, int size,
- xXIGetPropertyReply *rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->type, n);
- swapl(&rep->bytes_after, n);
- swapl(&rep->num_items, n);
- /* data will be swapped, see ProcXIGetProperty */
- WriteToClient(client, size, (char*)rep);
-}
+/*
+ * Copyright © 2006 Keith Packard
+ * Copyright © 2008 Peter Hutterer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WAXIANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WAXIANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ */
+
+/* This code is a modified version of randr/rrproperty.c */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "dix.h"
+#include "inputstr.h"
+#include <X11/extensions/XI.h>
+#include <X11/Xatom.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XI2proto.h>
+#include "exglobals.h"
+#include "exevents.h"
+#include "swaprep.h"
+
+#include "xiproperty.h"
+#include "xserver-properties.h"
+
+/**
+ * Properties used or alloced from inside the server.
+ */
+static struct dev_properties
+{
+ Atom type;
+ 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_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;
+
+static void send_property_event(DeviceIntPtr dev, Atom property, int what)
+{
+ devicePropertyNotify event;
+ xXIPropertyEvent xi2;
+ int state;
+
+ 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);
+}
+
+static int list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
+{
+ XIPropertyPtr prop;
+ Atom *atoms = NULL;
+ int nprops = 0;
+
+ for (prop = dev->properties.properties; prop; prop = prop->next)
+ nprops++;
+ if (nprops)
+ {
+ Atom *a;
+
+ atoms = malloc(nprops * sizeof(Atom));
+ if(!atoms)
+ return BadAlloc;
+ a = atoms;
+ for (prop = dev->properties.properties; prop; prop = prop->next, a++)
+ *a = prop->propertyName;
+ }
+
+ *natoms = nprops;
+ *atoms_return = atoms;
+ return Success;
+}
+
+static int
+get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
+ BOOL delete, int offset, int length,
+ int *bytes_after, Atom *type_return, int *format, int *nitems,
+ int *length_return, char **data)
+{
+ unsigned long n, len, ind;
+ int rc;
+ XIPropertyPtr prop;
+ XIPropertyValuePtr prop_value;
+
+ if (!ValidAtom(property))
+ {
+ client->errorValue = property;
+ return BadAtom;
+ }
+ if ((delete != xTrue) && (delete != xFalse))
+ {
+ client->errorValue = delete;
+ return BadValue;
+ }
+
+ if ((type != AnyPropertyType) && !ValidAtom(type))
+ {
+ client->errorValue = type;
+ return BadAtom;
+ }
+
+ for (prop = dev->properties.properties; prop; prop = prop->next)
+ if (prop->propertyName == property)
+ break;
+
+ if (!prop)
+ {
+ *bytes_after = 0;
+ *type_return = None;
+ *format = 0;
+ *nitems = 0;
+ *length_return = 0;
+ return Success;
+ }
+
+ rc = XIGetDeviceProperty(dev, property, &prop_value);
+ if (rc != Success)
+ {
+ client->errorValue = property;
+ return rc;
+ }
+
+ /* If the request type and actual type don't match. Return the
+ property information, but not the data. */
+
+ if (((type != prop_value->type) && (type != AnyPropertyType)))
+ {
+ *bytes_after = prop_value->size;
+ *format = prop_value->format;
+ *length_return = 0;
+ *nitems = 0;
+ *type_return = prop_value->type;
+ return Success;
+ }
+
+ /* Return type, format, value to client */
+ n = (prop_value->format/8) * prop_value->size; /* size (bytes) of prop */
+ ind = offset << 2;
+
+ /* If offset is invalid such that it causes "len" to
+ be negative, it's a value error. */
+
+ if (n < ind)
+ {
+ client->errorValue = offset;
+ return BadValue;
+ }
+
+ len = min(n - ind, 4 * length);
+
+ *bytes_after = n - (ind + len);
+ *format = prop_value->format;
+ *length_return = len;
+ if (prop_value->format)
+ *nitems = len / (prop_value->format / 8);
+ else
+ *nitems = 0;
+ *type_return = prop_value->type;
+
+ *data = (char*)prop_value->data + ind;
+
+ return Success;
+}
+
+static int
+check_change_property(ClientPtr client, Atom property, Atom type, int format,
+ int mode, int nitems)
+{
+ if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
+ (mode != PropModePrepend))
+ {
+ client->errorValue = mode;
+ return BadValue;
+ }
+ if ((format != 8) && (format != 16) && (format != 32))
+ {
+ client->errorValue = format;
+ return BadValue;
+ }
+
+ if (!ValidAtom(property))
+ {
+ client->errorValue = property;
+ return BadAtom;
+ }
+ if (!ValidAtom(type))
+ {
+ client->errorValue = type;
+ return BadAtom;
+ }
+
+ return Success;
+}
+
+static int
+change_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
+ int format, int mode, int len, void *data)
+{
+ int rc = Success;
+
+ rc = XIChangeDeviceProperty(dev, property, type, format, mode, len, data, TRUE);
+ if (rc != Success)
+ client->errorValue = property;
+
+ return rc;
+}
+
+/**
+ * Return the atom assigned to the specified string or 0 if the atom isn't known
+ * to the DIX.
+ *
+ * If name is NULL, None is returned.
+ */
+Atom
+XIGetKnownProperty(char *name)
+{
+ int i;
+
+ if (!name)
+ return None;
+
+ for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
+ {
+ if (strcmp(name, dev_properties[i].name) == 0){
+ if (dev_properties[i].type == None){
+ dev_properties[i].type =
+ MakeAtom(dev_properties[i].name,
+ strlen(dev_properties[i].name),
+ TRUE);
+ }
+
+ return dev_properties[i].type;
+ }
+ }
+
+ return 0;
+}
+
+void
+XIResetProperties(void)
+{
+ int i;
+
+ for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
+ dev_properties[i].type = None;
+}
+
+/**
+ * Convert the given property's value(s) into @nelem_return integer values and
+ * store them in @buf_return. If @nelem_return is larger than the number of
+ * values in the property, @nelem_return is set to the number of values in the
+ * property.
+ *
+ * If *@buf_return is NULL and @nelem_return is 0, memory is allocated
+ * automatically and must be freed by the caller.
+ *
+ * Possible return codes.
+ * Success ... No error.
+ * BadMatch ... Wrong atom type, atom is not XA_INTEGER
+ * BadAlloc ... NULL passed as buffer and allocation failed.
+ * BadLength ... @buff is NULL but @nelem_return is non-zero.
+ *
+ * @param val The property value
+ * @param nelem_return The maximum number of elements to return.
+ * @param buf_return Pointer to an array of at least @nelem_return values.
+ * @return Success or the error code if an error occured.
+ */
+_X_EXPORT int
+XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
+{
+ int i;
+ int *buf;
+
+ if (val->type != XA_INTEGER)
+ return BadMatch;
+ if (!*buf_return && *nelem_return)
+ return BadLength;
+
+ switch(val->format)
+ {
+ case 8:
+ case 16:
+ case 32:
+ break;
+ default:
+ return BadValue;
+ }
+
+ buf = *buf_return;
+
+ if (!buf && !(*nelem_return))
+ {
+ buf = calloc(val->size, sizeof(int));
+ if (!buf)
+ return BadAlloc;
+ *buf_return = buf;
+ *nelem_return = val->size;
+ } else if (val->size < *nelem_return)
+ *nelem_return = val->size;
+
+ for (i = 0; i < val->size && i < *nelem_return; i++)
+ {
+ switch(val->format)
+ {
+ case 8: buf[i] = ((CARD8*)val->data)[i]; break;
+ case 16: buf[i] = ((CARD16*)val->data)[i]; break;
+ case 32: buf[i] = ((CARD32*)val->data)[i]; break;
+ }
+ }
+
+ return Success;
+}
+
+/**
+ * Convert the given property's value(s) into @nelem_return float values and
+ * store them in @buf_return. If @nelem_return is larger than the number of
+ * values in the property, @nelem_return is set to the number of values in the
+ * property.
+ *
+ * If *@buf_return is NULL and @nelem_return is 0, memory is allocated
+ * automatically and must be freed by the caller.
+ *
+ * Possible errors returned:
+ * Success
+ * BadMatch ... Wrong atom type, atom is not XA_FLOAT
+ * BadValue ... Wrong format, format is not 32
+ * BadAlloc ... NULL passed as buffer and allocation failed.
+ * BadLength ... @buff is NULL but @nelem_return is non-zero.
+ *
+ * @param val The property value
+ * @param nelem_return The maximum number of elements to return.
+ * @param buf_return Pointer to an array of at least @nelem_return values.
+ * @return Success or the error code if an error occured.
+ */
+_X_EXPORT int
+XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
+{
+ int i;
+ float *buf;
+
+ if (!val->type || val->type != XIGetKnownProperty(XATOM_FLOAT))
+ return BadMatch;
+
+ if (val->format != 32)
+ return BadValue;
+ if (!*buf_return && *nelem_return)
+ return BadLength;
+
+ buf = *buf_return;
+
+ if (!buf && !(*nelem_return))
+ {
+ buf = calloc(val->size, sizeof(float));
+ if (!buf)
+ return BadAlloc;
+ *buf_return = buf;
+ *nelem_return = val->size;
+ } else if (val->size < *nelem_return)
+ *nelem_return = val->size;
+
+ for (i = 0; i < val->size && i < *nelem_return; i++)
+ buf[i] = ((float*)val->data)[i];
+
+ return Success;
+}
+
+/* Registers a new property handler on the given device and returns a unique
+ * identifier for this handler. This identifier is required to unregister the
+ * property handler again.
+ * @return The handler's identifier or 0 if an error occured.
+ */
+long
+XIRegisterPropertyHandler(DeviceIntPtr dev,
+ int (*SetProperty) (DeviceIntPtr dev,
+ Atom property,
+ XIPropertyValuePtr prop,
+ BOOL checkonly),
+ int (*GetProperty) (DeviceIntPtr dev,
+ Atom property),
+ int (*DeleteProperty) (DeviceIntPtr dev,
+ Atom property))
+{
+ XIPropertyHandlerPtr new_handler;
+
+ new_handler = calloc(1, sizeof(XIPropertyHandler));
+ if (!new_handler)
+ return 0;
+
+ new_handler->id = XIPropHandlerID++;
+ new_handler->SetProperty = SetProperty;
+ new_handler->GetProperty = GetProperty;
+ new_handler->DeleteProperty = DeleteProperty;
+ new_handler->next = dev->properties.handlers;
+ dev->properties.handlers = new_handler;
+
+ return new_handler->id;
+}
+
+void
+XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
+{
+ XIPropertyHandlerPtr curr, prev = NULL;
+
+ curr = dev->properties.handlers;
+ while(curr && curr->id != id)
+ {
+ prev = curr;
+ curr = curr->next;
+ }
+
+ if (!curr)
+ return;
+
+ if (!prev) /* first one */
+ dev->properties.handlers = curr->next;
+ else
+ prev->next = curr->next;
+
+ free(curr);
+}
+
+static XIPropertyPtr
+XICreateDeviceProperty (Atom property)
+{
+ XIPropertyPtr prop;
+
+ prop = (XIPropertyPtr)malloc(sizeof(XIPropertyRec));
+ if (!prop)
+ return NULL;
+
+ prop->next = NULL;
+ prop->propertyName = property;
+ prop->value.type = None;
+ prop->value.format = 0;
+ prop->value.size = 0;
+ prop->value.data = NULL;
+ prop->deletable = TRUE;
+
+ return prop;
+}
+
+static XIPropertyPtr
+XIFetchDeviceProperty(DeviceIntPtr dev, Atom property)
+{
+ XIPropertyPtr prop;
+
+ for (prop = dev->properties.properties; prop; prop = prop->next)
+ if (prop->propertyName == property)
+ return prop;
+ return NULL;
+}
+
+static void
+XIDestroyDeviceProperty (XIPropertyPtr prop)
+{
+ free(prop->value.data);
+ free(prop);
+}
+
+/* This function destroys all of the device's property-related stuff,
+ * including removing all device handlers.
+ * DO NOT CALL FROM THE DRIVER.
+ */
+void
+XIDeleteAllDeviceProperties (DeviceIntPtr device)
+{
+ XIPropertyPtr prop, next;
+ XIPropertyHandlerPtr curr_handler, next_handler;
+
+ for (prop = device->properties.properties; prop; prop = next)
+ {
+ next = prop->next;
+ send_property_event(device, prop->propertyName, XIPropertyDeleted);
+ XIDestroyDeviceProperty(prop);
+ }
+
+ device->properties.properties = NULL;
+
+ /* Now free all handlers */
+ curr_handler = device->properties.handlers;
+ while(curr_handler)
+ {
+ next_handler = curr_handler->next;
+ free(curr_handler);
+ curr_handler = next_handler;
+ }
+
+ device->properties.handlers = NULL;
+}
+
+
+int
+XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
+{
+ XIPropertyPtr prop, *prev;
+ int rc = Success;
+
+ for (prev = &device->properties.properties; (prop = *prev); prev = &(prop->next))
+ if (prop->propertyName == property)
+ break;
+
+ if (!prop)
+ return Success;
+
+ if (fromClient && !prop->deletable)
+ return BadAccess;
+
+ /* Ask handlers if we may delete the property */
+ if (device->properties.handlers)
+ {
+ XIPropertyHandlerPtr handler = device->properties.handlers;
+ while(handler)
+ {
+ if (handler->DeleteProperty)
+ rc = handler->DeleteProperty(device, prop->propertyName);
+ if (rc != Success)
+ return rc;
+ handler = handler->next;
+ }
+ }
+
+ if (prop)
+ {
+ *prev = prop->next;
+ send_property_event(device, prop->propertyName, XIPropertyDeleted);
+ XIDestroyDeviceProperty (prop);
+ }
+
+ return Success;
+}
+
+int
+XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
+ int format, int mode, unsigned long len,
+ const pointer value, Bool sendevent)
+{
+ XIPropertyPtr prop;
+ int size_in_bytes;
+ int total_size;
+ unsigned long total_len;
+ XIPropertyValuePtr prop_value;
+ XIPropertyValueRec new_value;
+ Bool add = FALSE;
+ int rc;
+
+ size_in_bytes = format >> 3;
+
+ /* first see if property already exists */
+ prop = XIFetchDeviceProperty (dev, property);
+ if (!prop) /* just add to list */
+ {
+ prop = XICreateDeviceProperty (property);
+ if (!prop)
+ return BadAlloc;
+ add = TRUE;
+ mode = PropModeReplace;
+ }
+ prop_value = &prop->value;
+
+ /* To append or prepend to a property the request format and type
+ must match those of the already defined property. The
+ existing format and type are irrelevant when using the mode
+ "PropModeReplace" since they will be written over. */
+
+ if ((format != prop_value->format) && (mode != PropModeReplace))
+ return BadMatch;
+ if ((prop_value->type != type) && (mode != PropModeReplace))
+ return BadMatch;
+ new_value = *prop_value;
+ if (mode == PropModeReplace)
+ total_len = len;
+ else
+ total_len = prop_value->size + len;
+
+ if (mode == PropModeReplace || len > 0)
+ {
+ pointer new_data = NULL, old_data = NULL;
+
+ total_size = total_len * size_in_bytes;
+ new_value.data = (pointer)malloc(total_size);
+ if (!new_value.data && total_size)
+ {
+ if (add)
+ XIDestroyDeviceProperty (prop);
+ return BadAlloc;
+ }
+ new_value.size = len;
+ new_value.type = type;
+ new_value.format = format;
+
+ switch (mode) {
+ case PropModeReplace:
+ new_data = new_value.data;
+ old_data = NULL;
+ break;
+ case PropModeAppend:
+ new_data = (pointer) (((char *) new_value.data) +
+ (prop_value->size * size_in_bytes));
+ old_data = new_value.data;
+ break;
+ case PropModePrepend:
+ new_data = new_value.data;
+ old_data = (pointer) (((char *) new_value.data) +
+ (prop_value->size * size_in_bytes));
+ break;
+ }
+ if (new_data)
+ memcpy ((char *) new_data, (char *) value, len * size_in_bytes);
+ if (old_data)
+ memcpy ((char *) old_data, (char *) prop_value->data,
+ prop_value->size * size_in_bytes);
+
+ if (dev->properties.handlers)
+ {
+ XIPropertyHandlerPtr handler;
+ BOOL checkonly = TRUE;
+ /* run through all handlers with checkonly TRUE, then again with
+ * checkonly FALSE. Handlers MUST return error codes on the
+ * checkonly run, errors on the second run are ignored */
+ do
+ {
+ handler = dev->properties.handlers;
+ while(handler)
+ {
+ if (handler->SetProperty)
+ {
+ rc = handler->SetProperty(dev, prop->propertyName,
+ &new_value, checkonly);
+ if (checkonly && rc != Success)
+ {
+ free(new_value.data);
+ return rc;
+ }
+ }
+ handler = handler->next;
+ }
+ checkonly = !checkonly;
+ } while (!checkonly);
+ }
+ free(prop_value->data);
+ *prop_value = new_value;
+ } else if (len == 0)
+ {
+ /* do nothing */
+ }
+
+ if (add)
+ {
+ prop->next = dev->properties.properties;
+ dev->properties.properties = prop;
+ }
+
+ if (sendevent)
+ send_property_event(dev, prop->propertyName,
+ (add) ? XIPropertyCreated : XIPropertyModified);
+
+ return Success;
+}
+
+int
+XIGetDeviceProperty (DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
+{
+ XIPropertyPtr prop = XIFetchDeviceProperty (dev, property);
+ int rc;
+
+ if (!prop)
+ {
+ *value = NULL;
+ return BadAtom;
+ }
+
+ /* If we can, try to update the property value first */
+ if (dev->properties.handlers)
+ {
+ XIPropertyHandlerPtr handler = dev->properties.handlers;
+ while(handler)
+ {
+ if (handler->GetProperty)
+ {
+ rc = handler->GetProperty(dev, prop->propertyName);
+ if (rc != Success)
+ {
+ *value = NULL;
+ return rc;
+ }
+ }
+ handler = handler->next;
+ }
+ }
+
+ *value = &prop->value;
+ return Success;
+}
+
+int
+XISetDevicePropertyDeletable(DeviceIntPtr dev, Atom property, Bool deletable)
+{
+ XIPropertyPtr prop = XIFetchDeviceProperty(dev, property);
+
+ if (!prop)
+ return BadAtom;
+
+ prop->deletable = deletable;
+ return Success;
+}
+
+int
+ProcXListDeviceProperties (ClientPtr client)
+{
+ Atom *atoms;
+ xListDevicePropertiesReply rep;
+ int natoms;
+ DeviceIntPtr dev;
+ int rc = Success;
+
+ REQUEST(xListDevicePropertiesReq);
+ REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
+
+ rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
+ if (rc != Success)
+ return rc;
+
+ rc = list_atoms(dev, &natoms, &atoms);
+ if (rc != Success)
+ return rc;
+
+ rep.repType = X_Reply;
+ rep.RepType = X_ListDeviceProperties;
+ rep.length = natoms;
+ rep.sequenceNumber = client->sequence;
+ rep.nAtoms = natoms;
+
+ WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
+ if (natoms)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
+ free(atoms);
+ }
+ return rc;
+}
+
+int
+ProcXChangeDeviceProperty (ClientPtr client)
+{
+ REQUEST(xChangeDevicePropertyReq);
+ DeviceIntPtr dev;
+ unsigned long len;
+ int totalSize;
+ int rc;
+
+ REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
+ UpdateCurrentTime();
+
+ rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
+ if (rc != Success)
+ return rc;
+
+ rc = check_change_property(client, stuff->property, stuff->type,
+ stuff->format, stuff->mode, stuff->nUnits);
+
+ len = stuff->nUnits;
+ if (len > (bytes_to_int32(0xffffffff - sizeof(xChangeDevicePropertyReq))))
+ return BadLength;
+
+ totalSize = len * (stuff->format/8);
+ REQUEST_FIXED_SIZE(xChangeDevicePropertyReq, totalSize);
+
+ rc = change_property(client, dev, stuff->property, stuff->type,
+ stuff->format, stuff->mode, len, (void*)&stuff[1]);
+ return rc;
+}
+
+int
+ProcXDeleteDeviceProperty (ClientPtr client)
+{
+ REQUEST(xDeleteDevicePropertyReq);
+ DeviceIntPtr dev;
+ int rc;
+
+ REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
+ UpdateCurrentTime();
+ rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
+ if (rc != Success)
+ return rc;
+
+ if (!ValidAtom(stuff->property))
+ {
+ client->errorValue = stuff->property;
+ return BadAtom;
+ }
+
+ rc = XIDeleteDeviceProperty(dev, stuff->property, TRUE);
+ return rc;
+}
+
+int
+ProcXGetDeviceProperty (ClientPtr client)
+{
+ REQUEST(xGetDevicePropertyReq);
+ DeviceIntPtr dev;
+ int length;
+ int rc, format, nitems, bytes_after;
+ char *data;
+ Atom type;
+ xGetDevicePropertyReply reply;
+
+ REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
+ if (stuff->delete)
+ UpdateCurrentTime();
+ rc = dixLookupDevice (&dev, stuff->deviceid, client,
+ stuff->delete ? DixSetPropAccess :
+ DixGetPropAccess);
+ if (rc != Success)
+ return rc;
+
+ rc = get_property(client, dev, stuff->property, stuff->type,
+ stuff->delete, stuff->longOffset, stuff->longLength,
+ &bytes_after, &type, &format, &nitems, &length, &data);
+
+ 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);
+
+ if (stuff->delete && (reply.bytesAfter == 0))
+ send_property_event(dev, stuff->property, XIPropertyDeleted);
+
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
+
+ if (length)
+ {
+ switch (reply.format) {
+ case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
+ case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
+ default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
+ }
+ WriteSwappedDataToClient(client, length, data);
+ }
+
+ /* delete the Property */
+ if (stuff->delete && (reply.bytesAfter == 0))
+ {
+ XIPropertyPtr prop, *prev;
+ for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
+ {
+ if (prop->propertyName == stuff->property)
+ {
+ *prev = prop->next;
+ XIDestroyDeviceProperty(prop);
+ break;
+ }
+ }
+ }
+ return Success;
+}
+
+
+int
+SProcXListDeviceProperties (ClientPtr client)
+{
+ REQUEST(xListDevicePropertiesReq);
+
+ swaps(&stuff->length);
+
+ REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
+ return (ProcXListDeviceProperties(client));
+}
+
+int
+SProcXChangeDeviceProperty (ClientPtr client)
+{
+ REQUEST(xChangeDevicePropertyReq);
+
+ REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->property);
+ swapl(&stuff->type);
+ swapl(&stuff->nUnits);
+ return (ProcXChangeDeviceProperty(client));
+}
+
+int
+SProcXDeleteDeviceProperty (ClientPtr client)
+{
+ REQUEST(xDeleteDevicePropertyReq);
+
+ swaps(&stuff->length);
+ swapl(&stuff->property);
+ REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
+ return (ProcXDeleteDeviceProperty(client));
+}
+
+int
+SProcXGetDeviceProperty (ClientPtr client)
+{
+ REQUEST(xGetDevicePropertyReq);
+
+ swaps(&stuff->length);
+ swapl(&stuff->property);
+ swapl(&stuff->type);
+ swapl(&stuff->longOffset);
+ swapl(&stuff->longLength);
+ REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
+ return (ProcXGetDeviceProperty(client));
+}
+
+
+/* Reply swapping */
+
+void
+SRepXListDeviceProperties(ClientPtr client, int size,
+ xListDevicePropertiesReply *rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->nAtoms);
+ /* properties will be swapped later, see ProcXListDeviceProperties */
+ WriteToClient(client, size, (char*)rep);
+}
+
+void
+SRepXGetDeviceProperty(ClientPtr client, int size,
+ xGetDevicePropertyReply *rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->propertyType);
+ swapl(&rep->bytesAfter);
+ swapl(&rep->nItems);
+ /* data will be swapped, see ProcXGetDeviceProperty */
+ WriteToClient(client, size, (char*)rep);
+}
+
+/* XI2 Request/reply handling */
+int
+ProcXIListProperties(ClientPtr client)
+{
+ Atom *atoms;
+ xXIListPropertiesReply rep;
+ int natoms;
+ DeviceIntPtr dev;
+ int rc = Success;
+
+ REQUEST(xXIListPropertiesReq);
+ REQUEST_SIZE_MATCH(xXIListPropertiesReq);
+
+ rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
+ if (rc != Success)
+ return rc;
+
+ rc = list_atoms(dev, &natoms, &atoms);
+ if (rc != Success)
+ return rc;
+
+ rep.repType = X_Reply;
+ rep.RepType = X_XIListProperties;
+ rep.length = natoms;
+ rep.sequenceNumber = client->sequence;
+ rep.num_properties = natoms;
+
+ WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep);
+ if (natoms)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
+ free(atoms);
+ }
+ return rc;
+}
+
+int
+ProcXIChangeProperty(ClientPtr client)
+{
+ int rc;
+ DeviceIntPtr dev;
+ int totalSize;
+ unsigned long len;
+
+ REQUEST(xXIChangePropertyReq);
+ REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
+ UpdateCurrentTime();
+
+ rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
+ if (rc != Success)
+ return rc;
+
+ rc = check_change_property(client, stuff->property, stuff->type,
+ stuff->format, stuff->mode, stuff->num_items);
+ len = stuff->num_items;
+ if (len > bytes_to_int32(0xffffffff - sizeof(xXIChangePropertyReq)))
+ return BadLength;
+
+ totalSize = len * (stuff->format/8);
+ REQUEST_FIXED_SIZE(xXIChangePropertyReq, totalSize);
+
+ rc = change_property(client, dev, stuff->property, stuff->type,
+ stuff->format, stuff->mode, len, (void*)&stuff[1]);
+ return rc;
+}
+
+int
+ProcXIDeleteProperty(ClientPtr client)
+{
+ DeviceIntPtr dev;
+ int rc;
+ REQUEST(xXIDeletePropertyReq);
+
+ REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
+ UpdateCurrentTime();
+ rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
+ if (rc != Success)
+ return rc;
+
+ if (!ValidAtom(stuff->property))
+ {
+ client->errorValue = stuff->property;
+ return BadAtom;
+ }
+
+ rc = XIDeleteDeviceProperty(dev, stuff->property, TRUE);
+ return rc;
+}
+
+
+int
+ProcXIGetProperty(ClientPtr client)
+{
+ REQUEST(xXIGetPropertyReq);
+ DeviceIntPtr dev;
+ xXIGetPropertyReply reply;
+ int length;
+ int rc, format, nitems, bytes_after;
+ char *data;
+ Atom type;
+
+ REQUEST_SIZE_MATCH(xXIGetPropertyReq);
+ if (stuff->delete)
+ UpdateCurrentTime();
+ rc = dixLookupDevice (&dev, stuff->deviceid, client,
+ stuff->delete ? DixSetPropAccess :
+ DixGetPropAccess);
+ if (rc != Success)
+ return rc;
+
+ rc = get_property(client, dev, stuff->property, stuff->type,
+ stuff->delete, stuff->offset, stuff->len,
+ &bytes_after, &type, &format, &nitems, &length, &data);
+
+ 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);
+
+ if (length && stuff->delete && (reply.bytes_after == 0))
+ send_property_event(dev, stuff->property, XIPropertyDeleted);
+
+ WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &reply);
+
+ if (length)
+ {
+ switch (reply.format) {
+ case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
+ case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
+ default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
+ }
+ WriteSwappedDataToClient(client, length, data);
+ }
+
+ /* delete the Property */
+ if (stuff->delete && (reply.bytes_after == 0))
+ {
+ XIPropertyPtr prop, *prev;
+ for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
+ {
+ if (prop->propertyName == stuff->property)
+ {
+ *prev = prop->next;
+ XIDestroyDeviceProperty(prop);
+ break;
+ }
+ }
+ }
+
+ return Success;
+}
+
+int
+SProcXIListProperties(ClientPtr client)
+{
+ REQUEST(xXIListPropertiesReq);
+
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+
+ REQUEST_SIZE_MATCH(xXIListPropertiesReq);
+ return (ProcXIListProperties(client));
+}
+
+int
+SProcXIChangeProperty(ClientPtr client)
+{
+ REQUEST(xXIChangePropertyReq);
+
+ REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->property);
+ swapl(&stuff->type);
+ swapl(&stuff->num_items);
+ return (ProcXIChangeProperty(client));
+}
+
+int
+SProcXIDeleteProperty(ClientPtr client)
+{
+ REQUEST(xXIDeletePropertyReq);
+
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->property);
+ REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
+ return (ProcXIDeleteProperty(client));
+}
+
+int
+SProcXIGetProperty(ClientPtr client)
+{
+ REQUEST(xXIGetPropertyReq);
+
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->property);
+ swapl(&stuff->type);
+ swapl(&stuff->offset);
+ swapl(&stuff->len);
+ REQUEST_SIZE_MATCH(xXIGetPropertyReq);
+ return (ProcXIGetProperty(client));
+}
+
+
+void
+SRepXIListProperties(ClientPtr client, int size,
+ xXIListPropertiesReply *rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_properties);
+ /* properties will be swapped later, see ProcXIListProperties */
+ WriteToClient(client, size, (char*)rep);
+}
+
+void
+SRepXIGetProperty(ClientPtr client, int size,
+ xXIGetPropertyReply *rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->type);
+ swapl(&rep->bytes_after);
+ swapl(&rep->num_items);
+ /* data will be swapped, see ProcXIGetProperty */
+ WriteToClient(client, size, (char*)rep);
+}
diff --git a/xorg-server/Xi/xiquerydevice.c b/xorg-server/Xi/xiquerydevice.c
index a768d499c..902eb918c 100644
--- a/xorg-server/Xi/xiquerydevice.c
+++ b/xorg-server/Xi/xiquerydevice.c
@@ -52,12 +52,10 @@ static void SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info);
int
SProcXIQueryDevice(ClientPtr client)
{
- char n;
-
REQUEST(xXIQueryDeviceReq);
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
return ProcXIQueryDevice(client);
}
@@ -166,11 +164,9 @@ ProcXIQueryDevice(ClientPtr client)
void
SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply *rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->num_devices, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_devices);
/* Device info is already swapped, see ProcXIQueryDevice */
@@ -278,17 +274,16 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, Bool reportState)
static void
SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
{
- char n;
Atom *btn;
int i;
- swaps(&info->type, n);
- swaps(&info->length, n);
- swaps(&info->sourceid, n);
+ swaps(&info->type);
+ swaps(&info->length);
+ swaps(&info->sourceid);
for (i = 0, btn = (Atom*)&info[1]; i < info->num_buttons; i++, btn++)
- swaps(btn, n);
+ swapl(btn);
- swaps(&info->num_buttons, n);
+ swaps(&info->num_buttons);
}
/**
@@ -317,17 +312,16 @@ ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
static void
SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
{
- char n;
uint32_t *key;
int i;
- swaps(&info->type, n);
- swaps(&info->length, n);
- swaps(&info->sourceid, n);
+ swaps(&info->type);
+ swaps(&info->length);
+ swaps(&info->sourceid);
for (i = 0, key = (uint32_t*)&info[1]; i < info->num_keycodes; i++, key++)
- swapl(key, n);
+ swapl(key);
- swaps(&info->num_keycodes, n);
+ swaps(&info->num_keycodes);
}
/**
@@ -364,16 +358,15 @@ ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber,
static void
SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
{
- char n;
- swaps(&info->type, n);
- swaps(&info->length, n);
- swapl(&info->label, n);
- swapl(&info->min.integral, n);
- swapl(&info->min.frac, n);
- swapl(&info->max.integral, n);
- swapl(&info->max.frac, n);
- swaps(&info->number, n);
- swaps(&info->sourceid, n);
+ swaps(&info->type);
+ swaps(&info->length);
+ swapl(&info->label);
+ swapl(&info->min.integral);
+ swapl(&info->min.frac);
+ swapl(&info->max.integral);
+ swapl(&info->max.frac);
+ swaps(&info->number);
+ swaps(&info->sourceid);
}
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
@@ -471,7 +464,6 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
static void
SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info)
{
- char n;
char *any = (char*)&info[1];
int i;
@@ -497,10 +489,10 @@ SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info)
any += len * 4;
}
- swaps(&info->deviceid, n);
- swaps(&info->use, n);
- swaps(&info->attachment, n);
- swaps(&info->num_classes, n);
- swaps(&info->name_len, n);
+ swaps(&info->deviceid);
+ swaps(&info->use);
+ swaps(&info->attachment);
+ swaps(&info->num_classes);
+ swaps(&info->name_len);
}
diff --git a/xorg-server/Xi/xiquerypointer.c b/xorg-server/Xi/xiquerypointer.c
index 51317994b..9e05eff30 100644
--- a/xorg-server/Xi/xiquerypointer.c
+++ b/xorg-server/Xi/xiquerypointer.c
@@ -61,12 +61,10 @@
int
SProcXIQueryPointer(ClientPtr client)
{
- char n;
-
REQUEST(xXIQueryPointerReq);
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->win, n);
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->win);
return (ProcXIQueryPointer(client));
}
@@ -212,17 +210,15 @@ void
SRepXIQueryPointer(ClientPtr client, int size,
xXIQueryPointerReply * rep)
{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->root, n);
- swapl(&rep->child, n);
- swapl(&rep->root_x, n);
- swapl(&rep->root_y, n);
- swapl(&rep->win_x, n);
- swapl(&rep->win_y, n);
- swaps(&rep->buttons_len, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->root);
+ swapl(&rep->child);
+ swapl(&rep->root_x);
+ swapl(&rep->root_y);
+ swapl(&rep->win_x);
+ swapl(&rep->win_y);
+ swaps(&rep->buttons_len);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/xiqueryversion.c b/xorg-server/Xi/xiqueryversion.c
index f647f9872..a94061432 100644
--- a/xorg-server/Xi/xiqueryversion.c
+++ b/xorg-server/Xi/xiqueryversion.c
@@ -103,23 +103,20 @@ ProcXIQueryVersion(ClientPtr client)
int
SProcXIQueryVersion(ClientPtr client)
{
- char n;
-
REQUEST(xXIQueryVersionReq);
- swaps(&stuff->length, n);
+ swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXIQueryVersionReq);
- swaps(&stuff->major_version, n);
- swaps(&stuff->minor_version, n);
+ swaps(&stuff->major_version);
+ swaps(&stuff->minor_version);
return (ProcXIQueryVersion(client));
}
void
SRepXIQueryVersion(ClientPtr client, int size, xXIQueryVersionReply *rep)
{
- char n;
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->major_version, n);
- swaps(&rep->minor_version, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->major_version);
+ swaps(&rep->minor_version);
WriteToClient(client, size, (char *)rep);
}
diff --git a/xorg-server/Xi/xiselectev.c b/xorg-server/Xi/xiselectev.c
index 6f26b3d08..3af4f1fb9 100644
--- a/xorg-server/Xi/xiselectev.c
+++ b/xorg-server/Xi/xiselectev.c
@@ -1,310 +1,304 @@
-/*
- * Copyright 2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- * Author: Peter Hutterer
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-
-#include "dixstruct.h"
-#include "windowstr.h"
-#include "exglobals.h"
-#include "exevents.h"
-#include <X11/extensions/XI2proto.h>
-
-#include "xiselectev.h"
-
-/**
- * Check the given mask (in len bytes) for invalid mask bits.
- * Invalid mask bits are any bits above XI2LastEvent.
- *
- * @return BadValue if at least one invalid bit is set or Success otherwise.
- */
-int XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
-{
- if (len >= XIMaskLen(XI2LASTEVENT))
- {
- int i;
- for (i = XI2LASTEVENT + 1; i < len * 8; i++)
- {
- if (BitIsOn(mask, i))
- {
- client->errorValue = i;
- return BadValue;
- }
- }
- }
-
- return Success;
-}
-
-int
-SProcXISelectEvents(ClientPtr client)
-{
- char n;
- int i;
- xXIEventMask* evmask;
-
- REQUEST(xXISelectEventsReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xXISelectEventsReq);
- swapl(&stuff->win, n);
- swaps(&stuff->num_masks, n);
-
- evmask = (xXIEventMask*)&stuff[1];
- for (i = 0; i < stuff->num_masks; i++)
- {
- swaps(&evmask->deviceid, n);
- swaps(&evmask->mask_len, n);
- evmask = (xXIEventMask*)(((char*)&evmask[1]) + evmask->mask_len * 4);
- }
-
- return (ProcXISelectEvents(client));
-}
-
-int
-ProcXISelectEvents(ClientPtr client)
-{
- int rc, num_masks;
- WindowPtr win;
- DeviceIntPtr dev;
- DeviceIntRec dummy;
- xXIEventMask *evmask;
- int *types = NULL;
- int len;
-
- REQUEST(xXISelectEventsReq);
- REQUEST_AT_LEAST_SIZE(xXISelectEventsReq);
-
- if (stuff->num_masks == 0)
- return BadValue;
-
- rc = dixLookupWindow(&win, stuff->win, client, DixReceiveAccess);
- if (rc != Success)
- return rc;
-
- len = sz_xXISelectEventsReq;
-
- /* check request validity */
- evmask = (xXIEventMask*)&stuff[1];
- num_masks = stuff->num_masks;
- while(num_masks--)
- {
- len += sizeof(xXIEventMask) + evmask->mask_len * 4;
-
- if (bytes_to_int32(len) > stuff->length)
- return BadLength;
-
- if (evmask->deviceid != XIAllDevices &&
- evmask->deviceid != XIAllMasterDevices)
- rc = dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
- else {
- /* XXX: XACE here? */
- }
- if (rc != Success)
- return rc;
-
- /* hierarchy event mask is not allowed on devices */
- if (evmask->deviceid != XIAllDevices && evmask->mask_len >= 1)
- {
- unsigned char *bits = (unsigned char*)&evmask[1];
- if (BitIsOn(bits, XI_HierarchyChanged))
- {
- client->errorValue = XI_HierarchyChanged;
- return BadValue;
- }
- }
-
- /* Raw events may only be selected on root windows */
- if (win->parent && evmask->mask_len >= 1)
- {
- unsigned char *bits = (unsigned char*)&evmask[1];
- if (BitIsOn(bits, XI_RawKeyPress) ||
- BitIsOn(bits, XI_RawKeyRelease) ||
- BitIsOn(bits, XI_RawButtonPress) ||
- BitIsOn(bits, XI_RawButtonRelease) ||
- BitIsOn(bits, XI_RawMotion))
- {
- client->errorValue = XI_RawKeyPress;
- return BadValue;
- }
- }
-
- if (XICheckInvalidMaskBits(client, (unsigned char*)&evmask[1],
- evmask->mask_len * 4) != Success)
- return BadValue;
-
- evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
- evmask++;
- }
-
- if (bytes_to_int32(len) != stuff->length)
- return BadLength;
-
- /* Set masks on window */
- evmask = (xXIEventMask*)&stuff[1];
- num_masks = stuff->num_masks;
- while(num_masks--)
- {
- if (evmask->deviceid == XIAllDevices ||
- evmask->deviceid == XIAllMasterDevices)
- {
- dummy.id = evmask->deviceid;
- dev = &dummy;
- } else
- dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
- if (XISetEventMask(dev, win, client, evmask->mask_len * 4,
- (unsigned char*)&evmask[1]) != Success)
- return BadAlloc;
- evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
- evmask++;
- }
-
- RecalculateDeliverableEvents(win);
-
- free(types);
- return Success;
-}
-
-
-int
-SProcXIGetSelectedEvents(ClientPtr client)
-{
- char n;
-
- REQUEST(xXIGetSelectedEventsReq);
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
- swapl(&stuff->win, n);
-
- return (ProcXIGetSelectedEvents(client));
-}
-
-int
-ProcXIGetSelectedEvents(ClientPtr client)
-{
- int rc, i;
- WindowPtr win;
- char n;
- char *buffer = NULL;
- xXIGetSelectedEventsReply reply;
- OtherInputMasks *masks;
- InputClientsPtr others = NULL;
- xXIEventMask *evmask = NULL;
- DeviceIntPtr dev;
-
- REQUEST(xXIGetSelectedEventsReq);
- REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
-
- rc = dixLookupWindow(&win, stuff->win, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- reply.repType = X_Reply;
- reply.RepType = X_XIGetSelectedEvents;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.num_masks = 0;
-
- masks = wOtherInputMasks(win);
- if (masks)
- {
- for (others = wOtherInputMasks(win)->inputClients; others;
- others = others->next) {
- if (SameClient(others, client)) {
- break;
- }
- }
- }
-
- if (!others)
- {
- WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
- return Success;
- }
-
- buffer = calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
- if (!buffer)
- return BadAlloc;
-
- evmask = (xXIEventMask*)buffer;
- for (i = 0; i < MAXDEVICES; i++)
- {
- int j;
- unsigned char *devmask = others->xi2mask[i];
-
- if (i > 2)
- {
- rc = dixLookupDevice(&dev, i, client, DixGetAttrAccess);
- if (rc != Success)
- continue;
- }
-
-
- for (j = XI2MASKSIZE - 1; j >= 0; j--)
- {
- if (devmask[j] != 0)
- {
- int mask_len = (j + 4)/4; /* j is an index, hence + 4, not + 3 */
- evmask->deviceid = i;
- evmask->mask_len = mask_len;
- reply.num_masks++;
- reply.length += sizeof(xXIEventMask)/4 + evmask->mask_len;
-
- if (client->swapped)
- {
- swaps(&evmask->deviceid, n);
- swaps(&evmask->mask_len, n);
- }
-
- memcpy(&evmask[1], devmask, j + 1);
- evmask = (xXIEventMask*)((char*)evmask +
- sizeof(xXIEventMask) + mask_len * 4);
- break;
- }
- }
- }
-
- WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
-
- if (reply.num_masks)
- WriteToClient(client, reply.length * 4, buffer);
-
- free(buffer);
- return Success;
-}
-
-void SRepXIGetSelectedEvents(ClientPtr client,
- int len, xXIGetSelectedEventsReply *rep)
-{
- char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swaps(&rep->num_masks, n);
- WriteToClient(client, len, (char *)rep);
-}
-
-
+/*
+ * Copyright 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+
+#include "dixstruct.h"
+#include "windowstr.h"
+#include "exglobals.h"
+#include "exevents.h"
+#include <X11/extensions/XI2proto.h>
+
+#include "xiselectev.h"
+
+/**
+ * Check the given mask (in len bytes) for invalid mask bits.
+ * Invalid mask bits are any bits above XI2LastEvent.
+ *
+ * @return BadValue if at least one invalid bit is set or Success otherwise.
+ */
+int XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
+{
+ if (len >= XIMaskLen(XI2LASTEVENT))
+ {
+ int i;
+ for (i = XI2LASTEVENT + 1; i < len * 8; i++)
+ {
+ if (BitIsOn(mask, i))
+ {
+ client->errorValue = i;
+ return BadValue;
+ }
+ }
+ }
+
+ return Success;
+}
+
+int
+SProcXISelectEvents(ClientPtr client)
+{
+ int i;
+ xXIEventMask* evmask;
+
+ REQUEST(xXISelectEventsReq);
+ swaps(&stuff->length);
+ REQUEST_AT_LEAST_SIZE(xXISelectEventsReq);
+ swapl(&stuff->win);
+ swaps(&stuff->num_masks);
+
+ evmask = (xXIEventMask*)&stuff[1];
+ for (i = 0; i < stuff->num_masks; i++)
+ {
+ swaps(&evmask->deviceid);
+ swaps(&evmask->mask_len);
+ evmask = (xXIEventMask*)(((char*)&evmask[1]) + evmask->mask_len * 4);
+ }
+
+ return (ProcXISelectEvents(client));
+}
+
+int
+ProcXISelectEvents(ClientPtr client)
+{
+ int rc, num_masks;
+ WindowPtr win;
+ DeviceIntPtr dev;
+ DeviceIntRec dummy;
+ xXIEventMask *evmask;
+ int *types = NULL;
+ int len;
+
+ REQUEST(xXISelectEventsReq);
+ REQUEST_AT_LEAST_SIZE(xXISelectEventsReq);
+
+ if (stuff->num_masks == 0)
+ return BadValue;
+
+ rc = dixLookupWindow(&win, stuff->win, client, DixReceiveAccess);
+ if (rc != Success)
+ return rc;
+
+ len = sz_xXISelectEventsReq;
+
+ /* check request validity */
+ evmask = (xXIEventMask*)&stuff[1];
+ num_masks = stuff->num_masks;
+ while(num_masks--)
+ {
+ len += sizeof(xXIEventMask) + evmask->mask_len * 4;
+
+ if (bytes_to_int32(len) > stuff->length)
+ return BadLength;
+
+ if (evmask->deviceid != XIAllDevices &&
+ evmask->deviceid != XIAllMasterDevices)
+ rc = dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
+ else {
+ /* XXX: XACE here? */
+ }
+ if (rc != Success)
+ return rc;
+
+ /* hierarchy event mask is not allowed on devices */
+ if (evmask->deviceid != XIAllDevices && evmask->mask_len >= 1)
+ {
+ unsigned char *bits = (unsigned char*)&evmask[1];
+ if (BitIsOn(bits, XI_HierarchyChanged))
+ {
+ client->errorValue = XI_HierarchyChanged;
+ return BadValue;
+ }
+ }
+
+ /* Raw events may only be selected on root windows */
+ if (win->parent && evmask->mask_len >= 1)
+ {
+ unsigned char *bits = (unsigned char*)&evmask[1];
+ if (BitIsOn(bits, XI_RawKeyPress) ||
+ BitIsOn(bits, XI_RawKeyRelease) ||
+ BitIsOn(bits, XI_RawButtonPress) ||
+ BitIsOn(bits, XI_RawButtonRelease) ||
+ BitIsOn(bits, XI_RawMotion))
+ {
+ client->errorValue = XI_RawKeyPress;
+ return BadValue;
+ }
+ }
+
+ if (XICheckInvalidMaskBits(client, (unsigned char*)&evmask[1],
+ evmask->mask_len * 4) != Success)
+ return BadValue;
+
+ evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
+ evmask++;
+ }
+
+ if (bytes_to_int32(len) != stuff->length)
+ return BadLength;
+
+ /* Set masks on window */
+ evmask = (xXIEventMask*)&stuff[1];
+ num_masks = stuff->num_masks;
+ while(num_masks--)
+ {
+ if (evmask->deviceid == XIAllDevices ||
+ evmask->deviceid == XIAllMasterDevices)
+ {
+ dummy.id = evmask->deviceid;
+ dev = &dummy;
+ } else
+ dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
+ if (XISetEventMask(dev, win, client, evmask->mask_len * 4,
+ (unsigned char*)&evmask[1]) != Success)
+ return BadAlloc;
+ evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
+ evmask++;
+ }
+
+ RecalculateDeliverableEvents(win);
+
+ free(types);
+ return Success;
+}
+
+
+int
+SProcXIGetSelectedEvents(ClientPtr client)
+{
+ REQUEST(xXIGetSelectedEventsReq);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
+ swapl(&stuff->win);
+
+ return (ProcXIGetSelectedEvents(client));
+}
+
+int
+ProcXIGetSelectedEvents(ClientPtr client)
+{
+ int rc, i;
+ WindowPtr win;
+ char *buffer = NULL;
+ xXIGetSelectedEventsReply reply;
+ OtherInputMasks *masks;
+ InputClientsPtr others = NULL;
+ xXIEventMask *evmask = NULL;
+ DeviceIntPtr dev;
+
+ REQUEST(xXIGetSelectedEventsReq);
+ REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
+
+ rc = dixLookupWindow(&win, stuff->win, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ reply.repType = X_Reply;
+ reply.RepType = X_XIGetSelectedEvents;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+ reply.num_masks = 0;
+
+ masks = wOtherInputMasks(win);
+ if (masks)
+ {
+ for (others = wOtherInputMasks(win)->inputClients; others;
+ others = others->next) {
+ if (SameClient(others, client)) {
+ break;
+ }
+ }
+ }
+
+ if (!others)
+ {
+ WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
+ return Success;
+ }
+
+ buffer = calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
+ if (!buffer)
+ return BadAlloc;
+
+ evmask = (xXIEventMask*)buffer;
+ for (i = 0; i < MAXDEVICES; i++)
+ {
+ int j;
+ unsigned char *devmask = others->xi2mask[i];
+
+ if (i > 2)
+ {
+ rc = dixLookupDevice(&dev, i, client, DixGetAttrAccess);
+ if (rc != Success)
+ continue;
+ }
+
+
+ for (j = XI2MASKSIZE - 1; j >= 0; j--)
+ {
+ if (devmask[j] != 0)
+ {
+ int mask_len = (j + 4)/4; /* j is an index, hence + 4, not + 3 */
+ evmask->deviceid = i;
+ evmask->mask_len = mask_len;
+ reply.num_masks++;
+ reply.length += sizeof(xXIEventMask)/4 + evmask->mask_len;
+
+ if (client->swapped)
+ {
+ swaps(&evmask->deviceid);
+ swaps(&evmask->mask_len);
+ }
+
+ memcpy(&evmask[1], devmask, j + 1);
+ evmask = (xXIEventMask*)((char*)evmask +
+ sizeof(xXIEventMask) + mask_len * 4);
+ break;
+ }
+ }
+ }
+
+ WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
+
+ if (reply.num_masks)
+ WriteToClient(client, reply.length * 4, buffer);
+
+ free(buffer);
+ return Success;
+}
+
+void SRepXIGetSelectedEvents(ClientPtr client,
+ int len, xXIGetSelectedEventsReply *rep)
+{
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->num_masks);
+ WriteToClient(client, len, (char *)rep);
+}
+
+
diff --git a/xorg-server/Xi/xisetclientpointer.c b/xorg-server/Xi/xisetclientpointer.c
index 09db8ff75..934747d30 100644
--- a/xorg-server/Xi/xisetclientpointer.c
+++ b/xorg-server/Xi/xisetclientpointer.c
@@ -51,12 +51,10 @@
int
SProcXISetClientPointer(ClientPtr client)
{
- char n;
-
REQUEST(xXISetClientPointerReq);
- swaps(&stuff->length, n);
- swapl(&stuff->win, n);
- swaps(&stuff->deviceid, n);
+ swaps(&stuff->length);
+ swapl(&stuff->win);
+ swaps(&stuff->deviceid);
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
return (ProcXISetClientPointer(client));
}
diff --git a/xorg-server/Xi/xisetdevfocus.c b/xorg-server/Xi/xisetdevfocus.c
index 059424e41..294df7c32 100644
--- a/xorg-server/Xi/xisetdevfocus.c
+++ b/xorg-server/Xi/xisetdevfocus.c
@@ -43,13 +43,11 @@
int
SProcXISetFocus(ClientPtr client)
{
- char n;
-
REQUEST(xXISetFocusReq);
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
- swapl(&stuff->focus, n);
- swapl(&stuff->time, n);
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
+ swapl(&stuff->focus);
+ swapl(&stuff->time);
return ProcXISetFocus(client);
}
@@ -57,11 +55,9 @@ SProcXISetFocus(ClientPtr client)
int
SProcXIGetFocus(ClientPtr client)
{
- char n;
-
REQUEST(xXIGetFocusReq);
- swaps(&stuff->length, n);
- swaps(&stuff->deviceid, n);
+ swaps(&stuff->length);
+ swaps(&stuff->deviceid);
return ProcXIGetFocus(client);
}
@@ -122,9 +118,8 @@ ProcXIGetFocus(ClientPtr client)
void
SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply *rep)
{
- char n;
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- swapl(&rep->focus, n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->focus);
WriteToClient(client, len, (char *)rep);
}
diff --git a/xorg-server/Xi/xiwarppointer.c b/xorg-server/Xi/xiwarppointer.c
index a463ab94d..8fcb4d16b 100644
--- a/xorg-server/Xi/xiwarppointer.c
+++ b/xorg-server/Xi/xiwarppointer.c
@@ -56,19 +56,17 @@
int
SProcXIWarpPointer(ClientPtr client)
{
- char n;
-
REQUEST(xXIWarpPointerReq);
- swaps(&stuff->length, n);
- swapl(&stuff->src_win, n);
- swapl(&stuff->dst_win, n);
- swapl(&stuff->src_x, n);
- swapl(&stuff->src_y, n);
- swaps(&stuff->src_width, n);
- swaps(&stuff->src_height, n);
- swapl(&stuff->dst_x, n);
- swapl(&stuff->dst_y, n);
- swaps(&stuff->deviceid, n);
+ swaps(&stuff->length);
+ swapl(&stuff->src_win);
+ swapl(&stuff->dst_win);
+ swapl(&stuff->src_x);
+ swapl(&stuff->src_y);
+ swaps(&stuff->src_width);
+ swaps(&stuff->src_height);
+ swapl(&stuff->dst_x);
+ swapl(&stuff->dst_y);
+ swaps(&stuff->deviceid);
return (ProcXIWarpPointer(client));
}