diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-01-29 18:20:47 +1030 |
---|---|---|
committer | Peter Hutterer <whot@hyena.localdomain> | 2007-01-29 18:20:47 +1030 |
commit | 6a123cbfed985382f5b0c209d880dabeb8ee9733 (patch) | |
tree | 2ad5510077953e8ccc45db22485c3eb0f42eae07 /src | |
parent | bfd533c3a7e854d893a06e6a7fe2b3f079508a4d (diff) |
Adding XChangePointerKeyboardPairing call.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/XChPKPair.c | 63 | ||||
-rw-r--r-- | src/XExtInt.c | 19 | ||||
-rw-r--r-- | src/XExtToWire.c | 17 |
4 files changed, 100 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 09f71a2..a0e4b04 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,6 +11,7 @@ libXi_la_SOURCES = \ XChgKMap.c \ XChgPnt.c \ XChgProp.c \ + XChPKPair.c \ XCloseDev.c \ XDevBell.c \ XExtToWire.c \ diff --git a/src/XChPKPair.c b/src/XChPKPair.c new file mode 100644 index 0000000..4ec8bbc --- /dev/null +++ b/src/XChPKPair.c @@ -0,0 +1,63 @@ +/************************************************************ + +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. + +*/ + +/*********************************************************************** + * + * XChangePointerKeyboardPairing - Change the pairing between pointer and + * keyboard. + * + */ + +#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 +XChangePointerKeyboardPairing(dpy, pointer, keyboard) + register Display* dpy; + XDevice* pointer; + XDevice* keyboard; +{ + register xChangePointerKeyboardPairingReq *req; + XExtDisplayInfo *info = XInput_find_display(dpy); + + LockDisplay(dpy); + if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) + return (NoSuchExtension); + + GetReq(ChangePointerKeyboardPairing, req); + req->reqType = info->codes->major_opcode; + req->ReqType = X_ChangePointerKeyboardPairing; + req->pointer = pointer->device_id; + req->keyboard = keyboard->device_id; + + UnlockDisplay(dpy); + SyncHandle(); + return Success; +} diff --git a/src/XExtInt.c b/src/XExtInt.c index 40a1eee..3384e4a 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -268,6 +268,14 @@ _XiGetDevicePresenceNotifyEvent(Display * dpy) return info->codes->first_event + XI_DevicePresenceNotify; } +int +_XiGetPointerKeyboardPairingNotifyEvent(Display * dpy) +{ + XExtDisplayInfo *info = XInput_find_display(dpy); + + return info->codes->first_event + XI_PointerKeyboardPairingChangedNotify; +} + /*********************************************************************** * * Handle Input extension events. @@ -718,6 +726,17 @@ XInputWireToEvent(dpy, re, event) return (ENQUEUE_EVENT); } break; + case XI_PointerKeyboardPairingChangedNotify: + { + XPointerKeyboardPairingChangedNotifyEvent *ev = + (XPointerKeyboardPairingChangedNotifyEvent*)re; + pairingChangedNotify *ev2 = (pairingChangedNotify*) event; + *ev = *(XPointerKeyboardPairingChangedNotifyEvent*)save; + ev->time = ev2->time; + ev->pointerid = ev2->pointer; + ev->keyboardid = ev2->keyboard; + return (ENQUEUE_EVENT); + } default: printf("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", type); break; diff --git a/src/XExtToWire.c b/src/XExtToWire.c index a93a811..955f522 100644 --- a/src/XExtToWire.c +++ b/src/XExtToWire.c @@ -480,6 +480,23 @@ _XiEventToWire(dpy, re, event, count) elev->mode = ev->mode; break; } + case XI_PointerKeyboardPairingChangedNotify: + { + register XPointerKeyboardPairingChangedNotifyEvent *ev = + (XPointerKeyboardPairingChangedNotifyEvent*)re; + register pairingChangedNotify *pcev; + *count = 1; + pcev = (pairingChangedNotify *)Xmalloc(*count * sizeof(xEvent)); + if (!pcev) + return (_XUnknownNativeEvent(dpy, re, *event)); + + *event = (xEvent *) pcev; + pcev->type = ev->type; + pcev->time = ev->time; + pcev->pointer = ev->pointerid; + pcev->keyboard = ev->keyboardid; + break; + } default: return (_XUnknownNativeEvent(dpy, re, *event)); } |