From 0c406639a823f4cad097c8e5a98606658d44bbf4 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 7 Jul 2017 14:59:20 -0400 Subject: Commit a work-in-progress for converting an X11 keycode into a Qt::Key definition --- src-qt5/core/libLumina/NativeWindow.pri | 2 +- src-qt5/core/libLumina/NativeWindowSystem.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/libLumina') diff --git a/src-qt5/core/libLumina/NativeWindow.pri b/src-qt5/core/libLumina/NativeWindow.pri index b10e472c..fef9c736 100644 --- a/src-qt5/core/libLumina/NativeWindow.pri +++ b/src-qt5/core/libLumina/NativeWindow.pri @@ -1,7 +1,7 @@ # Files QT *= x11extras -LIBS *= -lc -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-image -lxcb-composite -lxcb-damage -lxcb-util -lXdamage +LIBS *= -lc -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-image -lxcb-composite -lxcb-damage -lxcb-util -lxcb-keysyms -lXdamage SOURCES *= $${PWD}/NativeWindow.cpp \ $${PWD}/NativeWindowSystem.cpp \ diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index a8fb550e..6f737b27 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -27,6 +27,7 @@ #include #include #include +#include //XLib includes (XCB Damage lib does not appear to register for damage events properly) #include @@ -250,7 +251,13 @@ void NativeWindowSystem::stop(){ //Small simplification functions Qt::Key NativeWindowSystem::KeycodeToQt(int keycode){ - qDebug() << "Try to convert keycode to Qt::Key:" << keycode; + static xcb_key_symbols_t *SYM = 0; + if(SYM==0){ SYM = xcb_key_symbols_alloc(QX11Info::connection()); } + xcb_keysym_t symbol = xcb_key_symbols_get_keysym(SYM, keycode,0); + //not sure about the "column" input - we want raw keys though so ignore the "modified" key states (columns) for now + qDebug() << "Try to convert keycode to Qt::Key:" << keycode << symbol; + //Now map this symbol to the appropriate Qt::Key enumeration + qDebug() << " -- Simple Qt Map:" << (Qt::Key)(symbol); qDebug() << " - Not implemented yet"; return Qt::Key_unknown; } @@ -802,6 +809,7 @@ void NativeWindowSystem::GotPong(WId id){ void NativeWindowSystem::NewKeyPress(int keycode, WId win){ emit NewInputEvent(); if(screenLocked){ return; } + KeycodeToQt(keycode); emit KeyPressDetected(win, keycode); } -- cgit