Bug 940677 - Add pref to enable auto switching between Desktop/Metro for Laptop/Slates. r=bbondy a=lsblakk
authorStephen Pohl <spohl.mozilla.bugs@gmail.com>
Tue, 10 Dec 2013 12:53:59 -0500
changeset 175262 934314077dd1e2fa42be83ba3f9ff8a39c6e11db
parent 175261 27a40ec39d19f45589fc1a6755646fc7d10404aa
child 175263 69a98ae06f1b92dff33037d9bd0aa17899df2f53
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy, lsblakk
bugs940677
milestone28.0a2
Bug 940677 - Add pref to enable auto switching between Desktop/Metro for Laptop/Slates. r=bbondy a=lsblakk
widget/windows/nsWindow.cpp
widget/windows/winrt/MetroWidget.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5490,18 +5490,20 @@ nsWindow::ProcessMessage(UINT msg, WPARA
         }
       }
     }
     break;
     case WM_SETTINGCHANGE:
       if (IsWin8OrLater() && lParam &&
           !wcsicmp(L"ConvertibleSlateMode", (wchar_t*)lParam)) {
         // If we're switching into slate mode, switch to Metro for hardware
-        // that supports this feature.
-        if (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0) {
+        // that supports this feature if the pref is set.
+        if (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0 &&
+            Preferences::GetBool("browser.shell.desktop-auto-switch-enabled",
+                                 false)) {
           nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
           if (appStartup) {
             appStartup->Quit(nsIAppStartup::eForceQuit |
                              nsIAppStartup::eRestartTouchEnvironment);
           }
         }
       }
     break;
--- a/widget/windows/winrt/MetroWidget.cpp
+++ b/widget/windows/winrt/MetroWidget.cpp
@@ -712,18 +712,20 @@ MetroWidget::StaticWindowProcedure(HWND 
 LRESULT
 MetroWidget::WindowProcedure(HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLParam)
 {
   if(sDefaultBrowserMsgId == aMsg) {
     CloseGesture();
   } else if (WM_SETTINGCHANGE == aMsg) {
     if (aLParam && !wcsicmp(L"ConvertibleSlateMode", (wchar_t*)aLParam)) {
       // If we're switching away from slate mode, switch to Desktop for
-      // hardware that supports this feature.
-      if (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) != 0) {
+      // hardware that supports this feature if the pref is set.
+      if (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) != 0 &&
+          Preferences::GetBool("browser.shell.metro-auto-switch-enabled",
+                               false)) {
         nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
         if (appStartup) {
           appStartup->Quit(nsIAppStartup::eForceQuit | nsIAppStartup::eRestart);
         }
       }
     }
   }