Bug 1549537 - Unconditionally offer 'Span' option for desktop background position on Linux. r=sfoster
authorIan Moody <moz-ian@perix.co.uk>
Tue, 07 May 2019 18:36:19 +0000
changeset 534908 1b84518177e73dba6d06f515d3a09373ca19cfe7
parent 534907 c22a9760c9eb5b8eac862485e90dd90e0f57be5d
child 534909 340bf0a7176dfbbff8d47ad5a2df9da1715e3679
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfoster
bugs1549537, 1544105
milestone68.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 1549537 - Unconditionally offer 'Span' option for desktop background position on Linux. r=sfoster Bug 1544105 added a default implementation of `GfxInfoBase::FindMonitors` so `gfxInfo.getMonitors()` no longer throws on Linux, but it only ever returns the primary monitor there. Differential Revision: https://phabricator.services.mozilla.com/D30096
browser/components/shell/content/setDesktopBackground.js
--- a/browser/components/shell/content/setDesktopBackground.js
+++ b/browser/components/shell/content/setDesktopBackground.js
@@ -28,23 +28,24 @@ var gSetBackground = {
     this._canvas.width = this._canvas.height * screenRatio;
     document.getElementById("preview-unavailable").style.width =
       this._canvas.width + "px";
 
     if (AppConstants.platform == "macosx") {
       document.documentElement.getButton("accept").hidden = true;
     } else {
       let multiMonitors = false;
-      try {
+      if (AppConstants.platform == "linux") {
+        // getMonitors only ever returns the primary monitor on Linux, so just
+        // always show the option
+        multiMonitors = true;
+      } else {
         const gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
         const monitors = gfxInfo.getMonitors();
         multiMonitors = monitors.length > 1;
-      } catch (e) {
-        // getMonitors() isn't implemented on Linux
-        multiMonitors = true;
       }
 
       if (!multiMonitors || AppConstants.isPlatformAndVersionAtMost("win", 6.1)) {
         // Hide span option if < Win8 since that's when it was introduced.
         document.getElementById("spanPosition").hidden = true;
       }
     }