diff options
-rw-r--r-- | include/X11/extensions/XInput2.h | 37 | ||||
-rw-r--r-- | src/XChDevHier.c | 80 | ||||
-rw-r--r-- | src/XDefDevCur.c | 15 | ||||
-rw-r--r-- | src/XExtInt.c | 12 | ||||
-rw-r--r-- | src/XExtToWire.c | 6 | ||||
-rw-r--r-- | src/XGetCPtr.c | 17 | ||||
-rw-r--r-- | src/XIint.h | 6 | ||||
-rw-r--r-- | src/XQueryDvPtr.c | 27 | ||||
-rw-r--r-- | src/XSetCPtr.c | 15 | ||||
-rw-r--r-- | src/XUndefDevCur.c | 10 | ||||
-rw-r--r-- | src/XWarpDvPtr.c | 15 |
11 files changed, 127 insertions, 113 deletions
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h index 70d40b3..69cf6a8 100644 --- a/include/X11/extensions/XInput2.h +++ b/include/X11/extensions/XInput2.h @@ -39,7 +39,7 @@ typedef struct { char* name; Bool sendCore; Bool enable; -} XCreateMasterInfo; +} XICreateMasterInfo; typedef struct { int type; @@ -47,25 +47,30 @@ typedef struct { int returnMode; /* AttachToMaster, Floating */ XDevice* returnPointer; XDevice* returnKeyboard; -} XRemoveMasterInfo; +} XIRemoveMasterInfo; typedef struct { int type; XDevice* device; - int changeMode; /* AttachToMaster, Floating */ XDevice* newMaster; -} XChangeAttachmentInfo; +} XIAttachSlaveInfo; + +typedef struct { + int type; + XDevice* device; +} XIDetachSlaveInfo; typedef union { int type; /* must be first element */ - XCreateMasterInfo create; - XRemoveMasterInfo remove; - XChangeAttachmentInfo change; -} XAnyHierarchyChangeInfo; + XICreateMasterInfo create; + XIRemoveMasterInfo remove; + XIAttachSlaveInfo attach; + XIDetachSlaveInfo detach; +} XIAnyHierarchyChangeInfo; _XFUNCPROTOBEGIN -extern Bool XQueryDevicePointer( +extern Bool XIQueryDevicePointer( Display* /* display */, XDevice* /* device */, Window /* win */, @@ -78,7 +83,7 @@ extern Bool XQueryDevicePointer( unsigned int* /* mask */ ); -extern Bool XWarpDevicePointer( +extern Bool XIWarpDevicePointer( Display* /* display */, XDevice* /* device */, Window /* src_win */, @@ -91,32 +96,32 @@ extern Bool XWarpDevicePointer( int /* dst_y */ ); -extern Status XDefineDeviceCursor( +extern Status XIDefineDeviceCursor( Display* /* display */, XDevice* /* device */, Window /* win */, Cursor /* cursor */ ); -extern Status XUndefineDeviceCursor( +extern Status XIUndefineDeviceCursor( Display* /* display */, XDevice* /* device */, Window /* win */ ); -extern Status XChangeDeviceHierarchy( +extern Status XIChangeDeviceHierarchy( Display* /* display */, - XAnyHierarchyChangeInfo* /* changes*/, + XIAnyHierarchyChangeInfo* /* changes*/, int /* num_changes */ ); -extern Status XSetClientPointer( +extern Status XISetClientPointer( Display* /* dpy */, Window /* win */, XDevice* /* device */ ); -extern Bool XGetClientPointer( +extern Bool XIGetClientPointer( Display* /* dpy */, Window /* win */, XID* /* deviceid */ diff --git a/src/XChDevHier.c b/src/XChDevHier.c index d157415..b9d96f2 100644 --- a/src/XChDevHier.c +++ b/src/XChDevHier.c @@ -26,7 +26,7 @@ in this Software without prior written authorization from The Open Group. /*********************************************************************** * - * XChangeDeviceHierarch - change the device hierarchy, i.e. which slave + * XIChangeDeviceHierarchy - change the device hierarchy, i.e. which slave * device is attached to which master, etc. */ @@ -39,12 +39,12 @@ in this Software without prior written authorization from The Open Group. #include "XIint.h" int -XChangeDeviceHierarchy(Display* dpy, - XAnyHierarchyChangeInfo* changes, - int num_changes) +XIChangeDeviceHierarchy(Display* dpy, + XIAnyHierarchyChangeInfo* changes, + int num_changes) { - XAnyHierarchyChangeInfo* any; - xChangeDeviceHierarchyReq *req; + XIAnyHierarchyChangeInfo* any; + xXIChangeDeviceHierarchyReq *req; XExtDisplayInfo *info = XInput_find_display(dpy); char *data = NULL, *dptr; int dlen = 0, i; @@ -53,9 +53,9 @@ XChangeDeviceHierarchy(Display* dpy, if (_XiCheckExtInit(dpy, XInput_2, info) == -1) return (NoSuchExtension); - GetReq(ChangeDeviceHierarchy, req); + GetReq(XIChangeDeviceHierarchy, req); req->reqType = info->codes->major_opcode; - req->ReqType = X_ChangeDeviceHierarchy; + req->ReqType = X_XIChangeDeviceHierarchy; req->num_changes = num_changes; /* alloc required memory */ @@ -66,15 +66,18 @@ XChangeDeviceHierarchy(Display* dpy, case CH_CreateMasterDevice: { int slen = (strlen(any->create.name)); - dlen += sizeof(xCreateMasterInfo) + + dlen += sizeof(xXICreateMasterInfo) + slen + (4 - (slen % 4)); } break; case CH_RemoveMasterDevice: - dlen += sizeof(xRemoveMasterInfo); + dlen += sizeof(xXIRemoveMasterInfo); break; - case CH_ChangeAttachment: - dlen += sizeof(xChangeAttachmentInfo); + case CH_AttachSlave: + dlen += sizeof(xXIAttachSlaveInfo); + break; + case CH_DetachSlave: + dlen += sizeof(xXIDetachSlaveInfo); break; default: return BadValue; @@ -93,49 +96,56 @@ XChangeDeviceHierarchy(Display* dpy, { case CH_CreateMasterDevice: { - XCreateMasterInfo* C = &any->create; - xCreateMasterInfo* c = (xCreateMasterInfo*)dptr; + XICreateMasterInfo* C = &any->create; + xXICreateMasterInfo* c = (xXICreateMasterInfo*)dptr; c->type = C->type; - c->sendCore = C->sendCore; + c->send_core = C->sendCore; c->enable = C->enable; - c->namelen = strlen(C->name); - c->length = sizeof(xCreateMasterInfo) + c->namelen + - (4 - (c->namelen % 4)); - strncpy((char*)&c[1], C->name, c->namelen); + c->name_len = strlen(C->name); + c->length = (sizeof(xXICreateMasterInfo) + c->name_len + 3)/4; + strncpy((char*)&c[1], C->name, c->name_len); dptr += c->length; } break; case CH_RemoveMasterDevice: { - XRemoveMasterInfo* R = &any->remove; - xRemoveMasterInfo* r = (xRemoveMasterInfo*)dptr; + XIRemoveMasterInfo* R = &any->remove; + xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)dptr; r->type = R->type; - r->returnMode = R->returnMode; + r->return_mode = R->returnMode; r->deviceid = R->device->device_id; - r->length = sizeof(xRemoveMasterInfo); - if (r->returnMode == AttachToMaster) + r->length = sizeof(xXIRemoveMasterInfo)/4; + if (r->return_mode == AttachToMaster) { - r->returnPointer = R->returnPointer->device_id; - r->returnKeyboard = R->returnKeyboard->device_id; + r->return_pointer = R->returnPointer->device_id; + r->return_keyboard = R->returnKeyboard->device_id; } - dptr += sizeof(xRemoveMasterInfo); + dptr += sizeof(xXIRemoveMasterInfo); } break; - case CH_ChangeAttachment: + case CH_AttachSlave: { - XChangeAttachmentInfo* C = &any->change; - xChangeAttachmentInfo* c = (xChangeAttachmentInfo*)dptr; + XIAttachSlaveInfo* C = &any->attach; + xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)dptr; c->type = C->type; c->deviceid = C->device->device_id; - c->changeMode = C->changeMode; - c->length = sizeof(xChangeAttachmentInfo); - if (c->changeMode == AttachToMaster) - c->newMaster = C->newMaster->device_id; + c->length = sizeof(xXIAttachSlaveInfo)/4; + c->new_master = C->newMaster->device_id; - dptr += sizeof(xChangeAttachmentInfo); + dptr += sizeof(xXIAttachSlaveInfo); } break; + case CH_DetachSlave: + { + XIDetachSlaveInfo *D = &any->detach; + xXIDetachSlaveInfo *d = (xXIDetachSlaveInfo*)dptr; + + d->type = D->type; + d->deviceid = D->device->device_id; + d->length = sizeof(xXIDetachSlaveInfo)/4; + dptr += sizeof(xXIDetachSlaveInfo); + } } } diff --git a/src/XDefDevCur.c b/src/XDefDevCur.c index fb7e8f7..b21d7fa 100644 --- a/src/XDefDevCur.c +++ b/src/XDefDevCur.c @@ -26,20 +26,21 @@ in this Software without prior written authorization from The Open Group. /*********************************************************************** * - * XDefineDeviceCursor - Change the cursor of an extension input device. + * XIDefineDeviceCursor - Change the cursor of an extension input device. * */ +#include <stdint.h> #include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> +#include <X11/extensions/XI2proto.h> #include <X11/Xlibint.h> -#include <X11/extensions/XInput.h> +#include <X11/extensions/XInput2.h> #include <X11/extensions/extutil.h> #include "XIint.h" -int XDefineDeviceCursor(Display *dpy, XDevice* dev, Window w, Cursor cursor) +int XIDefineDeviceCursor(Display *dpy, XDevice* dev, Window w, Cursor cursor) { - register xChangeDeviceCursorReq *req; + xXIChangeDeviceCursorReq *req; XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); @@ -47,9 +48,9 @@ int XDefineDeviceCursor(Display *dpy, XDevice* dev, Window w, Cursor cursor) if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) return (NoSuchExtension); - GetReq(ChangeDeviceCursor, req); + GetReq(XIChangeDeviceCursor, req); req->reqType = info->codes->major_opcode; - req->ReqType = X_ChangeDeviceCursor; + req->ReqType = X_XIChangeDeviceCursor; req->deviceid = dev->device_id; req->win = w; req->cursor = cursor; diff --git a/src/XExtInt.c b/src/XExtInt.c index bbc8a9b..4e24216 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -773,12 +773,12 @@ XInputWireToEvent( { switch(ge->evtype) { - case XI_DeviceHierarchyChangedNotify: + case XI_HierarchyChangedNotify: { XDeviceHierarchyChangedEvent* dhc_event = (XDeviceHierarchyChangedEvent*)save; - deviceHierarchyChangedEvent* dhc_wire = - (deviceHierarchyChangedEvent*)event; + XIDeviceHierarchyEvent* dhc_wire = + (XIDeviceHierarchyEvent*)event; dhc_event->extension = dhc_wire->extension; dhc_event->evtype = dhc_wire->evtype; @@ -786,12 +786,12 @@ XInputWireToEvent( *re = *save; return ENQUEUE_EVENT; } - case XI_DeviceClassesChangedNotify: + case XI_ClassesChangedNotify: { XDeviceClassesChangedEvent* dcc_event = (XDeviceClassesChangedEvent*)save; - deviceClassesChangedEvent* dcc_wire = - (deviceClassesChangedEvent*)event; + XIDeviceChangedEvent* dcc_wire = + (XIDeviceChangedEvent*)event; int size; XAnyClassPtr Any; xAnyClassPtr any; diff --git a/src/XExtToWire.c b/src/XExtToWire.c index fb8f68b..73d173f 100644 --- a/src/XExtToWire.c +++ b/src/XExtToWire.c @@ -462,13 +462,13 @@ _XiEventToWire( #if 0 switch (((XGenericEvent*)re)->evtype) { - case XI_DeviceHierarchyChangedNotify: + case XI_HierarchyChangedNotify: { XDeviceHierarchyChangedEvent *ev = (XDeviceHierarchyChangedEvent*)re; - deviceHierarchyChangedEvent *dhcev; + XIDeviceHierarchyEvent *dhcev; *count = 1; - dhcev = (deviceHierarchyChangedEvent *)Xmalloc(*count * sizeof(xEvent)); + dhcev = (XIDeviceHierarchyEvent *)Xmalloc(*count * sizeof(xEvent)); if (!dhcev) return (_XUnknownNativeEvent(dpy, re, *event)); diff --git a/src/XGetCPtr.c b/src/XGetCPtr.c index 180d0c6..7d96284 100644 --- a/src/XGetCPtr.c +++ b/src/XGetCPtr.c @@ -26,31 +26,32 @@ in this Software without prior written authorization from The Open Group. /*********************************************************************** * - * XGetClientPointer - Get the clientPointer setting for a client. + * XIGetClientPointer - Get the clientPointer setting for a client. * */ +#include <stdint.h> #include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> +#include <X11/extensions/XI2proto.h> #include <X11/Xlibint.h> -#include <X11/extensions/XInput.h> +#include <X11/extensions/XInput2.h> #include <X11/extensions/extutil.h> #include "XIint.h" Bool -XGetClientPointer(Display* dpy, Window win, XID* deviceid) +XIGetClientPointer(Display* dpy, Window win, XID* deviceid) { - xGetClientPointerReq *req; - xGetClientPointerReply rep; + xXIGetClientPointerReq *req; + xXIGetClientPointerReply rep; XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) return (NoSuchExtension); - GetReq(GetClientPointer, req); + GetReq(XIGetClientPointer, req); req->reqType = info->codes->major_opcode; - req->ReqType = X_GetClientPointer; + req->ReqType = X_XIGetClientPointer; req->win = win; if (!_XReply(dpy, (xReply*) &rep, 0, xFalse)) { diff --git a/src/XIint.h b/src/XIint.h index 38a64b7..6ef150f 100644 --- a/src/XIint.h +++ b/src/XIint.h @@ -33,10 +33,4 @@ extern void ParseClassInfo( int /* num_classes */ ); -extern int XUndefDeviceCursor( - Display * /* dpy */, - XDevice * /* dev */, - Window /* w */ -); - #endif diff --git a/src/XQueryDvPtr.c b/src/XQueryDvPtr.c index 878e93d..2adc1c2 100644 --- a/src/XQueryDvPtr.c +++ b/src/XQueryDvPtr.c @@ -26,19 +26,20 @@ in this Software without prior written authorization from The Open Group. /*********************************************************************** * - * XQueryDevicePointer - Query the pointer of an extension input device. + * XIQueryDevicePointer - Query the pointer of an extension input device. * */ +#include <stdint.h> #include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> +#include <X11/extensions/XI2proto.h> #include <X11/Xlibint.h> -#include <X11/extensions/XInput.h> +#include <X11/extensions/XInput2.h> #include <X11/extensions/extutil.h> #include "XIint.h" Bool -XQueryDevicePointer(Display *dpy, +XIQueryDevicePointer(Display *dpy, XDevice *dev, Window w, Window *root, @@ -49,8 +50,8 @@ XQueryDevicePointer(Display *dpy, int *win_y, unsigned int *mask) { - xQueryDevicePointerReq *req; - xQueryDevicePointerReply rep; + xXIQueryDevicePointerReq *req; + xXIQueryDevicePointerReply rep; XExtDisplayInfo *info = XInput_find_display(dpy); @@ -58,9 +59,9 @@ XQueryDevicePointer(Display *dpy, if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) return False; - GetReq(QueryDevicePointer, req); + GetReq(XIQueryDevicePointer, req); req->reqType = info->codes->major_opcode; - req->ReqType = X_QueryDevicePointer; + req->ReqType = X_XIQueryDevicePointer; req->deviceid = dev->device_id; req->win = w; @@ -72,12 +73,12 @@ XQueryDevicePointer(Display *dpy, *root = rep.root; *child = rep.child; - *root_x = cvtINT16toInt(rep.rootX); - *root_y = cvtINT16toInt(rep.rootY); - *win_x = cvtINT16toInt(rep.winX); - *win_y = cvtINT16toInt(rep.winY); + *root_x = cvtINT16toInt(rep.root_x.integral); + *root_y = cvtINT16toInt(rep.root_y.integral); + *win_x = cvtINT16toInt(rep.win_x.integral); + *win_y = cvtINT16toInt(rep.win_y.integral); *mask = rep.mask; UnlockDisplay(dpy); SyncHandle(); - return rep.sameScreen; + return rep.same_screen; } diff --git a/src/XSetCPtr.c b/src/XSetCPtr.c index bcd0bac..1c92812 100644 --- a/src/XSetCPtr.c +++ b/src/XSetCPtr.c @@ -26,33 +26,34 @@ in this Software without prior written authorization from The Open Group. /*********************************************************************** * - * XSetClientPointer - Sets the default pointer for a client. This call is + * XISetClientPointer - Sets the default pointer for a client. This call is * important for legacy applications that may send ambiguous requests to the * server where the server has to randomly pick a device. * Ideally, the window manager will always send a SetClientPointer request * before the client interacts with an application. */ +#include <stdint.h> #include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> +#include <X11/extensions/XI2proto.h> #include <X11/Xlibint.h> -#include <X11/extensions/XInput.h> +#include <X11/extensions/XInput2.h> #include <X11/extensions/extutil.h> #include "XIint.h" Status -XSetClientPointer(Display* dpy, Window win, XDevice* device) +XISetClientPointer(Display* dpy, Window win, XDevice* device) { - xSetClientPointerReq* req; + xXISetClientPointerReq* req; XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) return (NoSuchExtension); - GetReq(SetClientPointer, req); + GetReq(XISetClientPointer, req); req->reqType = info->codes->major_opcode; - req->ReqType = X_SetClientPointer; + req->ReqType = X_XISetClientPointer; req->win = win; req->deviceid = device->device_id; diff --git a/src/XUndefDevCur.c b/src/XUndefDevCur.c index af20fff..81e312e 100644 --- a/src/XUndefDevCur.c +++ b/src/XUndefDevCur.c @@ -26,19 +26,19 @@ in this Software without prior written authorization from The Open Group. /*********************************************************************** * - * XDefineDeviceCursor - Change the cursor of an extension input device. + * XIUndefineDeviceCursor - Change the cursor of an extension input device to + * None.. * */ #include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> #include <X11/Xlibint.h> -#include <X11/extensions/XInput.h> +#include <X11/extensions/XInput2.h> #include <X11/extensions/extutil.h> #include "XIint.h" -int XUndefDeviceCursor(Display *dpy, XDevice* dev, Window w) +int XIUndefineDeviceCursor(Display *dpy, XDevice* dev, Window w) { - return XDefineDeviceCursor(dpy, dev, w, None); + return XIDefineDeviceCursor(dpy, dev, w, None); } diff --git a/src/XWarpDvPtr.c b/src/XWarpDvPtr.c index b006be9..6a9c45d 100644 --- a/src/XWarpDvPtr.c +++ b/src/XWarpDvPtr.c @@ -26,19 +26,20 @@ in this Software without prior written authorization from The Open Group. /*********************************************************************** * - * XWarpDevicePointer - Warp the pointer of an extension input device. + * XIWarpDevicePointer - Warp the pointer of an extension input device. * */ +#include <stdint.h> #include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> +#include <X11/extensions/XI2proto.h> #include <X11/Xlibint.h> -#include <X11/extensions/XInput.h> +#include <X11/extensions/XInput2.h> #include <X11/extensions/extutil.h> #include "XIint.h" int -XWarpDevicePointer(Display *dpy, +XIWarpDevicePointer(Display *dpy, XDevice *dev, Window src_win, Window dst_win, @@ -49,7 +50,7 @@ XWarpDevicePointer(Display *dpy, int dst_x, int dst_y) { - register xWarpDevicePointerReq *req; + xXIWarpDevicePointerReq *req; XExtDisplayInfo *info = XInput_find_display(dpy); @@ -57,9 +58,9 @@ XWarpDevicePointer(Display *dpy, if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) return (NoSuchExtension); - GetReq(WarpDevicePointer, req); + GetReq(XIWarpDevicePointer, req); req->reqType = info->codes->major_opcode; - req->ReqType = X_WarpDevicePointer; + req->ReqType = X_XIWarpDevicePointer; req->deviceid = dev->device_id; req->src_win = src_win; req->dst_win = dst_win; |