diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-07 15:17:58 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-07 15:24:57 +1000 |
commit | 1b23d5c2377732ffd5cf5c41c699c764606b71a8 (patch) | |
tree | 17fc9e7c55d356a0dc40b92d262b6a6f19a9a3fa | |
parent | 5a9a2bfcafff748c49e4ad411c5250ca52fd7ff8 (diff) |
Re-do the pointer barrier event API
Use a struct as argument, but do provide a helper call.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | include/X11/extensions/XInput2.h | 31 | ||||
-rw-r--r-- | src/XIBarrier.c | 39 |
2 files changed, 39 insertions, 31 deletions
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h index 2fb065b..3f43d21 100644 --- a/include/X11/extensions/XInput2.h +++ b/include/X11/extensions/XInput2.h @@ -169,6 +169,16 @@ typedef struct int status; } XIGrabModifiers; +typedef XID PointerBarrier; +typedef int32_t BarrierEventID; + +typedef struct +{ + int deviceid; + PointerBarrier barrier; + BarrierEventID eventid; +} XIBarrierReleasePointerInfo; + /** * Generic XI2 event. All XI2 events have the same header. */ @@ -328,9 +338,6 @@ typedef struct { int flags; } XITouchOwnershipEvent; -typedef XID PointerBarrier; -typedef int32_t BarrierEventID; - typedef struct { int type; /* GenericEvent */ unsigned long serial; /* # of last request processed by server */ @@ -629,20 +636,18 @@ XIGetProperty( ); extern void -XIBarrierReleasePointerFull( - Display* display, - int num_barriers, - PointerBarrier *barriers, - unsigned long *eventids, - int *deviceids +XIBarrierReleasePointers( + Display* display, + XIBarrierReleasePointerInfo *barriers, + int num_barriers ); extern void XIBarrierReleasePointer( - Display* display, - int deviceid, - PointerBarrier barrier, - unsigned long eventid + Display* display, + int deviceid, + PointerBarrier barrier, + BarrierEventID eventid ); extern void XIFreeDeviceInfo(XIDeviceInfo *info); diff --git a/src/XIBarrier.c b/src/XIBarrier.c index e0d12a0..155b98b 100644 --- a/src/XIBarrier.c +++ b/src/XIBarrier.c @@ -34,22 +34,20 @@ #include "XIint.h" void -XIBarrierReleasePointerFull (Display *dpy, - int num_barriers, - PointerBarrier *barriers, - unsigned long *eventids, - int *deviceids) +XIBarrierReleasePointers(Display *dpy, + XIBarrierReleasePointerInfo *barriers, + int num_barriers) { - XExtDisplayInfo *info = XInput_find_display (dpy); + XExtDisplayInfo *info = XInput_find_display(dpy); xXIBarrierReleasePointerReq *req; int extra = 0; int i; - uint32_t *p; + xXIBarrierReleasePointerInfo *b; if (!num_barriers) return; - extra = (num_barriers * 12); + extra = (num_barriers * sizeof(xXIBarrierReleasePointerInfo)); LockDisplay (dpy); GetReqExtra (XIBarrierReleasePointer, extra, req); @@ -57,11 +55,11 @@ XIBarrierReleasePointerFull (Display *dpy, req->ReqType = X_XIBarrierReleasePointer; req->num_barriers = num_barriers; - p = (uint32_t *) &req[1]; - for (i = 0; i < num_barriers; i++) { - *(p++) = barriers[i]; - *(p++) = eventids[i]; - *(p++) = deviceids[i]; + b = (xXIBarrierReleasePointerInfo *) &req[1]; + for (i = 0; i < num_barriers; i++, b++) { + b->deviceid = barriers[i].deviceid; + b->eventid = barriers[i].eventid; + b->barrier = barriers[i].barrier; } UnlockDisplay (dpy); @@ -69,10 +67,15 @@ XIBarrierReleasePointerFull (Display *dpy, } void -XIBarrierReleasePointer (Display *dpy, - int deviceid, - PointerBarrier barrier, - unsigned long eventid) +XIBarrierReleasePointer(Display *dpy, + int deviceid, + PointerBarrier barrier, + BarrierEventID eventid) { - XIBarrierReleasePointerFull (dpy, 1, &barrier, &eventid, &deviceid); + XIBarrierReleasePointerInfo info; + info.deviceid = deviceid; + info.barrier = barrier; + info.eventid = eventid; + + XIBarrierReleasePointers(dpy, &info, 1); } |