diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-08-13 13:11:44 +0930 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-08-15 14:52:13 +0930 |
commit | de1573172ad2c2e98c101727930a468213295783 (patch) | |
tree | 78500abb755fcd8ab507628d1e9305265ae8a284 /Xi | |
parent | 8b9ed7dec2954d4890ddcc7c874fc0832b16495a (diff) |
Backport device properties to XI 1.5 instead of XI 2.0
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/exglobals.h | 2 | ||||
-rw-r--r-- | Xi/extinit.c | 93 | ||||
-rw-r--r-- | Xi/xiproperty.c | 36 |
3 files changed, 72 insertions, 59 deletions
diff --git a/Xi/exglobals.h b/Xi/exglobals.h index 0b1caf99c..42a695356 100644 --- a/Xi/exglobals.h +++ b/Xi/exglobals.h @@ -52,6 +52,7 @@ extern Mask DeviceOwnerGrabButtonMask; extern Mask DeviceButtonGrabMask; extern Mask DeviceButtonMotionMask; extern Mask DevicePresenceNotifyMask; +extern Mask DevicePropertyNotifyMask; extern Mask DeviceEnterWindowMask; extern Mask DeviceLeaveWindowMask; extern Mask PropagateMask[]; @@ -72,6 +73,7 @@ extern int DeviceButtonStateNotify; extern int DeviceMappingNotify; extern int ChangeDeviceNotify; extern int DevicePresenceNotify; +extern int DevicePropertyNotify; extern int DeviceEnterNotify; extern int DeviceLeaveNotify; diff --git a/Xi/extinit.c b/Xi/extinit.c index ba93ebcf0..979622ff0 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -210,22 +210,24 @@ static int (*ProcIVector[])(ClientPtr) = { ProcXSetDeviceValuators, /* 33 */ ProcXGetDeviceControl, /* 34 */ ProcXChangeDeviceControl, /* 35 */ - ProcXQueryDevicePointer, /* 36 */ - ProcXWarpDevicePointer, /* 37 */ - ProcXChangeDeviceCursor, /* 38 */ - ProcXChangeDeviceHierarchy, /* 39 */ - ProcXChangeWindowAccess, /* 40 */ - ProcXQueryWindowAccess, /* 41 */ - ProcXSetClientPointer, /* 42 */ - ProcXGetClientPointer, /* 43 */ - ProcXiSelectEvent, /* 44 */ - ProcXExtendedGrabDevice, /* 45 */ - ProcXListDeviceProperties, /* 46 */ - ProcXQueryDeviceProperty, /* 47 */ - ProcXConfigureDeviceProperty, /* 48 */ - ProcXChangeDeviceProperty, /* 49 */ - ProcXDeleteDeviceProperty, /* 50 */ - ProcXGetDeviceProperty /* 51 */ + /* XI 1.5 */ + ProcXListDeviceProperties, /* 36 */ + ProcXQueryDeviceProperty, /* 37 */ + ProcXConfigureDeviceProperty, /* 38 */ + ProcXChangeDeviceProperty, /* 39 */ + ProcXDeleteDeviceProperty, /* 40 */ + ProcXGetDeviceProperty, /* 41 */ + /* XI 2 */ + ProcXQueryDevicePointer, /* 42 */ + ProcXWarpDevicePointer, /* 43 */ + ProcXChangeDeviceCursor, /* 44 */ + ProcXChangeDeviceHierarchy, /* 45 */ + ProcXChangeWindowAccess, /* 46 */ + ProcXQueryWindowAccess, /* 47 */ + ProcXSetClientPointer, /* 48 */ + ProcXGetClientPointer, /* 49 */ + ProcXiSelectEvent, /* 50 */ + ProcXExtendedGrabDevice /* 51 */ }; /* For swapped clients */ @@ -266,22 +268,22 @@ static int (*SProcIVector[])(ClientPtr) = { SProcXSetDeviceValuators, /* 33 */ SProcXGetDeviceControl, /* 34 */ SProcXChangeDeviceControl, /* 35 */ - SProcXQueryDevicePointer, /* 36 */ - SProcXWarpDevicePointer, /* 37 */ - SProcXChangeDeviceCursor, /* 38 */ - SProcXChangeDeviceHierarchy, /* 39 */ - SProcXChangeWindowAccess, /* 40 */ - SProcXQueryWindowAccess, /* 41 */ - SProcXSetClientPointer, /* 42 */ - SProcXGetClientPointer, /* 43 */ - SProcXiSelectEvent, /* 44 */ - SProcXExtendedGrabDevice, /* 45 */ - SProcXListDeviceProperties, /* 46 */ - SProcXQueryDeviceProperty, /* 47 */ - SProcXConfigureDeviceProperty, /* 48 */ - SProcXChangeDeviceProperty, /* 49 */ - SProcXDeleteDeviceProperty, /* 50 */ - SProcXGetDeviceProperty /* 51 */ + SProcXListDeviceProperties, /* 36 */ + SProcXQueryDeviceProperty, /* 37 */ + SProcXConfigureDeviceProperty, /* 38 */ + SProcXChangeDeviceProperty, /* 39 */ + SProcXDeleteDeviceProperty, /* 40 */ + SProcXGetDeviceProperty, /* 41 */ + SProcXQueryDevicePointer, /* 42 */ + SProcXWarpDevicePointer, /* 43 */ + SProcXChangeDeviceCursor, /* 44 */ + SProcXChangeDeviceHierarchy, /* 45 */ + SProcXChangeWindowAccess, /* 46 */ + SProcXQueryWindowAccess, /* 47 */ + SProcXSetClientPointer, /* 48 */ + SProcXGetClientPointer, /* 49 */ + SProcXiSelectEvent, /* 50 */ + SProcXExtendedGrabDevice /* 51 */ }; /***************************************************************** @@ -308,6 +310,7 @@ Mask DeviceOwnerGrabButtonMask; Mask DeviceButtonGrabMask; Mask DeviceButtonMotionMask; Mask DevicePresenceNotifyMask; +Mask DevicePropertyNotifyMask; Mask DeviceEnterWindowMask; Mask DeviceLeaveWindowMask; @@ -327,6 +330,7 @@ int DeviceButtonStateNotify; int DeviceMappingNotify; int ChangeDeviceNotify; int DevicePresenceNotify; +int DevicePropertyNotify; int DeviceEnterNotify; int DeviceLeaveNotify; @@ -590,6 +594,17 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to } static void +SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to) +{ + char n; + + *to = *from; + swaps(&to->sequenceNumber,n); + swapl(&to->time, n); + swapl(&to->atom, n); +} + +static void SDeviceEnterNotifyEvent (deviceEnterNotify *from, deviceEnterNotify *to) { char n; @@ -786,7 +801,8 @@ FixExtensionEvents(ExtensionEntry * extEntry) DeviceKeyStateNotify = ChangeDeviceNotify + 1; DeviceButtonStateNotify = DeviceKeyStateNotify + 1; DevicePresenceNotify = DeviceButtonStateNotify + 1; - DeviceEnterNotify = DevicePresenceNotify + 1; + DevicePropertyNotify = DevicePresenceNotify + 1; + DeviceEnterNotify = DevicePropertyNotify + 1; DeviceLeaveNotify = DeviceEnterNotify + 1; event_base[KeyClass] = DeviceKeyPress; @@ -876,6 +892,9 @@ FixExtensionEvents(ExtensionEntry * extEntry) DevicePresenceNotifyMask = GetNextExtEventMask(); SetEventInfo(DevicePresenceNotifyMask, _devicePresence); + DevicePropertyNotifyMask = GetNextExtEventMask(); + SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify); + DeviceEnterWindowMask = GetNextExtEventMask(); SetMaskForExtEvent(DeviceEnterWindowMask, DeviceEnterNotify); AllowPropagateSuppress(DeviceEnterWindowMask); @@ -929,8 +948,9 @@ RestoreExtensionEvents(void) DeviceKeyStateNotify = 13; DeviceButtonStateNotify = 13; DevicePresenceNotify = 14; - DeviceEnterNotify = 15; - DeviceLeaveNotify = 16; + DevicePropertyNotify = 15; + DeviceEnterNotify = 16; + DeviceLeaveNotify = 17; BadDevice = 0; BadEvent = 1; @@ -969,6 +989,7 @@ IResetProc(ExtensionEntry * unused) EventSwapVector[DeviceMappingNotify] = NotImplemented; EventSwapVector[ChangeDeviceNotify] = NotImplemented; EventSwapVector[DevicePresenceNotify] = NotImplemented; + EventSwapVector[DevicePropertyNotify] = NotImplemented; EventSwapVector[DeviceEnterNotify] = NotImplemented; EventSwapVector[DeviceLeaveNotify] = NotImplemented; RestoreExtensionEvents(); @@ -1072,6 +1093,8 @@ SEventIDispatch(xEvent * from, xEvent * to) DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); else if (type == DevicePresenceNotify) DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify); + else if (type == DevicePropertyNotify) + DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify); else if (type == DeviceEnterNotify) DO_SWAP(SDeviceEnterNotifyEvent, deviceEnterNotify); else if (type == DeviceLeaveNotify) diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index b4ccfe653..ec1ed6c29 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -191,21 +191,18 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device) { XIPropertyPtr prop, next; XIPropertyHandlerPtr curr_handler, next_handler; - devicePropertyNotifyEvent event; + devicePropertyNotify event; for (prop = device->properties.properties; prop; prop = next) { next = prop->next; - event.type = GenericEvent; - event.extension = IReqCode; - event.evtype = XI_DevicePropertyNotify; - event.length = 0; + event.type = DevicePropertyNotify; event.deviceid = device->id; event.state = PropertyDelete; event.atom = prop->propertyName; event.time = currentTime.milliseconds; - SendEventToAllWindows(device, XI_DevicePropertyNotifyMask, + SendEventToAllWindows(device, DevicePropertyNotifyMask, (xEvent*)&event, 1); XIDestroyDeviceProperty(prop); @@ -226,7 +223,7 @@ int XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient) { XIPropertyPtr prop, *prev; - devicePropertyNotifyEvent event; + devicePropertyNotify event; for (prev = &device->properties.properties; (prop = *prev); prev = &(prop->next)) if (prop->propertyName == property) @@ -238,15 +235,12 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient) if (prop) { *prev = prop->next; - event.type = GenericEvent; - event.extension = IReqCode; - event.length = 0; - event.evtype = XI_DevicePropertyNotify; + event.type = DevicePropertyNotify; event.deviceid = device->id; event.state = PropertyDelete; event.atom = prop->propertyName; event.time = currentTime.milliseconds; - SendEventToAllWindows(device, XI_DevicePropertyNotifyMask, + SendEventToAllWindows(device, DevicePropertyNotifyMask, (xEvent*)&event, 1); XIDestroyDeviceProperty (prop); } @@ -261,7 +255,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type, Bool fromClient) { XIPropertyPtr prop; - devicePropertyNotifyEvent event; + devicePropertyNotify event; int size_in_bytes; int total_size; unsigned long total_len; @@ -379,15 +373,12 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type, if (sendevent) { - event.type = GenericEvent; - event.extension = IReqCode; - event.length = 0; - event.evtype = XI_DevicePropertyNotify; + event.type = DevicePropertyNotify; event.deviceid = dev->id; event.state = PropertyNewValue; event.atom = prop->propertyName; event.time = currentTime.milliseconds; - SendEventToAllWindows(dev, XI_DevicePropertyNotifyMask, + SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent*)&event, 1); } return(Success); @@ -786,17 +777,14 @@ ProcXGetDeviceProperty (ClientPtr client) if (stuff->delete && (reply.bytesAfter == 0)) { - devicePropertyNotifyEvent event; + devicePropertyNotify event; - event.type = GenericEvent; - event.extension = IReqCode; - event.length = 0; - event.evtype = XI_DevicePropertyNotify; + event.type = DevicePropertyNotify; event.deviceid = dev->id; event.state = PropertyDelete; event.atom = prop->propertyName; event.time = currentTime.milliseconds; - SendEventToAllWindows(dev, XI_DevicePropertyNotifyMask, + SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent*)&event, 1); } |