diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2012-06-18 16:57:57 +0300 |
---|---|---|
committer | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2012-06-18 21:51:24 +0200 |
commit | 8175d42a0833f03d5fe297560e9968c88a434d70 (patch) | |
tree | 8fb6ce6b6c23c4f17e094323bd3191db221623d0 | |
parent | 4097fb07df32eb3c748b75088684dd17a15970c9 (diff) | |
download | qtwayland-8175d42a0833f03d5fe297560e9968c88a434d70.tar.gz |
Map function keys properly
Change-Id: I3a13e0f05a3504e4d7b7f13c29ace139f88041e5
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8f68cbf5..4dc20224 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -449,19 +449,16 @@ static uint32_t translateKey(uint32_t sym, char *string, size_t size) Q_UNUSED(size); string[0] = '\0'; - int code = -1; - for (int i = 0; KeyTbl[i]; i += 2) { - if (sym == KeyTbl[i]) { - code = KeyTbl[i + 1]; - break; - } - } - if (code == -1) { - string[0] = sym; - string[1] = '\0'; - return toupper(sym); - } - return code; + if (sym >= XK_F1 && sym <= XK_F35) + return Qt::Key_F1 + (int(sym) - XK_F1); + + for (int i = 0; KeyTbl[i]; i += 2) + if (sym == KeyTbl[i]) + return KeyTbl[i + 1]; + + string[0] = sym; + string[1] = '\0'; + return toupper(sym); } #endif // QT_NO_WAYLAND_XKB |