Skip to content

Commit

Permalink
Move setFullScreen into module
Browse files Browse the repository at this point in the history
  • Loading branch information
muffinista committed Feb 1, 2019
1 parent f85c5ab commit 08283ec
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,7 @@ var runScreenSaverOnDisplay = function(saver, s) {
w.once("ready-to-show", () => {
log.info("ready-to-show", s.id);
if ( debugMode !== true && testMode !== true ) {
w.setFullScreen(true);
}

if ( ! w.isVisible() ) {
w.show();
w.moveTop();
windows.setFullScreen(w);
}

diff = process.hrtime(tickCount);
Expand Down Expand Up @@ -460,8 +455,9 @@ var runScreenSaverOnDisplay = function(saver, s) {
var blankScreen = function(s) {
var windowOpts = getWindowOpts(s);
var w = new BrowserWindow(windowOpts);
w.isSaver = true;
w.setFullScreen(true);
w.isSaver = true;

windows.setFullScreen(w);

log.info("blankScreen", s.id, windowOpts);

Expand Down Expand Up @@ -749,9 +745,11 @@ var setupReleaseCheck = function() {
trayMenu.items[3].visible = global.NEW_RELEASE_AVAILABLE;
});

log.info("Run initial release check");
checkForNewRelease();

// check for a new release every 12 hours
log.info("Setup release check");
checkForNewRelease();
setInterval(checkForNewRelease, RELEASE_CHECK_INTERVAL);
};

Expand Down
20 changes: 20 additions & 0 deletions src/main/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,27 @@ var forceWindowClose = function(w) {
}
};

/**
* Set full screen mode for the given window. Use OSX's
* fast/simple fullscreen mode if available.
* @param {BrowserWindow} w the window to apply
*/
var setFullScreen = function(w) {
if ( process.platform !== "darwin" ) {
w.setFullScreen(true);
}
else {
w.setSimpleFullScreen(true);
}

if ( ! w.isVisible() ) {
w.show();
w.moveTop();
}
};

exports.screenSaverIsRunning = screenSaverIsRunning;
exports.handleDisplayChange = handleDisplayChange;
exports.closeRunningScreensavers = closeRunningScreensavers;
exports.forceWindowClose = forceWindowClose;
exports.setFullScreen = setFullScreen;

0 comments on commit 08283ec

Please sign in to comment.