Unverified Commit aadeb9a2 authored by Thibaut Sardan's avatar Thibaut Sardan Committed by GitHub
Browse files

Merge branch 'master' into tbaut-fix-window-size

parents c6b93abb 0281d013
Pipeline #31594 failed with stage
in 1 minute and 6 seconds
......@@ -30,10 +30,7 @@ function loadTray (fetherApp) {
tray.on('double-click', () => onTrayClick(fetherApp));
// Right click event handler does not work on Windows as intended
tray.on('right-click', () => {
if (process.platform === 'win32') {
pino.info('Detected right click on Windows');
showTrayBalloon(fetherApp);
}
pino.info('Detected right click on Windows');
});
tray.setToolTip(options.tooltip);
tray.setHighlightMode('never');
......
......@@ -8,13 +8,7 @@ import Pino from '../utils/pino';
const pino = Pino();
function setupWin32Listeners (fetherApp) {
const {
moveWindowUp,
onWindowClose,
processSaveWinPosition,
showTrayBalloon,
win
} = fetherApp;
const { onWindowClose, processSaveWinPosition, win } = fetherApp;
if (process.platform === 'win32') {
/**
......@@ -52,7 +46,6 @@ function setupWin32Listeners (fetherApp) {
} else if (wParam.readUInt32LE(0) === 0xf030) {
// SC_MAXIMIZE
eventName = 'maximize';
showTrayBalloon(fetherApp);
} else if (wParam.readUInt32LE(0) === 0xf020) {
// SC_MINIMIZE
eventName = 'minimize';
......@@ -60,7 +53,6 @@ function setupWin32Listeners (fetherApp) {
} else if (wParam.readUInt32LE(0) === 0xf120) {
// SC_RESTORE
eventName = 'restored';
showTrayBalloon(fetherApp);
}
if (eventName !== null) {
......@@ -74,17 +66,7 @@ function setupWin32Listeners (fetherApp) {
* Detect event on Windows when Fether window was moved or resized
*/
win.hookWindowMessage(Number.parseInt('0x0232'), (wParam, lParam) => {
pino.info('Detected completion of move or resize event');
// Move Fether window back up into view if it was a resize event
// that causes the bottom to be cropped
moveWindowUp(fetherApp);
// Try again after a delay incase Fether window resize occurs
// x seconds after navigating to a new page.
setTimeout(() => {
moveWindowUp(fetherApp);
}, 5000);
pino.info('Detected completion of moved or resize event');
// Save Fether window position to Electron settings
processSaveWinPosition(fetherApp);
......
......@@ -11,12 +11,7 @@ import Pino from '../utils/pino';
const pino = Pino();
function setupWinListeners (fetherApp) {
const {
moveWindowUp,
onWindowClose,
processSaveWinPosition,
win
} = fetherApp;
const { onWindowClose, processSaveWinPosition, win } = fetherApp;
// Open external links in browser
win.webContents.on('new-window', (event, url) => {
......@@ -24,7 +19,7 @@ function setupWinListeners (fetherApp) {
electron.shell.openExternal(url);
});
// Linux (unchecked on others)
// Windows and Linux (unchecked on others)
win.on('move', () => {
/**
* On Linux using this with debouncing is the closest equivalent
......@@ -49,17 +44,12 @@ function setupWinListeners (fetherApp) {
* On Linux the closest equivalent to achieving 'moved' is debouncing
* on the 'move' event. It also works in 'close' even when app crashes
*/
processSaveWinPosition(fetherApp);
pino.info('Detected moved event');
});
// macOS and Linux (not Windows)
// macOS and Linux and Windows
win.on('resize', () => {
pino.info('Detected resize event');
moveWindowUp(fetherApp);
setTimeout(() => {
moveWindowUp(fetherApp);
}, 5000);
});
win.on('blur', () => {
......
......@@ -16,6 +16,8 @@ function showWindow (fetherApp, trayPos) {
calculateWinPosition,
createWindow,
fixWinPosition,
moveWindowUp,
processSaveWinPosition,
setupWinListeners,
setupWin32Listeners,
win
......@@ -84,6 +86,13 @@ function showWindow (fetherApp, trayPos) {
fetherApp.hasSetupWinListeners = true;
}
moveWindowUp(fetherApp);
setTimeout(() => {
moveWindowUp(fetherApp);
}, 5000);
processSaveWinPosition(fetherApp);
fetherApp.emit('after-show-window');
}
......
......@@ -17,7 +17,7 @@ const INDEX_HTML_PATH =
});
// Icon path differs when started with `yarn electron` or `yarn start`
let iconPath = path.join(staticPath, 'assets', 'icons', 'icon.png');
let iconPath = path.join(staticPath, 'assets', 'icons', 'mac', 'iconDock.png');
let iconDockPath = '';
if (process.platform === 'win32') {
......@@ -40,8 +40,6 @@ if (process.platform === 'win32') {
);
}
const shouldUseFrame = false;
const windowPosition =
process.platform === 'win32' ? 'trayBottomCenter' : 'trayCenter';
......@@ -69,8 +67,8 @@ const DEFAULT_OPTIONS = {
};
const TASKBAR_OPTIONS = {
frame: shouldUseFrame,
height: 515,
frame: false,
// On Linux the user must click the tray icon and then click the tooltip
// to toggle the Fether window open/close
tooltip: 'Click to toggle Fether window',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment