summaryrefslogtreecommitdiffhomepage
path: root/qxt-mini/x11-keymap.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-05-30 20:48:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-05-30 20:48:09 +0200
commitc64c3c69dfed2d5d2af7b72b0489f52b28f854a8 (patch)
tree1c6995ca16437f7deaa1e4a6be88ea3f009ec328 /qxt-mini/x11-keymap.cpp
parentf018bf4beeb15f346177dcee2b9e1a023627e7c4 (diff)
qxt-mini: fix numpad handling
Diffstat (limited to 'qxt-mini/x11-keymap.cpp')
-rw-r--r--qxt-mini/x11-keymap.cpp46
1 files changed, 33 insertions, 13 deletions
diff --git a/qxt-mini/x11-keymap.cpp b/qxt-mini/x11-keymap.cpp
index 16e55368..701c60bc 100644
--- a/qxt-mini/x11-keymap.cpp
+++ b/qxt-mini/x11-keymap.cpp
@@ -143,24 +143,25 @@ static tt numpad_keymap[] = {
{ Qt::Key_7, XK_KP_7 },
{ Qt::Key_8, XK_KP_8 },
{ Qt::Key_9, XK_KP_9 },
- { Qt::Key_5, XK_KP_Begin },
+
{ Qt::Key_Space, XK_KP_Space },
{ Qt::Key_Tab, XK_KP_Tab },
{ Qt::Key_F1, XK_KP_F1 },
{ Qt::Key_F2, XK_KP_F2 },
{ Qt::Key_F3, XK_KP_F3 },
{ Qt::Key_F4, XK_KP_F4 },
- { Qt::Key_Home, XK_KP_Home },
- { Qt::Key_End, XK_KP_End },
- { Qt::Key_Left, XK_KP_Left },
- { Qt::Key_Right, XK_KP_Right },
- { Qt::Key_Up, XK_KP_Up },
- { Qt::Key_Down, XK_KP_Down },
- { Qt::Key_PageUp, XK_KP_Page_Up },
- { Qt::Key_PageUp, XK_KP_Prior },
- { Qt::Key_PageDown, XK_KP_Page_Down },
- { Qt::Key_PageDown, XK_KP_Next },
- { Qt::Key_Insert, XK_KP_Insert },
+
+ { Qt::Key_1, XK_KP_End },
+ { Qt::Key_2, XK_KP_Down },
+ { Qt::Key_3, XK_KP_Page_Down },
+ { Qt::Key_4, XK_KP_Left },
+ { Qt::Key_5, XK_KP_Begin },
+ { Qt::Key_6, XK_KP_Right },
+ { Qt::Key_7, XK_KP_Home },
+ { Qt::Key_8, XK_KP_Up },
+ { Qt::Key_9, XK_KP_Page_Up },
+ { Qt::Key_0, XK_KP_Insert },
+
{ Qt::Key_Delete, XK_KP_Delete },
{ Qt::Key_Equal, XK_KP_Equal },
{ Qt::Key_Asterisk, XK_KP_Multiply },
@@ -210,7 +211,7 @@ std::vector<quint32> qt_key_to_x11(Display*, Qt::Key k, Qt::KeyboardModifiers)
return ret;
}
QXT_GUI_EXPORT
-static Qt::KeyboardModifiers x11_mods_to_qt(quint32 mods)
+Qt::KeyboardModifiers x11_mods_to_qt(quint32 mods)
{
Qt::KeyboardModifiers ret(0);
@@ -294,4 +295,23 @@ QPair<KeySym, KeySym> keycode_to_keysym(Display* disp,
return ret;
}
+
+QXT_GUI_EXPORT
+quint32 xcb_mods_to_x11(quint32 mods)
+{
+ unsigned int keystate = 0;
+
+ if(mods & XCB_MOD_MASK_1) // alt
+ keystate |= Mod1Mask;
+ if(mods & XCB_MOD_MASK_CONTROL) // ctrl
+ keystate |= ControlMask;
+ if(mods & XCB_MOD_MASK_4) // super aka win key
+ keystate |= Mod4Mask;
+ if(mods & XCB_MOD_MASK_SHIFT) //shift
+ keystate |= ShiftMask;
+ if(mods & XCB_MOD_MASK_2) // numlock
+ keystate |= Mod2Mask;
+
+ return keystate;
+}
#endif