summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-08-13 12:03:29 +0930
committerPeter Hutterer <peter.hutterer@redhat.com>2008-08-13 12:03:29 +0930
commitbec02767629ed795582ba3f645299d7036093511 (patch)
tree03aa44ece5d32a18eef4b28ff610967adf2b0160
parentc5179577ddf0680dffb480d27db9036e9bd27716 (diff)
Backport device property code to XI 1.5.
Ditching generic events, using normal XI events instead.
-rw-r--r--include/X11/extensions/XInput.h45
-rw-r--r--src/XExtInt.c31
2 files changed, 39 insertions, 37 deletions
diff --git a/include/X11/extensions/XInput.h b/include/X11/extensions/XInput.h
index 2fd77e9..1007b24 100644
--- a/include/X11/extensions/XInput.h
+++ b/include/X11/extensions/XInput.h
@@ -70,9 +70,12 @@ SOFTWARE.
#define _deviceStateNotify 0
#define _deviceMappingNotify 1
#define _changeDeviceNotify 2
-/* Space of 4 between is necessary! */
-#define _deviceEnterNotify 6
-#define _deviceLeaveNotify 7
+/* Space of 3 between is necessary! Reserved for DeviceKeyStateNotify,
+ DeviceButtonStateNotify, DevicePresenceNotify (essentially unused). This
+ code has to be in sync with FixExtensionEvents() in xserver/Xi/extinit.c */
+#define _propertyNotify 6
+#define _deviceEnterNotify 7
+#define _deviceLeaveNotify 8
#define FindTypeAndClass(d,type,_class,classid,offset) \
{ int _i; XInputClassInfo *_ip; \
@@ -120,6 +123,9 @@ SOFTWARE.
#define ChangeDeviceNotify(d,type,_class) \
FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
+#define DevicePropertyNotify(d, type, _class) \
+ FindTypeAndClass(d, type, _class, OtherClass, _propertyNotify)
+
#define DevicePointerMotionHint(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
@@ -467,6 +473,22 @@ typedef struct {
XID control;
} XDevicePresenceNotifyEvent;
+/*
+ * Notifies the client that a property on a device has changed value. The
+ * client is expected to query the server for updated value of the property.
+ */
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* unused */
+ Time time;
+ XID deviceid; /* id of the device that changed */
+ Atom atom; /* the property that changed */
+ int state; /* PropertyNewValue or PropertyDeleted */
+} XDevicePropertyNotifyEvent;
+
typedef struct {
int type;
@@ -527,23 +549,6 @@ typedef struct {
XAnyClassPtr inputclassinfo; /* same as in XDeviceInfo */
} XDeviceClassesChangedEvent;
-/*
- * Notifies the client that a property on a device has changed value. The
- * client is expected to query the server for updated value of the property.
- */
-typedef struct {
- int type; /* GenericEvent */
- unsigned long serial; /* # of last request processed by server */
- Bool send_event; /* true if this came from a SendEvent request */
- Display *display; /* Display the event was read from */
- int extension; /* XI extension offset */
- int evtype; /* XI_DeviceHierarchyChangedNotify */
- Time time;
- XID deviceid; /* id of the device that changed */
- Atom atom; /* the property that changed */
- int state; /* PropertyNewValue or PropertyDeleted */
-} XDevicePropertyNotifyEvent;
-
/*******************************************************************
*
diff --git a/src/XExtInt.c b/src/XExtInt.c
index d8d7a1c..0dd8df3 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -178,6 +178,8 @@ static XExtensionVersion versions[] = { {XI_Absent, 0, 0},
XI_Add_XChangeDeviceControl_Minor},
{XI_Present, XI_Add_DevicePresenceNotify_Major,
XI_Add_DevicePresenceNotify_Minor},
+{XI_Present, XI_Add_DeviceProperties_Major,
+ XI_Add_DeviceProperties_Minor},
{XI_Present, XI_2_Major, XI_2_Minor}
};
@@ -759,7 +761,19 @@ XInputWireToEvent(
return (ENQUEUE_EVENT);
}
break;
+ case XI_DevicePropertyNotify:
+ {
+ XDevicePropertyNotifyEvent* ev = (XDevicePropertyNotifyEvent*)re;
+ devicePropertyNotify *ev2 = (devicePropertyNotify*)event;
+ *ev = *(XDevicePropertyNotifyEvent*)save;
+ ev->time = ev2->time;
+ ev->deviceid = ev2->deviceid;
+ ev->atom = ev2->atom;
+ ev->state = ev2->state;
+ return ENQUEUE_EVENT;
+ }
+ break;
case XI_DeviceEnterNotify:
case XI_DeviceLeaveNotify:
{
@@ -846,23 +860,6 @@ XInputWireToEvent(
*re = *save;
return ENQUEUE_EVENT;
}
- case XI_DevicePropertyNotify:
- {
- XDevicePropertyNotifyEvent* dpn_event =
- (XDevicePropertyNotifyEvent*)save;
- devicePropertyNotifyEvent* dpn_wire =
- (devicePropertyNotifyEvent*)event;
-
- dpn_event->extension = dpn_wire->extension;
- dpn_event->evtype = dpn_wire->evtype;
- dpn_event->time = dpn_wire->time;
- dpn_event->deviceid = dpn_wire->deviceid;
- dpn_event->atom = dpn_wire->atom;
- dpn_event->state = dpn_wire->state;
-
- *re = *save;
- return ENQUEUE_EVENT;
- }
default:
printf("XInputWireToEvent: Unknown generic event. type %d\n", ge->evtype);