summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbkeyboard.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2018-07-28 14:40:12 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-08-16 04:42:55 +0000
commitb7dcc3455f1270cef3b21699e909ef502374db97 (patch)
tree1a81cb096d9a2d8b2ab34c55f6405dd578a39525 /src/plugins/platforms/xcb/qxcbkeyboard.cpp
parentc5bde010eabb79b10cea630d366d94ff5981fa57 (diff)
xcb: Use functors in QXcbConnection::checkEvent()
... to check for buffered events. This makes the code less verbose and easier to read. Changed the filter signature to pass an event type in addition to the actual event, for the convenience of API user. And do not pass worthless nullptr-s to the filter. The only reason why KeyChecker from qxcbkeyboard.cpp was not converted to lambda expression is that the code looks suspicious - KeyChecker::m_release default value is 'true' and I don't see where it would ever be assigned 'false' (ref. QTBUG-69679) and the code is known to be buggy (ref. QTBUG-57335). Those issues are out-of-scope for this patch. Change-Id: If2fdd60fbb93eb983f3c9ad616aaf04834fede9f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbkeyboard.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 5a2dac4a5a..37c8def6cc 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -1485,12 +1485,11 @@ public:
{
}
- bool checkEvent(xcb_generic_event_t *ev)
+ bool operator() (xcb_generic_event_t *ev, int type)
{
if (m_error || !ev)
return false;
- int type = ev->response_type & ~0x80;
if (type != XCB_KEY_PRESS && type != XCB_KEY_RELEASE)
return false;
@@ -1517,9 +1516,6 @@ public:
return false;
}
- bool release() const { return m_release; }
- xcb_timestamp_t time() const { return m_time; }
-
private:
xcb_window_t m_window;
xcb_keycode_t m_code;