Bug 900382 Support "LogOff", "PowerOff", "Hibernate", "Standby" and "WakeUp" key values on Windows, GTK and Qt r=jimm+karlt+smaug+jimm
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 30 Dec 2014 10:47:54 +0900
changeset 247441 40b3358b1d4b97bea26766d4527af3b944a65f0a
parent 247440 6f6ae656691d20459934b21af4fc40ce95d08e2c
child 247442 7c0ab70d2e40502c35e7c2fd8ffafc24e1a7e901
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs900382
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 900382 Support "LogOff", "PowerOff", "Hibernate", "Standby" and "WakeUp" key values on Windows, GTK and Qt r=jimm+karlt+smaug+jimm
dom/events/KeyNameList.h
widget/NativeKeyToDOMKeyName.h
widget/qt/nsQtKeyUtils.cpp
--- a/dom/events/KeyNameList.h
+++ b/dom/events/KeyNameList.h
@@ -105,23 +105,23 @@ DEFINE_KEYNAME_WITH_SAME_NAME(ZoomOut)
 
 /******************************************************************************
  * Device Keys
  *****************************************************************************/
 DEFINE_KEYNAME_WITH_SAME_NAME(BrightnessDown)
 DEFINE_KEYNAME_WITH_SAME_NAME(BrightnessUp)
 DEFINE_KEYNAME_WITH_SAME_NAME(Camera)
 DEFINE_KEYNAME_WITH_SAME_NAME(Eject)
-// DEFINE_KEYNAME_WITH_SAME_NAME(LogOff)
+DEFINE_KEYNAME_WITH_SAME_NAME(LogOff)
 DEFINE_KEYNAME_WITH_SAME_NAME(Power)
-// DEFINE_KEYNAME_WITH_SAME_NAME(PowerOff)
+DEFINE_KEYNAME_WITH_SAME_NAME(PowerOff)
 DEFINE_KEYNAME_WITH_SAME_NAME(PrintScreen)
-// DEFINE_KEYNAME_WITH_SAME_NAME(Hibernate)
-// DEFINE_KEYNAME_WITH_SAME_NAME(Standby)
-// DEFINE_KEYNAME_WITH_SAME_NAME(WakeUp)
+DEFINE_KEYNAME_WITH_SAME_NAME(Hibernate)
+DEFINE_KEYNAME_WITH_SAME_NAME(Standby)
+DEFINE_KEYNAME_WITH_SAME_NAME(WakeUp)
 
 /******************************************************************************
  * IME and Composition Keys
  *****************************************************************************/
 DEFINE_KEYNAME_WITH_SAME_NAME(AllCandidates)
 DEFINE_KEYNAME_WITH_SAME_NAME(Alphanumeric)
 DEFINE_KEYNAME_WITH_SAME_NAME(CodeInput)
 DEFINE_KEYNAME_WITH_SAME_NAME(Compose)
--- a/widget/NativeKeyToDOMKeyName.h
+++ b/widget/NativeKeyToDOMKeyName.h
@@ -409,30 +409,55 @@ KEY_MAP_QT      (BrightnessUp, Qt::Key_M
 KEY_MAP_QT      (Camera, Qt::Key_Camera)
 KEY_MAP_ANDROID (Camera, AKEYCODE_CAMERA)
 
 // Eject
 KEY_MAP_GTK     (Eject, GDK_Eject)
 KEY_MAP_QT      (Eject, Qt::Key_Eject)
 KEY_MAP_ANDROID (Eject, AKEYCODE_MEDIA_EJECT)
 
+// LogOff
+KEY_MAP_GTK     (LogOff, GDK_LogOff)
+KEY_MAP_QT      (LogOff, Qt::Key_LogOff)
+
 // Power
-KEY_MAP_GTK     (Power, GDK_PowerOff)
-KEY_MAP_QT      (Power, Qt::Key_PowerOff)
 KEY_MAP_ANDROID (Power, AKEYCODE_POWER)
 
+// PowerOff
+KEY_MAP_GTK     (PowerOff, GDK_PowerDown)
+KEY_MAP_GTK     (PowerOff, GDK_PowerOff)
+KEY_MAP_QT      (PowerOff, Qt::Key_PowerDown)
+KEY_MAP_QT      (PowerOff, Qt::Key_PowerOff)
+
 // PrintScreen
 KEY_MAP_WIN     (PrintScreen, VK_SNAPSHOT)
 KEY_MAP_GTK     (PrintScreen, GDK_3270_PrintScreen)
 KEY_MAP_GTK     (PrintScreen, GDK_Print)
 KEY_MAP_GTK     (PrintScreen, GDK_Sys_Req)
 KEY_MAP_QT      (PrintScreen, Qt::Key_Print)
 KEY_MAP_QT      (PrintScreen, Qt::Key_SysReq)
 KEY_MAP_ANDROID (PrintScreen, AKEYCODE_SYSRQ)
 
+// Hibernate
+KEY_MAP_GTK     (Hibernate, GDK_Hibernate)
+KEY_MAP_QT      (Hibernate, Qt::Key_Hibernate)
+
+// Standby
+KEY_MAP_WIN     (Standby, VK_SLEEP)
+KEY_MAP_GTK     (Standby, GDK_Standby)
+KEY_MAP_GTK     (Standby, GDK_Suspend)
+KEY_MAP_GTK     (Standby, GDK_Sleep)
+KEY_MAP_QT      (Standby, Qt::Key_Standby)
+KEY_MAP_QT      (Standby, Qt::Key_Suspend)
+KEY_MAP_QT      (Standby, Qt::Key_Sleep)
+
+// WakeUp
+KEY_MAP_GTK     (WakeUp, GDK_WakeUp)
+KEY_MAP_QT      (WakeUp, Qt::Key_WakeUp)
+
 /******************************************************************************
  * IME and Composition Keys
  ******************************************************************************/
 // AllCandidates
 KEY_MAP_GTK     (AllCandidates, GDK_MultipleCandidate) // OADG 109, Zen Koho
 KEY_MAP_QT      (AllCandidates, Qt::Key_MultipleCandidate)
 
 // Alphanumeric
--- a/widget/qt/nsQtKeyUtils.cpp
+++ b/widget/qt/nsQtKeyUtils.cpp
@@ -382,23 +382,21 @@ QtKeyCodeToDOMKeyNameIndex(int aKeysym)
         case Qt::Key_Hangul_Romaja:
         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_Standby:
         case Qt::Key_OpenUrl:
         case Qt::Key_LaunchMedia:
         case Qt::Key_KeyboardLightOnOff:
         case Qt::Key_KeyboardBrightnessUp:
         case Qt::Key_KeyboardBrightnessDown:
-        case Qt::Key_WakeUp:
         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:
@@ -416,17 +414,16 @@ QtKeyCodeToDOMKeyNameIndex(int aKeysym)
         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_LogOff:
         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:
@@ -456,21 +453,18 @@ QtKeyCodeToDOMKeyNameIndex(int aKeysym)
         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_Hibernate:
         case Qt::Key_View:
         case Qt::Key_TopMenu:
-        case Qt::Key_PowerDown:
-        case Qt::Key_Suspend:
         case Qt::Key_ContrastAdjust:
         case Qt::Key_TouchpadToggle:
         case Qt::Key_TouchpadOn:
         case Qt::Key_TouchpadOff:
         case Qt::Key_unknown:
         case Qt::Key_Call:
         case Qt::Key_CameraFocus:
         case Qt::Key_Context1:
@@ -481,17 +475,16 @@ QtKeyCodeToDOMKeyNameIndex(int aKeysym)
         case Qt::Key_Hangup:
         case Qt::Key_No:
         case Qt::Key_Select:
         case Qt::Key_Yes:
         case Qt::Key_ToggleCallHangup:
         case Qt::Key_VoiceDial:
         case Qt::Key_LastNumberRedial:
         case Qt::Key_Printer:
-        case Qt::Key_Sleep:
         default:
             return KEY_NAME_INDEX_Unidentified;
     }
 }
 
 CodeNameIndex
 ScanCodeToDOMCodeNameIndex(int32_t aScanCode)
 {