fixed titlebar not adjusting to macOS fullscreen mode - fixes #4274

This commit is contained in:
Eugene Pankov
2021-08-15 14:40:40 +02:00
parent f7b0272be5
commit 03045eb952
2 changed files with 18 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
title-bar( title-bar(
*ngIf='ready && !hostWindow.isFullScreen && config.store.appearance.frame == "full" && config.store.appearance.dock == "off"', *ngIf='ready && !hostWindow.isFullscreen && config.store.appearance.frame == "full" && config.store.appearance.dock == "off"',
[class.inset]='hostApp.platform == Platform.macOS && !hostWindow.isFullScreen' [class.inset]='hostApp.platform == Platform.macOS && !hostWindow.isFullscreen'
) )
.content( .content(
@@ -10,7 +10,7 @@ title-bar(
) )
.tab-bar .tab-bar
.inset.background(*ngIf='hostApp.platform == Platform.macOS \ .inset.background(*ngIf='hostApp.platform == Platform.macOS \
&& !hostWindow.isFullScreen \ && !hostWindow.isFullscreen \
&& config.store.appearance.frame == "thin" \ && config.store.appearance.frame == "thin" \
&& (config.store.appearance.tabsLocation == "top" || config.store.appearance.tabsLocation == "left")') && (config.store.appearance.tabsLocation == "top" || config.store.appearance.tabsLocation == "left")')
.tabs( .tabs(

View File

@@ -12,9 +12,9 @@ export interface Bounds {
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class ElectronHostWindow extends HostWindowService { export class ElectronHostWindow extends HostWindowService {
get isFullscreen (): boolean { return this._isFullScreen} get isFullscreen (): boolean { return this._isFullscreen }
private _isFullScreen = false private _isFullscreen = false
constructor ( constructor (
zone: NgZone, zone: NgZone,
@@ -23,28 +23,26 @@ export class ElectronHostWindow extends HostWindowService {
) { ) {
super() super()
electron.ipcRenderer.on('host:window-enter-full-screen', () => zone.run(() => { electron.ipcRenderer.on('host:window-enter-full-screen', () => zone.run(() => {
this._isFullScreen = true this._isFullscreen = true
})) }))
electron.ipcRenderer.on('host:window-leave-full-screen', () => zone.run(() => { electron.ipcRenderer.on('host:window-leave-full-screen', () => zone.run(() => {
this._isFullScreen = false this._isFullscreen = false
})) }))
electron.ipcRenderer.on('host:window-shown', () => { electron.ipcRenderer.on('host:window-shown', () => zone.run(() => this.windowShown.next()))
zone.run(() => this.windowShown.next())
})
electron.ipcRenderer.on('host:window-close-request', () => { electron.ipcRenderer.on('host:window-close-request', () => zone.run(() => {
zone.run(() => this.windowCloseRequest.next()) this.windowCloseRequest.next()
}) }))
electron.ipcRenderer.on('host:window-moved', () => { electron.ipcRenderer.on('host:window-moved', () => zone.run(() => {
zone.run(() => this.windowMoved.next()) this.windowMoved.next()
}) }))
electron.ipcRenderer.on('host:window-focused', () => { electron.ipcRenderer.on('host:window-focused', () => zone.run(() => {
zone.run(() => this.windowFocused.next()) this.windowFocused.next()
}) }))
} }
getWindow (): BrowserWindow { getWindow (): BrowserWindow {
@@ -64,7 +62,7 @@ export class ElectronHostWindow extends HostWindowService {
} }
toggleFullscreen (): void { toggleFullscreen (): void {
this.getWindow().setFullScreen(!this._isFullScreen) this.getWindow().setFullScreen(!this._isFullscreen)
} }
minimize (): void { minimize (): void {