From 091d2cd5fa15a9ffc442892bf6f4a6ea72a62d55 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 7 Jul 2017 16:25:20 -0400 Subject: Get the F1-F35 keys all detected/mapped appropriately to Qt keys --- src-qt5/core/libLumina/NativeWindowSystem.cpp | 57 +++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) (limited to 'src-qt5/core') diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index 4a66f621..73bba1a9 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -18,6 +18,16 @@ #include #include + +#define XK_MISCELLANY +#define XK_XKB_KEYS +#define XK_LATIN1 +#define XK_LATIN2 +#define XK_LATIN3 +#define XK_LATIN4 +//NOTE: Look at the keysymdef.h file for additional define/characters which we may need later +#include + //XCB Library includes #include #include @@ -262,11 +272,52 @@ Qt::Key NativeWindowSystem::KeycodeToQt(int keycode){ else if(xcb_is_private_keypad_key(symbol)){ qDebug() << "Private Keypad Key"; } else if(xcb_is_cursor_key(symbol)){ qDebug() << "Cursor Key"; } else if(xcb_is_pf_key(symbol)){ qDebug() << "PF Key"; } - else if(xcb_is_function_key(symbol)){ qDebug() << "Function Key"; } - else if(xcb_is_misc_function_key(symbol)){ qDebug() << "Misc Function Key"; } + else if(xcb_is_function_key(symbol)){ + switch(symbol){ + case XK_F1: return Qt::Key_F1; + case XK_F2: return Qt::Key_F2; + case XK_F3: return Qt::Key_F3; + case XK_F4: return Qt::Key_F4; + case XK_F5: return Qt::Key_F5; + case XK_F6: return Qt::Key_F6; + case XK_F7: return Qt::Key_F7; + case XK_F8: return Qt::Key_F8; + case XK_F9: return Qt::Key_F9; + case XK_F10: return Qt::Key_F10; + case XK_F11: return Qt::Key_F11; + case XK_F12: return Qt::Key_F12; + case XK_F13: return Qt::Key_F13; + case XK_F14: return Qt::Key_F14; + case XK_F15: return Qt::Key_F15; + case XK_F16: return Qt::Key_F16; + case XK_F17: return Qt::Key_F17; + case XK_F18: return Qt::Key_F18; + case XK_F19: return Qt::Key_F19; + case XK_F20: return Qt::Key_F20; + case XK_F21: return Qt::Key_F21; + case XK_F22: return Qt::Key_F22; + case XK_F23: return Qt::Key_F23; + case XK_F24: return Qt::Key_F24; + case XK_F25: return Qt::Key_F25; + case XK_F26: return Qt::Key_F26; + case XK_F27: return Qt::Key_F27; + case XK_F28: return Qt::Key_F28; + case XK_F29: return Qt::Key_F29; + case XK_F30: return Qt::Key_F30; + case XK_F31: return Qt::Key_F31; + case XK_F32: return Qt::Key_F32; + case XK_F33: return Qt::Key_F33; + case XK_F34: return Qt::Key_F34; + case XK_F35: return Qt::Key_F35; + default: + qDebug() << "Unknown Function Key"; + } + }else if(xcb_is_misc_function_key(symbol)){ qDebug() << "Misc Function Key"; } else if(xcb_is_modifier_key(symbol)){ qDebug() << "Modifier Key"; - + /*switch(symbol){ + case: XK_ + }*/ }else if(!QKeySequence(symbol).isEmpty()){ //One of the standard keys, go ahead and do a direct map qDebug() << " -- [GOT MATCH]" << QKeySequence(symbol); -- cgit