From 7adef58fd9607037bb3e63c0460350dd324af8e8 Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Tue, 3 Apr 2012 17:01:12 +0300 Subject: Pass autorepeat info to input context key filtering with XCB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifbb658dde6689543f48ed8fb82109ea07bcf8bd7 Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 31 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index c5e124ab45..ef98f82e97 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -1073,14 +1073,6 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod 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; - } - bool isAutoRepeat = false; if (type == QEvent::KeyPress) { @@ -1099,13 +1091,28 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod m_autorepeat_code = isAutoRepeat ? code : 0; } - QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers, - code, 0, state, string.left(count), isAutoRepeat); + bool filtered = false; + if (inputContext) { + QKeyEvent event(type, qtcode, modifiers, string, isAutoRepeat); + event.setTimestamp(time); + filtered = inputContext->filterEvent(&event); + } + + if (!filtered) + QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers, + code, 0, state, string.left(count), isAutoRepeat); if (isAutoRepeat && type == QEvent::KeyRelease) { // since we removed it from the event queue using checkEvent we need to send the key press here - QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers, - code, 0, state, string.left(count), isAutoRepeat); + filtered = false; + if (inputContext) { + QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, string, isAutoRepeat); + event.setTimestamp(time); + filtered = inputContext->filterEvent(&event); + } + if (!filtered) + QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers, + code, 0, state, string.left(count), isAutoRepeat); } } -- cgit v1.2.3