Force fullscreen when kioskmode is active

This commit is contained in:
Michael Teeuw 2016-08-09 10:22:29 +02:00
parent f3119824f4
commit d000e3c8a9
2 changed files with 27 additions and 10 deletions

View File

@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## Unpublished
### Updated
- Force fullscreen when kioskmode is active.
## [2.0.4] - 2016-08-07 ## [2.0.4] - 2016-08-07
### Added ### Added

View File

@ -1,3 +1,5 @@
/* jshint esversion: 6 */
"use strict"; "use strict";
const Server = require(__dirname + "/server.js"); const Server = require(__dirname + "/server.js");
@ -32,13 +34,27 @@ function createWindow() {
mainWindow.webContents.openDevTools(); mainWindow.webContents.openDevTools();
} }
// Emitted when the window is closed. // Set responders for window events.
mainWindow.on("closed", function() { mainWindow.on("closed", function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null; mainWindow = null;
}); });
if (config.kioskmode) {
mainWindow.on("blur", function() {
mainWindow.focus();
});
mainWindow.on("leave-full-screen", function() {
// console.log("leave-full-screen");
mainWindow.setFullScreen(true);
});
mainWindow.on("resize", function() {
setTimeout(function() {
mainWindow.reload();
}, 1000);
});
}
} }
// This method will be called when Electron has finished // This method will be called when Electron has finished
@ -50,11 +66,7 @@ app.on("ready", function() {
// Quit when all windows are closed. // Quit when all windows are closed.
app.on("window-all-closed", function() { app.on("window-all-closed", function() {
// On OS X it is common for applications and their menu bar createWindow();
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== "darwin") {
app.quit();
}
}); });
app.on("activate", function() { app.on("activate", function() {