Improve debug information on key events

Summary: Print the Qt::Key value on the debug window

Test Plan: When I press the power button I get Key_PowerOff

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25896
This commit is contained in:
Aleix Pol 2019-12-11 18:35:28 +01:00
parent 31e664783f
commit 3efedf510c

View file

@ -289,7 +289,12 @@ void DebugConsoleFilter::keyEvent(KeyEvent *event)
}; };
text.append(timestampRow(event->timestamp())); text.append(timestampRow(event->timestamp()));
text.append(tableRow(i18nc("Whether the event is an automatic key repeat", "Repeat"), event->isAutoRepeat())); text.append(tableRow(i18nc("Whether the event is an automatic key repeat", "Repeat"), event->isAutoRepeat()));
const auto keyMetaObject = Qt::qt_getEnumMetaObject(Qt::Key());
const auto enumerator = keyMetaObject->enumerator(keyMetaObject->indexOfEnumerator("Key"));
text.append(tableRow(i18nc("The code as read from the input device", "Scan code"), event->nativeScanCode())); text.append(tableRow(i18nc("The code as read from the input device", "Scan code"), event->nativeScanCode()));
text.append(tableRow(i18nc("Key according to Qt", "Qt::Key code"),
enumerator.valueToKey(event->key())));
text.append(tableRow(i18nc("The translated code to an Xkb symbol", "Xkb symbol"), event->nativeVirtualKey())); text.append(tableRow(i18nc("The translated code to an Xkb symbol", "Xkb symbol"), event->nativeVirtualKey()));
text.append(tableRow(i18nc("The translated code interpreted as text", "Utf8"), event->text())); text.append(tableRow(i18nc("The translated code interpreted as text", "Utf8"), event->text()));
text.append(tableRow(i18nc("The currently active modifiers", "Modifiers"), modifiersToString())); text.append(tableRow(i18nc("The currently active modifiers", "Modifiers"), modifiersToString()));