@@ -13,9 +13,7 @@ import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
1313import { ISerializableCommandAction } from 'vs/platform/actions/common/actions' ;
1414import { URI } from 'vs/base/common/uri' ;
1515import { Rectangle , BrowserWindow } from 'electron' ;
16- import { IDisposable , Disposable , DisposableStore } from 'vs/base/common/lifecycle' ;
17- import { CancelablePromise , createCancelablePromise } from 'vs/base/common/async' ;
18- import { IElectronMainService } from 'vs/platform/electron/electron-main/electronMainService' ;
16+ import { IDisposable } from 'vs/base/common/lifecycle' ;
1917
2018export interface IWindowState {
2119 width ?: number ;
@@ -143,45 +141,3 @@ export interface IOpenConfiguration extends IBaseOpenConfiguration {
143141}
144142
145143export interface IOpenEmptyConfiguration extends IBaseOpenConfiguration { }
146-
147- export class ActiveWindowManager extends Disposable {
148-
149- private readonly disposables = this . _register ( new DisposableStore ( ) ) ;
150- private firstActiveWindowIdPromise : CancelablePromise < number | undefined > | undefined ;
151-
152- private activeWindowId : number | undefined ;
153-
154- constructor ( @IElectronMainService electronService : IElectronMainService ) {
155- super ( ) ;
156-
157- // remember last active window id upon events
158- const onActiveWindowChange = Event . latch ( Event . any ( electronService . onWindowOpen , electronService . onWindowFocus ) ) ;
159- onActiveWindowChange ( this . setActiveWindow , this , this . disposables ) ;
160-
161- // resolve current active window
162- this . firstActiveWindowIdPromise = createCancelablePromise ( ( ) => electronService . getActiveWindowId ( - 1 ) ) ;
163- ( async ( ) => {
164- try {
165- const windowId = await this . firstActiveWindowIdPromise ;
166- this . activeWindowId = ( typeof this . activeWindowId === 'number' ) ? this . activeWindowId : windowId ;
167- } finally {
168- this . firstActiveWindowIdPromise = undefined ;
169- }
170- } ) ( ) ;
171- }
172-
173- private setActiveWindow ( windowId : number | undefined ) {
174- if ( this . firstActiveWindowIdPromise ) {
175- this . firstActiveWindowIdPromise . cancel ( ) ;
176- this . firstActiveWindowIdPromise = undefined ;
177- }
178-
179- this . activeWindowId = windowId ;
180- }
181-
182- async getActiveClientId ( ) : Promise < string | undefined > {
183- const id = this . firstActiveWindowIdPromise ? ( await this . firstActiveWindowIdPromise ) : this . activeWindowId ;
184-
185- return `window:${ id } ` ;
186- }
187- }
0 commit comments