diff options
author | Mihai Moldovan <ionic@ionic.de> | 2018-02-26 01:00:54 +0100 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2018-02-26 01:00:54 +0100 |
commit | 05152b788ab184f45df1f64182791c88a09dc6f9 (patch) | |
tree | 4232012c65ee251fef529950a420689154778847 /nx-X11/programs/Xserver/Xi/gtmotion.c | |
parent | e247900edd20c140faf42ba0759bf59cbd2f75ae (diff) | |
parent | 4598c0c3d215f7f2237a9ccee3a143025f2af005 (diff) | |
download | nx-libs-05152b788ab184f45df1f64182791c88a09dc6f9.tar.gz nx-libs-05152b788ab184f45df1f64182791c88a09dc6f9.tar.bz2 nx-libs-05152b788ab184f45df1f64182791c88a09dc6f9.zip |
Merge branch 'uli42-pr/update_xi' into arctica-3.6.x
Attributes GH PR #644: https://github.com/ArcticaProject/nx-libs/pull/644
Diffstat (limited to 'nx-X11/programs/Xserver/Xi/gtmotion.c')
-rw-r--r-- | nx-X11/programs/Xserver/Xi/gtmotion.c | 106 |
1 files changed, 47 insertions, 59 deletions
diff --git a/nx-X11/programs/Xserver/Xi/gtmotion.c b/nx-X11/programs/Xserver/Xi/gtmotion.c index 9c04ca30e..72209d1b4 100644 --- a/nx-X11/programs/Xserver/Xi/gtmotion.c +++ b/nx-X11/programs/Xserver/Xi/gtmotion.c @@ -55,13 +55,13 @@ 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 "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ +#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -74,16 +74,15 @@ SOFTWARE. */ int -SProcXGetDeviceMotionEvents(client) -register ClientPtr client; - { +SProcXGetDeviceMotionEvents(register ClientPtr client) +{ REQUEST(xGetDeviceMotionEventsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); swapl(&stuff->start); swapl(&stuff->stop); - return(ProcXGetDeviceMotionEvents(client)); - } + return (ProcXGetDeviceMotionEvents(client)); +} /**************************************************************************** * @@ -92,36 +91,33 @@ register ClientPtr client; */ int -ProcXGetDeviceMotionEvents(client) - ClientPtr client; +ProcXGetDeviceMotionEvents(ClientPtr client) { INT32 *coords = NULL, *bufptr; xGetDeviceMotionEventsReply rep; unsigned long i; - int num_events, axes, size = 0, tsize; + int num_events, axes, size = 0, tsize; unsigned long nEvents; DeviceIntPtr dev; TimeStamp start, stop; - int length = 0; - ValuatorClassPtr v; + int length = 0; + ValuatorClassPtr v; REQUEST(xGetDeviceMotionEventsReq); REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); - dev = LookupDeviceIntRec (stuff->deviceid); - if (dev == NULL) - { - SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, - BadDevice); + dev = LookupDeviceIntRec(stuff->deviceid); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, + BadDevice); return Success; - } + } v = dev->valuator; - if (v==NULL || v->numAxes == 0) - { - SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, - BadMatch); + if (v == NULL || v->numAxes == 0) { + SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, + BadMatch); return Success; - } + } if (dev->valuator->motionHintWindow) MaybeStopDeviceHint(dev, client); axes = v->numAxes; @@ -135,49 +131,43 @@ ProcXGetDeviceMotionEvents(client) start = ClientTimeToServerTime(stuff->start); stop = ClientTimeToServerTime(stuff->stop); if (CompareTimeStamps(start, stop) == LATER || - CompareTimeStamps(start, currentTime) == LATER) - { - WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); - return Success; - } + CompareTimeStamps(start, currentTime) == LATER) { + WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); + return Success; + } if (CompareTimeStamps(stop, currentTime) == LATER) - stop = currentTime; + stop = currentTime; num_events = v->numMotionEvents; - if (num_events) - { - size = sizeof(Time) + (axes * sizeof (INT32)); + if (num_events) { + size = sizeof(Time) + (axes * sizeof(INT32)); tsize = num_events * size; coords = (INT32 *) malloc(tsize); if (!coords) { - SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, - BadAlloc); + SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, + BadAlloc); return Success; - } - rep.nEvents = (v->GetMotionProc) ( - dev, (xTimecoord *)coords, /* XXX */ - start.milliseconds, stop.milliseconds, (ScreenPtr)NULL); - } - if (rep.nEvents > 0) - { - length = (rep.nEvents * size +3) >> 2; - rep.length = length; } + rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */ + start.milliseconds, stop.milliseconds, + (ScreenPtr) NULL); + } + if (rep.nEvents > 0) { + length = (rep.nEvents * size + 3) >> 2; + rep.length = length; + } nEvents = rep.nEvents; WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); - if (nEvents) - { - if (client->swapped) - { + if (nEvents) { + if (client->swapped) { bufptr = coords; - for (i=0; i<nEvents * (axes+1); i++) - { + for (i = 0; i < nEvents * (axes + 1); i++) { swapl(bufptr); bufptr++; - } } + } WriteToClient(client, length * 4, coords); - } + } if (coords) free(coords); return Success; @@ -191,13 +181,11 @@ ProcXGetDeviceMotionEvents(client) */ void -SRepXGetDeviceMotionEvents (client, size, rep) - ClientPtr client; - int size; - xGetDeviceMotionEventsReply *rep; - { +SRepXGetDeviceMotionEvents(ClientPtr client, int size, + xGetDeviceMotionEventsReply * rep) +{ swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->nEvents); WriteToClient(client, size, rep); - } +} |