aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/Xi/chgptr.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/Xi/chgptr.c')
-rw-r--r--nx-X11/programs/Xserver/Xi/chgptr.c143
1 files changed, 61 insertions, 82 deletions
diff --git a/nx-X11/programs/Xserver/Xi/chgptr.c b/nx-X11/programs/Xserver/Xi/chgptr.c
index 7fef2a104..af2625f49 100644
--- a/nx-X11/programs/Xserver/Xi/chgptr.c
+++ b/nx-X11/programs/Xserver/Xi/chgptr.c
@@ -55,17 +55,17 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <nx-X11/X.h> /* for inputstr.h */
-#include <nx-X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
+#include <nx-X11/X.h> /* for inputstr.h */
+#include <nx-X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h>
#include <nx-X11/extensions/XIproto.h>
#include "XIstubs.h"
-#include "windowstr.h" /* window structure */
-#include "scrnintstr.h" /* screen structure */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
#include "extnsionst.h"
-#include "extinit.h" /* LookupDeviceIntRec */
+#include "extinit.h" /* LookupDeviceIntRec */
#include "dixevents.h"
#include "exevents.h"
@@ -81,14 +81,13 @@ SOFTWARE.
*/
int
-SProcXChangePointerDevice(client)
- register ClientPtr client;
- {
+SProcXChangePointerDevice(register ClientPtr client)
+{
REQUEST(xChangePointerDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
- return(ProcXChangePointerDevice(client));
- }
+ return (ProcXChangePointerDevice(client));
+}
/***********************************************************************
*
@@ -97,14 +96,13 @@ SProcXChangePointerDevice(client)
*/
int
-ProcXChangePointerDevice (client)
- register ClientPtr client;
- {
- DeviceIntPtr xptr = inputInfo.pointer;
- DeviceIntPtr dev;
- ValuatorClassPtr v;
- xChangePointerDeviceReply rep;
- changeDeviceNotify ev;
+ProcXChangePointerDevice(register ClientPtr client)
+{
+ DeviceIntPtr xptr = inputInfo.pointer;
+ DeviceIntPtr dev;
+ ValuatorClassPtr v;
+ xChangePointerDeviceReply rep;
+ changeDeviceNotify ev;
REQUEST(xChangePointerDeviceReq);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
@@ -114,75 +112,68 @@ ProcXChangePointerDevice (client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- dev = LookupDeviceIntRec (stuff->deviceid);
- if (dev == NULL)
- {
+ dev = LookupDeviceIntRec(stuff->deviceid);
+ if (dev == NULL) {
rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
- BadDevice);
+ SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
+ BadDevice);
return Success;
- }
+ }
v = dev->valuator;
- if (v == NULL || v->numAxes < 2 ||
- stuff->xaxis >= v->numAxes ||
- stuff->yaxis >= v->numAxes)
- {
+ if (v == NULL || v->numAxes < 2 ||
+ stuff->xaxis >= v->numAxes || stuff->yaxis >= v->numAxes) {
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch);
return Success;
- }
+ }
if (((dev->grab) && !SameClient(dev->grab, client)) ||
- ((xptr->grab) && !SameClient(xptr->grab, client)))
+ ((xptr->grab) && !SameClient(xptr->grab, client)))
rep.status = AlreadyGrabbed;
else if ((dev->sync.frozen &&
- dev->sync.other && !SameClient(dev->sync.other, client)) ||
+ dev->sync.other && !SameClient(dev->sync.other, client)) ||
(xptr->sync.frozen &&
xptr->sync.other && !SameClient(xptr->sync.other, client)))
rep.status = GrabFrozen;
- else
- {
- if (ChangePointerDevice (
- xptr, dev, stuff->xaxis, stuff->yaxis) != Success)
- {
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
- BadDevice);
+ else {
+ if (ChangePointerDevice(xptr, dev, stuff->xaxis, stuff->yaxis) !=
+ Success) {
+ SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
+ BadDevice);
return Success;
- }
+ }
if (dev->focus)
DeleteFocusClassDeviceStruct(dev);
if (!dev->button)
- InitButtonClassDeviceStruct (dev, 0, NULL);
+ InitButtonClassDeviceStruct(dev, 0, NULL);
if (!dev->ptrfeed)
- InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA);
- RegisterOtherDevice (xptr);
- RegisterPointerDevice (dev);
+ InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr) NoopDDA);
+ RegisterOtherDevice(xptr);
+ RegisterPointerDevice(dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewPointer;
- SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
- SendMappingNotify (MappingPointer, 0, 0, client);
+ SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
+ SendMappingNotify(MappingPointer, 0, 0, client);
rep.status = 0;
- }
+ }
- WriteReplyToClient (client, sizeof (xChangePointerDeviceReply),
- &rep);
+ WriteReplyToClient(client, sizeof(xChangePointerDeviceReply), &rep);
return Success;
- }
+}
void
-DeleteFocusClassDeviceStruct(dev)
- DeviceIntPtr dev;
- {
+DeleteFocusClassDeviceStruct(DeviceIntPtr dev)
+{
free(dev->focus->trace);
free(dev->focus);
dev->focus = NULL;
- }
+}
/***********************************************************************
*
@@ -191,23 +182,18 @@ DeleteFocusClassDeviceStruct(dev)
*/
void
-SendEventToAllWindows (dev, mask, ev, count)
- DeviceIntPtr dev;
- Mask mask;
- xEvent *ev;
- int count;
- {
+SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
+{
int i;
WindowPtr pWin, p1;
- for (i=0; i<screenInfo.numScreens; i++)
- {
+ for (i = 0; i < screenInfo.numScreens; i++) {
pWin = screenInfo.screens[i]->root;
(void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
p1 = pWin->firstChild;
- FindInterestedChildren (dev, p1, mask, ev, count);
- }
+ FindInterestedChildren(dev, p1, mask, ev, count);
}
+}
/***********************************************************************
*
@@ -217,23 +203,18 @@ SendEventToAllWindows (dev, mask, ev, count)
*/
void
-FindInterestedChildren (dev, p1, mask, ev, count)
- DeviceIntPtr dev;
- WindowPtr p1;
- Mask mask;
- xEvent *ev;
- int count;
- {
+FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
+ xEvent * ev, int count)
+{
WindowPtr p2;
- while (p1)
- {
- p2 = p1->firstChild;
+ while (p1) {
+ p2 = p1->firstChild;
(void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
- FindInterestedChildren (dev, p2, mask, ev, count);
+ FindInterestedChildren(dev, p2, mask, ev, count);
p1 = p1->nextSib;
- }
}
+}
/***********************************************************************
*
@@ -243,12 +224,10 @@ FindInterestedChildren (dev, p1, mask, ev, count)
*/
void
-SRepXChangePointerDevice (client, size, rep)
- ClientPtr client;
- int size;
- xChangePointerDeviceReply *rep;
- {
+SRepXChangePointerDevice(ClientPtr client, int size,
+ xChangePointerDeviceReply * rep)
+{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
- }
+}