summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-08-17 14:50:39 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-17 06:40:32 +1000
commit3ed1b463205295a5ebba7d570a4cb8dfade51a38 (patch)
tree5cef0d43e362afc1ba3f1f334c6be4b0314c4a29
parent00382417331d0b38373796fd31757be9fd3e9971 (diff)
Support XI 2.1 XIScrollClass
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--include/X11/extensions/XInput2.h11
-rw-r--r--man/XIQueryDevice.txt39
-rw-r--r--src/XExtInt.c37
3 files changed, 86 insertions, 1 deletions
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h
index 3fcf083..910b25f 100644
--- a/include/X11/extensions/XInput2.h
+++ b/include/X11/extensions/XInput2.h
@@ -133,6 +133,17 @@ typedef struct
int mode;
} XIValuatorClassInfo;
+/* new in XI 2.1 */
+typedef struct
+{
+ int type;
+ int sourceid;
+ int number;
+ int scroll_type;
+ double increment;
+ int flags;
+} XIScrollClassInfo;
+
typedef struct
{
int deviceid;
diff --git a/man/XIQueryDevice.txt b/man/XIQueryDevice.txt
index 09da8d6..6b5a622 100644
--- a/man/XIQueryDevice.txt
+++ b/man/XIQueryDevice.txt
@@ -100,7 +100,7 @@ DESCRIPTION
The type field specifies the type of the input class.
Currently, the following types are defined:
- XIKeyClass, XIButtonClass, XIValuatorClass
+ XIKeyClass, XIButtonClass, XIValuatorClass, XIScrollClass
In the future, additional types may be added. Clients are
required to ignore unknown input classes.
@@ -194,6 +194,43 @@ DESCRIPTION
XIModeAbsolute this axis sends absolute coordinates. If the
mode is XIModeRelative, this device sends relative coordinates.
+ typedef struct
+ {
+ int type;
+ int sourceid;
+ int number;
+ int scroll_type;
+ double increment;
+ int flags;
+ } XIScrollClassInfo;
+
+ This class describes scrolling capability on a valuator. For
+ each XIScrollClassInfo, an XIValuatorClassInfo with the same
+ number is present on the device.
+
+ The number field specifies the valuator number on the physical
+ device that this scroll information applies to. See the
+ respective XIValuatorClassInfo for detailed information on this
+ valuator.
+
+ The scroll_type field specifies the type of scrolling, either
+ XIScrollTypeVertical or XIScrollTypeHorizontal.
+
+ The increment specifies the value change considered one unit of
+ scrolling down.
+
+ The flags field specifies flags that apply to this scrolling
+ information:
+
+ If XIScrollFlagNoEmulation is set, the server will not
+ emulate legacy button events for valuator changes on this
+ valuator.
+
+ If XIScrollFlagPreferred is set, this axis is the
+ preferred axis for this scroll type and will be used for
+ the emulation of XI_Motion events when the driver submits
+ legacy scroll button events.
+
XIQueryDevice can generate a BadDevice error.
XIFreeDeviceInfo frees the information returned by
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 870dc0c..d74a8d4 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -1039,6 +1039,9 @@ sizeDeviceClassType(int type, int num_elements)
case XIValuatorClass:
l = sizeof(XIValuatorClassInfo);
break;
+ case XIScrollClass:
+ l = sizeof(XIScrollClassInfo);
+ break;
default:
printf("sizeDeviceClassType: unknown type %d\n", type);
break;
@@ -1098,6 +1101,9 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
case XIValuatorClass:
len += sizeDeviceClassType(XIValuatorClass, 0);
break;
+ case XIScrollClass:
+ len += sizeDeviceClassType(XIScrollClass, 0);
+ break;
default:
printf("copyDeviceChangedEvent: unknown type %d\n",
any->type);
@@ -1162,6 +1168,15 @@ copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
out->classes[i] = (XIAnyClassInfo*)vout;
break;
}
+ case XIScrollClass:
+ {
+ XIScrollClassInfo *sin, *sout;
+ sin = (XIScrollClassInfo*)any;
+ sout = next_block(&ptr, sizeof(XIScrollClassInfo));
+ *sout = *sin;
+ out->classes[i] = (XIAnyClassInfo*)sout;
+ break;
+ }
}
}
@@ -1433,6 +1448,9 @@ size_classes(xXIAnyInfo* from, int nclasses)
case XIValuatorClass:
l = sizeDeviceClassType(XIValuatorClass, 0);
break;
+ case XIScrollClass:
+ l = sizeDeviceClassType(XIScrollClass, 0);
+ break;
}
len += l;
@@ -1545,6 +1563,25 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
to->classes[cls_idx++] = any_lib;
}
break;
+ case XIScrollClass:
+ {
+ XIScrollClassInfo *cls_lib;
+ xXIScrollInfo *cls_wire;
+
+ cls_lib = next_block(&ptr_lib, sizeof(XIScrollClassInfo));
+ cls_wire = (xXIScrollInfo*)any_wire;
+
+ cls_lib->type = cls_wire->type;
+ cls_lib->sourceid = cls_wire->sourceid;
+ cls_lib->number = cls_wire->number;
+ cls_lib->scroll_type= cls_wire->scroll_type;
+ cls_lib->flags = cls_wire->flags;
+ cls_lib->increment = cls_wire->increment.integral;
+ cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1UL << 32);
+
+ to->classes[cls_idx++] = any_lib;
+ }
+ break;
}
len += any_wire->length * 4;
ptr_wire += any_wire->length * 4;