summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorWeng Xuetian <wengxt@gmail.com>2012-06-26 23:02:23 +0800
committerQt by Nokia <qt-info@nokia.com>2012-06-27 14:43:00 +0200
commit3dbd381e039818e4021b33533dbfdab1419510e1 (patch)
treeb217c0739d5969a729bc40661815c67c0450334e /src/plugins
parent175c69108a5b3c81d32b775f01d1e811289c89c6 (diff)
Also use x11FilterEvent for auto repeat key in xcb.
filterEvent for QPlatformInputContext is already used for auto repeat key, x11FilterEvent also need to be filtered. Task-number: QTBUG-25795 Change-Id: I3db87fdffdb5b01404047e905793ae6e10bb1e90 Reviewed-by: Pekka Vuorela <pekka.ta.vuorela@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 638c490d17..9876adfdfc 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -46,6 +46,7 @@
#include <X11/keysym.h>
#include <QtGui/QWindowSystemInterface>
#include <QtCore/QTextCodec>
+#include <QtCore/QMetaMethod>
#include <private/qguiapplication_p.h>
#include <stdio.h>
@@ -1054,16 +1055,22 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
QByteArray chars;
xcb_keysym_t sym = lookupString(window, state, code, type, &chars);
QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
+ QMetaMethod method;
if (inputContext) {
+ int methodIndex = inputContext->metaObject()->indexOfMethod("x11FilterEvent(uint,uint,uint,bool)");
+ if (methodIndex != -1)
+ method = inputContext->metaObject()->method(methodIndex);
+ }
+
+ if (method.isValid()) {
bool retval = false;
- if (inputContext->metaObject()->indexOfMethod("x11FilterEvent(uint,uint,uint,bool)") != -1)
- QMetaObject::invokeMethod(inputContext, "x11FilterEvent", Qt::DirectConnection,
- Q_RETURN_ARG(bool, retval),
- Q_ARG(uint, sym),
- Q_ARG(uint, code),
- Q_ARG(uint, state),
- Q_ARG(bool, type == QEvent::KeyPress));
+ method.invoke(inputContext, Qt::DirectConnection,
+ Q_RETURN_ARG(bool, retval),
+ Q_ARG(uint, sym),
+ Q_ARG(uint, code),
+ Q_ARG(uint, state),
+ Q_ARG(bool, type == QEvent::KeyPress));
if (retval)
return;
}
@@ -1105,7 +1112,16 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
if (isAutoRepeat && type == QEvent::KeyRelease) {
// since we removed it from the event queue using checkEvent we need to send the key press here
filtered = false;
- if (inputContext) {
+ if (method.isValid()) {
+ method.invoke(inputContext, Qt::DirectConnection,
+ Q_RETURN_ARG(bool, filtered),
+ Q_ARG(uint, sym),
+ Q_ARG(uint, code),
+ Q_ARG(uint, state),
+ Q_ARG(bool, true));
+ }
+
+ if (!filtered && inputContext) {
QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, string, isAutoRepeat);
event.setTimestamp(time);
filtered = inputContext->filterEvent(&event);