From ea7da7c241c7334305f256102d767bf3904370bd Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 18 Jun 2013 16:18:53 +0200 Subject: [PATCH] Key mappings for more remote-control keys We are missing a few key mappings to have support for remote control keys supported by Android and DirectFB. This patch adds the four color keys Red/Green/Yellow/Blue and ChannelUp and ChannelDown. Change-Id: I4d859c28e0d61c5362f1212ba1e577a47de86ec1 Reviewed-by: BogDan Vatra Reviewed-by: Simon Hausmann --- src/corelib/global/qnamespace.h | 8 ++++++++ src/corelib/global/qnamespace.qdoc | 6 ++++++ .../platforms/android/src/androidjniinput.cpp | 18 ++++++++++++++++++ .../directfb/qdirectfbconvenience.cpp | 8 ++++++++ src/plugins/platforms/xcb/qxcbkeyboard.cpp | 8 ++++++++ 5 files changed, 48 insertions(+) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 25c47d5d34..6f1a089670 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -982,6 +982,14 @@ public: Key_MicMute = 0x01000113, + Key_Red = 0x01000114, + Key_Green = 0x01000115, + Key_Yellow = 0x01000116, + Key_Blue = 0x01000117, + + Key_ChannelUp = 0x01000118, + Key_ChannelDown = 0x01000119, + Key_MediaLast = 0x0100ffff, // Keypad navigation keys diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f9248eb68d..5cd1812b54 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1622,6 +1622,12 @@ \value Key_TouchpadOn \value Key_TouchpadOff \value Key_MicMute + \value Key_Red + \value Key_Green + \value Key_Yellow + \value Key_Blue + \value Key_ChannelUp + \value Key_ChannelDown \value Key_MediaLast \value Key_unknown diff --git a/src/plugins/platforms/android/src/androidjniinput.cpp b/src/plugins/platforms/android/src/androidjniinput.cpp index 75cb617ca8..b31e74bb52 100644 --- a/src/plugins/platforms/android/src/androidjniinput.cpp +++ b/src/plugins/platforms/android/src/androidjniinput.cpp @@ -411,6 +411,24 @@ namespace QtAndroidInput case 0x00000018: return Qt::Key_VolumeUp; + case 0x000000b7: // KEYCODE_PROG_RED + return Qt::Key_Red; + + case 0x000000b8: // KEYCODE_PROG_GREEN + return Qt::Key_Green; + + case 0x000000b9: // KEYCODE_PROG_YELLOW + return Qt::Key_Yellow; + + case 0x000000ba: // KEYCODE_PROG_BLUE + return Qt::Key_Blue; + + case 0x000000a6: // KEYCODE_CHANNEL_UP + return Qt::Key_ChannelUp; + + case 0x000000a7: // KEYCODE_CHANNEL_DOWN + return Qt::Key_ChannelDown; + case 0x00000000: // KEYCODE_UNKNOWN case 0x00000011: // KEYCODE_STAR ?!?!? case 0x00000012: // KEYCODE_POUND ?!?!? diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp index 4a349bbae6..b6db830f82 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp @@ -286,6 +286,14 @@ QDirectFbKeyMap::QDirectFbKeyMap() insert(DIKS_MAIL , Qt::Key_LaunchMail); insert(DIKS_FAVORITES , Qt::Key_Favorites); + insert(DIKS_RED , Qt::Key_Red); + insert(DIKS_GREEN , Qt::Key_Green); + insert(DIKS_YELLOW , Qt::Key_Yellow); + insert(DIKS_BLUE , Qt::Key_Blue); + + insert(DIKS_CHANNEL_UP , Qt::Key_ChannelUp); + insert(DIKS_CHANNEL_DOWN , Qt::Key_ChannelDown); + insert(DIKS_BACK , Qt::Key_Back); insert(DIKS_FORWARD , Qt::Key_Forward); insert(DIKS_VOLUME_UP , Qt::Key_VolumeUp); diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 6e5a9ccbb4..751bd168f6 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -243,6 +243,10 @@ #define XF86XK_Select 0x1008FFA0 #define XF86XK_View 0x1008FFA1 #define XF86XK_TopMenu 0x1008FFA2 +#define XF86XK_Red 0x1008FFA3 +#define XF86XK_Green 0x1008FFA4 +#define XF86XK_Yellow 0x1008FFA5 +#define XF86XK_Blue 0x1008FFA6 #define XF86XK_Suspend 0x1008FFA7 #define XF86XK_Hibernate 0x1008FFA8 #define XF86XK_TouchpadToggle 0x1008FFA9 @@ -538,6 +542,10 @@ static const unsigned int KeyTbl[] = { XF86XK_Select, Qt::Key_Select, XF86XK_View, Qt::Key_View, XF86XK_TopMenu, Qt::Key_TopMenu, + XF86XK_Red, Qt::Key_Red, + XF86XK_Green, Qt::Key_Green, + XF86XK_Yellow, Qt::Key_Yellow, + XF86XK_Blue, Qt::Key_Blue, XF86XK_Bluetooth, Qt::Key_Bluetooth, XF86XK_Suspend, Qt::Key_Suspend, XF86XK_Hibernate, Qt::Key_Hibernate,