fix #1440: fixed auto-type for maximized windows

pull/1513/head
antelle 2020-05-15 22:41:39 +02:00
parent 099f1ca9d0
commit 5b91dcb272
No known key found for this signature in database
GPG Key ID: 094A2F2D6136A4EE
3 changed files with 20 additions and 4 deletions

View File

@ -222,10 +222,7 @@ const Launcher = {
return !!this.electron().remote.BrowserWindow.getFocusedWindow();
},
showMainWindow() {
const win = this.getMainWindow();
win.show();
win.focus();
win.restore();
this.remoteApp().showAndFocusMainWindow();
},
spawn(config) {
const ts = logger.ts();

View File

@ -15,6 +15,7 @@ let appReady = false;
let restartPending = false;
let mainWindowPosition = {};
let updateMainWindowPositionTimeout = null;
let mainWindowMaximized = false;
const windowPositionFileName = 'window-position.json';
const appSettingsFileName = 'app-settings.json';
@ -160,6 +161,7 @@ app.reqNative = function(mod) {
}
return binding;
};
app.showAndFocusMainWindow = showAndFocusMainWindow;
function readAppSettings() {
const appSettingsFilePath = path.join(app.getPath('userData'), appSettingsFileName);
@ -237,6 +239,12 @@ function createMainWindow() {
mainWindow.on('minimize', () => {
emitRemoteEvent('launcher-minimize');
});
mainWindow.on('maximize', () => {
mainWindowMaximized = true;
});
mainWindow.on('unmaximize', () => {
mainWindowMaximized = false;
});
mainWindow.on('leave-full-screen', () => {
emitRemoteEvent('leave-full-screen');
});
@ -266,6 +274,15 @@ function restoreMainWindow() {
setTimeout(destroyAppIcon, 0);
}
function showAndFocusMainWindow() {
if (mainWindowMaximized) {
mainWindow.maximize();
} else {
mainWindow.show();
}
mainWindow.focus();
}
function closeMainWindow() {
emitRemoteEvent('launcher-exit-request');
setTimeout(destroyAppIcon, 0);
@ -335,6 +352,7 @@ function restoreMainWindowPosition() {
}
if (mainWindowPosition.maximized) {
mainWindow.maximize();
mainWindowMaximized = true;
}
if (mainWindowPosition.fullScreen) {
mainWindow.setFullScreen(true);

View File

@ -11,6 +11,7 @@ Release notes
`+` #1350: clearing master password after auto lock period
`-` fix #1463: copying the original url instead of adding https:
`-` fix #620: clearing middle-click clipboard in Linux
`-` fix #1440: fixed auto-type for maximized windows
##### v1.14.3 (2020-05-15)
`*` improved exporting files with markdown notes