1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Fix class name, add constructor.

This commit is contained in:
Thomas Harte 2021-05-05 19:17:23 -04:00
parent 22b29e77a7
commit 6fe947b8b9

View File

@ -35,14 +35,19 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#endif #endif
std::optional<Inputs::Keyboard::Key> MainWindow::keyForEvent(QKeyEvent *event) { KeyboardMapper::KeyboardMapper() {
#ifdef HAS_X11
#endif
}
std::optional<Inputs::Keyboard::Key> KeyboardMapper::keyForEvent(QKeyEvent *event) {
// Workaround for X11: assume PC-esque mapping. // Workaround for X11: assume PC-esque mapping.
#ifdef HAS_X11 #ifdef HAS_X11
if(QGuiApplication::platformName() == QLatin1String("xcb")) { if(QGuiApplication::platformName() == QLatin1String("xcb")) {
#define BIND(code, key) case code: return Inputs::Keyboard::Key::key; #define BIND(code, key) case code: return Inputs::Keyboard::Key::key;
switch(keysym->nativeVirtualKey()) { switch(event->nativeVirtualKey()) {
default: qDebug() << "Unmapped" << event->nativeScanCode(); return {}; default: qDebug() << "Unmapped" << event->nativeScanCode(); return {};
BIND(XK_Escape, Escape); BIND(XK_Escape, Escape);