diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-01-02 10:32:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-09 19:27:32 +0100 |
commit | 097b0a531642f79d8b240f89ca1eacca2ee59a5e (patch) | |
tree | 4beeffbb2ccf330e12c0028dbcaaf724ec4cc29e /src/plugins/platforms/xcb/qxcbconnection.h | |
parent | 8ca19dde556d4ec5a04d15af6d9985f2203ee4d5 (diff) |
Use XInput2 scrolling events to enable smoother scrolling
With this patch all wheel events will be generated by XInput2 where
available. This enables higher precision and smoother scrolling
especially from input devices such as touchpads on laptops.
[ChangeLog][Platform Specific Changes][X11 / XCB]Support XInput2 smooth scrolling events
Change-Id: I3b069ed92ad5c53e08af64baaece32de82e9b5c4
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.h')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 9e64c37b94..71f5ce13fb 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -69,9 +69,12 @@ struct XInput2MaemoData; #elif XCB_USE_XINPUT2 #include <X11/extensions/XI2.h> +#ifdef XIScrollClass +#define XCB_USE_XINPUT21 // XI 2.1 adds smooth scrolling support #ifdef XI_TouchBeginMask #define XCB_USE_XINPUT22 // XI 2.2 adds multi-point touch support #endif +#endif struct XInput2DeviceData; #endif struct xcb_randr_get_output_info_reply_t; @@ -271,6 +274,10 @@ namespace QXcbAtom { AbsDistance, WacomSerialIDs, INTEGER, + RelHorizWheel, + RelVertWheel, + RelHorizScroll, + RelVertScroll, #if XCB_USE_MAEMO_WINDOW_PROPERTIES MeegoTouchOrientationAngle, @@ -499,10 +506,19 @@ private: void xi2ReportTabletEvent(const TabletData &tabletData, void *event); QVector<TabletData> m_tabletData; #endif + struct ScrollingDevice { + ScrollingDevice() : deviceId(0), verticalIndex(0), horizontalIndex(0), orientations(0) { } + int deviceId; + int verticalIndex, horizontalIndex; + double verticalIncrement, horizontalIncrement; + Qt::Orientations orientations; + QPointF lastScrollPosition; + }; + void xi2HandleScrollEvent(void *event, ScrollingDevice &scrollingDevice); + QHash<int, ScrollingDevice> m_scrollingDevices; #endif // XCB_USE_XINPUT2 #if defined(XCB_USE_XINPUT2) || defined(XCB_USE_XINPUT2_MAEMO) - static int xi2CountBits(unsigned char *ptr, int len); static bool xi2GetValuatorValueIfSet(void *event, int valuatorNum, double *value); static bool xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event, int opCode); #endif |