Commit 3efedf51 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

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
parent 31e66478
...@@ -289,7 +289,12 @@ void DebugConsoleFilter::keyEvent(KeyEvent *event) ...@@ -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()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment