mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1225142 - Add software button on runtime to control it via a preference. r=fabrice,jryans
This commit is contained in:
parent
7daddae2e7
commit
f533f397a1
@ -528,6 +528,9 @@ pref("layout.frame_rate.precise", true);
|
||||
// Handle hardware buttons in the b2g chrome package
|
||||
pref("b2g.keys.menu.enabled", true);
|
||||
|
||||
// Display simulator software buttons
|
||||
pref("b2g.software-buttons", false);
|
||||
|
||||
// Screen timeout in seconds
|
||||
pref("power.screen.timeout", 60);
|
||||
|
||||
|
@ -15,13 +15,24 @@ function enableTouch() {
|
||||
touchEventSimulator.start();
|
||||
}
|
||||
|
||||
// Some additional buttons are displayed on simulators to fake hardware buttons.
|
||||
function setupButtons() {
|
||||
let homeButton = document.getElementById('home-button');
|
||||
if (!homeButton) {
|
||||
// The toolbar only exists in b2g desktop build with
|
||||
// FXOS_SIMULATOR turned on.
|
||||
return;
|
||||
}
|
||||
let link = document.createElement('link');
|
||||
link.type = 'text/css';
|
||||
link.rel = 'stylesheet';
|
||||
link.href = 'chrome://b2g/content/desktop.css';
|
||||
document.head.appendChild(link);
|
||||
|
||||
let footer = document.createElement('footer');
|
||||
footer.id = 'controls';
|
||||
document.body.appendChild(footer);
|
||||
let homeButton = document.createElement('button');
|
||||
homeButton.id = 'home-button';
|
||||
footer.appendChild(homeButton);
|
||||
let rotateButton = document.createElement('button');
|
||||
rotateButton.id = 'rotate-button';
|
||||
footer.appendChild(rotateButton);
|
||||
|
||||
homeButton.addEventListener('mousedown', function() {
|
||||
let window = shell.contentBrowser.contentWindow;
|
||||
let e = new window.KeyboardEvent('keydown', {key: 'Home'});
|
||||
@ -36,7 +47,6 @@ function setupButtons() {
|
||||
});
|
||||
|
||||
Cu.import("resource://gre/modules/GlobalSimulatorScreen.jsm");
|
||||
let rotateButton = document.getElementById('rotate-button');
|
||||
rotateButton.addEventListener('mousedown', function() {
|
||||
rotateButton.classList.add('active');
|
||||
});
|
||||
@ -165,7 +175,9 @@ window.addEventListener('ContentStart', function() {
|
||||
if (!isMulet) {
|
||||
enableTouch();
|
||||
}
|
||||
setupButtons();
|
||||
if (Services.prefs.getBoolPref('b2g.software-buttons')) {
|
||||
setupButtons();
|
||||
}
|
||||
checkDebuggerPort();
|
||||
setupStorage();
|
||||
// On Firefox mulet, we automagically enable the responsive mode
|
||||
|
@ -18,9 +18,6 @@
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="shell.css" type="text/css">
|
||||
#ifdef FXOS_SIMULATOR
|
||||
<link rel="stylesheet" href="desktop.css" type="text/css">
|
||||
#endif
|
||||
<script type="text/javascript">
|
||||
<!-- Add raptor performance marker -->
|
||||
window.performance.mark('gecko-shell-html-load');
|
||||
@ -52,17 +49,6 @@
|
||||
src="chrome://b2g/content/devtools/debugger.js"> </script>
|
||||
</head>
|
||||
<body id="container">
|
||||
#ifdef FXOS_SIMULATOR
|
||||
#ifndef MOZ_MULET
|
||||
<!--
|
||||
Some additional buttons are displayed on desktop to fake hardware buttons.
|
||||
-->
|
||||
<footer id="controls">
|
||||
<button id="home-button"></button>
|
||||
<button id="rotate-button"></button>
|
||||
</footer>
|
||||
#endif
|
||||
#endif
|
||||
#ifndef MOZ_GRAPHENE
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
<!--
|
||||
|
@ -22,13 +22,11 @@ chrome.jar:
|
||||
#endif
|
||||
* content/devtools/debugger.js (content/devtools/debugger.js)
|
||||
content/devtools/hud.js (content/devtools/hud.js)
|
||||
#ifdef FXOS_SIMULATOR
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
content/desktop.css (content/desktop.css)
|
||||
content/images/desktop/home-black.png (content/images/desktop/home-black.png)
|
||||
content/images/desktop/home-white.png (content/images/desktop/home-white.png)
|
||||
content/images/desktop/rotate.png (content/images/desktop/rotate.png)
|
||||
#endif
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
content/desktop.js (content/desktop.js)
|
||||
content/screen.js (content/screen.js)
|
||||
content/runapp.js (content/runapp.js)
|
||||
|
Loading…
Reference in New Issue
Block a user