@theia/core 1.71.0-next.44 → 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 +27 -3
- 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/lib/node/messaging/default-messaging-service.d.ts.map +1 -1
- package/lib/node/messaging/default-messaging-service.js +1 -0
- package/lib/node/messaging/default-messaging-service.js.map +1 -1
- package/lib/node/messaging/test/default-messaging-service.spec.d.ts +2 -0
- package/lib/node/messaging/test/default-messaging-service.spec.d.ts.map +1 -0
- package/lib/node/messaging/test/default-messaging-service.spec.js +81 -0
- package/lib/node/messaging/test/default-messaging-service.spec.js.map +1 -0
- 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/src/node/messaging/default-messaging-service.ts +1 -0
- package/src/node/messaging/test/default-messaging-service.spec.ts +85 -0
|
@@ -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,cAAc,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,GAAW;QACtB,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,OAAO,mBAAU,CAAC,IAAI,CAAC;QAC3B,CAAC;QAED,MAAM,KAAK,GAAwB;YAC/B,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;YACxC,kBAAkB,EAAE,SAAS;SAChC,CAAC;QACF,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAElC,MAAM,OAAO,GA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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,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,+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,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,m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E,kBAAkB,CAAC,CAAC,CAAC,YAAA;IAGrD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI;IAahG,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,MAAM,GAAG,KAAK;CAgBrD"}
|
|
@@ -55,6 +55,7 @@ let DefaultMessagingService = class DefaultMessagingService {
|
|
|
55
55
|
createMainChannelContainer(socket) {
|
|
56
56
|
const connectionContainer = this.container.createChild();
|
|
57
57
|
connectionContainer.bind(exports.MainChannel).toConstantValue(socket);
|
|
58
|
+
socket.onClose(() => connectionContainer.unbindAllAsync().catch(e => console.error(e)));
|
|
58
59
|
return connectionContainer;
|
|
59
60
|
}
|
|
60
61
|
getConnectionChannelHandlers(socket) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-messaging-service.js","sourceRoot":"","sources":["../../../src/node/messaging/default-messaging-service.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,yCAA6E;AAC7E,yCAA+G;AAC/G,2DAAuD;AACvD,+EAA0E;AAC1E,sCAAuC;AACvC,8DAA+E;AAC/E,+EAA0E;AAG7D,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAClD,QAAA,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAG1C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAA7B;QAagB,oBAAe,GAAG,IAAI,kBAAkB,EAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"default-messaging-service.js","sourceRoot":"","sources":["../../../src/node/messaging/default-messaging-service.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,yCAA6E;AAC7E,yCAA+G;AAC/G,2DAAuD;AACvD,+EAA0E;AAC1E,sCAAuC;AACvC,8DAA+E;AAC/E,+EAA0E;AAG7D,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAClD,QAAA,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAG1C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAA7B;QAagB,oBAAe,GAAG,IAAI,kBAAkB,EAAW,CAAC;IAiD3E,CAAC;IA/CG,UAAU;QACN,IAAI,CAAC,yBAAyB,CAAC,qBAAY,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3F,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,EAAE,CAAC;YAC/D,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACL,CAAC;IAED,yBAAyB,CAAC,IAAY,EAAE,QAA6E;QACjH,IAAI,CAAC,yBAAyB,CAAC,yBAAyB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7E,CAAC;IAED,sBAAsB,CAAC,IAAY,EAAE,QAAyE;QAC1G,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAA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M,EAAE,CAAC;gBACV,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC1B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,UAAa;QAC7B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,IAAI,CAAC;gBACD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBACzC,IAAI,MAAM,EAAE,CAAC;oBACT,OAAO,MAAM,CAAC;gBAClB,CAAC;YACL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACrB,CAAC;QACL,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AApCD,gDAoCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-messaging-service.spec.d.ts","sourceRoot":"","sources":["../../../../src/node/messaging/test/default-messaging-service.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
const tslib_1 = require("tslib");
|
|
19
|
+
const chai_1 = require("chai");
|
|
20
|
+
const inversify_1 = require("inversify");
|
|
21
|
+
const common_1 = require("../../../common");
|
|
22
|
+
const channel_1 = require("../../../common/message-rpc/channel");
|
|
23
|
+
const uint8_array_message_buffer_1 = require("../../../common/message-rpc/uint8-array-message-buffer");
|
|
24
|
+
const connection_container_module_1 = require("../connection-container-module");
|
|
25
|
+
const default_messaging_service_1 = require("../default-messaging-service");
|
|
26
|
+
const frontend_connection_service_1 = require("../frontend-connection-service");
|
|
27
|
+
const messaging_service_1 = require("../messaging-service");
|
|
28
|
+
describe('DefaultMessagingService', () => {
|
|
29
|
+
describe('when a frontend connection closes', () => {
|
|
30
|
+
it('disposes the connection-scoped child container, invoking @preDestroy on bound singleton services', async () => {
|
|
31
|
+
let canaryDisposed = false;
|
|
32
|
+
let CanaryConnectionHandler = class CanaryConnectionHandler {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.path = 'canary';
|
|
35
|
+
}
|
|
36
|
+
onConnection(_channel) { }
|
|
37
|
+
onPreDestroy() {
|
|
38
|
+
canaryDisposed = true;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, inversify_1.preDestroy)(),
|
|
43
|
+
tslib_1.__metadata("design:type", Function),
|
|
44
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
45
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
46
|
+
], CanaryConnectionHandler.prototype, "onPreDestroy", null);
|
|
47
|
+
CanaryConnectionHandler = tslib_1.__decorate([
|
|
48
|
+
(0, inversify_1.injectable)()
|
|
49
|
+
], CanaryConnectionHandler);
|
|
50
|
+
const canaryModule = connection_container_module_1.ConnectionContainerModule.create(({ bind }) => {
|
|
51
|
+
bind(CanaryConnectionHandler).toSelf().inSingletonScope();
|
|
52
|
+
bind(common_1.ConnectionHandler).toService(CanaryConnectionHandler);
|
|
53
|
+
});
|
|
54
|
+
const container = new inversify_1.Container();
|
|
55
|
+
container.bind(default_messaging_service_1.MessagingContainer).toConstantValue(container);
|
|
56
|
+
container.bind(default_messaging_service_1.DefaultMessagingService).toSelf().inSingletonScope();
|
|
57
|
+
container.bind(connection_container_module_1.ConnectionContainerModule).toConstantValue(canaryModule);
|
|
58
|
+
(0, common_1.bindContributionProvider)(container, connection_container_module_1.ConnectionContainerModule);
|
|
59
|
+
(0, common_1.bindContributionProvider)(container, messaging_service_1.MessagingService.Contribution);
|
|
60
|
+
let serviceHandler;
|
|
61
|
+
const frontendConnectionService = {
|
|
62
|
+
registerConnectionHandler(path, callback) {
|
|
63
|
+
if (path === common_1.servicesPath) {
|
|
64
|
+
serviceHandler = callback;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
container.bind(frontend_connection_service_1.FrontendConnectionService).toConstantValue(frontendConnectionService);
|
|
69
|
+
const messagingService = container.get(default_messaging_service_1.DefaultMessagingService);
|
|
70
|
+
messagingService.initialize();
|
|
71
|
+
(0, chai_1.expect)(serviceHandler, 'connection handler not registered on the services path').to.not.be.undefined;
|
|
72
|
+
const mainChannel = new channel_1.BasicChannel(() => new uint8_array_message_buffer_1.Uint8ArrayWriteBuffer());
|
|
73
|
+
serviceHandler({}, mainChannel);
|
|
74
|
+
(0, chai_1.expect)(canaryDisposed, 'canary should not be disposed before the channel is closed').to.be.false;
|
|
75
|
+
mainChannel.onCloseEmitter.fire({ reason: 'frontend connection closed' });
|
|
76
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
77
|
+
(0, chai_1.expect)(canaryDisposed, 'canary @preDestroy was not invoked').to.be.true;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=default-messaging-service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-messaging-service.spec.js","sourceRoot":"","sources":["../../../../src/node/messaging/test/default-messaging-service.spec.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,+BAA8B;AAC9B,yCAA8D;AAC9D,4CAA4F;AAC5F,iEAA4E;AAC5E,uGAA+F;AAC/F,gFAA2E;AAC3E,4EAA2F;AAC3F,gFAA2E;AAC3E,4DAAwD;AAExD,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IAErC,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAE/C,EAAE,CAAC,kGAAkG,EAAE,KAAK,IAAI,EAAE;YAC9G,IAAI,cAAc,GAAG,KAAK,CAAC;YAG3B,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;gBAA7B;oBACa,SAAI,GAAG,QAAQ,CAAC;gBAO7B,CAAC;gBANG,YAAY,CAAC,QAAiB,IAA2C,CAAC;gBAGhE,YAAY;oBAClB,cAAc,GAAG,IAAI,CAAC;gBAC1B,CAAC;aACJ,CAAA;YAHa;gBADT,IAAA,sBAAU,GAAE;;;;uEAGZ;YAPC,uBAAuB;gBAD5B,IAAA,sBAAU,GAAE;eACP,uBAAuB,CAQ5B;YAED,MAAM,YAAY,GAAG,uDAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;g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E,EAAE,WAAW,CAAC,CAAC;YAEjC,IAAA,aAAM,EAAC,cAAc,EAAE,4DAA4D,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;YAEjG,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC,CAAC;YAC1E,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;YAE1D,IAAA,aAAM,EAAC,cAAc,EAAE,oCAAoC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC5E,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;AAEP,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
|
});
|
|
@@ -71,6 +71,7 @@ export class DefaultMessagingService implements MessagingService, BackendApplica
|
|
|
71
71
|
protected createMainChannelContainer(socket: Channel): Container {
|
|
72
72
|
const connectionContainer: Container = this.container.createChild() as Container;
|
|
73
73
|
connectionContainer.bind(MainChannel).toConstantValue(socket);
|
|
74
|
+
socket.onClose(() => connectionContainer.unbindAllAsync().catch(e => console.error(e)));
|
|
74
75
|
return connectionContainer;
|
|
75
76
|
}
|
|
76
77
|
|