summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Olszak <olszak.tomasz@gmail.com>2015-02-26 15:41:12 +0100
committerTomasz Olszak <olszak.tomasz@gmail.com>2015-02-26 15:41:12 +0100
commitf3600905f9b3d905568dd7494a18e69f9d255fd3 (patch)
tree7f16c636780295bf2aad67b41c9c3e8155e1dfa1
parent007f6200018365c69647fe6708fc751fd4c6af33 (diff)
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 dc5501eaf5..7d12f0de01 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1855,7 +1855,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
) {
@@ -1871,7 +1871,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 5fb745717b..7b59f0d9ad 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
};
@@ -1414,6 +1425,12 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
targetWindow->updateNetWmUserTime(time);
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;