Reduce invocations QString::left() in XCB key event processing.

Change-Id: I6d422af4d7186356c196d6362a850f7e7b997bb4
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
bb10
Friedemann Kleint 2013-01-17 12:38:09 +01:00 committed by The Qt Project
parent d315e01218
commit 7b8ab42044
1 changed files with 5 additions and 4 deletions

View File

@ -1081,6 +1081,7 @@ 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);
string.truncate(count);
bool isAutoRepeat = false;
@ -1102,7 +1103,7 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
bool filtered = false;
if (inputContext) {
QKeyEvent event(type, qtcode, modifiers, code, sym, state, string.left(count), isAutoRepeat, count);
QKeyEvent event(type, qtcode, modifiers, code, sym, state, string, isAutoRepeat, count);
event.setTimestamp(time);
filtered = inputContext->filterEvent(&event);
}
@ -1114,7 +1115,7 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
QWindowSystemInterface::handleContextMenuEvent(window, false, pos, globalPos, modifiers);
}
QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers,
code, sym, state, string.left(count), isAutoRepeat);
code, sym, state, string, isAutoRepeat);
}
if (isAutoRepeat && type == QEvent::KeyRelease) {
@ -1130,13 +1131,13 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
}
if (!filtered && inputContext) {
QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, code, sym, state, string.left(count), isAutoRepeat, count);
QKeyEvent event(QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat, count);
event.setTimestamp(time);
filtered = inputContext->filterEvent(&event);
}
if (!filtered)
QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers,
code, sym, state, string.left(count), isAutoRepeat);
code, sym, state, string, isAutoRepeat);
}
}