Skip to content

Commit 244934e

Browse files
author
Benjamin Pasero
committed
1 parent 29a9994 commit 244934e

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/vs/platform/native/electron-main/nativeHostMainService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class NativeHostMainService implements INativeHostMainService {
7474

7575
//#region Events
7676

77-
readonly onWindowOpen = Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-created', (event, window: BrowserWindow) => window.id), windowId => !!this.windowsMainService.getWindowById(windowId));
77+
readonly onWindowOpen = Event.map(this.windowsMainService.onWindowOpened, window => window.id);
7878

7979
readonly onWindowMaximize = Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-maximize', (event, window: BrowserWindow) => window.id), windowId => !!this.windowsMainService.getWindowById(windowId));
8080
readonly onWindowUnmaximize = Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-unmaximize', (event, window: BrowserWindow) => window.id), windowId => !!this.windowsMainService.getWindowById(windowId));

src/vs/platform/windows/electron-main/windows.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export interface IWindowsMainService {
9898

9999
readonly _serviceBrand: undefined;
100100

101+
readonly onWindowOpened: Event<ICodeWindow>;
101102
readonly onWindowReady: Event<ICodeWindow>;
102103
readonly onWindowsCountChanged: Event<IWindowsCountChangedEvent>;
103104

src/vs/platform/windows/electron-main/windowsMainService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
163163

164164
private shuttingDown = false;
165165

166+
private readonly _onWindowOpened = this._register(new Emitter<ICodeWindow>());
167+
readonly onWindowOpened = this._onWindowOpened.event;
168+
166169
private readonly _onWindowReady = this._register(new Emitter<ICodeWindow>());
167170
readonly onWindowReady = this._onWindowReady.event;
168171

@@ -1416,6 +1419,9 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
14161419
// Add to our list of windows
14171420
WindowsMainService.WINDOWS.push(createdWindow);
14181421

1422+
// Indicate new window via event
1423+
this._onWindowOpened.fire(createdWindow);
1424+
14191425
// Indicate number change via event
14201426
this._onWindowsCountChanged.fire({ oldCount: WindowsMainService.WINDOWS.length - 1, newCount: WindowsMainService.WINDOWS.length });
14211427

0 commit comments

Comments
 (0)