Merge branch 'code-style/main' into code-style/merge
This commit is contained in:
@@ -57,7 +57,7 @@ function init (state, options) {
|
|||||||
win.setSheetOffset(config.UI_HEADER_HEIGHT)
|
win.setSheetOffset(config.UI_HEADER_HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
win.webContents.on('dom-ready', function () {
|
win.webContents.on('dom-ready', () => {
|
||||||
menu.onToggleFullScreen(main.win.isFullScreen())
|
menu.onToggleFullScreen(main.win.isFullScreen())
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -73,27 +73,27 @@ function init (state, options) {
|
|||||||
win.on('hide', onWindowBlur)
|
win.on('hide', onWindowBlur)
|
||||||
win.on('show', onWindowFocus)
|
win.on('show', onWindowFocus)
|
||||||
|
|
||||||
win.on('enter-full-screen', function () {
|
win.on('enter-full-screen', () => {
|
||||||
menu.onToggleFullScreen(true)
|
menu.onToggleFullScreen(true)
|
||||||
send('fullscreenChanged', true)
|
send('fullscreenChanged', true)
|
||||||
win.setMenuBarVisibility(false)
|
win.setMenuBarVisibility(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
win.on('leave-full-screen', function () {
|
win.on('leave-full-screen', () => {
|
||||||
menu.onToggleFullScreen(false)
|
menu.onToggleFullScreen(false)
|
||||||
send('fullscreenChanged', false)
|
send('fullscreenChanged', false)
|
||||||
win.setMenuBarVisibility(true)
|
win.setMenuBarVisibility(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
win.on('move', debounce(function (e) {
|
win.on('move', debounce(e => {
|
||||||
send('windowBoundsChanged', e.sender.getBounds())
|
send('windowBoundsChanged', e.sender.getBounds())
|
||||||
}, 1000))
|
}, 1000))
|
||||||
|
|
||||||
win.on('resize', debounce(function (e) {
|
win.on('resize', debounce(e => {
|
||||||
send('windowBoundsChanged', e.sender.getBounds())
|
send('windowBoundsChanged', e.sender.getBounds())
|
||||||
}, 1000))
|
}, 1000))
|
||||||
|
|
||||||
win.on('close', function (e) {
|
win.on('close', e => {
|
||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
const tray = require('../tray')
|
const tray = require('../tray')
|
||||||
if (!tray.hasTray()) {
|
if (!tray.hasTray()) {
|
||||||
@@ -143,23 +143,15 @@ function setBounds (bounds, maximize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maximize or minimize, if the second argument is present
|
// Maximize or minimize, if the second argument is present
|
||||||
let willBeMaximized
|
if (maximize === true && !main.win.isMaximized()) {
|
||||||
if (maximize === true) {
|
log('setBounds: maximizing')
|
||||||
if (!main.win.isMaximized()) {
|
main.win.maximize()
|
||||||
log('setBounds: maximizing')
|
} else if (maximize === false && main.win.isMaximized()) {
|
||||||
main.win.maximize()
|
log('setBounds: unmaximizing')
|
||||||
}
|
main.win.unmaximize()
|
||||||
willBeMaximized = true
|
|
||||||
} else if (maximize === false) {
|
|
||||||
if (main.win.isMaximized()) {
|
|
||||||
log('setBounds: unmaximizing')
|
|
||||||
main.win.unmaximize()
|
|
||||||
}
|
|
||||||
willBeMaximized = false
|
|
||||||
} else {
|
|
||||||
willBeMaximized = main.win.isMaximized()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const willBeMaximized = typeof maximize === 'boolean' ? maximize : main.win.isMaximized
|
||||||
// Assuming we're not maximized or maximizing, set the window size
|
// Assuming we're not maximized or maximizing, set the window size
|
||||||
if (!willBeMaximized) {
|
if (!willBeMaximized) {
|
||||||
log(`setBounds: setting bounds to ${JSON.stringify(bounds)}`)
|
log(`setBounds: setting bounds to ${JSON.stringify(bounds)}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user