diff options
-rw-r--r-- | include/X11/extensions/XInput2.h | 11 | ||||
-rw-r--r-- | man/XIQueryDevice.txt | 39 | ||||
-rw-r--r-- | src/XExtInt.c | 40 | ||||
-rw-r--r-- | src/XIint.h | 2 |
4 files changed, 89 insertions, 3 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 9e1ad19..d74a8d4 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -270,7 +270,8 @@ static XExtensionVersion versions[] = { {XI_Absent, 0, 0}, XI_Add_DevicePresenceNotify_Minor}, {XI_Present, XI_Add_DeviceProperties_Major, XI_Add_DeviceProperties_Minor}, -{XI_Present, 2, 0} +{XI_Present, 2, 0}, +{XI_Present, 2, 1} }; /*********************************************************************** @@ -1038,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; @@ -1097,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); @@ -1161,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; + } } } @@ -1432,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; @@ -1544,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; diff --git a/src/XIint.h b/src/XIint.h index 8e9cf72..41d99b3 100644 --- a/src/XIint.h +++ b/src/XIint.h @@ -20,7 +20,7 @@ #define XInput_Add_DeviceProperties 6 #define XInput_2_0 7 #endif - +#define XInput_2_1 8 extern XExtDisplayInfo *XInput_find_display(Display *); |