diff options
-rw-r--r-- | Xi/Makefile.am | 4 | ||||
-rw-r--r-- | Xi/chpkpair.c | 27 | ||||
-rw-r--r-- | Xi/chpkpair.h | 5 | ||||
-rw-r--r-- | Xi/extinit.c | 55 |
4 files changed, 68 insertions, 23 deletions
diff --git a/Xi/Makefile.am b/Xi/Makefile.am index 9b1253e0b..346453cb6 100644 --- a/Xi/Makefile.am +++ b/Xi/Makefile.am @@ -97,6 +97,8 @@ libXi_la_SOURCES = \ ungrdevk.c \ ungrdevk.h \ warpdevp.c \ - warpdevp.h + warpdevp.h \ + xiselev.c \ + xiselev.h EXTRA_DIST = stubs.c diff --git a/Xi/chpkpair.c b/Xi/chpkpair.c index fcbdcdf2e..555c8e1ca 100644 --- a/Xi/chpkpair.c +++ b/Xi/chpkpair.c @@ -44,11 +44,14 @@ from the author. #include "windowstr.h" /* window structure */ #include "scrnintstr.h" /* screen structure */ #include <X11/extensions/XI.h> +#include <X11/extensions/XInput.h> #include <X11/extensions/XIproto.h> +#include <X11/extensions/geproto.h> #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" +#include "geext.h" #include "chpkpair.h" @@ -74,6 +77,7 @@ ProcXChangePointerKeyboardPairing(ClientPtr client) { DeviceIntPtr pPointer, pKeyboard; int ret; + pairingChangedNotify ev; REQUEST(xChangePointerKeyboardPairingReq); REQUEST_SIZE_MATCH(xChangePointerKeyboardPairingReq); @@ -105,6 +109,27 @@ ProcXChangePointerKeyboardPairing(ClientPtr client) } - /* TODO: generate event here... */ + memset(&ev, 0, sizeof(pairingChangedNotify)); + GEInitEvent(GEV(&ev), IReqCode); + ev.evtype = XI_PointerKeyboardPairingChangedNotify; + ev.pointer = pPointer->id; + ev.keyboard = pKeyboard->id; + ev.length = 0; + ev.time = currentTime.milliseconds; + SendEventToAllWindows(inputInfo.pointer, + XI_PointerKeyboardPairingChangedMask, + (xEvent*)&ev, 1); return Success; } + +/* Event swap proc */ +void +SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify *from, + pairingChangedNotify *to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber, n); + swapl(&to->time, n); +} diff --git a/Xi/chpkpair.h b/Xi/chpkpair.h index 1acf54921..b0d410d74 100644 --- a/Xi/chpkpair.h +++ b/Xi/chpkpair.h @@ -36,5 +36,10 @@ int SProcXChangePointerKeyboardPairing(ClientPtr /* client */ int ProcXChangePointerKeyboardPairing(ClientPtr /* client */ ); +void +SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify* /* from */, + pairingChangedNotify* /* to */ + ); + #endif /* WARPDEVP_H */ diff --git a/Xi/extinit.c b/Xi/extinit.c index 9d921fa07..c58a10f16 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -65,6 +65,8 @@ SOFTWARE. #include "extnsionst.h" /* extension entry */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> +#include <X11/extensions/geproto.h> +#include "geext.h" /* extension interfaces for ge */ #include "dixevents.h" #include "exevents.h" @@ -121,6 +123,8 @@ SOFTWARE. #include "ungrdevb.h" #include "ungrdevk.h" #include "warpdevp.h" +#include "xiselev.h" + static Mask lastExtEventMask = 1; int ExtEventIndex; @@ -180,7 +184,6 @@ Mask DeviceButtonMotionMask; Mask DevicePresenceNotifyMask; Mask DeviceEnterWindowMask; Mask DeviceLeaveWindowMask; -Mask PointerKeyboardPairingChangedMask; int DeviceValuator; int DeviceKeyPress; @@ -200,6 +203,8 @@ int ChangeDeviceNotify; int DevicePresenceNotify; int DeviceEnterNotify; int DeviceLeaveNotify; + +/* GE events */ int PointerKeyboardPairingChangedNotify; int RT_INPUTCLIENT; @@ -225,6 +230,26 @@ static XExtensionVersion thisversion = { XI_Present, XI_Add_DevicePresenceNotify_Minor }; +/**************************************************************** + * + * EventSwap for generic events coming from the GE extension. + */ + +static void +XIGEEventSwap(xGenericEvent* from, xGenericEvent* to) +{ + int n; + + swaps(&from->sequenceNumber, n); + switch(from->evtype) + { + case XI_PointerKeyboardPairingChangedNotify: + SPointerKeyboardPairingChangedNotifyEvent + ((pairingChangedNotify*)from, (pairingChangedNotify*)to); + break; + } +} + /************************************************************************* * * ProcIDispatch - main dispatch routine for requests to this extension. @@ -314,6 +339,8 @@ ProcIDispatch(ClientPtr client) return (ProcXChangeDeviceCursor(client)); else if (stuff->data == X_ChangePointerKeyboardPairing) return (ProcXChangePointerKeyboardPairing(client)); + else if (stuff->data == X_XiSelectEvent) + return (ProcXiSelectEvent(client)); else if (stuff->data == X_RegisterPairingClient) return (ProcXRegisterPairingClient(client)); else if (stuff->data == X_GrabAccessControl) @@ -425,6 +452,8 @@ SProcIDispatch(ClientPtr client) return (SProcXChangeDeviceCursor(client)); else if (stuff->data == X_ChangePointerKeyboardPairing) return (SProcXChangePointerKeyboardPairing(client)); + else if (stuff->data == X_XiSelectEvent) + return (SProcXiSelectEvent(client)); else if (stuff->data == X_RegisterPairingClient) return (SProcXRegisterPairingClient(client)); else if (stuff->data == X_GrabAccessControl) @@ -659,16 +688,6 @@ SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to) swaps(&to->eventY, n); } -static void -SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify *from, - pairingChangedNotify *to) -{ - char n; - - *to = *from; - swaps(&to->sequenceNumber, n); - swapl(&to->time, n); -} /************************************************************************** * @@ -792,7 +811,10 @@ FixExtensionEvents(ExtensionEntry * extEntry) DevicePresenceNotify = DeviceButtonStateNotify + 1; DeviceEnterNotify = DevicePresenceNotify + 1; DeviceLeaveNotify = DeviceEnterNotify + 1; - PointerKeyboardPairingChangedNotify = DeviceLeaveNotify + 1; + + /* GE Events */ + PointerKeyboardPairingChangedNotify = + XI_PointerKeyboardPairingChangedNotify; event_base[KeyClass] = DeviceKeyPress; event_base[ButtonClass] = DeviceButtonPress; @@ -877,11 +899,6 @@ FixExtensionEvents(ExtensionEntry * extEntry) SetMaskForExtEvent(DeviceLeaveWindowMask, DeviceLeaveNotify); AllowPropagateSuppress(DeviceLeaveWindowMask); - PointerKeyboardPairingChangedMask = GetNextExtEventMask(); - SetMaskForExtEvent(PointerKeyboardPairingChangedMask, - PointerKeyboardPairingChangedNotify); - AllowPropagateSuppress(PointerKeyboardPairingChangedMask); - SetEventInfo(0, _noExtensionEvent); } @@ -925,7 +942,6 @@ RestoreExtensionEvents(void) DevicePresenceNotify = 14; DeviceEnterNotify = 15; DeviceLeaveNotify = 16; - PointerKeyboardPairingChangedNotify = 17; BadDevice = 0; BadEvent = 1; @@ -1095,8 +1111,6 @@ SEventIDispatch(xEvent * from, xEvent * to) DO_SWAP(SDeviceEnterNotifyEvent, deviceEnterNotify); else if (type == DeviceLeaveNotify) DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify); - else if (type == PointerKeyboardPairingChangedNotify) - DO_SWAP(SPointerKeyboardPairingChangedNotifyEvent, pairingChangedNotify); else { FatalError("XInputExtension: Impossible event!\n"); } @@ -1144,7 +1158,6 @@ XInputExtensionInit(void) EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; EventSwapVector[DeviceEnterNotify] = SEventIDispatch; EventSwapVector[DeviceLeaveNotify] = SEventIDispatch; - EventSwapVector[PointerKeyboardPairingChangedNotify] = SEventIDispatch; } else { FatalError("IExtensionInit: AddExtensions failed\n"); } |