Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Commit

Permalink
windows: fixed incorrect overlay/browserView size
Browse files Browse the repository at this point in the history
  • Loading branch information
Beelink committed Nov 9, 2019
1 parent ebfd009 commit 997fa5a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 28 deletions.
20 changes: 0 additions & 20 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1025,15 +1025,6 @@ function showMainWindow() {
mainWindow.on("blur", () => {
mainWindow.webContents.send("window-blur");
});

mainWindow.on("unresponsive", () => {
console.log("unresponsive");
dialog.showMessageBox(mainWindow, {
type: "warning",
title: "Ferny not responding",
message: "We are working on it..."
});
});

mainWindow.on("resize", () => {
setTimeout(() => {
Expand All @@ -1046,21 +1037,10 @@ function showMainWindow() {

mainWindow.on("maximize", () => {
mainWindow.webContents.send("window-maximize");
// if(tabManager.hasActiveTab()) {
// tabManager.getActiveTab().activate();
// }
// setTimeout(() => {
// overlay.refreshBounds();
// }, 150);
// overlay.refreshBounds();
});

mainWindow.on("unmaximize", () => {
mainWindow.webContents.send("window-unmaximize");
// if(tabManager.hasActiveTab()) {
// tabManager.getActiveTab().activate();
// }
// overlay.refreshBounds();
});

mainWindow.webContents.once("dom-ready", () => {
Expand Down
21 changes: 15 additions & 6 deletions modules/Overlay/Overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,21 @@ class Overlay extends EventEmitter {

refreshBounds() {
let size = this.window.getSize();
this.view.setBounds({
x: 0,
y: this.top,
width: size[0],
height: size[1] - this.top
});
if(this.window.isMaximized() && process.platform == "win32") {
this.view.setBounds({
x: 0,
y: this.top,
width: size[0] - 16,
height: size[1] - this.top - 16
});
} else {
this.view.setBounds({
x: 0,
y: this.top,
width: size[0],
height: size[1] - this.top
});
}
}

show() {
Expand Down
8 changes: 6 additions & 2 deletions modules/TabManager/TabManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ class TabManager extends EventEmitter {

tab.on("activate", (activatedTab) => {
setTimeout(() => {
activatedTab.setBounds(this.left, this.top, this.getWidth(), this.getHeight());
}, 100);
if(this.window.isMaximized() && process.platform == "win32") {
activatedTab.setBounds(this.left - 16, this.top, this.getWidth(), this.getHeight() - 16);
} else {
activatedTab.setBounds(this.left, this.top, this.getWidth(), this.getHeight());
}
}, 150);
this.emit("tab-activated");
});

Expand Down

0 comments on commit 997fa5a

Please sign in to comment.