@theia/core 1.71.0-next.49 → 1.71.0-next.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/catalog.json +3 -9
- package/lib/browser/saveable-service.d.ts +9 -2
- package/lib/browser/saveable-service.d.ts.map +1 -1
- package/lib/browser/saveable-service.js +34 -25
- package/lib/browser/saveable-service.js.map +1 -1
- package/lib/browser/window/browser-window-module.d.ts.map +1 -1
- package/lib/browser/window/browser-window-module.js +2 -0
- package/lib/browser/window/browser-window-module.js.map +1 -1
- package/lib/browser/window/default-secondary-window-service.d.ts +2 -0
- package/lib/browser/window/default-secondary-window-service.d.ts.map +1 -1
- package/lib/browser/window/default-secondary-window-service.js +7 -0
- package/lib/browser/window/default-secondary-window-service.js.map +1 -1
- package/lib/browser/window/window-focus-service.d.ts +71 -0
- package/lib/browser/window/window-focus-service.d.ts.map +1 -0
- package/lib/browser/window/window-focus-service.js +173 -0
- package/lib/browser/window/window-focus-service.js.map +1 -0
- package/lib/electron-browser/window/electron-window-module.d.ts.map +1 -1
- package/lib/electron-browser/window/electron-window-module.js +2 -0
- package/lib/electron-browser/window/electron-window-module.js.map +1 -1
- package/package.json +4 -4
- package/src/browser/saveable-service.ts +34 -27
- package/src/browser/window/browser-window-module.ts +2 -0
- package/src/browser/window/default-secondary-window-service.ts +6 -0
- package/src/browser/window/window-focus-service.ts +187 -0
- package/src/electron-browser/window/electron-window-module.ts +2 -0
package/lib/browser/catalog.json
CHANGED
|
@@ -5161,12 +5161,6 @@
|
|
|
5161
5161
|
"fileMatch": ["podbard.yaml"],
|
|
5162
5162
|
"url": "https://raw.githubusercontent.com/Songmu/podbard/main/schema.yaml"
|
|
5163
5163
|
},
|
|
5164
|
-
{
|
|
5165
|
-
"name": "Podman Desktop Extension",
|
|
5166
|
-
"description": "Podman Desktop extension package.json manifest",
|
|
5167
|
-
"fileMatch": [],
|
|
5168
|
-
"url": "https://raw.githubusercontent.com/podman-desktop/podman-desktop/main/schemas/extension-schema.json"
|
|
5169
|
-
},
|
|
5170
5164
|
{
|
|
5171
5165
|
"name": "POPxf",
|
|
5172
5166
|
"description": "Polynomial Observable Predictions in High-Energy Physics",
|
|
@@ -8393,10 +8387,10 @@
|
|
|
8393
8387
|
"url": "https://raw.githubusercontent.com/goblet/goblet/main/goblet.schema.json"
|
|
8394
8388
|
},
|
|
8395
8389
|
{
|
|
8396
|
-
"name": "
|
|
8397
|
-
"description": "
|
|
8390
|
+
"name": "Declarative Automation Bundles",
|
|
8391
|
+
"description": "Declarative Automation Bundles config",
|
|
8398
8392
|
"fileMatch": ["databricks.yml", "databricks.yaml"],
|
|
8399
|
-
"url": "https://www.schemastore.org/
|
|
8393
|
+
"url": "https://www.schemastore.org/declarative-automation-bundles.json"
|
|
8400
8394
|
},
|
|
8401
8395
|
{
|
|
8402
8396
|
"name": "JSON Schema Draft 4 (unofficial with '$ref' and 'format')",
|
|
@@ -20,6 +20,7 @@ import { AutoSaveMode, Saveable, SaveableSource, SaveableWidget, SaveOptions, Po
|
|
|
20
20
|
import { Widget } from './widgets';
|
|
21
21
|
import { FrontendApplicationContribution } from './frontend-application-contribution';
|
|
22
22
|
import { FrontendApplication } from './frontend-application';
|
|
23
|
+
import { WindowFocusService } from './window/window-focus-service';
|
|
23
24
|
export declare const SaveErrorChecker: unique symbol;
|
|
24
25
|
/**
|
|
25
26
|
* Contribution point for checking whether a given URI has errors.
|
|
@@ -39,6 +40,7 @@ export interface SaveErrorChecker {
|
|
|
39
40
|
}
|
|
40
41
|
export declare class SaveableService implements FrontendApplicationContribution {
|
|
41
42
|
protected readonly errorCheckers: ContributionProvider<SaveErrorChecker>;
|
|
43
|
+
protected readonly windowFocusService: WindowFocusService;
|
|
42
44
|
protected saveThrottles: Map<Widget, AutoSaveThrottle>;
|
|
43
45
|
protected saveMode: AutoSaveMode;
|
|
44
46
|
protected saveDelay: number;
|
|
@@ -57,11 +59,16 @@ export declare class SaveableService implements FrontendApplicationContribution
|
|
|
57
59
|
get autoSaveWhenNoErrors(): boolean;
|
|
58
60
|
set autoSaveWhenNoErrors(value: boolean);
|
|
59
61
|
onDidInitializeLayout(app: FrontendApplication): void;
|
|
62
|
+
/**
|
|
63
|
+
* Save all dirty saveables when the application window loses focus.
|
|
64
|
+
* Triggered for both `onFocusChange` and `onWindowChange` auto-save modes,
|
|
65
|
+
* matching VSCode's behavior where a window focus loss is a superset of
|
|
66
|
+
* editor focus loss.
|
|
67
|
+
*/
|
|
68
|
+
protected saveOnWindowBlur(): void;
|
|
60
69
|
protected updateAutoSaveMode(mode: AutoSaveMode): void;
|
|
61
70
|
protected updateAutoSaveDelay(delay: number): void;
|
|
62
71
|
registerSaveable(widget: Widget, saveable: Saveable): Disposable;
|
|
63
|
-
protected addBlurListener(widget: Widget, saveable: Saveable): Disposable;
|
|
64
|
-
protected windowHasFocus(document: Document): boolean;
|
|
65
72
|
protected shouldAutoSave(widget: Widget, saveable: Saveable): boolean;
|
|
66
73
|
protected applySaveableWidget(widget: Widget, saveable: Saveable): void;
|
|
67
74
|
protected createCloseWithSaving(): (this: SaveableWidget, options?: SaveableWidget.CloseOptions) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveable-service.d.ts","sourceRoot":"","sources":["../../src/browser/saveable-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAmB,GAAG,EAAE,UAAU,EAAwB,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACzH,OAAO,EAAE,WAAW,EAAqB,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAA+B,0BAA0B,EAAoB,MAAM,YAAY,CAAC;AAC5K,OAAO,EAAiB,MAAM,EAAE,MAAM,WAAW,CA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AAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE,GAAG,WAAW,EAAE,UAAU,EAAE;IAwBhH,SAAS,CAAC,aAAa,CAAC,KAAK,UAAQ,GAAG,IAAI;IAgB5C,OAAO,IAAI,IAAI;CAIlB"}
|
|
@@ -22,6 +22,7 @@ const common_1 = require("../common");
|
|
|
22
22
|
const navigatable_types_1 = require("./navigatable-types");
|
|
23
23
|
const saveable_1 = require("./saveable");
|
|
24
24
|
const widgets_1 = require("./widgets");
|
|
25
|
+
const window_focus_service_1 = require("./window/window-focus-service");
|
|
25
26
|
const throttle = require("lodash.throttle");
|
|
26
27
|
exports.SaveErrorChecker = Symbol('SaveErrorChecker');
|
|
27
28
|
let SaveableService = class SaveableService {
|
|
@@ -97,6 +98,34 @@ let SaveableService = class SaveableService {
|
|
|
97
98
|
this.saveThrottles.get(e)?.dispose();
|
|
98
99
|
this.saveThrottles.delete(e);
|
|
99
100
|
});
|
|
101
|
+
// Save all dirty editors when any application window loses focus
|
|
102
|
+
this.windowFocusService.onDidWindowChangeFocus(({ hasFocus }) => {
|
|
103
|
+
if (!hasFocus) {
|
|
104
|
+
this.saveOnWindowBlur();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Save all dirty saveables when the application window loses focus.
|
|
110
|
+
* Triggered for both `onFocusChange` and `onWindowChange` auto-save modes,
|
|
111
|
+
* matching VSCode's behavior where a window focus loss is a superset of
|
|
112
|
+
* editor focus loss.
|
|
113
|
+
*/
|
|
114
|
+
saveOnWindowBlur() {
|
|
115
|
+
if (this.saveMode !== 'onWindowChange' && this.saveMode !== 'onFocusChange') {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (!this.shell) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
for (const widget of this.shell.widgets) {
|
|
122
|
+
const saveable = saveable_1.Saveable.get(widget);
|
|
123
|
+
if (saveable && this.shouldAutoSave(widget, saveable)) {
|
|
124
|
+
saveable.save({
|
|
125
|
+
saveReason: saveable_1.SaveReason.FocusChange
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
100
129
|
}
|
|
101
130
|
updateAutoSaveMode(mode) {
|
|
102
131
|
this.saveMode = mode;
|
|
@@ -129,35 +158,11 @@ let SaveableService = class SaveableService {
|
|
|
129
158
|
saveReason: saveable_1.SaveReason.AfterDelay
|
|
130
159
|
});
|
|
131
160
|
}
|
|
132
|
-
}
|
|
161
|
+
});
|
|
133
162
|
this.saveThrottles.set(widget, saveThrottle);
|
|
134
163
|
this.applySaveableWidget(widget, saveable);
|
|
135
164
|
return saveThrottle;
|
|
136
165
|
}
|
|
137
|
-
addBlurListener(widget, saveable) {
|
|
138
|
-
const document = widget.node.ownerDocument;
|
|
139
|
-
const listener = (() => {
|
|
140
|
-
if (this.saveMode === 'onWindowChange' && !this.windowHasFocus(document) && this.shouldAutoSave(widget, saveable)) {
|
|
141
|
-
saveable.save({
|
|
142
|
-
saveReason: saveable_1.SaveReason.FocusChange
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}).bind(this);
|
|
146
|
-
document.addEventListener('blur', listener);
|
|
147
|
-
return common_1.Disposable.create(() => {
|
|
148
|
-
document.removeEventListener('blur', listener);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
windowHasFocus(document) {
|
|
152
|
-
if (document.visibilityState === 'hidden') {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
else if (document.hasFocus()) {
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
// TODO: Add support for iframes
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
166
|
shouldAutoSave(widget, saveable) {
|
|
162
167
|
const uri = navigatable_types_1.NavigatableWidget.getUri(widget);
|
|
163
168
|
if (uri?.scheme === common_1.UNTITLED_SCHEME) {
|
|
@@ -292,6 +297,10 @@ tslib_1.__decorate([
|
|
|
292
297
|
(0, inversify_1.named)(exports.SaveErrorChecker),
|
|
293
298
|
tslib_1.__metadata("design:type", Object)
|
|
294
299
|
], SaveableService.prototype, "errorCheckers", void 0);
|
|
300
|
+
tslib_1.__decorate([
|
|
301
|
+
(0, inversify_1.inject)(window_focus_service_1.WindowFocusService),
|
|
302
|
+
tslib_1.__metadata("design:type", window_focus_service_1.WindowFocusService)
|
|
303
|
+
], SaveableService.prototype, "windowFocusService", void 0);
|
|
295
304
|
exports.SaveableService = SaveableService = tslib_1.__decorate([
|
|
296
305
|
(0, inversify_1.injectable)()
|
|
297
306
|
], SaveableService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveable-service.js","sourceRoot":"","sources":["../../src/browser/saveable-service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;AAGlF,yCAAsD;AACtD,sCAAyH;AACzH,2DAAqE;AACrE,yCAA4K;AAC5K,uCAAkD;AAGlD,4CAA6C;AAEhC,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAoBpD,IAAM,eAAe,GAArB,MAAM,eAAe;IAArB;
|
|
1
|
+
{"version":3,"file":"saveable-service.js","sourceRoot":"","sources":["../../src/browser/saveable-service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;AAGlF,yCAAsD;AACtD,sCAAyH;AACzH,2DAAqE;AACrE,yCAA4K;AAC5K,uCAAkD;AAGlD,wEAAmE;AACnE,4CAA6C;AAEhC,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAoBpD,IAAM,eAAe,GAArB,MAAM,eAAe;IAArB;QAQO,kBAAa,GAAG,IAAI,GAAG,EAA4B,CAAC;QACpD,aAAQ,GAAiB,KAAK,CAAC;QAC/B,cAAS,GAAG,IAAI,CAAC;QACjB,qBAAgB,GAAG,KAAK,CAAC;QAGhB,+BAA0B,GAAG,IAAI,gBAAO,EAAgB,CA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
-
{"version":3,"file":"browser-window-module.d.ts","sourceRoot":"","sources":["../../../src/browser/window/browser-window-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;;
|
|
1
|
+
{"version":3,"file":"browser-window-module.d.ts","sourceRoot":"","sources":["../../../src/browser/window/browser-window-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;;AAY5C,wBAQG"}
|
|
@@ -25,12 +25,14 @@ const secondary_window_service_1 = require("./secondary-window-service");
|
|
|
25
25
|
const default_secondary_window_service_1 = require("./default-secondary-window-service");
|
|
26
26
|
const common_1 = require("../../common");
|
|
27
27
|
const window_title_service_1 = require("./window-title-service");
|
|
28
|
+
const window_focus_service_1 = require("./window-focus-service");
|
|
28
29
|
exports.default = new inversify_1.ContainerModule(bind => {
|
|
29
30
|
bind(default_window_service_1.DefaultWindowService).toSelf().inSingletonScope();
|
|
30
31
|
bind(window_service_1.WindowService).toService(default_window_service_1.DefaultWindowService);
|
|
31
32
|
bind(frontend_application_contribution_1.FrontendApplicationContribution).toService(default_window_service_1.DefaultWindowService);
|
|
32
33
|
bind(clipboard_service_1.ClipboardService).to(browser_clipboard_service_1.BrowserClipboardService).inSingletonScope();
|
|
33
34
|
bind(secondary_window_service_1.SecondaryWindowService).to(default_secondary_window_service_1.DefaultSecondaryWindowService).inSingletonScope();
|
|
35
|
+
bind(window_focus_service_1.WindowFocusService).toSelf().inSingletonScope();
|
|
34
36
|
(0, common_1.bindRootContributionProvider)(bind, window_title_service_1.WindowTitleContribution);
|
|
35
37
|
});
|
|
36
38
|
//# sourceMappingURL=browser-window-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-window-module.js","sourceRoot":"","sources":["../../../src/browser/window/browser-window-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,yCAA4C;AAC5C,wEAAoE;AACpE,wFAAmF;AACnF,4FAAuF;AACvF,4DAAwD;AACxD,4EAAuE;AACvE,yEAAoE;AACpE,yFAAmF;AACnF,yCAA4D;AAC5D,iEAAiE;
|
|
1
|
+
{"version":3,"file":"browser-window-module.js","sourceRoot":"","sources":["../../../src/browser/window/browser-window-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,yCAA4C;AAC5C,wEAAoE;AACpE,wFAAmF;AACnF,4FAAuF;AACvF,4DAAwD;AACxD,4EAAuE;AACvE,yEAAoE;AACpE,yFAAmF;AACnF,yCAA4D;AAC5D,iEAAiE;AACjE,iEAA4D;AAE5D,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,6CAAoB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACvD,IAAI,CAAC,8BAAa,CAAC,CAAC,SAAS,CAAC,6CAAoB,CAAC,CAAC;IACpD,IAAI,CAAC,mEAA+B,CAAC,CAAC,SAAS,CAAC,6CAAoB,CAAC,CAAC;IACtE,IAAI,CAAC,oCAAgB,CAAC,CAAC,EAAE,CAAC,mDAAuB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACtE,IAAI,CAAC,iDAAsB,CAAC,CAAC,EAAE,CAAC,gEAA6B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAClF,IAAI,CAAC,yCAAkB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACrD,IAAA,qCAA4B,EAAC,IAAI,EAAE,8CAAuB,CAAC,CAAC;AAChE,CAAC,CAAC,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { ExtractableWidget, Widget } from '../widgets';
|
|
|
4
4
|
import { ApplicationShell } from '../shell';
|
|
5
5
|
import { Emitter, Event, PreferenceService } from '../../common';
|
|
6
6
|
import { SaveableService } from '../saveable-service';
|
|
7
|
+
import { WindowFocusService } from './window-focus-service';
|
|
7
8
|
export declare class DefaultSecondaryWindowService implements SecondaryWindowService {
|
|
8
9
|
protected readonly onWindowOpenedEmitter: Emitter<Window>;
|
|
9
10
|
readonly onWindowOpened: Event<Window>;
|
|
@@ -23,6 +24,7 @@ export declare class DefaultSecondaryWindowService implements SecondaryWindowSer
|
|
|
23
24
|
protected readonly windowService: WindowService;
|
|
24
25
|
protected readonly preferenceService: PreferenceService;
|
|
25
26
|
protected readonly saveResourceService: SaveableService;
|
|
27
|
+
protected readonly windowFocusService: WindowFocusService;
|
|
26
28
|
init(): void;
|
|
27
29
|
protected registerShutdownListeners(): void;
|
|
28
30
|
createSecondaryWindow(widget: ExtractableWidget, shell: ApplicationShell): Window | SecondaryWindow | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-secondary-window-service.d.ts","sourceRoot":"","sources":["../../../src/browser/window/default-secondary-window-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAe,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,eAAe,EA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BAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,eAAe,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAG1D,IAAI,IAAI,IAAI;IA+BZ,SAAS,CAAC,yBAAyB,IAAI,IAAI;IAU3C,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,gBAAgB,GAAG,MAAM,GAAG,eAAe,GAAG,SAAS;IAwC/G,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAMpG,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAS/D,SAAS,CAAC,8BAA8B,CAAC,MAAM,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;IA0C3F,UAAU,IAAI,MAAM,EAAE;IAItB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxB,SAAS,CAAC,YAAY,IAAI,MAAM;IAIhC;;OAEG;cACa,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAgCrI"}
|
|
@@ -25,6 +25,7 @@ const saveable_1 = require("../saveable");
|
|
|
25
25
|
const common_1 = require("../../common");
|
|
26
26
|
const saveable_service_1 = require("../saveable-service");
|
|
27
27
|
const secondary_window_handler_1 = require("../secondary-window-handler");
|
|
28
|
+
const window_focus_service_1 = require("./window-focus-service");
|
|
28
29
|
let DefaultSecondaryWindowService = class DefaultSecondaryWindowService {
|
|
29
30
|
constructor() {
|
|
30
31
|
this.onWindowOpenedEmitter = new common_1.Emitter;
|
|
@@ -92,6 +93,7 @@ let DefaultSecondaryWindowService = class DefaultSecondaryWindowService {
|
|
|
92
93
|
this.secondaryWindows.push(newWindow);
|
|
93
94
|
this.onWindowOpenedEmitter.fire(newWindow);
|
|
94
95
|
newWindow.addEventListener('DOMContentLoaded', () => {
|
|
96
|
+
const focusRegistration = this.windowFocusService.registerWindow(newWindow);
|
|
95
97
|
newWindow.addEventListener('beforeunload', evt => {
|
|
96
98
|
const widgets = (0, secondary_window_handler_1.getAllWidgetsFromSecondaryWindow)(newWindow) ?? [widget];
|
|
97
99
|
for (const w of widgets) {
|
|
@@ -105,6 +107,7 @@ let DefaultSecondaryWindowService = class DefaultSecondaryWindowService {
|
|
|
105
107
|
}
|
|
106
108
|
}, { capture: true });
|
|
107
109
|
newWindow.addEventListener('unload', () => {
|
|
110
|
+
focusRegistration.dispose();
|
|
108
111
|
const extIndex = this.secondaryWindows.indexOf(newWindow);
|
|
109
112
|
if (extIndex > -1) {
|
|
110
113
|
this.onWindowClosedEmitter.fire(newWindow);
|
|
@@ -231,6 +234,10 @@ tslib_1.__decorate([
|
|
|
231
234
|
(0, inversify_1.inject)(saveable_service_1.SaveableService),
|
|
232
235
|
tslib_1.__metadata("design:type", saveable_service_1.SaveableService)
|
|
233
236
|
], DefaultSecondaryWindowService.prototype, "saveResourceService", void 0);
|
|
237
|
+
tslib_1.__decorate([
|
|
238
|
+
(0, inversify_1.inject)(window_focus_service_1.WindowFocusService),
|
|
239
|
+
tslib_1.__metadata("design:type", window_focus_service_1.WindowFocusService)
|
|
240
|
+
], DefaultSecondaryWindowService.prototype, "windowFocusService", void 0);
|
|
234
241
|
tslib_1.__decorate([
|
|
235
242
|
(0, inversify_1.postConstruct)(),
|
|
236
243
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-secondary-window-service.js","sourceRoot":"","sources":["../../../src/browser/window/default-secondary-window-service.ts"],"names":[],"mappings":";;;;;AAAA,gFAAgF;AAChF,kFAAkF;AAClF,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,yCAA8D;AAE9D,qDAAiD;AACjD,wCAAuD;AAEvD,0CAAuC;AACvC,yCAA8E;AAC9E,0DAAsD;AACtD,0EAAsG;
|
|
1
|
+
{"version":3,"file":"default-secondary-window-service.js","sourceRoot":"","sources":["../../../src/browser/window/default-secondary-window-service.ts"],"names":[],"mappings":";;;;;AAAA,gFAAgF;AAChF,kFAAkF;AAClF,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,yCAA8D;AAE9D,qDAAiD;AACjD,wCAAuD;AAEvD,0CAAuC;AACvC,yCAA8E;AAC9E,0DAAsD;AACtD,0EAAsG;AACtG,iEAA4D;AAGrD,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAAnC;QACgB,0BAAqB,GAAG,IAAI,gBAAe,CAAC;QACtD,mBAAc,GAAkB,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC;QACvD,0BAAqB,GAAG,IAAI,gBAAe,CAAC;QACtD,mBAAc,GAAkB,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC;QACvD,+BAA0B,GAAG,IAAI,gBAAyB,CAAC;QACrE,wBAAmB,GAA4B,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC;QAI9F;;;WAGG;QACgB,WAAM,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,8CAA8C;QACtC,WAAM,GAAG,CAAC,CAAC;QAET,qBAAgB,GAAa,EAAE,CAAC;IAw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AE,CAAC;oBACrB,kBAAkB,GAAG,KAAK,CAAC;gBAC/B,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,kBAAkB,CAAC;IAC9B,CAAC;;AAzNQ,sEAA6B;AAqBnB;IADlB,IAAA,kBAAM,EAAC,8BAAa,CAAC;;oEAC0B;AAG7B;IADlB,IAAA,kBAAM,EAAC,0BAAiB,CAAC;;wEAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,kCAAe,CAAC;sCACgB,kCAAe;0EAAC;AAGrC;IADlB,IAAA,kBAAM,EAAC,yCAAkB,CAAC;sCACY,yCAAkB;yEAAC;AAG1D;IADC,IAAA,yBAAa,GAAE;;;;yDA8Bf;wCA9DQ,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CA0NzC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Disposable, DisposableCollection, Emitter, Event } from '../../common';
|
|
2
|
+
export interface WindowFocusEvent {
|
|
3
|
+
win: Window;
|
|
4
|
+
hasFocus: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Tracks focus state for each registered application window independently.
|
|
8
|
+
*
|
|
9
|
+
* The main window is registered automatically. Secondary windows should be
|
|
10
|
+
* registered via {@link registerWindow} — typically by the service responsible
|
|
11
|
+
* for creating them.
|
|
12
|
+
*
|
|
13
|
+
* Uses two complementary signals per window for robust detection:
|
|
14
|
+
* - `window` `focus`/`blur` events (OS-level window focus changes)
|
|
15
|
+
* - `document` `visibilitychange` events (browser tab switches)
|
|
16
|
+
*
|
|
17
|
+
* Blur events are debounced per window with `setTimeout(0)` so that focus
|
|
18
|
+
* moving between elements within the same window does not produce a false
|
|
19
|
+
* blur: the subsequent `focus` event cancels the pending blur before it fires.
|
|
20
|
+
*
|
|
21
|
+
* Each per-window event is latched — it only fires when that window's focus
|
|
22
|
+
* state actually changes.
|
|
23
|
+
*/
|
|
24
|
+
export declare class WindowFocusService implements Disposable {
|
|
25
|
+
protected readonly onDidWindowChangeFocusEmitter: Emitter<WindowFocusEvent>;
|
|
26
|
+
/**
|
|
27
|
+
* Fires when an individual window's focus state changes.
|
|
28
|
+
* The event payload identifies which window changed and whether it gained or lost focus.
|
|
29
|
+
*
|
|
30
|
+
* A window losing focus to another application window will fire separately
|
|
31
|
+
* for each window involved: one event with `hasFocus: false` for the window
|
|
32
|
+
* that lost focus, and one with `hasFocus: true` for the window that gained it.
|
|
33
|
+
*/
|
|
34
|
+
readonly onDidWindowChangeFocus: Event<WindowFocusEvent>;
|
|
35
|
+
protected readonly toDispose: DisposableCollection;
|
|
36
|
+
/** Per-window tracking state. */
|
|
37
|
+
protected readonly windowStates: Map<Window, WindowTrackingState>;
|
|
38
|
+
protected init(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Register a window for focus tracking. The returned {@link Disposable}
|
|
41
|
+
* removes the window from tracking when disposed.
|
|
42
|
+
*
|
|
43
|
+
* The main window is registered automatically. Call this for secondary
|
|
44
|
+
* windows when they are created.
|
|
45
|
+
*/
|
|
46
|
+
registerWindow(win: Window): Disposable;
|
|
47
|
+
/**
|
|
48
|
+
* Whether any registered window currently has focus.
|
|
49
|
+
*/
|
|
50
|
+
get hasFocus(): boolean;
|
|
51
|
+
protected windowHasFocus(win: Window): boolean;
|
|
52
|
+
protected handleFocus(win: Window, state: WindowTrackingState): void;
|
|
53
|
+
/**
|
|
54
|
+
* Schedule a deferred blur check for this specific window.
|
|
55
|
+
* If no `focus` event arrives on this same window before the timeout fires,
|
|
56
|
+
* we treat it as a real focus loss for that window.
|
|
57
|
+
*/
|
|
58
|
+
protected scheduleBlur(win: Window, state: WindowTrackingState): void;
|
|
59
|
+
protected cancelPendingBlur(state: WindowTrackingState): void;
|
|
60
|
+
/**
|
|
61
|
+
* Re-evaluate a single window's focus and fire if it changed (latching).
|
|
62
|
+
*/
|
|
63
|
+
protected updateWindowFocusState(win: Window, state: WindowTrackingState): void;
|
|
64
|
+
dispose(): void;
|
|
65
|
+
}
|
|
66
|
+
interface WindowTrackingState {
|
|
67
|
+
lastFocusState: boolean;
|
|
68
|
+
pendingBlurTimeout: ReturnType<typeof setTimeout> | undefined;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=window-focus-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window-focus-service.d.ts","sourceRoot":"","sources":["../../../src/browser/window/window-focus-service.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEhF,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,kBAAmB,YAAW,UAAU;IAEjD,SAAS,CAAC,QAAQ,CAAC,6BAA6B,4BAAmC;IAEnF;;;;;;;OAOG;IACH,QAAQ,CAAC,sBAAsB,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAA4C;IAEpG,SAAS,CAAC,QAAQ,CAAC,SAAS,uBAAgE;IAE5F,iCAAiC;IACjC,SAAS,CAAC,QAAQ,CAAC,YAAY,mCAA0C;IAGzE,SAAS,CAAC,IAAI,IAAI,IAAI;IAItB;;;;;;OAMG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;IAmCvC;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAOtB;IAED,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAS9C,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAOpE;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAQrE,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAO7D;;OAEG;IACH,SAAS,CAAC,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAQ/E,OAAO,IAAI,IAAI;CAMlB;AAED,UAAU,mBAAmB;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,SAAS,CAAC;CACjE"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.WindowFocusService = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
// based on https://github.com/microsoft/vscode/blob/ea6aac971b851ff8675f9ea04f8c0dfc36034a89/src/vs/workbench/services/host/browser/browserHostService.ts
|
|
21
|
+
// and https://github.com/microsoft/vscode/blob/ea6aac971b851ff8675f9ea04f8c0dfc36034a89/src/vs/base/browser/dom.ts#L1319 (FocusTracker)
|
|
22
|
+
/*---------------------------------------------------------------------------------------------
|
|
23
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
24
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
25
|
+
*--------------------------------------------------------------------------------------------*/
|
|
26
|
+
const inversify_1 = require("inversify");
|
|
27
|
+
const common_1 = require("../../common");
|
|
28
|
+
/**
|
|
29
|
+
* Tracks focus state for each registered application window independently.
|
|
30
|
+
*
|
|
31
|
+
* The main window is registered automatically. Secondary windows should be
|
|
32
|
+
* registered via {@link registerWindow} — typically by the service responsible
|
|
33
|
+
* for creating them.
|
|
34
|
+
*
|
|
35
|
+
* Uses two complementary signals per window for robust detection:
|
|
36
|
+
* - `window` `focus`/`blur` events (OS-level window focus changes)
|
|
37
|
+
* - `document` `visibilitychange` events (browser tab switches)
|
|
38
|
+
*
|
|
39
|
+
* Blur events are debounced per window with `setTimeout(0)` so that focus
|
|
40
|
+
* moving between elements within the same window does not produce a false
|
|
41
|
+
* blur: the subsequent `focus` event cancels the pending blur before it fires.
|
|
42
|
+
*
|
|
43
|
+
* Each per-window event is latched — it only fires when that window's focus
|
|
44
|
+
* state actually changes.
|
|
45
|
+
*/
|
|
46
|
+
let WindowFocusService = class WindowFocusService {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.onDidWindowChangeFocusEmitter = new common_1.Emitter();
|
|
49
|
+
/**
|
|
50
|
+
* Fires when an individual window's focus state changes.
|
|
51
|
+
* The event payload identifies which window changed and whether it gained or lost focus.
|
|
52
|
+
*
|
|
53
|
+
* A window losing focus to another application window will fire separately
|
|
54
|
+
* for each window involved: one event with `hasFocus: false` for the window
|
|
55
|
+
* that lost focus, and one with `hasFocus: true` for the window that gained it.
|
|
56
|
+
*/
|
|
57
|
+
this.onDidWindowChangeFocus = this.onDidWindowChangeFocusEmitter.event;
|
|
58
|
+
this.toDispose = new common_1.DisposableCollection(this.onDidWindowChangeFocusEmitter);
|
|
59
|
+
/** Per-window tracking state. */
|
|
60
|
+
this.windowStates = new Map();
|
|
61
|
+
}
|
|
62
|
+
init() {
|
|
63
|
+
this.registerWindow(window);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Register a window for focus tracking. The returned {@link Disposable}
|
|
67
|
+
* removes the window from tracking when disposed.
|
|
68
|
+
*
|
|
69
|
+
* The main window is registered automatically. Call this for secondary
|
|
70
|
+
* windows when they are created.
|
|
71
|
+
*/
|
|
72
|
+
registerWindow(win) {
|
|
73
|
+
if (this.windowStates.has(win)) {
|
|
74
|
+
return common_1.Disposable.NULL;
|
|
75
|
+
}
|
|
76
|
+
const state = {
|
|
77
|
+
lastFocusState: this.windowHasFocus(win),
|
|
78
|
+
pendingBlurTimeout: undefined,
|
|
79
|
+
};
|
|
80
|
+
this.windowStates.set(win, state);
|
|
81
|
+
const onFocus = () => this.handleFocus(win, state);
|
|
82
|
+
const onBlur = () => this.scheduleBlur(win, state);
|
|
83
|
+
const onVisibilityChange = () => this.updateWindowFocusState(win, state);
|
|
84
|
+
win.addEventListener('focus', onFocus);
|
|
85
|
+
win.addEventListener('blur', onBlur);
|
|
86
|
+
win.document.addEventListener('visibilitychange', onVisibilityChange);
|
|
87
|
+
const cleanup = common_1.Disposable.create(() => {
|
|
88
|
+
this.cancelPendingBlur(state);
|
|
89
|
+
this.windowStates.delete(win);
|
|
90
|
+
win.removeEventListener('focus', onFocus);
|
|
91
|
+
win.removeEventListener('blur', onBlur);
|
|
92
|
+
try {
|
|
93
|
+
win.document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// The window may already be closed
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
this.toDispose.push(cleanup);
|
|
100
|
+
return cleanup;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Whether any registered window currently has focus.
|
|
104
|
+
*/
|
|
105
|
+
get hasFocus() {
|
|
106
|
+
for (const win of this.windowStates.keys()) {
|
|
107
|
+
if (this.windowHasFocus(win)) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
windowHasFocus(win) {
|
|
114
|
+
try {
|
|
115
|
+
return win.document.hasFocus();
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
// The window may have been closed
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
handleFocus(win, state) {
|
|
123
|
+
// Cancel this window's pending blur — focus arrived before the timeout,
|
|
124
|
+
// meaning focus just moved between elements within this window.
|
|
125
|
+
this.cancelPendingBlur(state);
|
|
126
|
+
this.updateWindowFocusState(win, state);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Schedule a deferred blur check for this specific window.
|
|
130
|
+
* If no `focus` event arrives on this same window before the timeout fires,
|
|
131
|
+
* we treat it as a real focus loss for that window.
|
|
132
|
+
*/
|
|
133
|
+
scheduleBlur(win, state) {
|
|
134
|
+
this.cancelPendingBlur(state);
|
|
135
|
+
state.pendingBlurTimeout = setTimeout(() => {
|
|
136
|
+
state.pendingBlurTimeout = undefined;
|
|
137
|
+
this.updateWindowFocusState(win, state);
|
|
138
|
+
}, 0);
|
|
139
|
+
}
|
|
140
|
+
cancelPendingBlur(state) {
|
|
141
|
+
if (state.pendingBlurTimeout !== undefined) {
|
|
142
|
+
clearTimeout(state.pendingBlurTimeout);
|
|
143
|
+
state.pendingBlurTimeout = undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Re-evaluate a single window's focus and fire if it changed (latching).
|
|
148
|
+
*/
|
|
149
|
+
updateWindowFocusState(win, state) {
|
|
150
|
+
const focused = this.windowHasFocus(win);
|
|
151
|
+
if (focused !== state.lastFocusState) {
|
|
152
|
+
state.lastFocusState = focused;
|
|
153
|
+
this.onDidWindowChangeFocusEmitter.fire({ win, hasFocus: focused });
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
dispose() {
|
|
157
|
+
for (const state of this.windowStates.values()) {
|
|
158
|
+
this.cancelPendingBlur(state);
|
|
159
|
+
}
|
|
160
|
+
this.toDispose.dispose();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
exports.WindowFocusService = WindowFocusService;
|
|
164
|
+
tslib_1.__decorate([
|
|
165
|
+
(0, inversify_1.postConstruct)(),
|
|
166
|
+
tslib_1.__metadata("design:type", Function),
|
|
167
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
168
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
169
|
+
], WindowFocusService.prototype, "init", null);
|
|
170
|
+
exports.WindowFocusService = WindowFocusService = tslib_1.__decorate([
|
|
171
|
+
(0, inversify_1.injectable)()
|
|
172
|
+
], WindowFocusService);
|
|
173
|
+
//# sourceMappingURL=window-focus-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window-focus-service.js","sourceRoot":"","sources":["../../../src/browser/window/window-focus-service.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,0JAA0J;AAC1J,wIAAwI;AACxI;;;gGAGgG;AAEhG,yCAAsD;AACtD,yCAAgF;AAOhF;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QAEgB,kCAA6B,GAAG,IAAI,gBAAO,EAAoB,CAAC;QAEnF;;;;;;;WAOG;QACM,2BAAsB,GAA4B,IAAI,CAAC,6BAA6B,CAAC,KAAK,CAAC;QAEjF,cAAS,GAAG,IAAI,6BAAoB,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAE5F,iCAAiC;QACd,iBAAY,GAAG,IAAI,GAAG,EAA+B,CAAC;IAkH7E,CAAC;IA/Ga,IAAI;QACV,IAAI,CAAC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,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACzC,YAAY,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YACvC,KAAK,CAAC,kBAAkB,GAAG,SAAS,CAAC;QACzC,CAAC;IACL,CAAC;IAED;;OAEG;IACO,sBAAsB,CAAC,GAAW,EAAE,KAA0B;QACpE,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,OAAO,KAAK,KAAK,CAAC,cAAc,EAAE,CAAC;YACnC,KAAK,CAAC,cAAc,GAAG,OAAO,CAAC;YAC/B,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;IAED,OAAO;QACH,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ,CAAA;AAnIY,gDAAkB;AAoBjB;IADT,IAAA,yBAAa,GAAE;;;;8CAGf;6BAtBQ,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAmI9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron-window-module.d.ts","sourceRoot":"","sources":["../../../src/electron-browser/window/electron-window-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"electron-window-module.d.ts","sourceRoot":"","sources":["../../../src/electron-browser/window/electron-window-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAoB5C,OAAO,gEAAgE,CAAC;;AAExE,wBAkBG"}
|
|
@@ -33,6 +33,7 @@ const external_app_open_handler_1 = require("./external-app-open-handler");
|
|
|
33
33
|
const electron_uri_handler_1 = require("../electron-uri-handler");
|
|
34
34
|
const common_1 = require("../../common");
|
|
35
35
|
const window_title_service_1 = require("../../browser/window/window-title-service");
|
|
36
|
+
const window_focus_service_1 = require("../../browser/window/window-focus-service");
|
|
36
37
|
const window_zoom_status_bar_item_1 = require("./window-zoom-status-bar-item");
|
|
37
38
|
require("../../../src/electron-browser/style/window-zoom-action-bar.css");
|
|
38
39
|
exports.default = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
|
|
@@ -48,6 +49,7 @@ exports.default = new inversify_1.ContainerModule((bind, unbind, isBound, rebind
|
|
|
48
49
|
bind(external_app_open_handler_1.ExternalAppOpenHandler).toSelf().inSingletonScope();
|
|
49
50
|
bind(browser_1.OpenHandler).toService(external_app_open_handler_1.ExternalAppOpenHandler);
|
|
50
51
|
(0, common_1.bindRootContributionProvider)(bind, window_title_service_1.WindowTitleContribution);
|
|
52
|
+
bind(window_focus_service_1.WindowFocusService).toSelf().inSingletonScope();
|
|
51
53
|
bind(window_zoom_status_bar_item_1.WindowZoomStatusBarItem).toSelf().inSingletonScope();
|
|
52
54
|
bind(frontend_application_contribution_1.FrontendApplicationContribution).toService(window_zoom_status_bar_item_1.WindowZoomStatusBarItem);
|
|
53
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron-window-module.js","sourceRoot":"","sources":["../../../src/electron-browser/window/electron-window-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,yCAA4C;AAC5C,2CAA4C;AAC5C,uEAAmE;AACnE,uGAAkG;AAClG,yFAA2F;AAC3F,4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AC,kDAAsB,CAAC,CAAC;IACpD,IAAA,qCAA4B,EAAC,IAAI,EAAE,8CAAuB,CAAC,CAAC;IAC5D,IAAI,CAAC,qDAAuB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC1D,IAAI,CAAC,mEAA+B,CAAC,CAAC,SAAS,CAAC,qDAAuB,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"electron-window-module.js","sourceRoot":"","sources":["../../../src/electron-browser/window/electron-window-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,yCAA4C;AAC5C,2CAA4C;AAC5C,uEAAmE;AACnE,uGAAkG;AAClG,yFAA2F;AAC3F,4FAAuF;AACvF,wEAAoE;AACpE,qGAA8H;AAC9H,8EAAyE;AACzE,gGAA4F;AAC5F,+FAAgG;AAChG,2FAAqF;AACrF,mGAA0F;AAC1F,uEAAkE;AAClE,2EAAqE;AACrE,kEAAyE;AACzE,yCAA4D;AAC5D,oFAAoF;AACpF,oFAA+E;AAC/E,+EAAwE;AACxE,0EAAwE;AAExE,kBAAe,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACjE,IAAI,CAAC,wDAAyB,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CACrD,8DAA6B,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,4DAA6B,CAAC,CAC9F,CAAC,gBAAgB,EAAE,CAAC;IACrB,IAAA,mDAAqB,EAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,8BAAa,CAAC,CAAC,EAAE,CAAC,+CAAqB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACjE,IAAI,CAAC,mEAA+B,CAAC,CAAC,SAAS,CAAC,8BAAa,CAAC,CAAC;IAC/D,IAAI,CAAC,qDAA8B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACjE,IAAI,CAAC,mEAA+B,CAAC,CAAC,SAAS,CAAC,qDAA8B,CAAC,CAAC;IAChF,IAAI,CAAC,oCAAgB,CAAC,CAAC,EAAE,CAAC,qDAAwB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACvE,MAAM,CAAC,4DAA+B,CAAC,CAAC,EAAE,CAAC,6EAAuC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACvG,IAAI,CAAC,iDAAsB,CAAC,CAAC,EAAE,CAAC,kEAA8B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACnF,IAAI,CAAC,kDAAsB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACzD,IAAI,CAAC,qBAAW,CAAC,CAAC,SAAS,CAAC,kDAAsB,CAAC,CAAC;IACpD,IAAA,qCAA4B,EAAC,IAAI,EAAE,8CAAuB,CAAC,CAAC;IAC5D,IAAI,CAAC,yCAAkB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACrD,IAAI,CAAC,qDAAuB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC1D,IAAI,CAAC,mEAA+B,CAAC,CAAC,SAAS,CAAC,qDAAuB,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/core",
|
|
3
|
-
"version": "1.71.0-next.
|
|
3
|
+
"version": "1.71.0-next.51+fdb38abfd",
|
|
4
4
|
"description": "Theia is a cloud & desktop IDE framework implemented in TypeScript.",
|
|
5
5
|
"main": "lib/common/index.js",
|
|
6
6
|
"typings": "lib/common/index.d.ts",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"@lumino/virtualdom": "^2.0.4",
|
|
18
18
|
"@lumino/widgets": "2.7.5",
|
|
19
19
|
"@parcel/watcher": "^2.5.6",
|
|
20
|
-
"@theia/application-package": "1.71.0-next.
|
|
21
|
-
"@theia/request": "1.71.0-next.
|
|
20
|
+
"@theia/application-package": "1.71.0-next.51+fdb38abfd",
|
|
21
|
+
"@theia/request": "1.71.0-next.51+fdb38abfd",
|
|
22
22
|
"@types/body-parser": "^1.19.6",
|
|
23
23
|
"@types/express": "^4.17.21",
|
|
24
24
|
"@types/fs-extra": "^4.0.2",
|
|
@@ -221,5 +221,5 @@
|
|
|
221
221
|
"nyc": {
|
|
222
222
|
"extends": "../../configs/nyc.json"
|
|
223
223
|
},
|
|
224
|
-
"gitHead": "
|
|
224
|
+
"gitHead": "fdb38abfdd1ce0f547a16ec9f5b9251d789b4074"
|
|
225
225
|
}
|
|
@@ -22,6 +22,7 @@ import { AutoSaveMode, Saveable, SaveableSource, SaveableWidget, SaveOptions, Sa
|
|
|
22
22
|
import { waitForClosed, Widget } from './widgets';
|
|
23
23
|
import { FrontendApplicationContribution } from './frontend-application-contribution';
|
|
24
24
|
import { FrontendApplication } from './frontend-application';
|
|
25
|
+
import { WindowFocusService } from './window/window-focus-service';
|
|
25
26
|
import throttle = require('lodash.throttle');
|
|
26
27
|
|
|
27
28
|
export const SaveErrorChecker = Symbol('SaveErrorChecker');
|
|
@@ -49,6 +50,9 @@ export class SaveableService implements FrontendApplicationContribution {
|
|
|
49
50
|
@inject(ContributionProvider) @named(SaveErrorChecker)
|
|
50
51
|
protected readonly errorCheckers: ContributionProvider<SaveErrorChecker>;
|
|
51
52
|
|
|
53
|
+
@inject(WindowFocusService)
|
|
54
|
+
protected readonly windowFocusService: WindowFocusService;
|
|
55
|
+
|
|
52
56
|
protected saveThrottles = new Map<Widget, AutoSaveThrottle>();
|
|
53
57
|
protected saveMode: AutoSaveMode = 'off';
|
|
54
58
|
protected saveDelay = 1000;
|
|
@@ -131,6 +135,35 @@ export class SaveableService implements FrontendApplicationContribution {
|
|
|
131
135
|
this.saveThrottles.get(e)?.dispose();
|
|
132
136
|
this.saveThrottles.delete(e);
|
|
133
137
|
});
|
|
138
|
+
// Save all dirty editors when any application window loses focus
|
|
139
|
+
this.windowFocusService.onDidWindowChangeFocus(({ hasFocus }) => {
|
|
140
|
+
if (!hasFocus) {
|
|
141
|
+
this.saveOnWindowBlur();
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Save all dirty saveables when the application window loses focus.
|
|
148
|
+
* Triggered for both `onFocusChange` and `onWindowChange` auto-save modes,
|
|
149
|
+
* matching VSCode's behavior where a window focus loss is a superset of
|
|
150
|
+
* editor focus loss.
|
|
151
|
+
*/
|
|
152
|
+
protected saveOnWindowBlur(): void {
|
|
153
|
+
if (this.saveMode !== 'onWindowChange' && this.saveMode !== 'onFocusChange') {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (!this.shell) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
for (const widget of this.shell.widgets) {
|
|
160
|
+
const saveable = Saveable.get(widget);
|
|
161
|
+
if (saveable && this.shouldAutoSave(widget, saveable)) {
|
|
162
|
+
saveable.save({
|
|
163
|
+
saveReason: SaveReason.FocusChange
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
134
167
|
}
|
|
135
168
|
|
|
136
169
|
protected updateAutoSaveMode(mode: AutoSaveMode): void {
|
|
@@ -169,39 +202,13 @@ export class SaveableService implements FrontendApplicationContribution {
|
|
|
169
202
|
saveReason: SaveReason.AfterDelay
|
|
170
203
|
});
|
|
171
204
|
}
|
|
172
|
-
}
|
|
173
|
-
this.addBlurListener(widget, saveable)
|
|
205
|
+
}
|
|
174
206
|
);
|
|
175
207
|
this.saveThrottles.set(widget, saveThrottle);
|
|
176
208
|
this.applySaveableWidget(widget, saveable);
|
|
177
209
|
return saveThrottle;
|
|
178
210
|
}
|
|
179
211
|
|
|
180
|
-
protected addBlurListener(widget: Widget, saveable: Saveable): Disposable {
|
|
181
|
-
const document = widget.node.ownerDocument;
|
|
182
|
-
const listener = (() => {
|
|
183
|
-
if (this.saveMode === 'onWindowChange' && !this.windowHasFocus(document) && this.shouldAutoSave(widget, saveable)) {
|
|
184
|
-
saveable.save({
|
|
185
|
-
saveReason: SaveReason.FocusChange
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}).bind(this);
|
|
189
|
-
document.addEventListener('blur', listener);
|
|
190
|
-
return Disposable.create(() => {
|
|
191
|
-
document.removeEventListener('blur', listener);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
protected windowHasFocus(document: Document): boolean {
|
|
196
|
-
if (document.visibilityState === 'hidden') {
|
|
197
|
-
return false;
|
|
198
|
-
} else if (document.hasFocus()) {
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
// TODO: Add support for iframes
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
212
|
protected shouldAutoSave(widget: Widget, saveable: Saveable): boolean {
|
|
206
213
|
const uri = NavigatableWidget.getUri(widget);
|
|
207
214
|
if (uri?.scheme === UNTITLED_SCHEME) {
|
|
@@ -24,6 +24,7 @@ import { SecondaryWindowService } from './secondary-window-service';
|
|
|
24
24
|
import { DefaultSecondaryWindowService } from './default-secondary-window-service';
|
|
25
25
|
import { bindRootContributionProvider } from '../../common';
|
|
26
26
|
import { WindowTitleContribution } from './window-title-service';
|
|
27
|
+
import { WindowFocusService } from './window-focus-service';
|
|
27
28
|
|
|
28
29
|
export default new ContainerModule(bind => {
|
|
29
30
|
bind(DefaultWindowService).toSelf().inSingletonScope();
|
|
@@ -31,5 +32,6 @@ export default new ContainerModule(bind => {
|
|
|
31
32
|
bind(FrontendApplicationContribution).toService(DefaultWindowService);
|
|
32
33
|
bind(ClipboardService).to(BrowserClipboardService).inSingletonScope();
|
|
33
34
|
bind(SecondaryWindowService).to(DefaultSecondaryWindowService).inSingletonScope();
|
|
35
|
+
bind(WindowFocusService).toSelf().inSingletonScope();
|
|
34
36
|
bindRootContributionProvider(bind, WindowTitleContribution);
|
|
35
37
|
});
|
|
@@ -22,6 +22,7 @@ import { Saveable } from '../saveable';
|
|
|
22
22
|
import { Emitter, environment, Event, PreferenceService } from '../../common';
|
|
23
23
|
import { SaveableService } from '../saveable-service';
|
|
24
24
|
import { getAllWidgetsFromSecondaryWindow, getDefaultRestoreArea } from '../secondary-window-handler';
|
|
25
|
+
import { WindowFocusService } from './window-focus-service';
|
|
25
26
|
|
|
26
27
|
@injectable()
|
|
27
28
|
export class DefaultSecondaryWindowService implements SecondaryWindowService {
|
|
@@ -53,6 +54,9 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
|
|
|
53
54
|
@inject(SaveableService)
|
|
54
55
|
protected readonly saveResourceService: SaveableService;
|
|
55
56
|
|
|
57
|
+
@inject(WindowFocusService)
|
|
58
|
+
protected readonly windowFocusService: WindowFocusService;
|
|
59
|
+
|
|
56
60
|
@postConstruct()
|
|
57
61
|
init(): void {
|
|
58
62
|
// Set up messaging with secondary windows
|
|
@@ -106,6 +110,7 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
|
|
|
106
110
|
this.secondaryWindows.push(newWindow);
|
|
107
111
|
this.onWindowOpenedEmitter.fire(newWindow);
|
|
108
112
|
newWindow.addEventListener('DOMContentLoaded', () => {
|
|
113
|
+
const focusRegistration = this.windowFocusService.registerWindow(newWindow);
|
|
109
114
|
newWindow.addEventListener('beforeunload', evt => {
|
|
110
115
|
const widgets = getAllWidgetsFromSecondaryWindow(newWindow) ?? [widget];
|
|
111
116
|
for (const w of widgets) {
|
|
@@ -120,6 +125,7 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
|
|
|
120
125
|
}, { capture: true });
|
|
121
126
|
|
|
122
127
|
newWindow.addEventListener('unload', () => {
|
|
128
|
+
focusRegistration.dispose();
|
|
123
129
|
const extIndex = this.secondaryWindows.indexOf(newWindow);
|
|
124
130
|
if (extIndex > -1) {
|
|
125
131
|
this.onWindowClosedEmitter.fire(newWindow);
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
// based on https://github.com/microsoft/vscode/blob/ea6aac971b851ff8675f9ea04f8c0dfc36034a89/src/vs/workbench/services/host/browser/browserHostService.ts
|
|
18
|
+
// and https://github.com/microsoft/vscode/blob/ea6aac971b851ff8675f9ea04f8c0dfc36034a89/src/vs/base/browser/dom.ts#L1319 (FocusTracker)
|
|
19
|
+
/*---------------------------------------------------------------------------------------------
|
|
20
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
21
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
22
|
+
*--------------------------------------------------------------------------------------------*/
|
|
23
|
+
|
|
24
|
+
import { injectable, postConstruct } from 'inversify';
|
|
25
|
+
import { Disposable, DisposableCollection, Emitter, Event } from '../../common';
|
|
26
|
+
|
|
27
|
+
export interface WindowFocusEvent {
|
|
28
|
+
win: Window;
|
|
29
|
+
hasFocus: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Tracks focus state for each registered application window independently.
|
|
34
|
+
*
|
|
35
|
+
* The main window is registered automatically. Secondary windows should be
|
|
36
|
+
* registered via {@link registerWindow} — typically by the service responsible
|
|
37
|
+
* for creating them.
|
|
38
|
+
*
|
|
39
|
+
* Uses two complementary signals per window for robust detection:
|
|
40
|
+
* - `window` `focus`/`blur` events (OS-level window focus changes)
|
|
41
|
+
* - `document` `visibilitychange` events (browser tab switches)
|
|
42
|
+
*
|
|
43
|
+
* Blur events are debounced per window with `setTimeout(0)` so that focus
|
|
44
|
+
* moving between elements within the same window does not produce a false
|
|
45
|
+
* blur: the subsequent `focus` event cancels the pending blur before it fires.
|
|
46
|
+
*
|
|
47
|
+
* Each per-window event is latched — it only fires when that window's focus
|
|
48
|
+
* state actually changes.
|
|
49
|
+
*/
|
|
50
|
+
@injectable()
|
|
51
|
+
export class WindowFocusService implements Disposable {
|
|
52
|
+
|
|
53
|
+
protected readonly onDidWindowChangeFocusEmitter = new Emitter<WindowFocusEvent>();
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Fires when an individual window's focus state changes.
|
|
57
|
+
* The event payload identifies which window changed and whether it gained or lost focus.
|
|
58
|
+
*
|
|
59
|
+
* A window losing focus to another application window will fire separately
|
|
60
|
+
* for each window involved: one event with `hasFocus: false` for the window
|
|
61
|
+
* that lost focus, and one with `hasFocus: true` for the window that gained it.
|
|
62
|
+
*/
|
|
63
|
+
readonly onDidWindowChangeFocus: Event<WindowFocusEvent> = this.onDidWindowChangeFocusEmitter.event;
|
|
64
|
+
|
|
65
|
+
protected readonly toDispose = new DisposableCollection(this.onDidWindowChangeFocusEmitter);
|
|
66
|
+
|
|
67
|
+
/** Per-window tracking state. */
|
|
68
|
+
protected readonly windowStates = new Map<Window, WindowTrackingState>();
|
|
69
|
+
|
|
70
|
+
@postConstruct()
|
|
71
|
+
protected init(): void {
|
|
72
|
+
this.registerWindow(window);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Register a window for focus tracking. The returned {@link Disposable}
|
|
77
|
+
* removes the window from tracking when disposed.
|
|
78
|
+
*
|
|
79
|
+
* The main window is registered automatically. Call this for secondary
|
|
80
|
+
* windows when they are created.
|
|
81
|
+
*/
|
|
82
|
+
registerWindow(win: Window): Disposable {
|
|
83
|
+
if (this.windowStates.has(win)) {
|
|
84
|
+
return Disposable.NULL;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const state: WindowTrackingState = {
|
|
88
|
+
lastFocusState: this.windowHasFocus(win),
|
|
89
|
+
pendingBlurTimeout: undefined,
|
|
90
|
+
};
|
|
91
|
+
this.windowStates.set(win, state);
|
|
92
|
+
|
|
93
|
+
const onFocus = () => this.handleFocus(win, state);
|
|
94
|
+
const onBlur = () => this.scheduleBlur(win, state);
|
|
95
|
+
const onVisibilityChange = () => this.updateWindowFocusState(win, state);
|
|
96
|
+
|
|
97
|
+
win.addEventListener('focus', onFocus);
|
|
98
|
+
win.addEventListener('blur', onBlur);
|
|
99
|
+
win.document.addEventListener('visibilitychange', onVisibilityChange);
|
|
100
|
+
|
|
101
|
+
const cleanup = Disposable.create(() => {
|
|
102
|
+
this.cancelPendingBlur(state);
|
|
103
|
+
this.windowStates.delete(win);
|
|
104
|
+
win.removeEventListener('focus', onFocus);
|
|
105
|
+
win.removeEventListener('blur', onBlur);
|
|
106
|
+
try {
|
|
107
|
+
win.document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
108
|
+
} catch {
|
|
109
|
+
// The window may already be closed
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
this.toDispose.push(cleanup);
|
|
114
|
+
return cleanup;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Whether any registered window currently has focus.
|
|
119
|
+
*/
|
|
120
|
+
get hasFocus(): boolean {
|
|
121
|
+
for (const win of this.windowStates.keys()) {
|
|
122
|
+
if (this.windowHasFocus(win)) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
protected windowHasFocus(win: Window): boolean {
|
|
130
|
+
try {
|
|
131
|
+
return win.document.hasFocus();
|
|
132
|
+
} catch {
|
|
133
|
+
// The window may have been closed
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
protected handleFocus(win: Window, state: WindowTrackingState): void {
|
|
139
|
+
// Cancel this window's pending blur — focus arrived before the timeout,
|
|
140
|
+
// meaning focus just moved between elements within this window.
|
|
141
|
+
this.cancelPendingBlur(state);
|
|
142
|
+
this.updateWindowFocusState(win, state);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Schedule a deferred blur check for this specific window.
|
|
147
|
+
* If no `focus` event arrives on this same window before the timeout fires,
|
|
148
|
+
* we treat it as a real focus loss for that window.
|
|
149
|
+
*/
|
|
150
|
+
protected scheduleBlur(win: Window, state: WindowTrackingState): void {
|
|
151
|
+
this.cancelPendingBlur(state);
|
|
152
|
+
state.pendingBlurTimeout = setTimeout(() => {
|
|
153
|
+
state.pendingBlurTimeout = undefined;
|
|
154
|
+
this.updateWindowFocusState(win, state);
|
|
155
|
+
}, 0);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
protected cancelPendingBlur(state: WindowTrackingState): void {
|
|
159
|
+
if (state.pendingBlurTimeout !== undefined) {
|
|
160
|
+
clearTimeout(state.pendingBlurTimeout);
|
|
161
|
+
state.pendingBlurTimeout = undefined;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Re-evaluate a single window's focus and fire if it changed (latching).
|
|
167
|
+
*/
|
|
168
|
+
protected updateWindowFocusState(win: Window, state: WindowTrackingState): void {
|
|
169
|
+
const focused = this.windowHasFocus(win);
|
|
170
|
+
if (focused !== state.lastFocusState) {
|
|
171
|
+
state.lastFocusState = focused;
|
|
172
|
+
this.onDidWindowChangeFocusEmitter.fire({ win, hasFocus: focused });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
dispose(): void {
|
|
177
|
+
for (const state of this.windowStates.values()) {
|
|
178
|
+
this.cancelPendingBlur(state);
|
|
179
|
+
}
|
|
180
|
+
this.toDispose.dispose();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
interface WindowTrackingState {
|
|
185
|
+
lastFocusState: boolean;
|
|
186
|
+
pendingBlurTimeout: ReturnType<typeof setTimeout> | undefined;
|
|
187
|
+
}
|
|
@@ -32,6 +32,7 @@ import { ExternalAppOpenHandler } from './external-app-open-handler';
|
|
|
32
32
|
import { ElectronUriHandlerContribution } from '../electron-uri-handler';
|
|
33
33
|
import { bindRootContributionProvider } from '../../common';
|
|
34
34
|
import { WindowTitleContribution } from '../../browser/window/window-title-service';
|
|
35
|
+
import { WindowFocusService } from '../../browser/window/window-focus-service';
|
|
35
36
|
import { WindowZoomStatusBarItem } from './window-zoom-status-bar-item';
|
|
36
37
|
import '../../../src/electron-browser/style/window-zoom-action-bar.css';
|
|
37
38
|
|
|
@@ -50,6 +51,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
|
50
51
|
bind(ExternalAppOpenHandler).toSelf().inSingletonScope();
|
|
51
52
|
bind(OpenHandler).toService(ExternalAppOpenHandler);
|
|
52
53
|
bindRootContributionProvider(bind, WindowTitleContribution);
|
|
54
|
+
bind(WindowFocusService).toSelf().inSingletonScope();
|
|
53
55
|
bind(WindowZoomStatusBarItem).toSelf().inSingletonScope();
|
|
54
56
|
bind(FrontendApplicationContribution).toService(WindowZoomStatusBarItem);
|
|
55
57
|
});
|