From 957524ffb23997476ae6aed644555f838d11ea0c Mon Sep 17 00:00:00 2001 From: lon9 <815882449@qq.com> Date: Wed, 18 Jun 2025 21:25:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=BA=90=E4=BB=A3=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/utils/WindowUtil.ets | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/entry/src/main/ets/utils/WindowUtil.ets b/entry/src/main/ets/utils/WindowUtil.ets index 7af4d51..2a24ff0 100644 --- a/entry/src/main/ets/utils/WindowUtil.ets +++ b/entry/src/main/ets/utils/WindowUtil.ets @@ -27,14 +27,7 @@ export enum ImmersiveType { FULLSCREEN_IMMERSIVE } -// [Start FreeWindowImmersive] -export enum FreeWindowImmersiveType { - FREE_WINDOW_NORMAL, - FREE_WINDOW_IMMERSIVE -} - export class WindowUtil { - // [StartExclude FreeWindowImmersive] public uiContext?: UIContext; public mainWindow: window.Window; public mainWindowInfo: WindowInfo = new WindowInfo(); @@ -71,7 +64,7 @@ export class WindowUtil { this.mainWindow = mainWindow; } - setImmersiveType(type: ImmersiveType, freeWindowType: FreeWindowImmersiveType) { + setImmersiveType(type: ImmersiveType) { if (type === ImmersiveType.NORMAL) { this.mainWindow.setWindowLayoutFullScreen(false) .then(() => { @@ -81,6 +74,8 @@ export class WindowUtil { hilog.error(0x0000, 'testLog', `Failed to set immersive mode. Code: ${err.code}, message: ${err.message}`); }); this.setSystemBarEnabled(true); + // Only used after the function loadContent() or setUIContent(). + this.mainWindow.setWindowDecorVisible(true); this.recover(); } else if (type === ImmersiveType.IMMERSIVE) { this.mainWindow.setWindowLayoutFullScreen(true) @@ -91,6 +86,7 @@ export class WindowUtil { hilog.error(0x0000, 'testLog', `Failed to set immersive mode. Code: ${err.code}, message: ${err.message}`); }); this.setSystemBarEnabled(true); + this.mainWindow.setWindowDecorVisible(false); this.recover(); } else if (type === ImmersiveType.FULLSCREEN_IMMERSIVE) { this.mainWindow.setWindowLayoutFullScreen(true) @@ -112,18 +108,9 @@ export class WindowUtil { }); } this.setSystemBarEnabled(false); - } - this.mainWindowInfo.isImmersive = type; - - // [EndExclude FreeWindowImmersive] - // Only used after the function loadContent() or setUIContent(). - if (freeWindowType === FreeWindowImmersiveType.FREE_WINDOW_NORMAL) { - this.mainWindow.setWindowDecorVisible(true); - } else { this.mainWindow.setWindowDecorVisible(false); } - this.mainWindowInfo.isFreeWindowImmersive = freeWindowType; - // [StartExclude FreeWindowImmersive] + this.mainWindowInfo.isImmersive = type; } setUIContext() { @@ -234,7 +221,6 @@ export class WindowUtil { this.mainWindow.off('windowSizeChange'); this.mainWindow.off('avoidAreaChange'); } - // [StartExclude FreeWindowImmersive] // [Start setSplitScreen] setSplitScreen(bundleName: string, abilityName: string, moduleName: string): void { @@ -332,7 +318,6 @@ export class WindowInfo { public windowStatusType: window.WindowStatusType = window.WindowStatusType.UNDEFINED; // Is the window an immersive layout. public isImmersive: ImmersiveType = ImmersiveType.NORMAL; - public isFreeWindowImmersive: FreeWindowImmersiveType = FreeWindowImmersiveType.FREE_WINDOW_NORMAL; // Window orientation. public orientation: window.Orientation = window.Orientation.UNSPECIFIED; // Window size. -- Gitee