summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Olszak <olszak.tomasz@gmail.com>2013-07-29 21:07:20 +0000
committerTomasz Olszak <olszak.tomasz@gmail.com>2014-10-04 17:36:21 +0200
commit238cbda93a9f279f9828c69bb9fdb893bda5705a (patch)
tree22ea56ae2a024c14a83a83cc2274e722a3450d9e
parent9d7e64fca44938f62119a8e3414e5b7bfeff56a8 (diff)
downloadqtbase-238cbda93a9f279f9828c69bb9fdb893bda5705a.tar.gz
qtbase-238cbda93a9f279f9828c69bb9fdb893bda5705a.tar.bz2
qtbase-238cbda93a9f279f9828c69bb9fdb893bda5705a.zip
Added Tizen hardware button handling.
It is mainly the same as in the Android so Android solution was adapted. Change-Id: Ie86c5fdd6e25178054e4df77ec4fe318960461ba Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp19
2 files changed, 20 insertions, 3 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 3e50ce44c4..e05d2f0f06 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1879,7 +1879,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
if (e->nullWindow
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)) || defined(Q_OS_LINUX_TIZEN)
|| e->key == Qt::Key_Back || e->key == Qt::Key_Menu
#endif
) {
@@ -1895,7 +1895,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
if (window && !window->d_func()->blockedByModalWindow)
QGuiApplication::sendSpontaneousEvent(window, &ev);
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)) || defined(Q_OS_LINUX_TIZEN)
else
ev.setAccepted(false);
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 7e70e7258d..da48e937a0 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -246,6 +246,10 @@
#define XF86XK_TouchpadOff 0x1008FFB1
#define XF86XK_AudioMicMute 0x1008FFB2
+#ifdef Q_OS_LINUX_TIZEN
+#define TIZEN_Key_Back XF86XK_Stop
+#define TIZEN_Key_Menu XF86XK_Send
+#endif //Q_OS_LINUX_TIZEN
// end of XF86keysyms.h
@@ -422,7 +426,11 @@ static const unsigned int KeyTbl[] = {
// wireless/bluetooth/uwb keys, special launcher keys, etc.
XF86XK_Back, Qt::Key_Back,
XF86XK_Forward, Qt::Key_Forward,
+#ifdef Q_OS_LINUX_TIZEN
+ TIZEN_Key_Back, Qt::Key_Back,
+#else
XF86XK_Stop, Qt::Key_Stop,
+#endif //Q_OS_LINUX_TIZEN
XF86XK_Refresh, Qt::Key_Refresh,
XF86XK_Favorites, Qt::Key_Favorites,
XF86XK_AudioMedia, Qt::Key_LaunchMedia,
@@ -504,7 +512,11 @@ static const unsigned int KeyTbl[] = {
XF86XK_RotationPB, Qt::Key_RotationPB,
XF86XK_RotationKB, Qt::Key_RotationKB,
XF86XK_Save, Qt::Key_Save,
+#ifdef Q_OS_LINUX_TIZEN
+ TIZEN_Key_Menu, Qt::Key_Menu,
+#else
XF86XK_Send, Qt::Key_Send,
+#endif //Q_OS_LINUX_TIZEN
XF86XK_Spell, Qt::Key_Spell,
XF86XK_SplitScreen, Qt::Key_SplitScreen,
XF86XK_Support, Qt::Key_Support,
@@ -563,7 +575,6 @@ static const unsigned int KeyTbl[] = {
XF86XK_LaunchD, Qt::Key_LaunchF,
XF86XK_LaunchE, Qt::Key_LaunchG,
XF86XK_LaunchF, Qt::Key_LaunchH,
-
0, 0
};
@@ -1310,6 +1321,12 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
// It is crucial the order of xkb_state_key_get_one_sym & xkb_state_update_key operations is not reversed!
xcb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, code);
+#ifdef Q_OS_LINUX_TIZEN
+ if (type == QEvent::KeyPress && (sym == TIZEN_Key_Back || sym == TIZEN_Key_Menu)) {
+ //silently omit press events for Back and Menu keys
+ return;
+ }
+#endif //Q_OS_LINUX_TIZEN
QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
QMetaMethod method;