diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2006-12-20 13:08:29 +1030 |
---|---|---|
committer | Peter Hutterer <whot@hyena.localdomain> | 2006-12-20 13:08:29 +1030 |
commit | 448def03e88d3460ce97a49df0816dedd609c1e3 (patch) | |
tree | 7d3a40e60bbf0591643263ec2e0cf25296608319 | |
parent | c8696a5230c565f8999fea136a85a875b04e7b9a (diff) |
Adding XWarpDevicePointer and XQueryDevicePointer calls.
-rw-r--r-- | Changelog | 10 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/XExtInt.c | 2 | ||||
-rw-r--r-- | src/XQueryDvPtr.c | 86 | ||||
-rw-r--r-- | src/XWarpDvPtr.c | 75 |
5 files changed, 174 insertions, 1 deletions
diff --git a/Changelog b/Changelog new file mode 100644 index 0000000..af71789 --- /dev/null +++ b/Changelog @@ -0,0 +1,10 @@ +MPX Changelog + +== 20.12.06 == +Adding XWarpDevicePointer and XQueryDevicePointer calls. + +Files: + Makefile.am + XExtInt.c + XQueryDvPtr.c + XWarpDvPtr.c diff --git a/src/Makefile.am b/src/Makefile.am index a02428c..f4db3d5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,6 +29,7 @@ libXi_la_SOURCES = \ XListDev.c \ XOpenDev.c \ XQueryDv.c \ + XQueryDvPtr.c \ XSelect.c \ XSetBMap.c \ XSetDVal.c \ @@ -39,6 +40,7 @@ libXi_la_SOURCES = \ XUngrDev.c \ XUngrDvB.c \ XUngrDvK.c \ + XWarpDvPtr.c \ XExtInt.c \ XIint.h diff --git a/src/XExtInt.c b/src/XExtInt.c index 8366104..10f728d 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -259,7 +259,7 @@ Ones(mask) return (((y + (y >> 3)) & 030707070707) % 077); } -static int +int _XiGetDevicePresenceNotifyEvent(Display * dpy) { XExtDisplayInfo *info = XInput_find_display(dpy); diff --git a/src/XQueryDvPtr.c b/src/XQueryDvPtr.c new file mode 100644 index 0000000..a67c113 --- /dev/null +++ b/src/XQueryDvPtr.c @@ -0,0 +1,86 @@ +/************************************************************ + +Copyright 2006 Peter Hutterer <peter@cs.unisa.edu.au> + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/*********************************************************************** + * + * XQueryDevicePointer - Query the pointer of an extension input device. + * + */ + +#include <X11/extensions/XI.h> +#include <X11/extensions/XIproto.h> +#include <X11/Xlibint.h> +#include <X11/extensions/XInput.h> +#include <X11/extensions/extutil.h> +#include "XIint.h" + +Bool +XQueryDevicePointer(dpy, dev, w, root, child, root_x, root_y, win_x, win_y, + mask, shared) + register Display *dpy; + XDevice* dev; + Window w, *root, *child; + int *root_x, *root_y, *win_x, *win_y; + unsigned int *mask; + Bool *shared; + +{ + int i, j; + int rlen; + int size = 0; + xQueryDevicePointerReq *req; + xQueryDevicePointerReply rep; + + XExtDisplayInfo *info = XInput_find_display(dpy); + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + return ((XDeviceState *) NoSuchExtension); + + GetReq(QueryDevicePointer, req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_QueryDevicePointer; + req->deviceid = dev->device_id; + req->win = w; + + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return (XDeviceState *) NULL; + } + + *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); + *mask = rep.mask; + *shared = rep.shared; + UnlockDisplay(dpy); + SyncHandle(); + return (rep.sameScreen); +} diff --git a/src/XWarpDvPtr.c b/src/XWarpDvPtr.c new file mode 100644 index 0000000..6bf8d34 --- /dev/null +++ b/src/XWarpDvPtr.c @@ -0,0 +1,75 @@ +/************************************************************ + +Copyright 2006 Peter Hutterer <peter@cs.unisa.edu.au> + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/*********************************************************************** + * + * XWarpDevicePointer - Warp the pointer of an extension input device. + * + */ + +#include <X11/extensions/XI.h> +#include <X11/extensions/XIproto.h> +#include <X11/Xlibint.h> +#include <X11/extensions/XInput.h> +#include <X11/extensions/extutil.h> +#include "XIint.h" + +int +XWarpDevicePointer(dpy, dev, src_win, dst_win, src_x, src_y, src_width, + src_height, dst_x, dst_y) + register Display *dpy; + XDevice* dev; + Window src_win, dst_win; + int src_x, src_y; + unsigned int src_width, src_height; + int dst_x, dst_y; +{ + register xWarpDevicePointerReq *req; + + XExtDisplayInfo *info = XInput_find_display(dpy); + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + return ((XDeviceState *) NoSuchExtension); + + GetReq(WarpDevicePointer, req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_WarpDevicePointer; + req->deviceid = dev->device_id; + req->src_win = src_win; + req->dst_win = dst_win; + req->src_x = src_x; + req->src_y = src_y; + req->src_width = src_width; + req->src_height = src_height; + req->dst_x = dst_x; + req->dst_y = dst_y; + + + UnlockDisplay(dpy); + SyncHandle(); + return Success; +} |