Cleaned up PC8080 cross-browser full-screen support (matches PCx86 now)

This commit is contained in:
Jeff Parsons 2017-08-03 08:42:29 -07:00 • committed by Jeff Parsons
commit 13b0c23b0a
19 changed files with 500 additions and 524 deletions

View file

@ -11,13 +11,19 @@ redirect_from:
Device Configurations
---------------------
All PCjs machines are built from the following sets of devices:
All PCjs machines are built from devices organized by CPU:
* [6502 Devices](c1p/): [Challenger 1P](c1p/machine/)
* [8080 Devices](pc8080/): [Space Invaders](pc8080/machine/invaders/), [VT100 Terminal](pc8080/machine/vt100/)
* [8086 Devices](pcx86/): [IBM PC and compatibles](pcx86/machine/)
* [PDP-10 Devices](pdp10/): [PDP-10 (Model KA10)](pdp10/machine/ka10/)
* [PDP-11 Devices](pdp11/): [PDP-11/20](pdp11/machine/1120/), [PDP-11/45](pdp11/machine/1145/), [PDP-11/70](pdp11/machine/1170/)
* [6502](c1p/)
- [Challenger 1P](c1p/machine/)
* [8080](pc8080/)
- [Space Invaders](pc8080/machine/invaders/)
- [VT100 Terminal](pc8080/machine/vt100/)
* [8086-80386](pcx86/)
- [IBM PC and compatibles](pcx86/machine/)
* [PDP-10](pdp10/)
- [PDP-10 (Model KA10)](pdp10/machine/ka10/)
* [PDP-11](pdp11/)
- [PDP-11/20](pdp11/machine/1120/), [PDP-11/45](pdp11/machine/1145/), [PDP-11/70](pdp11/machine/1170/)
These devices are user-installable components that you would typically find in a real personal computer,
such as keyboards, disk drive controllers with one or more drives, video cards, etc.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -103,9 +103,8 @@ class Video8080 extends Component {
{
super("Video", parmsVideo, Messages8080.VIDEO);
var video = this;
var video = this, sProp, sEvent;
this.fGecko = Web.isUserAgent("Gecko/");
var i, sEvent, asWebPrefixes = ['', 'moz', 'ms', 'webkit'];
this.cxScreen = parmsVideo['screenWidth'];
this.cyScreen = parmsVideo['screenHeight'];
@ -176,18 +175,8 @@ class Video8080 extends Component {
var sSmoothing = Web.getURLParm('smoothing');
if (sSmoothing) fSmoothing = (sSmoothing == "true");
if (fSmoothing != null) {
for (i = 0; i < asWebPrefixes.length; i++) {
sEvent = asWebPrefixes[i];
if (!sEvent) {
sEvent = 'imageSmoothingEnabled';
} else {
sEvent += 'ImageSmoothingEnabled';
}
if (this.contextScreen[sEvent] !== undefined) {
this.contextScreen[sEvent] = fSmoothing;
break;
}
}
sProp = Web.findProperty(this.contextScreen, 'imageSmoothingEnabled');
if (sProp) this.contextScreen[sProp] = fSmoothing;
}
this.rotateScreen = parmsVideo['screenRotate'];
@ -210,33 +199,27 @@ class Video8080 extends Component {
/*
* Here's the gross code to handle full-screen support across all supported browsers. The lack of standards
* is exasperating; browsers can't agree on 'full' or 'Full, 'request' or 'Request', 'screen' or 'Screen', and
* while some browsers honor other browser prefixes, most browsers don't.
* is exasperating; browsers can't agree on 'Fullscreen' (most common) or 'FullScreen' (least common), and while
* some browsers honor other browser prefixes, most don't. Event handlers tend to be more consistent (ie, all
* lower-case).
*/
this.container = container;
if (this.container) {
this.container.doFullScreen = container['requestFullscreen'] || container['msRequestFullscreen'] || container['mozRequestFullScreen'] || container['webkitRequestFullscreen'];
if (this.container.doFullScreen) {
for (i = 0; i < asWebPrefixes.length; i++) {
sEvent = asWebPrefixes[i] + 'fullscreenchange';
if ('on' + sEvent in document) {
var onFullScreenChange = function() {
var fFullScreen = (document['fullscreenElement'] || document['msFullscreenElement'] || document['mozFullScreenElement'] || document['webkitFullscreenElement']);
video.notifyFullScreen(!!fFullScreen);
};
document.addEventListener(sEvent, onFullScreenChange, false);
break;
sProp = Web.findProperty(container, 'requestFullscreen') || Web.findProperty(container, 'requestFullScreen');
if (sProp) {
this.container.doFullScreen = container[sProp];
sEvent = Web.findProperty(document, 'on', 'fullscreenchange');
if (sEvent) {
var sFullScreen = Web.findProperty(document, 'fullscreenElement') || Web.findProperty(document, 'fullScreenElement');
document.addEventListener(sEvent, function onFullScreenChange() {
video.notifyFullScreen(!!sFullScreen);
}, false);
}
}
for (i = 0; i < asWebPrefixes.length; i++) {
sEvent = asWebPrefixes[i] + 'fullscreenerror';
if ('on' + sEvent in document) {
var onFullScreenError = function() {
sEvent = Web.findProperty(document, 'on', 'fullscreenerror');
if (sEvent) {
document.addEventListener(sEvent, function onFullScreenError() {
video.notifyFullScreen(null);
};
document.addEventListener(sEvent, onFullScreenError, false);
break;
}
}, false);
}
}
}

View file

@ -2377,14 +2377,16 @@ class Video extends Component {
this.inputScreen.lockPointer = (sProp = Web.findProperty(this.inputScreen, 'requestPointerLock')) && this.inputScreen[sProp];
this.inputScreen.unlockPointer = (sProp = Web.findProperty(this.inputScreen, 'exitPointerLock')) && this.inputScreen[sProp];
if (this.inputScreen.lockPointer) {
var sPointerLock = Web.findProperty(document, 'pointerLockElement');
sEvent = Web.findProperty(document, 'on', 'pointerlockchange');
if (sEvent) document.addEventListener(sEvent, function onPointerLockChange() {
if (sEvent) {
var sPointerLock = Web.findProperty(document, 'pointerLockElement');
document.addEventListener(sEvent, function onPointerLockChange() {
var fLocked = !!(sPointerLock && document[sPointerLock] === video.inputScreen);
video.notifyPointerLocked(fLocked);
}, false);
}
}
}
this.sFileURL = parmsVideo['fontROM'];

View file

@ -689,7 +689,7 @@ class Web {
if (sEvent in obj) return sName;
} else {
if (!sName) {
sName = sProp[0].toLowerCase();
sName = sProp[0];
} else {
sName += sProp[0].toUpperCase();
}

View file

@ -1831,7 +1831,7 @@ class Web {
if (sEvent in obj) return sName;
} else {
if (!sName) {
sName = sProp[0].toLowerCase();
sName = sProp[0];
} else {
sName += sProp[0].toUpperCase();
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2121,7 +2121,7 @@ class Web {
if (sEvent in obj) return sName;
} else {
if (!sName) {
sName = sProp[0].toLowerCase();
sName = sProp[0];
} else {
sName += sProp[0].toUpperCase();
}
@ -14856,9 +14856,8 @@ class Video8080 extends Component {
{
super("Video", parmsVideo, Messages8080.VIDEO);
var video = this;
var video = this, sProp, sEvent;
this.fGecko = Web.isUserAgent("Gecko/");
var i, sEvent, asWebPrefixes = ['', 'moz', 'ms', 'webkit'];
this.cxScreen = parmsVideo['screenWidth'];
this.cyScreen = parmsVideo['screenHeight'];
@ -14929,18 +14928,8 @@ class Video8080 extends Component {
var sSmoothing = Web.getURLParm('smoothing');
if (sSmoothing) fSmoothing = (sSmoothing == "true");
if (fSmoothing != null) {
for (i = 0; i < asWebPrefixes.length; i++) {
sEvent = asWebPrefixes[i];
if (!sEvent) {
sEvent = 'imageSmoothingEnabled';
} else {
sEvent += 'ImageSmoothingEnabled';
}
if (this.contextScreen[sEvent] !== undefined) {
this.contextScreen[sEvent] = fSmoothing;
break;
}
}
sProp = Web.findProperty(this.contextScreen, 'imageSmoothingEnabled');
if (sProp) this.contextScreen[sProp] = fSmoothing;
}
this.rotateScreen = parmsVideo['screenRotate'];
@ -14963,33 +14952,27 @@ class Video8080 extends Component {
/*
* Here's the gross code to handle full-screen support across all supported browsers. The lack of standards
* is exasperating; browsers can't agree on 'full' or 'Full, 'request' or 'Request', 'screen' or 'Screen', and
* while some browsers honor other browser prefixes, most browsers don't.
* is exasperating; browsers can't agree on 'Fullscreen' (most common) or 'FullScreen' (least common), and while
* some browsers honor other browser prefixes, most don't. Event handlers tend to be more consistent (ie, all
* lower-case).
*/
this.container = container;
if (this.container) {
this.container.doFullScreen = container['requestFullscreen'] || container['msRequestFullscreen'] || container['mozRequestFullScreen'] || container['webkitRequestFullscreen'];
if (this.container.doFullScreen) {
for (i = 0; i < asWebPrefixes.length; i++) {
sEvent = asWebPrefixes[i] + 'fullscreenchange';
if ('on' + sEvent in document) {
var onFullScreenChange = function() {
var fFullScreen = (document['fullscreenElement'] || document['msFullscreenElement'] || document['mozFullScreenElement'] || document['webkitFullscreenElement']);
video.notifyFullScreen(!!fFullScreen);
};
document.addEventListener(sEvent, onFullScreenChange, false);
break;
sProp = Web.findProperty(container, 'requestFullscreen') || Web.findProperty(container, 'requestFullScreen');
if (sProp) {
this.container.doFullScreen = container[sProp];
sEvent = Web.findProperty(document, 'on', 'fullscreenchange');
if (sEvent) {
var sFullScreen = Web.findProperty(document, 'fullscreenElement') || Web.findProperty(document, 'fullScreenElement');
document.addEventListener(sEvent, function onFullScreenChange() {
video.notifyFullScreen(!!sFullScreen);
}, false);
}
}
for (i = 0; i < asWebPrefixes.length; i++) {
sEvent = asWebPrefixes[i] + 'fullscreenerror';
if ('on' + sEvent in document) {
var onFullScreenError = function() {
sEvent = Web.findProperty(document, 'on', 'fullscreenerror');
if (sEvent) {
document.addEventListener(sEvent, function onFullScreenError() {
video.notifyFullScreen(null);
};
document.addEventListener(sEvent, onFullScreenError, false);
break;
}
}, false);
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2349,7 +2349,7 @@ class Web {
if (sEvent in obj) return sName;
} else {
if (!sName) {
sName = sProp[0].toLowerCase();
sName = sProp[0];
} else {
sName += sProp[0].toUpperCase();
}
@ -49335,14 +49335,16 @@ class Video extends Component {
this.inputScreen.lockPointer = (sProp = Web.findProperty(this.inputScreen, 'requestPointerLock')) && this.inputScreen[sProp];
this.inputScreen.unlockPointer = (sProp = Web.findProperty(this.inputScreen, 'exitPointerLock')) && this.inputScreen[sProp];
if (this.inputScreen.lockPointer) {
var sPointerLock = Web.findProperty(document, 'pointerLockElement');
sEvent = Web.findProperty(document, 'on', 'pointerlockchange');
if (sEvent) document.addEventListener(sEvent, function onPointerLockChange() {
if (sEvent) {
var sPointerLock = Web.findProperty(document, 'pointerLockElement');
document.addEventListener(sEvent, function onPointerLockChange() {
var fLocked = !!(sPointerLock && document[sPointerLock] === video.inputScreen);
video.notifyPointerLocked(fLocked);
}, false);
}
}
}
this.sFileURL = parmsVideo['fontROM'];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2121,7 +2121,7 @@ class Web {
if (sEvent in obj) return sName;
} else {
if (!sName) {
sName = sProp[0].toLowerCase();
sName = sProp[0];
} else {
sName += sProp[0].toUpperCase();
}

View file

@ -2349,7 +2349,7 @@ class Web {
if (sEvent in obj) return sName;
} else {
if (!sName) {
sName = sProp[0].toLowerCase();
sName = sProp[0];
} else {
sName += sProp[0].toUpperCase();
}