diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-02-21 10:02:46 +1030 |
---|---|---|
committer | Peter Hutterer <whot@hyena.localdomain> | 2007-02-21 10:02:46 +1030 |
commit | 21765b25a938cf6c8302415d5d15e9a08c7bed98 (patch) | |
tree | 1b1c77187d9193e6d0cedc90e6010525724f6a4f | |
parent | 1ab0fa01391156d96cf6d3adc1076ad5216ac23d (diff) |
Adding XRegisterPairingClient and XUnregisterPairingClient calls.
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/XRegPair.c | 66 | ||||
-rw-r--r-- | src/XUnregPair.c | 67 |
3 files changed, 135 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index a0e4b04..c47d9fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,6 +32,7 @@ libXi_la_SOURCES = \ XOpenDev.c \ XQueryDv.c \ XQueryDvPtr.c \ + XRegPair.c \ XSelect.c \ XSetBMap.c \ XSetDVal.c \ @@ -43,6 +44,7 @@ libXi_la_SOURCES = \ XUngrDev.c \ XUngrDvB.c \ XUngrDvK.c \ + XUnregPair.c \ XWarpDvPtr.c \ XExtInt.c \ XIint.h diff --git a/src/XRegPair.c b/src/XRegPair.c new file mode 100644 index 0000000..cfb8362 --- /dev/null +++ b/src/XRegPair.c @@ -0,0 +1,66 @@ +/************************************************************ + +Copyright 2007 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. + +*/ + +/*********************************************************************** + * + * XRegisterPairingClient - Register a client as allowed to pair pointers and + * keyboards. Returns True on success or false otherwise. + * + */ + +#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 +XRegisterPairingClient(Display* dpy) +{ + xRegisterPairingClientReq *req; + xRegisterPairingClientReply rep; + XExtDisplayInfo *info = XInput_find_display(dpy); + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + return (NoSuchExtension); + + GetReq(RegisterPairingClient, req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_RegisterPairingClient; + req->disable = False; + + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + + UnlockDisplay(dpy); + SyncHandle(); + return rep.success; +} diff --git a/src/XUnregPair.c b/src/XUnregPair.c new file mode 100644 index 0000000..7b47601 --- /dev/null +++ b/src/XUnregPair.c @@ -0,0 +1,67 @@ +/************************************************************ + +Copyright 2007 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. + +*/ + +/*********************************************************************** + * + * XUnregisterPairingClient - A client is unregistered so other clients can + * register to change keyboard-pointer pairings. + * + * Returns True on success or False otherwise. + */ + +#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 +XUnregisterPairingClient(Display* dpy) +{ + xRegisterPairingClientReq *req; + xRegisterPairingClientReply rep; + XExtDisplayInfo *info = XInput_find_display(dpy); + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + return (NoSuchExtension); + + GetReq(RegisterPairingClient, req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_RegisterPairingClient; + req->disable = True; + + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + + UnlockDisplay(dpy); + SyncHandle(); + return rep.success; +} |