summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbkeyboard.h
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2018-08-04 00:47:14 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-08-16 04:43:56 +0000
commit21f976f4f0f79b1c4c77a402ebed88d8afb3d9e1 (patch)
tree7590aab440e29c593797cd33008e60c86608fe7d /src/plugins/platforms/xcb/qxcbkeyboard.h
parent32e21762fa58be2459c43fe17ec87bd302d04d59 (diff)
xcb: rewrite auto-repeat key detection logic
It's unclear what the original code was doing. It relied on 'm_release' which could never be 'false' (ref. QTBUG-69679). It was subtracting event times and comparing with arbitrary '10'. On X11 auto-repeat keys can be detected by checking time and keycode of the current release event and the next event in the queue. If an event is an auto-repeat, then next event in the queue will be a key press with matching time and keycode. Verified that auto-repeat was unreliable in Qt 4 as well. With this patch auto-repeat works as expected. Added support for Xlib's XPeekEvent in our XCB implementation QXcbConnection::checkEvent(): "The XPeekEvent() function returns the first event from the event queue, but it does not remove the event from the queue." Sneaking in one variable renaming: "string" -> "text", to match the QKeyEvent::text(). Task-number: QTBUG-57335 Task-number: QTBUG-69679 Change-Id: I0a23f138287f57eaaecf1a009bd939e7e0e23269 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbkeyboard.h')
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index ab926eab84..95915fb2e6 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -109,7 +109,8 @@ protected:
private:
bool m_config = false;
- xcb_keycode_t m_autorepeat_code = 0;
+ bool m_isAutoRepeat = false;
+ xcb_keycode_t m_autoRepeatCode = 0;
struct _mod_masks {
uint alt;