"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WindowStateImpl = exports.ExtHostWindowState = void 0;
const ide_core_common_1 = require("@opensumi/ide-core-common");
class ExtHostWindowState {
    constructor(rpcProtocol) {
        this.rpcProtocol = rpcProtocol;
        this.state = new WindowStateImpl();
        this._onDidChangeWindowState = new ide_core_common_1.Emitter();
        this.onDidChangeWindowState = this._onDidChangeWindowState.event;
    }
    $onDidChangeWindowFocus(focused) {
        if (focused !== this.state.focused) {
            this.state.focused = focused;
            this._onDidChangeWindowState.fire(this.state);
        }
    }
    $onDidChangeWindowActive(active) {
        if (active !== this.state.active) {
            this.state.active = active;
            this._onDidChangeWindowState.fire(this.state);
        }
    }
}
exports.ExtHostWindowState = ExtHostWindowState;
class WindowStateImpl {
    constructor() {
        // 当插件进程重启时，这里如果默认是 false，会与实际状态不一致，导致依赖该状态的插件处理有问题
        this.focused = true;
        this.active = true;
    }
}
exports.WindowStateImpl = WindowStateImpl;
//# sourceMappingURL=ext.host.window-state.js.map