[Pale-Moon] Issue #1865 - Remove XP_MACOSX conditional blocks.

This commit is contained in:
Moonchild 2021-03-22 12:02:28 +00:00 committed by roytam1
commit a984b1dd93
60 changed files with 9 additions and 1011 deletions

View file

@ -31,7 +31,7 @@ var ShellServiceInternal = {
.QueryInterface(Ci.nsIGNOMEShellService);
return linuxShellService.canSetDesktopBackground;
}
#elif defined(XP_WIN) || defined(XP_MACOSX)
#elif defined(XP_WIN)
return true;
#else
return false;

View file

@ -5,13 +5,8 @@
var Ci = Components.interfaces;
var gSetBackground = {
#ifdef XP_MACOSX
_position : "STRETCH",
_backgroundColor : undefined,
#else
_position : "",
_backgroundColor : 0,
#endif
_screenWidth : 0,
_screenHeight : 0,
_image : null,
@ -28,9 +23,6 @@ var gSetBackground = {
this._canvas = document.getElementById("screen");
this._screenWidth = screen.width;
this._screenHeight = screen.height;
#ifdef XP_MACOSX
document.documentElement.getButton("accept").hidden = true;
#endif
if (this._screenWidth / this._screenHeight >= 1.6)
document.getElementById("monitor").setAttribute("aspectratio", "16:10");
@ -63,37 +55,14 @@ var gSetBackground = {
var ctx = this._canvas.getContext("2d");
ctx.scale(this._canvas.clientWidth / this._screenWidth, this._canvas.clientHeight / this._screenHeight);
#ifdef XP_MACOSX
// Make sure to reset the button state in case the user has already
// set an image as their desktop background.
var setDesktopBackground = document.getElementById("setDesktopBackground");
setDesktopBackground.hidden = false;
var bundle = document.getElementById("backgroundBundle");
setDesktopBackground.label = bundle.getString("DesktopBackgroundSet");
setDesktopBackground.disabled = false;
document.getElementById("showDesktopPreferences").hidden = true;
#else
this._initColor();
#endif
this.updatePosition();
},
setDesktopBackground: function ()
{
#ifdef XP_MACOSX
Components.classes["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService)
.addObserver(this, "shell:desktop-background-changed", false);
var bundle = document.getElementById("backgroundBundle");
var setDesktopBackground = document.getElementById("setDesktopBackground");
setDesktopBackground.disabled = true;
setDesktopBackground.label = bundle.getString("DesktopBackgroundDownloading");
#else
document.persist("menuPosition", "value");
this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor);
#endif
this._shell.setDesktopBackground(this._image,
Ci.nsIShellService["BACKGROUND_" + this._position]);
},
@ -103,9 +72,7 @@ var gSetBackground = {
var ctx = this._canvas.getContext("2d");
ctx.clearRect(0, 0, this._screenWidth, this._screenHeight);
#ifndef XP_MACOSX
this._position = document.getElementById("menuPosition").value;
#endif
switch (this._position) {
case "TILE":
@ -161,24 +128,6 @@ var gSetBackground = {
}
};
#ifdef XP_MACOSX
gSetBackground["observe"] = function (aSubject, aTopic, aData)
{
if (aTopic == "shell:desktop-background-changed") {
document.getElementById("setDesktopBackground").hidden = true;
document.getElementById("showDesktopPreferences").hidden = false;
Components.classes["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService)
.removeObserver(this, "shell:desktop-background-changed");
}
};
gSetBackground["showDesktopPrefs"] = function()
{
this._shell.openApplication(Ci.nsIMacShellService.APPLICATION_DESKTOP);
};
#else
gSetBackground["_initColor"] = function ()
{
var color = this._shell.desktopBackgroundColor;
@ -214,4 +163,3 @@ gSetBackground["_rgbToHex"] = function (aR, aG, aB)
return "#" + [aR, aG, aB].map(aInt => aInt.toString(16).replace(/^(.)$/, "0$1"))
.join("").toUpperCase();
};
#endif

View file

@ -9,18 +9,10 @@
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/setDesktopBackground.dtd">
#ifdef XP_MACOSX
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
#endif
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
windowtype="Shell:SetDesktopBackground"
#ifndef XP_MACOSX
buttons="accept,cancel"
#else
buttons="accept"
#endif
buttonlabelaccept="&setDesktopBackground.title;"
onload="gSetBackground.load();"
ondialogaccept="gSetBackground.setDesktopBackground();"
@ -33,7 +25,6 @@
<script type="application/javascript" src="chrome://browser/content/setDesktopBackground.js"/>
<script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
#ifndef XP_MACOSX
<hbox align="center">
<label value="&position.label;"/>
<menulist id="menuPosition"
@ -53,7 +44,6 @@
type="button"
onchange="gSetBackground.updateColor(this.color);"/>
</hbox>
#endif
<groupbox align="center">
<caption label="&preview.label;"/>
<stack>
@ -63,22 +53,4 @@
</stack>
</groupbox>
#ifdef XP_MACOSX
<separator/>
<hbox align="right">
<button id="setDesktopBackground"
label="&setDesktopBackground.title;"
oncommand="gSetBackground.setDesktopBackground();"/>
<button id="showDesktopPreferences"
label="&openDesktopPrefs.label;"
oncommand="gSetBackground.showDesktopPrefs();"
hidden="true"/>
</hbox>
#endif
#ifdef XP_MACOSX
#include ../../../base/content/browserMountPoints.inc
#endif
</dialog>