Skip to content

Commit 8c4a682

Browse files
committed
fix win7 fullscreen problem
1 parent 8dbbfde commit 8c4a682

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

main.js

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ let win = null, settingsWin = null, aboutWin = null, tourWin = null, floatingWin
2929
newWindows = new Array, displays = null, hasMultiDisplays = null,
3030
isLoose = false, isScreenLocked = false,
3131
hasFloating = false,
32+
kioskInterval = null,
3233
store = null;
3334
let languageCodeList = ['en', 'zh-CN', 'zh-TW']//locale code
3435

@@ -149,8 +150,17 @@ function relaunchSolution() {
149150

150151
function setFullScreenMode(flag) {
151152
if (win != null) {
152-
if (!isLoose) win.setKiosk(flag);
153-
else if (process.platform == "darwin") win.setSimpleFullScreen(flag);
153+
if (!isLoose) {
154+
win.setKiosk(flag);
155+
if (flag) {
156+
kioskInterval = setInterval(function () {
157+
win.restore();
158+
win.show();
159+
win.moveTop();
160+
win.setKiosk(true);
161+
}, 5000);
162+
} else clearInterval(kioskInterval);
163+
} else if (process.platform == "darwin") win.setSimpleFullScreen(flag);
154164
else win.setFullScreen(flag);
155165
}
156166
}
@@ -176,7 +186,7 @@ function addScreenSolution(windowNumber, display) {
176186
if (app.isPackaged) newWindows[windowNumber].setFocusable(false);
177187
newWindows[windowNumber].setFullScreen(true);
178188
newWindows[windowNumber].moveTop();
179-
newWindows[windowNumber].setAlwaysOnTop(true);
189+
newWindows[windowNumber].setAlwaysOnTop(true, "floating");
180190
}
181191
function multiScreenSolution(mode) {
182192
if (app.isReady()) {
@@ -361,7 +371,7 @@ app.on('ready', () => {
361371
if (store.get("loose-mode")) isLoose = true;
362372

363373
if (win != null) {
364-
if (store.get("top") == true) win.setAlwaysOnTop(true);
374+
if (store.get("top") == true) win.setAlwaysOnTop(true, "floating");
365375
else win.setAlwaysOnTop(false);
366376
}
367377

@@ -967,7 +977,7 @@ ipcMain.on('warning-giver-workend', function () {
967977
if (restTimeFocused != true) win.show();
968978
win.center();
969979
win.flashFrame(true);
970-
if (!isLoose) win.setAlwaysOnTop(true);
980+
if (!isLoose) win.setAlwaysOnTop(true, "floating");
971981
win.moveTop();
972982
if (restTimeFocused == true) {
973983
if (dockHide) app.dock.show();//prevent kiosk error, show in dock
@@ -1045,7 +1055,7 @@ ipcMain.on('warning-giver-restend', function () {
10451055
if (workTimeFocused != true) win.show();
10461056
win.center();
10471057
win.flashFrame(true);
1048-
win.setAlwaysOnTop(true);
1058+
win.setAlwaysOnTop(true, "floating");
10491059
win.moveTop();
10501060
if (workTimeFocused == true) {
10511061
multiScreenSolution("on");
@@ -1123,7 +1133,7 @@ ipcMain.on('warning-giver-all-task-end', function () {
11231133
win.show();
11241134
win.center();
11251135
win.flashFrame(true);
1126-
win.setAlwaysOnTop(true);
1136+
win.setAlwaysOnTop(true, "floating");
11271137
win.moveTop();
11281138
win.setProgressBar(-1);
11291139
if (restTimeFocused == true) {
@@ -1336,8 +1346,8 @@ function about() {
13361346
webPreferences: { nodeIntegration: true }
13371347
});
13381348
aboutWin.loadFile("about.html");
1339-
win.setAlwaysOnTop(true);
1340-
aboutWin.setAlwaysOnTop(true);
1349+
win.setAlwaysOnTop(true, "floating");
1350+
aboutWin.setAlwaysOnTop(true, "floating");
13411351
aboutWin.focus();
13421352
aboutWin.once('ready-to-show', () => {
13431353
aboutWin.show();
@@ -1390,8 +1400,8 @@ function settings(mode) {
13901400
console.log(e);
13911401
}
13921402
settingsWin.loadFile("settings.html");
1393-
if (app.isPackaged) win.setAlwaysOnTop(true);
1394-
if (app.isPackaged) settingsWin.setAlwaysOnTop(true);
1403+
if (app.isPackaged) win.setAlwaysOnTop(true, "floating");
1404+
if (app.isPackaged) settingsWin.setAlwaysOnTop(true, "floating");
13951405
settingsWin.focus();
13961406
settingsWin.once('ready-to-show', () => {
13971407
settingsWin.show();
@@ -1452,8 +1462,8 @@ function tourguide() {
14521462
webPreferences: { nodeIntegration: true }
14531463
});
14541464
tourWin.loadFile("tourguide.html");
1455-
win.setAlwaysOnTop(true);
1456-
tourWin.setAlwaysOnTop(true);
1465+
win.setAlwaysOnTop(true, "floating");
1466+
tourWin.setAlwaysOnTop(true, "floating");
14571467
tourWin.focus();
14581468
tourWin.once('ready-to-show', () => {
14591469
tourWin.show();
@@ -1527,14 +1537,15 @@ function floating() {
15271537
frame: false,
15281538
show: false,
15291539
center: false,
1540+
type: 'toolbar',
15301541
titleBarStyle: "customButtonsOnHover",
15311542
webPreferences: { nodeIntegration: true },
15321543
skipTaskbar: true
15331544
});
15341545
floatingWin.loadFile("floating.html");
15351546
floatingWin.once('ready-to-show', () => {
15361547
floatingWin.show();
1537-
floatingWin.setAlwaysOnTop(true);
1548+
floatingWin.setAlwaysOnTop(true, "floating");
15381549
floatingWin.focus();
15391550
});
15401551
floatingWin.on('closed', () => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wnr",
3-
"version": "1.15.3",
3+
"version": "1.16.0",
44
"description": "Work and rest, with wnr now!",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)