Bug 1026939 Support "LaunchFoo" key values which launches specific application on GTK, Qt, Android and Gonk r=nchen+karlt+mwu+smaug+romaxa
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 30 Dec 2014 10:47:55 +0900
changeset 221632 700aa7de43c744e8f4f73b9fc9caa70ad9563788
parent 221631 f822dd2c92893cd460a347a22c15c7d0f0f42ef9
child 221633 c644cc4c6b9b74e4dbe1eba49ba7cbba09251cfd
push id10617
push userkwierso@gmail.com
push dateWed, 31 Dec 2014 00:06:35 +0000
treeherderfx-team@edccc126caae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchen
bugs1026939
milestone37.0a1
Bug 1026939 Support "LaunchFoo" key values which launches specific application on GTK, Qt, Android and Gonk r=nchen+karlt+mwu+smaug+romaxa
dom/events/KeyNameList.h
widget/NativeKeyToDOMKeyName.h
widget/android/nsWindow.cpp
widget/qt/nsQtKeyUtils.cpp
--- a/dom/events/KeyNameList.h
+++ b/dom/events/KeyNameList.h
@@ -222,27 +222,27 @@ DEFINE_KEYNAME_WITH_SAME_NAME(MediaTrack
 // DEFINE_KEYNAME_WITH_SAME_NAME(SpellCheck)
 DEFINE_KEYNAME_WITH_SAME_NAME(VolumeDown)
 DEFINE_KEYNAME_WITH_SAME_NAME(VolumeUp)
 DEFINE_KEYNAME_WITH_SAME_NAME(VolumeMute)
 
 /******************************************************************************
  * Application Keys
  *****************************************************************************/
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchCalculator)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchCalendar)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchCalculator)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchCalendar)
 DEFINE_KEYNAME_WITH_SAME_NAME(LaunchMail)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchMediaPlayer)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchMusicPlayer)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchMyComputer)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchScreenSaver)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchSpreadsheet)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchWebBrowser)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchWebCam)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LaunchWordProcessor)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchMediaPlayer)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchMusicPlayer)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchMyComputer)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchScreenSaver)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchSpreadsheet)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchWebBrowser)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchWebCam)
+DEFINE_KEYNAME_WITH_SAME_NAME(LaunchWordProcessor)
 
 DEFINE_KEYNAME_WITH_SAME_NAME(LaunchApplication1)
 DEFINE_KEYNAME_WITH_SAME_NAME(LaunchApplication2)
 DEFINE_KEYNAME_WITH_SAME_NAME(LaunchApplication3)
 DEFINE_KEYNAME_WITH_SAME_NAME(LaunchApplication4)
 DEFINE_KEYNAME_WITH_SAME_NAME(LaunchApplication5)
 DEFINE_KEYNAME_WITH_SAME_NAME(LaunchApplication6)
 DEFINE_KEYNAME_WITH_SAME_NAME(LaunchApplication7)
--- a/widget/NativeKeyToDOMKeyName.h
+++ b/widget/NativeKeyToDOMKeyName.h
@@ -863,16 +863,17 @@ KEY_MAP_QT      (F35, Qt::Key_F35)
  ******************************************************************************/
 // MediaPlayPause
 KEY_MAP_WIN     (MediaPlayPause, VK_MEDIA_PLAY_PAUSE)
 KEY_MAP_QT      (MediaPlayPause, Qt::Key_MediaTogglePlayPause)
 KEY_MAP_ANDROID (MediaPlayPause, AKEYCODE_MEDIA_PLAY_PAUSE)
 
 // MediaSelect
 KEY_MAP_WIN     (MediaSelect, VK_LAUNCH_MEDIA_SELECT)
+KEY_MAP_GTK     (MediaSelect, GDK_AudioMedia)
 
 // MediaStop
 KEY_MAP_WIN     (MediaStop, VK_MEDIA_STOP)
 KEY_MAP_GTK     (MediaStop, GDK_AudioStop)
 KEY_MAP_QT      (MediaStop, Qt::Key_MediaStop)
 KEY_MAP_ANDROID (MediaStop, AKEYCODE_MEDIA_STOP)
 
 // MediaTrackNext
@@ -906,27 +907,76 @@ KEY_MAP_WIN     (VolumeMute, VK_VOLUME_M
 KEY_MAP_COCOA   (VolumeMute, kVK_Mute)
 KEY_MAP_GTK     (VolumeMute, GDK_AudioMute)
 KEY_MAP_QT      (VolumeMute, Qt::Key_VolumeMute)
 KEY_MAP_ANDROID (VolumeMute, AKEYCODE_VOLUME_MUTE)
 
 /******************************************************************************
  * Application Keys
  ******************************************************************************/
+// LaunchCalculator
+KEY_MAP_GTK     (LaunchCalculator, GDK_Calculator)
+KEY_MAP_QT      (LaunchCalculator, Qt::Key_Calculator)
+KEY_MAP_ANDROID (LaunchCalculator, AKEYCODE_CALCULATOR)
+
+// LaunchCalendar
+KEY_MAP_GTK     (LaunchCalendar, GDK_Calendar)
+KEY_MAP_QT      (LaunchCalendar, Qt::Key_Calendar)
+KEY_MAP_ANDROID (LaunchCalendar, AKEYCODE_CALENDAR)
+
 // LaunchMail
 KEY_MAP_WIN     (LaunchMail, VK_LAUNCH_MAIL)
 KEY_MAP_GTK     (LaunchMail, GDK_Mail)
 KEY_MAP_QT      (LaunchMail, Qt::Key_LaunchMail)
 KEY_MAP_ANDROID (LaunchMail, AKEYCODE_ENVELOPE)
 
+// LaunchMediaPlayer
+// GDK_CD is defined as "Launch CD/DVD player" in XF86keysym.h.
+// Therefore, let's map it to media player rather than music player.
+KEY_MAP_GTK     (LaunchMediaPlayer, GDK_CD)
+KEY_MAP_GTK     (LaunchMediaPlayer, GDK_Video)
+KEY_MAP_QT      (LaunchMediaPlayer, Qt::Key_LaunchMedia)
+KEY_MAP_QT      (LaunchMediaPlayer, Qt::Key_CD)
+KEY_MAP_QT      (LaunchMediaPlayer, Qt::Key_Video)
+
+// LaunchMusicPlayer
+KEY_MAP_GTK     (LaunchMusicPlayer, GDK_Music)
+KEY_MAP_QT      (LaunchMusicPlayer, Qt::Key_Music)
+KEY_MAP_ANDROID (LaunchMusicPlayer, AKEYCODE_MUSIC)
+
+// LaunchMyComputer
+KEY_MAP_GTK     (LaunchMyComputer, GDK_MyComputer)
+KEY_MAP_GTK     (LaunchMyComputer, GDK_Explorer)
+KEY_MAP_QT      (LaunchMyComputer, Qt::Key_Explorer)
+
+// LaunchScreenSaver
+KEY_MAP_GTK     (LaunchScreenSaver, GDK_ScreenSaver)
+KEY_MAP_QT      (LaunchScreenSaver, Qt::Key_ScreenSaver)
+
+// LaunchSpreadsheet
+KEY_MAP_GTK     (LaunchSpreadsheet, GDK_Excel)
+KEY_MAP_QT      (LaunchSpreadsheet, Qt::Key_Excel)
+
+// LaunchWebBrowser
+KEY_MAP_GTK     (LaunchWebBrowser, GDK_WWW)
+KEY_MAP_QT      (LaunchWebBrowser, Qt::Key_WWW)
+KEY_MAP_ANDROID (LaunchWebBrowser, AKEYCODE_EXPLORER)
+
+// LaunchWebCam
+KEY_MAP_GTK     (LaunchWebCam, GDK_WebCam)
+KEY_MAP_QT      (LaunchWebCam, Qt::Key_WebCam)
+
+// LaunchWordProcessor
+KEY_MAP_GTK     (LaunchWordProcessor, GDK_Word)
+KEY_MAP_QT      (LaunchWordProcessor, Qt::Key_Word)
+
 // LaunchApplication1
 KEY_MAP_WIN     (LaunchApplication1, VK_LAUNCH_APP1)
 KEY_MAP_GTK     (LaunchApplication1, GDK_Launch0)
 KEY_MAP_QT      (LaunchApplication1, Qt::Key_Launch0)
-KEY_MAP_ANDROID (LaunchApplication1, AKEYCODE_EXPLORER)
 
 // LaunchApplication2
 KEY_MAP_WIN     (LaunchApplication2, VK_LAUNCH_APP2)
 KEY_MAP_GTK     (LaunchApplication2, GDK_Launch1)
 KEY_MAP_QT      (LaunchApplication2, Qt::Key_Launch1)
 
 // LaunchApplication3
 KEY_MAP_GTK     (LaunchApplication3, GDK_Launch2)
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1418,19 +1418,16 @@ ConvertAndroidKeyCodeToKeyNameIndex(Andr
         case AKEYCODE_BUTTON_13:
         case AKEYCODE_BUTTON_14:
         case AKEYCODE_BUTTON_15:
         case AKEYCODE_BUTTON_16:
 
         case AKEYCODE_MANNER_MODE:
         case AKEYCODE_3D_MODE:
         case AKEYCODE_CONTACTS:
-        case AKEYCODE_CALENDAR:
-        case AKEYCODE_MUSIC:
-        case AKEYCODE_CALCULATOR:
             return KEY_NAME_INDEX_Unidentified;
 
         case AKEYCODE_UNKNOWN:
             MOZ_ASSERT(
                 aAndroidGeckoEvent.Action() != AKEY_EVENT_ACTION_MULTIPLE,
                 "Don't call this when action is AKEY_EVENT_ACTION_MULTIPLE!");
             // It's actually an unknown key if the action isn't ACTION_MULTIPLE.
             // However, it might cause text input.  So, let's check the value.
--- a/widget/qt/nsQtKeyUtils.cpp
+++ b/widget/qt/nsQtKeyUtils.cpp
@@ -380,79 +380,67 @@ QtKeyCodeToDOMKeyNameIndex(int aKeysym)
         case Qt::Key_Hangul_Jeonja:
         case Qt::Key_Hangul_Banja:
         case Qt::Key_Hangul_PreHanja:
         case Qt::Key_Hangul_PostHanja:
         case Qt::Key_Hangul_Special:
         case Qt::Key_TrebleUp:
         case Qt::Key_TrebleDown:
         case Qt::Key_OpenUrl:
-        case Qt::Key_LaunchMedia:
         case Qt::Key_KeyboardLightOnOff:
         case Qt::Key_KeyboardBrightnessUp:
         case Qt::Key_KeyboardBrightnessDown:
-        case Qt::Key_ScreenSaver:
-        case Qt::Key_WWW:
         case Qt::Key_Memo:
         case Qt::Key_LightBulb:
         case Qt::Key_Shop:
         case Qt::Key_History:
         case Qt::Key_AddFavorite:
         case Qt::Key_HotLinks:
         case Qt::Key_Finance:
         case Qt::Key_Community:
         case Qt::Key_BackForward:
         case Qt::Key_ApplicationLeft:
         case Qt::Key_ApplicationRight:
         case Qt::Key_Book:
-        case Qt::Key_CD:
-        case Qt::Key_Calculator:
         case Qt::Key_ToDoList:
         case Qt::Key_ClearGrab:
         case Qt::Key_Close:
         case Qt::Key_Display:
         case Qt::Key_DOS:
         case Qt::Key_Documents:
-        case Qt::Key_Excel:
-        case Qt::Key_Explorer:
         case Qt::Key_Game:
         case Qt::Key_Go:
         case Qt::Key_iTouch:
         case Qt::Key_Market:
         case Qt::Key_Meeting:
         case Qt::Key_MenuKB:
         case Qt::Key_MenuPB:
         case Qt::Key_MySites:
         case Qt::Key_News:
         case Qt::Key_OfficeHome:
         case Qt::Key_Option:
         case Qt::Key_Phone:
-        case Qt::Key_Calendar:
         case Qt::Key_Reply:
         case Qt::Key_RotateWindows:
         case Qt::Key_RotationPB:
         case Qt::Key_RotationKB:
         case Qt::Key_Save:
         case Qt::Key_Send:
         case Qt::Key_Spell:
         case Qt::Key_SplitScreen:
         case Qt::Key_Support:
         case Qt::Key_TaskPane:
         case Qt::Key_Terminal:
         case Qt::Key_Tools:
         case Qt::Key_Travel:
-        case Qt::Key_Video:
-        case Qt::Key_Word:
         case Qt::Key_Xfer:
         case Qt::Key_Away:
         case Qt::Key_Messenger:
-        case Qt::Key_WebCam:
         case Qt::Key_MailForward:
         case Qt::Key_Pictures:
-        case Qt::Key_Music:
         case Qt::Key_Battery:
         case Qt::Key_Bluetooth:
         case Qt::Key_WLAN:
         case Qt::Key_UWB:
         case Qt::Key_AudioRepeat:
         case Qt::Key_AudioCycleTrack:
         case Qt::Key_Time:
         case Qt::Key_View: