mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 17:38:20 +01:00
Fix multiple dialogs focus bug
This commit is contained in:
parent
c2e72a067e
commit
c26e27d7ec
14
d.ts/antos.d.ts
vendored
14
d.ts/antos.d.ts
vendored
@ -380,10 +380,11 @@ declare namespace OS {
|
||||
*
|
||||
* Need to be implemented by subclasses
|
||||
*
|
||||
* @abstract
|
||||
* @memberof SubWindow
|
||||
*
|
||||
* @returns {void}
|
||||
* @memberof BaseDialog
|
||||
*/
|
||||
abstract init(): void;
|
||||
init(): void;
|
||||
/**
|
||||
* Main entry point after rendering of the sub-window
|
||||
*
|
||||
@ -412,6 +413,13 @@ declare namespace OS {
|
||||
* @memberof SubWindow
|
||||
*/
|
||||
hide(): void;
|
||||
/**
|
||||
* blur the sub-window
|
||||
*
|
||||
* @returns {void}
|
||||
* @memberof SubWindow
|
||||
*/
|
||||
blur(): void;
|
||||
}
|
||||
/**
|
||||
* Abstract prototype of all AntOS dialogs widget
|
||||
|
Binary file not shown.
@ -362,7 +362,11 @@ namespace OS {
|
||||
if (this.appmenu && this.pid === this.appmenu.pid) {
|
||||
this.appmenu.items = [];
|
||||
}
|
||||
return this.trigger("blur", undefined);
|
||||
this.trigger("blur", undefined);
|
||||
if(this.dialog)
|
||||
{
|
||||
this.dialog.blur();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,7 @@ namespace OS {
|
||||
*/
|
||||
parent: BaseModel | typeof GUI;
|
||||
|
||||
|
||||
/**
|
||||
*Creates an instance of SubWindow.
|
||||
* @param {string} name SubWindow (class) name
|
||||
@ -82,10 +83,26 @@ namespace OS {
|
||||
*
|
||||
* Need to be implemented by subclasses
|
||||
*
|
||||
* @abstract
|
||||
* @memberof SubWindow
|
||||
*
|
||||
* @returns {void}
|
||||
* @memberof BaseDialog
|
||||
*/
|
||||
abstract init(): void;
|
||||
init(): void {
|
||||
// show the app if it is not active
|
||||
this.on("focus",() => {
|
||||
if((this.pid == -1) || (PM.pidactive == this.pid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const app = PM.appByPid(this.pid);
|
||||
if(app)
|
||||
{
|
||||
app.show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Main entry point after rendering of the sub-window
|
||||
@ -115,7 +132,7 @@ namespace OS {
|
||||
* @memberof SubWindow
|
||||
*/
|
||||
show(): void {
|
||||
this.trigger("focus");
|
||||
this.trigger("focus", undefined);
|
||||
this.trigger("focused", undefined);
|
||||
if (this.dialog) {
|
||||
this.dialog.show();
|
||||
@ -129,10 +146,27 @@ namespace OS {
|
||||
* @memberof SubWindow
|
||||
*/
|
||||
hide(): void {
|
||||
return this.trigger("hide");
|
||||
this.trigger("hide", undefined);
|
||||
if (this.dialog) {
|
||||
this.dialog.hide();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* blur the sub-window
|
||||
*
|
||||
* @returns {void}
|
||||
* @memberof SubWindow
|
||||
*/
|
||||
blur(): void {
|
||||
this.trigger("blur", undefined);
|
||||
if (this.dialog) {
|
||||
this.dialog.blur();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SubWindow.type = ModelType.SubWindow;
|
||||
|
||||
/**
|
||||
@ -182,6 +216,7 @@ namespace OS {
|
||||
return (this.parent.dialog = undefined);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -238,6 +273,7 @@ namespace OS {
|
||||
* @memberof BasicDialog
|
||||
*/
|
||||
init(): void {
|
||||
super.init();
|
||||
//this._onenter = undefined;
|
||||
if (this.markup) {
|
||||
if (typeof this.markup === "string") {
|
||||
|
Loading…
Reference in New Issue
Block a user