mirror of
https://gitee.com/openharmony/applications_launcher
synced 2024-11-27 00:51:34 +00:00
!574 修复5.0分屏失败2
Merge pull request !574 from zhengyongjie/OpenHarmony-5.0-Release
This commit is contained in:
commit
a362c6e34c
@ -312,6 +312,7 @@ class WindowManager {
|
||||
|
||||
createRecentWindow(mode?: number) {
|
||||
Log.showDebug(TAG, 'createRecentWindow Begin, mode=' + mode);
|
||||
globalThis.recentMode = mode;
|
||||
let setWinMode = (mode && this.isSplitWindowMode(mode)) ? (win) => {
|
||||
windowManager.recentMode = mode;
|
||||
win.setWindowMode(mode).then();
|
||||
@ -321,6 +322,28 @@ class WindowManager {
|
||||
Log.showDebug(TAG, `${this.RECENT_WINDOW_NAME} setFullScreen`);
|
||||
});
|
||||
};
|
||||
let registerWinEvent = (win: window.Window) => {
|
||||
Log.showDebug(TAG, 'registerWinEvent Begin');
|
||||
win.on('windowEvent', (stageEventType) => {
|
||||
Log.showError(TAG,`Recent lifeCycleEvent callback stageEventType=${stageEventType}`);
|
||||
if (!globalThis.recentDisplay) {
|
||||
return;
|
||||
}
|
||||
if (stageEventType === window.WindowEventType.WINDOW_INACTIVE && globalThis.recentDisplay === globalThis.recentMode) {
|
||||
Log.showDebug(TAG,'Recent MainAbility onWindowStageInactive');
|
||||
try {
|
||||
let wins: window.Window = window.findWindow(windowManager.RECENT_WINDOW_NAME);
|
||||
Log.showError(TAG,'Hide recent on inactive');
|
||||
wins.hide().then(() => {
|
||||
globalThis.recentDisplay = null;
|
||||
})
|
||||
} catch (err) {
|
||||
let _err = err as BusinessError;
|
||||
Log.showError(TAG, `Recent lifeCycleEvent findWindow errCode: ${_err.code}, errMsg: ${_err.message}`);
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
try {
|
||||
let win: window.Window = window.findWindow(windowManager.RECENT_WINDOW_NAME);
|
||||
setWinMode(win);
|
||||
@ -332,6 +355,7 @@ class WindowManager {
|
||||
Log.showDebug(TAG, `recent window is not created, because ${JSON.stringify(err)}`);
|
||||
let callback = (win) => {
|
||||
Log.showDebug(TAG, 'Post recent window created');
|
||||
registerWinEvent(win);
|
||||
setWinMode(win);
|
||||
}
|
||||
this.createWindow(globalThis.desktopContext, windowManager.RECENT_WINDOW_NAME, windowManager.RECENT_RANK,
|
||||
|
@ -171,6 +171,7 @@ export class RecentMissionsViewModel {
|
||||
*/
|
||||
async moveMissionToFront(missionId: number): Promise<void> {
|
||||
if (globalThis.recentMode && windowManager.isSplitWindowMode(globalThis.recentMode)) {
|
||||
globalThis.recentDisplay = globalThis.recentMode;
|
||||
await amsMissionManager.moveMissionToFront(missionId, globalThis.recentMode);
|
||||
} else {
|
||||
await amsMissionManager.moveMissionToFront(missionId);
|
||||
|
Loading…
Reference in New Issue
Block a user