diff options
-rw-r--r-- | src/XDenyDev.c | 12 | ||||
-rw-r--r-- | src/XGetCPtr.c | 2 | ||||
-rw-r--r-- | src/XGetPairP.c | 2 | ||||
-rw-r--r-- | src/XPermDev.c | 12 | ||||
-rw-r--r-- | src/XQryAccRl.c | 14 |
5 files changed, 25 insertions, 17 deletions
diff --git a/src/XDenyDev.c b/src/XDenyDev.c index d4f9ca2..686ef12 100644 --- a/src/XDenyDev.c +++ b/src/XDenyDev.c @@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group. #include "XIint.h" Status -XDenyDevices(Display* dpy, Window win, char* devices, int count) +XDenyDevices(Display* dpy, Window win, XID* devices, int count) { xChangeWindowAccessReq* req; @@ -52,12 +52,16 @@ XDenyDevices(Display* dpy, Window win, char* devices, int count) req->reqType = info->codes->major_opcode; req->ReqType = X_ChangeWindowAccess; req->win = win; - req->clear = WindowAccessClearNone; + /* If list is empty, clear all devices */ + if (!count) + req->clear = WindowAccessClearDeny; + else + req->clear = WindowAccessClearNone; req->defaultRule = WindowAccessKeepRule; req->ndeny = count; - req->length += (count + 3) >> 2; + req->length += (count * sizeof(XID) + 3) >> 2; req->npermit = 0; - Data(dpy, devices, count); + Data(dpy, (char*)devices, count * sizeof(XID)); UnlockDisplay(dpy); SyncHandle(); diff --git a/src/XGetCPtr.c b/src/XGetCPtr.c index 33bd30b..0944ee1 100644 --- a/src/XGetCPtr.c +++ b/src/XGetCPtr.c @@ -41,7 +41,7 @@ Bool XGetClientPointer(dpy, win, deviceid) Display* dpy; Window win; - int* deviceid; + XID* deviceid; { xGetClientPointerReq *req; xGetClientPointerReply rep; diff --git a/src/XGetPairP.c b/src/XGetPairP.c index 6d0475d..c84f4bf 100644 --- a/src/XGetPairP.c +++ b/src/XGetPairP.c @@ -41,7 +41,7 @@ Bool XGetPairedPointer(dpy, keyboard, deviceid) Display* dpy; XDevice* keyboard; - int* deviceid; + XID* deviceid; { xGetPairedPointerReq *req; xGetPairedPointerReply rep; diff --git a/src/XPermDev.c b/src/XPermDev.c index 66def1c..1e5cd1e 100644 --- a/src/XPermDev.c +++ b/src/XPermDev.c @@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group. #include "XIint.h" Status -XPermitDevices(Display* dpy, Window win, char* devices, int count) +XPermitDevices(Display* dpy, Window win, XID* devices, int count) { xChangeWindowAccessReq* req; @@ -52,12 +52,16 @@ XPermitDevices(Display* dpy, Window win, char* devices, int count) req->reqType = info->codes->major_opcode; req->ReqType = X_ChangeWindowAccess; req->win = win; - req->clear = WindowAccessClearNone; + /* If list is empty, clear all devices */ + if (! count) + req->clear = WindowAccessClearPerm; + else + req->clear = WindowAccessClearNone; req->defaultRule = WindowAccessKeepRule; req->npermit = count; - req->length += (count + 3) >> 2; + req->length += (count * sizeof(XID) + 3) >> 2; req->ndeny = 0; - Data(dpy, devices, count); + Data(dpy, (char*)devices, count * sizeof(XID)); UnlockDisplay(dpy); SyncHandle(); diff --git a/src/XQryAccRl.c b/src/XQryAccRl.c index 74b76cc..0896b8a 100644 --- a/src/XQryAccRl.c +++ b/src/XQryAccRl.c @@ -41,9 +41,9 @@ Status XQueryWindowAccess(Display* dpy, Window win, int* rule, - char** permdevs, + XID** permdevs, int* nperm, - char** denydevs, + XID** denydevs, int* ndeny) { xQueryWindowAccessReq* req; @@ -69,7 +69,7 @@ XQueryWindowAccess(Display* dpy, *rule = rep.defaultRule; *nperm = rep.npermit; *ndeny = rep.ndeny; - *permdevs = (char*)Xmalloc(*nperm * sizeof(int)); + *permdevs = (XID *)Xmalloc(*nperm * sizeof(XID)); if (!*permdevs) { _XEatData(dpy, (unsigned long)rep.length << 2); @@ -78,7 +78,7 @@ XQueryWindowAccess(Display* dpy, return BadImplementation; } - *denydevs = (char*)Xmalloc(*ndeny * sizeof(int)); + *denydevs = (XID*)Xmalloc(*ndeny * sizeof(XID)); if (!*denydevs) { _XEatData(dpy, (unsigned long)rep.length << 2); @@ -86,11 +86,11 @@ XQueryWindowAccess(Display* dpy, SyncHandle(); return BadImplementation; } - _XRead(dpy, *permdevs, *nperm); - _XRead(dpy, *denydevs, *ndeny); + _XRead(dpy, (char*)*permdevs, *nperm * sizeof(XID)); + _XRead(dpy, (char*)*denydevs, *ndeny * sizeof(XID)); /* discard padding */ - _XEatData(dpy, (rep.length << 2) - *ndeny - *nperm); + _XEatData(dpy, (rep.length << 2) - (*ndeny * sizeof(XID)) - (*nperm * sizeof(XID))); UnlockDisplay(dpy); SyncHandle(); |