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>
This commit is contained in:
parent
175c69108a
commit
3dbd381e03
@ -46,6 +46,7 @@
|
|||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <QtGui/QWindowSystemInterface>
|
#include <QtGui/QWindowSystemInterface>
|
||||||
#include <QtCore/QTextCodec>
|
#include <QtCore/QTextCodec>
|
||||||
|
#include <QtCore/QMetaMethod>
|
||||||
#include <private/qguiapplication_p.h>
|
#include <private/qguiapplication_p.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -1054,16 +1055,22 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
|
|||||||
QByteArray chars;
|
QByteArray chars;
|
||||||
xcb_keysym_t sym = lookupString(window, state, code, type, &chars);
|
xcb_keysym_t sym = lookupString(window, state, code, type, &chars);
|
||||||
QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
|
QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
|
||||||
|
QMetaMethod method;
|
||||||
|
|
||||||
if (inputContext) {
|
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;
|
bool retval = false;
|
||||||
if (inputContext->metaObject()->indexOfMethod("x11FilterEvent(uint,uint,uint,bool)") != -1)
|
method.invoke(inputContext, Qt::DirectConnection,
|
||||||
QMetaObject::invokeMethod(inputContext, "x11FilterEvent", Qt::DirectConnection,
|
Q_RETURN_ARG(bool, retval),
|
||||||
Q_RETURN_ARG(bool, retval),
|
Q_ARG(uint, sym),
|
||||||
Q_ARG(uint, sym),
|
Q_ARG(uint, code),
|
||||||
Q_ARG(uint, code),
|
Q_ARG(uint, state),
|
||||||
Q_ARG(uint, state),
|
Q_ARG(bool, type == QEvent::KeyPress));
|
||||||
Q_ARG(bool, type == QEvent::KeyPress));
|
|
||||||
if (retval)
|
if (retval)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1105,7 +1112,16 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
|
|||||||
if (isAutoRepeat && type == QEvent::KeyRelease) {
|
if (isAutoRepeat && type == QEvent::KeyRelease) {
|
||||||
// since we removed it from the event queue using checkEvent we need to send the key press here
|
// since we removed it from the event queue using checkEvent we need to send the key press here
|
||||||
filtered = false;
|
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);
|
QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, string, isAutoRepeat);
|
||||||
event.setTimestamp(time);
|
event.setTimestamp(time);
|
||||||
filtered = inputContext->filterEvent(&event);
|
filtered = inputContext->filterEvent(&event);
|
||||||
|
Loading…
Reference in New Issue
Block a user