diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2011-09-20 15:33:27 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-20 19:18:19 +0200 |
commit | dbdfdb2c95b261fe28955a89c2e00e212fd7d106 (patch) | |
tree | 0f9315e206084931a4ba040d9f809de6f91389bf /src/plugins | |
parent | 6aad4122332c0291e2e3249b508c7583428177b9 (diff) |
Implemented key filter support on platform input context
As previously with QInputContext, now supporting filterEvent()
interface. Usage only on XCB so far.
Change-Id: I8e5972626552bda32318fe060017d0217bb79a94
Reviewed-on: http://codereview.qt-project.org/5240
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbkeyboard.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index cb65a5106e..b5722e7eeb 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -1026,9 +1026,9 @@ 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(); - - if (QObject* inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext()) { + if (inputContext) { bool retval = false; if (inputContext->metaObject()->indexOfMethod("x11FilterEvent") != -1) QMetaObject::invokeMethod(inputContext, "x11FilterEvent", Qt::DirectConnection, @@ -1045,6 +1045,15 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod int qtcode = 0; int count = chars.count(); QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); + + if (inputContext) { + QKeyEvent event(type, qtcode, modifiers, string); + event.setTimestamp(time); + bool retval = inputContext->filterEvent(&event); + if (retval) + return; + } + QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers, code, 0, state, string.left(count)); } |