mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
aux window - some polish (#197510)
- seed the aux window ID based on the main one - avoid using non-main windows for `getActiveWindowId`
This commit is contained in:
parent
14678c041f
commit
6454416d29
|
@ -33,7 +33,7 @@ export const { registerWindow, getWindows, getWindowsCount, getWindowId, onDidRe
|
|||
const mainWindow = window as CodeWindow;
|
||||
if (typeof mainWindow.vscodeWindowId !== 'number') {
|
||||
Object.defineProperty(window, 'vscodeWindowId', {
|
||||
get: () => -1
|
||||
get: () => 1
|
||||
});
|
||||
}
|
||||
windows.set(mainWindow.vscodeWindowId, { window: mainWindow, disposables: new DisposableStore() });
|
||||
|
|
|
@ -150,7 +150,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
|
|||
}
|
||||
|
||||
async getActiveWindowId(windowId: number | undefined): Promise<number | undefined> {
|
||||
const activeWindow = BrowserWindow.getFocusedWindow() || this.windowsMainService.getLastActiveWindow();
|
||||
const activeWindow = this.windowsMainService.getFocusedWindow() || this.windowsMainService.getLastActiveWindow();
|
||||
if (activeWindow) {
|
||||
return activeWindow.id;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { localize } from 'vs/nls';
|
||||
import { mark } from 'vs/base/common/performance';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { CodeWindow, Dimension, EventHelper, EventType, addDisposableListener, cloneGlobalStylesheets, copyAttributes, createMetaElement, getActiveWindow, getClientArea, isGlobalStylesheet, position, registerWindow, sharedMutationObserver, size, trackAttributes } from 'vs/base/browser/dom';
|
||||
import { CodeWindow, Dimension, EventHelper, EventType, addDisposableListener, cloneGlobalStylesheets, copyAttributes, createMetaElement, getActiveWindow, getClientArea, getWindowId, isGlobalStylesheet, position, registerWindow, sharedMutationObserver, size, trackAttributes } from 'vs/base/browser/dom';
|
||||
import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
@ -62,7 +62,7 @@ export class BrowserAuxiliaryWindowService extends Disposable implements IAuxili
|
|||
|
||||
private static readonly DEFAULT_SIZE = { width: 800, height: 600 };
|
||||
|
||||
private static WINDOW_IDS = 0;
|
||||
private static WINDOW_IDS = getWindowId(window) + 1; // start from the main window ID + 1
|
||||
|
||||
private readonly _onDidOpenAuxiliaryWindow = this._register(new Emitter<IAuxiliaryWindowOpenEvent>());
|
||||
readonly onDidOpenAuxiliaryWindow = this._onDidOpenAuxiliaryWindow.event;
|
||||
|
|
Loading…
Reference in a new issue