diff --git a/bundle.json b/bundle.json
index f079a7b8a7..6021f903b5 100644
--- a/bundle.json
+++ b/bundle.json
@@ -59,7 +59,8 @@
"//foundation/windowmanager/utils:libwmutil",
"//foundation/windowmanager/snapshot:snapshot_display",
"//foundation/windowmanager/interfaces/kits/napi/window_runtime/window_stage_napi:windowstage",
- "//foundation/windowmanager/interfaces/kits/napi:napi_packages"
+ "//foundation/windowmanager/interfaces/kits/napi:napi_packages",
+ "//foundation/windowmanager/resources:window_resources"
],
"inner_kits": [
{
diff --git a/dmserver/BUILD.gn b/dmserver/BUILD.gn
index 68fc4b6570..51f63aa43a 100644
--- a/dmserver/BUILD.gn
+++ b/dmserver/BUILD.gn
@@ -21,21 +21,6 @@ config("libdms_private_config") {
]
}
-ohos_prebuilt_etc("display_manager_config") {
- if (device_name == "rk3568") {
- source =
- "//foundation/windowmanager/resources/rk3568/display_manager_config.xml"
- install_enable = true
- } else {
- source =
- "//foundation/windowmanager/resources/other/display_manager_config.xml"
- install_enable = false
- }
- part_name = "window_manager"
- subsystem_name = "window"
- relative_install_dir = "window/resources"
-}
-
config("libdms_public_config") {
include_dirs = [ "include" ]
}
@@ -60,7 +45,6 @@ ohos_shared_library("libdms") {
public_configs = [ ":libdms_public_config" ]
deps = [
- ":display_manager_config",
"//foundation/windowmanager/dm:libdm",
"//foundation/windowmanager/utils:libwmutil",
diff --git a/interfaces/innerkits/wm/wm_common.h b/interfaces/innerkits/wm/wm_common.h
index 12807285b5..166d006b77 100644
--- a/interfaces/innerkits/wm/wm_common.h
+++ b/interfaces/innerkits/wm/wm_common.h
@@ -23,6 +23,7 @@ enum class WindowType : uint32_t {
APP_WINDOW_BASE = 1,
APP_MAIN_WINDOW_BASE = APP_WINDOW_BASE,
WINDOW_TYPE_APP_MAIN_WINDOW = APP_MAIN_WINDOW_BASE,
+ WINDOW_TYPE_PLACE_HOLDER,
APP_MAIN_WINDOW_END,
APP_SUB_WINDOW_BASE = 1000,
@@ -60,7 +61,6 @@ enum class WindowType : uint32_t {
WINDOW_TYPE_FREEZE_DISPLAY,
WINDOW_TYPE_VOICE_INTERACTION,
ABOVE_APP_SYSTEM_WINDOW_END,
-
SYSTEM_WINDOW_END = ABOVE_APP_SYSTEM_WINDOW_END,
};
diff --git a/resources/BUILD.gn b/resources/BUILD.gn
new file mode 100644
index 0000000000..683ee5b887
--- /dev/null
+++ b/resources/BUILD.gn
@@ -0,0 +1,20 @@
+# Copyright (c) 2022 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+group("window_resources") {
+ deps = [
+ "config:window_config",
+ "dialog_ui:dialog_ui",
+ "media:window_resources_media",
+ ]
+}
diff --git a/resources/config/BUILD.gn b/resources/config/BUILD.gn
new file mode 100644
index 0000000000..d7979d976f
--- /dev/null
+++ b/resources/config/BUILD.gn
@@ -0,0 +1,46 @@
+# Copyright (c) 2022 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import("//build/ohos.gni")
+
+ohos_prebuilt_etc("window_manager_config") {
+ if (device_name == "rk3568") {
+ source = "//foundation/windowmanager/resources/config/rk3568/window_manager_config.xml"
+ install_enable = true
+ } else {
+ source = "//foundation/windowmanager/resources/config/other/window_manager_config.xml"
+ install_enable = false
+ }
+ part_name = "window_manager"
+ subsystem_name = "window"
+ relative_install_dir = "window/resources"
+}
+
+ohos_prebuilt_etc("display_manager_config") {
+ if (device_name == "rk3568") {
+ source = "//foundation/windowmanager/resources/config/rk3568/display_manager_config.xml"
+ install_enable = true
+ } else {
+ source = "//foundation/windowmanager/resources/config/other/display_manager_config.xml"
+ install_enable = false
+ }
+ part_name = "window_manager"
+ subsystem_name = "window"
+ relative_install_dir = "window/resources"
+}
+
+group("window_config") {
+ deps = [
+ ":display_manager_config",
+ ":window_manager_config",
+ ]
+}
diff --git a/resources/other/display_manager_config.xml b/resources/config/other/display_manager_config.xml
similarity index 100%
rename from resources/other/display_manager_config.xml
rename to resources/config/other/display_manager_config.xml
diff --git a/resources/other/window_manager_config.xml b/resources/config/other/window_manager_config.xml
similarity index 100%
rename from resources/other/window_manager_config.xml
rename to resources/config/other/window_manager_config.xml
diff --git a/resources/rk3568/display_manager_config.xml b/resources/config/rk3568/display_manager_config.xml
similarity index 100%
rename from resources/rk3568/display_manager_config.xml
rename to resources/config/rk3568/display_manager_config.xml
diff --git a/resources/rk3568/window_manager_config.xml b/resources/config/rk3568/window_manager_config.xml
similarity index 100%
rename from resources/rk3568/window_manager_config.xml
rename to resources/config/rk3568/window_manager_config.xml
diff --git a/resources/dialog_ui/BUILD.gn b/resources/dialog_ui/BUILD.gn
new file mode 100644
index 0000000000..762fdfabba
--- /dev/null
+++ b/resources/dialog_ui/BUILD.gn
@@ -0,0 +1,16 @@
+# Copyright (c) 2022 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+group("dialog_ui") {
+ deps = [ "divider_dialog_ui/js:dialog_divider_ui_js_files_etc" ]
+}
diff --git a/resources/dialog_ui/divider_dialog_ui/js/BUILD.gn b/resources/dialog_ui/divider_dialog_ui/js/BUILD.gn
new file mode 100644
index 0000000000..33d56e74bd
--- /dev/null
+++ b/resources/dialog_ui/divider_dialog_ui/js/BUILD.gn
@@ -0,0 +1,27 @@
+# Copyright (c) 2022 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import("//build/ohos.gni")
+import("//foundation/arkui/ace_engine/build/ace_gen_sa_dialog_js.gni")
+
+gen_sa_dialog_js("dialog_divider_ui_js_files_etc") {
+ project_path =
+ "//foundation/windowmanager/resources/dialog_ui/divider_dialog_ui/js"
+ i18n_files = [
+ "i18n/en-US.json",
+ "i18n/zh-CN.json",
+ ]
+ common_files = []
+ dialog_name = "dialog_divider_ui"
+ part_name = "window_manager"
+ subsystem_name = "window"
+}
diff --git a/resources/dialog_ui/divider_dialog_ui/js/i18n/en-US.json b/resources/dialog_ui/divider_dialog_ui/js/i18n/en-US.json
new file mode 100644
index 0000000000..550544b44b
--- /dev/null
+++ b/resources/dialog_ui/divider_dialog_ui/js/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "message": {
+ },
+ "color": {
+ "gray": "gray",
+ "black": "black"
+ }
+}
\ No newline at end of file
diff --git a/resources/dialog_ui/divider_dialog_ui/js/i18n/zh-CN.json b/resources/dialog_ui/divider_dialog_ui/js/i18n/zh-CN.json
new file mode 100644
index 0000000000..a6e374d9b8
--- /dev/null
+++ b/resources/dialog_ui/divider_dialog_ui/js/i18n/zh-CN.json
@@ -0,0 +1,4 @@
+{
+ "message": {
+ }
+}
diff --git a/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.css b/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.css
new file mode 100644
index 0000000000..d2dd1fa806
--- /dev/null
+++ b/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.css
@@ -0,0 +1,43 @@
+/*
+ Copyright (c) 2022 Huawei Device Co., Ltd.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+.container {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+ height: 100%;
+}
+
+.divider-button {
+ flex-direction: row;
+ justify-content: space-around;
+ background-color: whitesmoke;
+}
+
+@media screen and (device-type: phone) or (orientation: portrait) {
+ .divider-button {
+ width: 10%;
+ height: 90%;
+ }
+}
+
+@media screen and (device-type: tablet) or (orientation: landscape) {
+ .divider-button {
+ width: 90%;
+ height: 10%;
+ }
+}
\ No newline at end of file
diff --git a/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.hml b/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.hml
new file mode 100644
index 0000000000..3668bde15a
--- /dev/null
+++ b/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.hml
@@ -0,0 +1,23 @@
+
+
+
+
+
diff --git a/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.js b/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.js
new file mode 100644
index 0000000000..6ba3538c9a
--- /dev/null
+++ b/resources/dialog_ui/divider_dialog_ui/js/pages/index/index.js
@@ -0,0 +1,49 @@
+/*
+ Copyright (c) 2022 Huawei Device Co., Ltd.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import router from '@ohos.router'
+import window from '@ohos.window';
+
+export default {
+ data: {
+ backgroundColor:"black"
+ },
+ onInit() {
+ callNativeHandler("EVENT_INIT", "");
+ },
+ onCancel() {
+ callNativeHandler("EVENT_CANCEL", "");
+ },
+ onExit() {
+ callNativeHandler("EVENT_CANCEL", "");
+ },
+ onExchange() {
+ },
+ onExchangeDoubleClick() {
+ console.info('double click exchange');
+ },
+ onFocus(){
+ this.backgroundColor = "black"
+ },
+ recoveryColor(){
+ this.backgroundColor = "gray"
+ },
+ onTouching(){
+ this.backgroundColor = "gray"
+ },
+ onTouchEnd(){
+ this.backgroundColor = "black"
+ }
+}
\ No newline at end of file
diff --git a/resources/media/BUILD.gn b/resources/media/BUILD.gn
new file mode 100644
index 0000000000..1f2b8c8524
--- /dev/null
+++ b/resources/media/BUILD.gn
@@ -0,0 +1,24 @@
+# Copyright (c) 2022 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import("//build/ohos.gni")
+
+ohos_prebuilt_etc("window_divider_image") {
+ source = "//foundation/windowmanager/resources/media/img/bg_split_handle.png"
+ part_name = "window_manager"
+ subsystem_name = "window"
+ relative_install_dir = "window/resources"
+}
+
+group("window_resources_media") {
+ deps = [ ":window_divider_image" ]
+}
diff --git a/resources/bg_split_handle.png b/resources/media/img/bg_split_handle.png
similarity index 100%
rename from resources/bg_split_handle.png
rename to resources/media/img/bg_split_handle.png
diff --git a/resources/starting_window.png b/resources/starting_window.png
deleted file mode 100644
index 835167cba8..0000000000
Binary files a/resources/starting_window.png and /dev/null differ
diff --git a/utils/include/wm_common_inner.h b/utils/include/wm_common_inner.h
index 798c67c863..92cd84b406 100644
--- a/utils/include/wm_common_inner.h
+++ b/utils/include/wm_common_inner.h
@@ -129,6 +129,7 @@ namespace {
constexpr uint32_t MIN_HORIZONTAL_SPLIT_WIDTH = 320;
constexpr uint32_t MAX_FLOATING_SIZE = 2560;
const std::string WINDOW_MANAGER_CONFIG_XML = "/system/etc/window/resources/window_manager_config.xml";
+ const Rect IVALID_EMPTY_RECT = {0, 0, 0, 0};
}
}
}
diff --git a/wm/src/window_impl.cpp b/wm/src/window_impl.cpp
index d66cab823d..12c563b8fd 100644
--- a/wm/src/window_impl.cpp
+++ b/wm/src/window_impl.cpp
@@ -2059,6 +2059,16 @@ void WindowImpl::SetDefaultOption()
property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
break;
}
+ case WindowType::WINDOW_TYPE_DOCK_SLICE: {
+ property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
+ property_->SetFocusable(false);
+ break;
+ }
+ case WindowType::WINDOW_TYPE_PLACE_HOLDER: {
+ AddWindowFlag(WindowFlag::WINDOW_FLAG_FORBID_SPLIT_MOVE);
+ property_->SetFocusable(false);
+ break;
+ }
default:
break;
}
diff --git a/wm/src/window_input_channel.cpp b/wm/src/window_input_channel.cpp
index c24aa856be..208bd9023f 100644
--- a/wm/src/window_input_channel.cpp
+++ b/wm/src/window_input_channel.cpp
@@ -59,6 +59,12 @@ void WindowInputChannel::HandlePointerEvent(std::shared_ptr&
return;
}
if (inputListener_ != nullptr) {
+ // divider window consumes pointer events directly
+ if (window_->GetType() == WindowType::WINDOW_TYPE_DOCK_SLICE) {
+ window_->ConsumePointerEvent(pointerEvent);
+ inputListener_->OnInputEvent(pointerEvent);
+ return;
+ }
int32_t action = pointerEvent->GetPointerAction();
if (action == MMI::PointerEvent::POINTER_ACTION_DOWN ||
action == MMI::PointerEvent::POINTER_ACTION_BUTTON_DOWN) {
diff --git a/wmserver/BUILD.gn b/wmserver/BUILD.gn
index b4c4bff3ca..d10c3a0911 100644
--- a/wmserver/BUILD.gn
+++ b/wmserver/BUILD.gn
@@ -35,35 +35,6 @@ config("libwms_config") {
defines += gpu_defines
}
-ohos_prebuilt_etc("window_divider_image") {
- source = "//foundation/windowmanager/resources/bg_split_handle.png"
- part_name = "window_manager"
- subsystem_name = "window"
- relative_install_dir = "window/resources"
-}
-
-ohos_prebuilt_etc("window_manager_config") {
- if (device_name == "rk3568") {
- source =
- "//foundation/windowmanager/resources/rk3568/window_manager_config.xml"
- install_enable = true
- } else {
- source =
- "//foundation/windowmanager/resources/other/window_manager_config.xml"
- install_enable = false
- }
- part_name = "window_manager"
- subsystem_name = "window"
- relative_install_dir = "window/resources"
-}
-
-ohos_prebuilt_etc("window_starting_image") {
- source = "//foundation/windowmanager/resources/starting_window.png"
- part_name = "window_manager"
- subsystem_name = "window"
- relative_install_dir = "window/resources"
-}
-
ohos_shared_library("libwms") {
sources = [
"../wm/src/zidl/window_manager_agent_proxy.cpp",
@@ -101,9 +72,7 @@ ohos_shared_library("libwms") {
configs = [ ":libwms_config" ]
deps = [
- ":window_divider_image",
- ":window_manager_config",
- ":window_starting_image",
+ "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
"//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
"//foundation/windowmanager/dm:libdm",
"//foundation/windowmanager/dmserver:libdms",
diff --git a/wmserver/include/display_group_controller.h b/wmserver/include/display_group_controller.h
index 63fb9a0963..84dfd2bc18 100644
--- a/wmserver/include/display_group_controller.h
+++ b/wmserver/include/display_group_controller.h
@@ -53,6 +53,7 @@ public:
const std::map& displayRectMap,
DisplayStateChangeType type);
sptr GetWindowPairByDisplayId(DisplayId displayId);
+ void SetInitalDividerRect(DisplayId displayId, const Rect& rect);
DisplayGroupWindowTree displayGroupWindowTree_;
std::map sysBarNodeMaps_;
diff --git a/wmserver/include/window_inner_manager.h b/wmserver/include/window_inner_manager.h
index 0ff8d089bb..3ab54045e1 100644
--- a/wmserver/include/window_inner_manager.h
+++ b/wmserver/include/window_inner_manager.h
@@ -1,85 +1,60 @@
-/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef OHOS_ROSEN_WINDOW_INNER_MANAGER_H
-#define OHOS_ROSEN_WINDOW_INNER_MANAGER_H
-
-#include
-#include
-#include
-#include
-#include
-#include "include/core/SkBitmap.h"
-#ifdef ACE_ENABLE_GL
-#include "render_context/render_context.h"
-#endif
-#include "transaction/rs_transaction.h"
-#include "ui/rs_surface_extractor.h"
-#include "wm_single_instance.h"
-#include "singleton_delegator.h"
-#include "window.h"
-#include "wm_common.h"
-
-namespace OHOS {
-namespace Rosen {
-enum class InnerWMCmd : uint32_t {
- INNER_WM_CREATE_DIVIDER,
- INNER_WM_DESTROY_DIVIDER,
- INNER_WM_DESTROY_THREAD,
-};
-
-struct WindowInnerMessage {
- InnerWMCmd cmdType;
- DisplayId displayId;
- Rect dividerRect;
-};
-
-class WindowInnerManager {
-WM_DECLARE_SINGLE_INSTANCE(WindowInnerManager);
-public:
- void Init();
- void SendMessage(InnerWMCmd cmdType, DisplayId displayId = 0);
-private:
- static inline SingletonDelegator delegator;
-
- void HandleMessage();
- sptr CreateWindow(DisplayId displayId, const WindowType& type, const Rect& rect);
- void CreateAndShowDivider(std::unique_ptr msg);
- void HideAndDestroyDivider(std::unique_ptr msg);
- void DestroyThread(std::unique_ptr msg);
- void DrawSurface(const sptr& window);
- void DrawColor(std::shared_ptr& rsSurface, uint32_t width, uint32_t height);
- void DrawBitmap(std::shared_ptr& rsSurface, uint32_t width, uint32_t height);
- sptr GetDividerWindow(DisplayId displayId) const;
- bool DecodeImageFile(const char* filename, SkBitmap& bitmap);
-
- std::mutex mutex_;
- std::condition_variable conVar_;
- bool ready_ = false;
-#ifdef ACE_ENABLE_GL
- std::unique_ptr renderContext_;
-#endif
- std::map> dividerMap_;
- std::vector> messages_;
- bool hasInitThread_ = false;
- bool needDestroyThread_ = false;
- bool isDividerImageLoaded_ = false;
- const char *splitIconPath_ = "/etc/window/resources/bg_split_handle.png";
- uint32_t DIVIDER_HANDLE_COLOR = 0xff808080; // gray
- SkBitmap dividerBitmap_;
-};
-}
-}
-#endif // OHOS_ROSEN_WINDOW_INNER_MANAGER_H
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ROSEN_WINDOW_INNER_MANAGER_H
+#define OHOS_ROSEN_WINDOW_INNER_MANAGER_H
+
+#include
+#include "event_handler.h"
+#include "event_runner.h"
+
+#include "wm_common.h"
+#include "wm_single_instance.h"
+
+namespace OHOS {
+namespace Rosen {
+class WindowInnerManager : public RefBase {
+WM_DECLARE_SINGLE_INSTANCE_BASE(WindowInnerManager);
+using EventRunner = OHOS::AppExecFwk::EventRunner;
+using EventHandler = OHOS::AppExecFwk::EventHandler;
+public:
+ void Start();
+ void Stop();
+ void CreateWindow(std::string name, WindowType type, Rect rect);
+ void DestroyWindow();
+public:
+ enum class InnerWMRunningState {
+ STATE_NOT_START,
+ STATE_RUNNING,
+ };
+ ~WindowInnerManager();
+
+private:
+ WindowInnerManager();
+ bool Init();
+ void HandleCreateWindow(std::string name, WindowType type, Rect rect);
+ void HandleDestroyWindow();
+
+private:
+ int32_t dialogId_ = -1;
+ std::shared_ptr eventHandler_;
+ std::shared_ptr eventLoop_;
+ InnerWMRunningState state_;
+ std::string dividerParams_ = "";
+ const std::string INNER_WM_THREAD_NAME = "inner_window_manager";
+};
+} // namespace Rosen
+} // namespace OHOS
+#endif // OHOS_ROSEN_WINDOW_INNER_MANAGER_H
\ No newline at end of file
diff --git a/wmserver/include/window_layout_policy.h b/wmserver/include/window_layout_policy.h
index 924515fc2f..1253fd58ad 100644
--- a/wmserver/include/window_layout_policy.h
+++ b/wmserver/include/window_layout_policy.h
@@ -52,6 +52,7 @@ public:
virtual void UpdateWindowNode(const sptr& node, bool isAddWindow = false);
virtual void UpdateLayoutRect(const sptr& node) = 0;
virtual void SetSplitDividerWindowRects(std::map dividerWindowRects) {};
+ virtual Rect GetInitalDividerRect(DisplayId displayId) const;
float GetVirtualPixelRatio(DisplayId displayId) const;
void UpdateClientRectAndResetReason(const sptr& node, const Rect& lastLayoutRect, const Rect& winRect);
Rect GetDisplayGroupRect() const;
@@ -101,6 +102,14 @@ protected:
WindowType::WINDOW_TYPE_STATUS_BAR,
WindowType::WINDOW_TYPE_NAVIGATION_BAR,
};
+ struct LayoutRects {
+ Rect primaryRect_;
+ Rect secondaryRect_;
+ Rect primaryLimitRect_;
+ Rect secondaryLimitRect_;
+ Rect dividerRect_;
+ Rect firstCascadeRect_;
+ };
sptr displayGroupInfo_;
mutable std::map limitRectMap_;
DisplayGroupWindowTree& displayGroupWindowTree_;
diff --git a/wmserver/include/window_layout_policy_cascade.h b/wmserver/include/window_layout_policy_cascade.h
index 858e307e7e..cc89f4409a 100644
--- a/wmserver/include/window_layout_policy_cascade.h
+++ b/wmserver/include/window_layout_policy_cascade.h
@@ -41,6 +41,7 @@ public:
void UpdateLayoutRect(const sptr& node) override;
void SetSplitDividerWindowRects(std::map dividerWindowRects) override;
void RemoveWindowNode(const sptr& node) override;
+ Rect GetInitalDividerRect(DisplayId displayId) const override;
private:
void InitAllRects();
@@ -70,7 +71,7 @@ private:
Rect dividerRect_;
Rect firstCascadeRect_;
};
- mutable std::map cascadeRectsMap_;
+ mutable std::map cascadeRectsMap_;
std::map restoringDividerWindowRects_;
};
}
diff --git a/wmserver/include/window_pair.h b/wmserver/include/window_pair.h
index 336c6c9901..f61a314b06 100644
--- a/wmserver/include/window_pair.h
+++ b/wmserver/include/window_pair.h
@@ -167,6 +167,8 @@ public:
*/
void SetAllAppWindowsRestoring(bool isAllAppWindowsRestoring);
+ void SetInitalDividerRect(const Rect& rect);
+
private:
/**
* Gets whether the window is related to split window.
@@ -207,14 +209,6 @@ private:
*/
void DumpPairInfo();
- /**
- * Send inner window message.
- *
- * @param cmd the message of inner window manager
- * @param displayId the id of target display
- */
- void SendInnerMessage(InnerWMCmd cmd, DisplayId displayId);
-
/**
* Find pairable window frome window trees.
*
@@ -248,6 +242,7 @@ private:
WindowPairStatus status_ = {WindowPairStatus::STATUS_EMPTY};
DisplayGroupWindowTree& displayGroupWindowTree_;
bool isAllAppWindowsRestoring_ { false };
+ Rect initalDivderRect_ {0, 0, 0, 0};
};
} // namespace Rosen
} // namespace OHOS
diff --git a/wmserver/include/window_zorder_policy.h b/wmserver/include/window_zorder_policy.h
index af41d1e82c..23f38d109c 100644
--- a/wmserver/include/window_zorder_policy.h
+++ b/wmserver/include/window_zorder_policy.h
@@ -38,6 +38,7 @@ private:
// main window
{ WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, 0 },
+ { WindowType::WINDOW_TYPE_PLACE_HOLDER, 0 },
// system-specific window
{ WindowType::WINDOW_TYPE_WALLPAPER, 0 },
diff --git a/wmserver/src/display_group_controller.cpp b/wmserver/src/display_group_controller.cpp
index 6e21e883b5..df29483bee 100644
--- a/wmserver/src/display_group_controller.cpp
+++ b/wmserver/src/display_group_controller.cpp
@@ -364,14 +364,12 @@ void DisplayGroupController::ProcessDisplayCreate(DisplayId displayId,
auto displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(displayId);
displayGroupInfo_->AddDisplayInfo(displayInfo);
- // create new window pair for split window
- auto windowPair = new WindowPair(displayId, displayGroupWindowTree_);
- windowPairMap_.insert(std::make_pair(displayId, windowPair));
-
// modify RSTree and window tree of displayGroup for cross-display nodes
ProcessCrossNodes(DisplayStateChangeType::CREATE);
UpdateDisplayGroupWindowTree();
windowNodeContainer_->GetLayoutPolicy()->ProcessDisplayCreate(displayId, displayRectMap);
+ Rect initialDividerRect = windowNodeContainer_->GetLayoutPolicy()->GetInitalDividerRect(displayId);
+ SetInitalDividerRect(displayId, initialDividerRect);
}
void DisplayGroupController::ProcessDisplayDestroy(DisplayId displayId,
@@ -440,5 +438,12 @@ sptr DisplayGroupController::GetWindowPairByDisplayId(DisplayId disp
}
return nullptr;
}
+
+void DisplayGroupController::SetInitalDividerRect(DisplayId displayId, const Rect& rect)
+{
+ if (windowPairMap_.find(displayId) != windowPairMap_.end()) {
+ windowPairMap_[displayId]->SetInitalDividerRect(rect);
+ }
+}
} // namespace Rosen
} // namespace OHOS
diff --git a/wmserver/src/window_inner_manager.cpp b/wmserver/src/window_inner_manager.cpp
index c77c6065a7..b8fe03b43b 100644
--- a/wmserver/src/window_inner_manager.cpp
+++ b/wmserver/src/window_inner_manager.cpp
@@ -1,303 +1,127 @@
-/*
- * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "window_inner_manager.h"
-
-#include
-
-#include "include/core/SkCanvas.h"
-#include "include/codec/SkCodec.h"
-#include "include/core/SkData.h"
-#include "include/core/SkImage.h"
-
-#include "vsync_station.h"
-#include "window_manager_hilog.h"
-#include "window_option.h"
-
-namespace OHOS {
-namespace Rosen {
-namespace {
- constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowInnerManager"};
-}
-
-WM_IMPLEMENT_SINGLE_INSTANCE(WindowInnerManager)
-
-bool WindowInnerManager::DecodeImageFile(const char* filename, SkBitmap& bitmap)
-{
- sk_sp data(SkData::MakeFromFileName(filename));
- std::unique_ptr codec = SkCodec::MakeFromData(std::move(data));
- if (codec == nullptr) {
- return false;
- }
- SkColorType colorType = kN32_SkColorType;
- SkImageInfo info = codec->getInfo().makeColorType(colorType);
- if (!bitmap.tryAllocPixels(info)) {
- return false;
- }
- return SkCodec::kSuccess == codec->getPixels(info, bitmap.getPixels(), bitmap.rowBytes());
-}
-
-void WindowInnerManager::DrawSurface(const sptr& window)
-{
- auto surfaceNode = window->GetSurfaceNode();
- auto winRect = window->GetRect();
- WLOGFI("SurfaceWindowDraw winRect, x : %{public}d, y : %{public}d, width: %{public}d, height: %{public}d",
- winRect.posX_, winRect.posY_, winRect.width_, winRect.height_);
-
- auto width = winRect.width_;
- auto height = winRect.height_;
-
- std::shared_ptr rsSurface = RSSurfaceExtractor::ExtractRSSurface(surfaceNode);
- if (rsSurface == nullptr) {
- WLOGFE("RSSurface is nullptr");
- return;
- }
-#ifdef ACE_ENABLE_GL
- rsSurface->SetRenderContext(renderContext_.get());
-#endif
- if (!isDividerImageLoaded_) {
- isDividerImageLoaded_ = DecodeImageFile(splitIconPath_, dividerBitmap_);
- }
- if (!dividerBitmap_.isNull() && dividerBitmap_.width() != 0 && dividerBitmap_.height() != 0) {
- DrawBitmap(rsSurface, width, height);
- } else {
- DrawColor(rsSurface, width, height);
- }
-}
-
-void WindowInnerManager::DrawBitmap(std::shared_ptr& rsSurface, uint32_t width, uint32_t height)
-{
- std::unique_ptr frame = rsSurface->RequestFrame(width, height);
- if (frame == nullptr) {
- WLOGFE("DrawBitmap frameptr is nullptr");
- return;
- }
- auto canvas = frame->GetCanvas();
- if (canvas == nullptr) {
- WLOGFE("DrawBitmap canvas is nullptr");
- return;
- }
- canvas->clear(SK_ColorTRANSPARENT);
- SkPaint paint;
- SkMatrix matrix;
- SkRect rect;
- rect.set(0, 0, static_cast(width), static_cast(height));
- if (dividerBitmap_.width() != 0 && dividerBitmap_.height() != 0) {
- if (width > height) {
- // rotate when divider is horizontal
- matrix.setScale(static_cast(height) / dividerBitmap_.width(),
- static_cast(width) / dividerBitmap_.height());
- matrix.postRotate(-90.0f); // divider shader rotate -90.0
- } else {
- matrix.setScale(static_cast(width) / dividerBitmap_.width(),
- static_cast(height) / dividerBitmap_.height());
- }
- }
- paint.setShader(dividerBitmap_.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat));
- if (paint.getShader() == nullptr) {
- WLOGFE("DrawBitmap shader is nullptr");
- return;
- }
- paint.setShader(paint.getShader()->makeWithLocalMatrix(matrix));
- canvas->drawRect(rect, paint);
- frame->SetDamageRegion(0, 0, width, height);
- rsSurface->FlushFrame(frame);
-}
-
-void WindowInnerManager::DrawColor(std::shared_ptr& rsSurface, uint32_t width, uint32_t height)
-{
- std::unique_ptr frame = rsSurface->RequestFrame(width, height);
- if (frame == nullptr) {
- WLOGFE("DrawColor frameptr is nullptr");
- return;
- }
- auto canvas = frame->GetCanvas();
- if (canvas == nullptr) {
- WLOGFE("DrawColor canvas is nullptr");
- return;
- }
- canvas->clear(SK_ColorTRANSPARENT);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setStyle(SkPaint::kFill_Style);
- const SkScalar skWidth = 20; // stroke width is 20.
- paint.setStrokeWidth(skWidth);
- paint.setStrokeJoin(SkPaint::kRound_Join);
- paint.setColor(DIVIDER_HANDLE_COLOR);
-
- SkPoint rectPts[] = { {0, 0}, {static_cast(width), static_cast(height)} };
- SkRect rect;
- rect.set(rectPts[0], rectPts[1]);
-
- canvas->drawRect(rect, paint);
- frame->SetDamageRegion(0, 0, width, height);
- rsSurface->FlushFrame(frame);
- return;
-}
-
-sptr WindowInnerManager::GetDividerWindow(DisplayId displayId) const
-{
- auto iter = dividerMap_.find(displayId);
- if (iter == dividerMap_.end()) {
- return nullptr;
- }
- return iter->second;
-}
-
-sptr WindowInnerManager::CreateWindow(DisplayId displayId, const WindowType& type, const Rect& rect)
-{
- sptr window = GetDividerWindow(displayId);
- if (window == nullptr) {
- sptr divWindowOp = new (std::nothrow) WindowOption();
- if (divWindowOp == nullptr) {
- WLOGFE("Window option is nullptr.");
- return nullptr;
- }
- divWindowOp->SetWindowRect(rect);
- divWindowOp->SetWindowType(type);
- divWindowOp->SetFocusable(false);
- divWindowOp->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
- window = Window::Create("divider" + std::to_string(displayId), divWindowOp);
- if (window == nullptr) {
- WLOGFE("Window is nullptr.");
- return nullptr;
- }
- dividerMap_.insert(std::make_pair(displayId, window));
- WLOGFI("CreateWindow success.");
- }
- return window;
-}
-
-void WindowInnerManager::CreateAndShowDivider(std::unique_ptr msg)
-{
- auto window = CreateWindow(msg->displayId, WindowType::WINDOW_TYPE_DOCK_SLICE, msg->dividerRect);
- if (window == nullptr) {
- return;
- }
-
- WMError res = window->Show();
- if (res != WMError::WM_OK) {
- WLOGFE("Show window failed");
- return;
- }
-
-#ifdef ACE_ENABLE_GL
- if (renderContext_ == nullptr) {
- renderContext_ = std::make_unique();
- renderContext_->InitializeEglContext();
- }
-#endif
- DrawSurface(window);
- WLOGFI("CreateAndShowDivider success");
-}
-
-void WindowInnerManager::HideAndDestroyDivider(std::unique_ptr msg)
-{
- sptr window = GetDividerWindow(msg->displayId);
- if (window == nullptr) {
- WLOGFE("Window is nullptr");
- return;
- }
- WMError res = window->Hide();
- if (res != WMError::WM_OK) {
- WLOGFE("Hide window failed");
- return;
- }
- res = window->Destroy();
- if (res != WMError::WM_OK) {
- WLOGFE("Destroy window failed");
- return;
- }
- dividerMap_.erase(msg->displayId);
- WLOGFI("HideAndDestroyDivider success");
-}
-
-void WindowInnerManager::DestroyThread(std::unique_ptr msg)
-{
- hasInitThread_ = false;
- needDestroyThread_ = true;
- isDividerImageLoaded_ = false;
- WLOGFI("DestroyThread success");
-}
-
-void WindowInnerManager::HandleMessage()
-{
- WLOGFI("HandleMessage");
- std::vector> handleMsgs;
- while (!needDestroyThread_) {
- // lock to store massages
- {
- std::unique_lock lk(mutex_);
- conVar_.wait(lk, [this] { return ready_; });
- for (auto& iter: messages_) {
- handleMsgs.push_back(std::move(iter));
- }
- messages_.clear();
- ready_ = false;
- }
- // loop to handle massages
- for (auto& msg : handleMsgs) {
- if (!msg) {
- continue;
- }
- auto cmdType = msg->cmdType;
- using Func_t = void(WindowInnerManager::*)(std::unique_ptr winMsg);
- static const std::map funcMap = {
- std::make_pair(InnerWMCmd::INNER_WM_CREATE_DIVIDER, &WindowInnerManager::CreateAndShowDivider),
- std::make_pair(InnerWMCmd::INNER_WM_DESTROY_DIVIDER, &WindowInnerManager::HideAndDestroyDivider),
- std::make_pair(InnerWMCmd::INNER_WM_DESTROY_THREAD, &WindowInnerManager::DestroyThread)};
- auto it = funcMap.find(cmdType);
- if (it != funcMap.end()) {
- (this->*(it->second))(std::move(msg));
- }
- }
- handleMsgs.clear();
- }
-}
-
-void WindowInnerManager::SendMessage(InnerWMCmd cmdType, DisplayId displayId)
-{
- std::unique_lock lk(mutex_);
- if (!hasInitThread_) {
- WLOGFI("Inner window manager thread has not been created");
- return;
- }
- std::unique_ptr winMsg = std::make_unique();
- if (!winMsg) {
- WLOGFI("alloc winMsg failed");
- return;
- }
- winMsg->cmdType = cmdType;
- winMsg->displayId = displayId;
- WLOGFI("SendMessage : displayId = %{public}" PRIu64", type = %{public}d",
- winMsg->displayId, static_cast(cmdType));
- messages_.push_back(std::move(winMsg));
- ready_ = true;
- conVar_.notify_one();
-}
-
-void WindowInnerManager::Init()
-{
- std::unique_lock lk(mutex_);
- needDestroyThread_ = false;
- // create inner thread
- std::thread innerWMThread(&WindowInnerManager::HandleMessage, this);
- innerWMThread.detach();
- hasInitThread_ = true;
- VsyncStation::GetInstance().SetIsMainHandlerAvailable(false);
- WLOGFI("Inner window manager thread create success");
-}
-}
-}
\ No newline at end of file
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "window_inner_manager.h"
+
+#include "ui_service_mgr_client.h"
+#include "window_manager_hilog.h"
+#include "window.h"
+
+namespace OHOS {
+namespace Rosen {
+namespace {
+ constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowInnerManager"};
+}
+WM_IMPLEMENT_SINGLE_INSTANCE(WindowInnerManager)
+
+WindowInnerManager::WindowInnerManager() : eventHandler_(nullptr), eventLoop_(nullptr),
+ state_(InnerWMRunningState::STATE_NOT_START)
+{
+}
+
+WindowInnerManager::~WindowInnerManager()
+{
+ Stop();
+}
+
+bool WindowInnerManager::Init()
+{
+ eventLoop_ = AppExecFwk::EventRunner::Create(INNER_WM_THREAD_NAME);
+ if (eventLoop_ == nullptr) {
+ return false;
+ }
+ eventHandler_ = std::make_shared(eventLoop_);
+ if (eventHandler_ == nullptr) {
+ return false;
+ }
+ WLOGFI("init window inner manager service success.");
+ return true;
+}
+
+void WindowInnerManager::Start()
+{
+ if (state_ == InnerWMRunningState::STATE_RUNNING) {
+ WLOGFI("window inner manager service has already started.");
+ }
+ if (!Init()) {
+ WLOGFI("failed to init window inner manager service.");
+ return;
+ }
+ state_ = InnerWMRunningState::STATE_RUNNING;
+ eventLoop_->Run();
+ WLOGFI("window inner manager service start success.");
+}
+
+void WindowInnerManager::Stop()
+{
+ WLOGFI("stop window inner manager service.");
+ if (eventLoop_ != nullptr) {
+ eventLoop_->Stop();
+ eventLoop_.reset();
+ }
+ if (eventHandler_ != nullptr) {
+ eventHandler_.reset();
+ }
+ state_ = InnerWMRunningState::STATE_NOT_START;
+}
+
+void WindowInnerManager::HandleCreateWindow(std::string name, WindowType type, Rect rect)
+{
+ auto dialogCallback = [this](int32_t id, const std::string& event, const std::string& params) {
+ if (params == "EVENT_CANCLE_CODE") {
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id);
+ }
+ };
+ Ace::UIServiceMgrClient::GetInstance()->ShowDialog(name, dividerParams_, type,
+ rect.posX_, rect.posY_, rect.width_, rect.height_, dialogCallback, &dialogId_);
+ WLOGFI("create inner window id: %{public}d succes", dialogId_);
+ return;
+}
+
+void WindowInnerManager::HandleDestroyWindow()
+{
+ if (dialogId_ == -1) {
+ return;
+ }
+ WLOGFI("destroy inner window id:: %{public}d.", dialogId_);
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(dialogId_);
+ dialogId_ = -1;
+ return;
+}
+
+void WindowInnerManager::CreateWindow(std::string name, WindowType type, Rect rect)
+{
+ if (dialogId_ != -1) {
+ return;
+ }
+ eventHandler_->PostTask([this, name, type, rect]() {
+ HandleCreateWindow(name, type, rect);
+ });
+ return;
+}
+
+void WindowInnerManager::DestroyWindow()
+{
+ if (dialogId_ == -1) {
+ WLOGFI("inner window has destroyed.");
+ return;
+ }
+ eventHandler_->PostTask([this]() {
+ HandleDestroyWindow();
+ });
+ return;
+}
+} // Rosen
+} // OHOS
\ No newline at end of file
diff --git a/wmserver/src/window_layout_policy.cpp b/wmserver/src/window_layout_policy.cpp
index 8c680c8a7b..f942df77b5 100644
--- a/wmserver/src/window_layout_policy.cpp
+++ b/wmserver/src/window_layout_policy.cpp
@@ -931,5 +931,10 @@ void WindowLayoutPolicy::SetFloatingWindowLimitsConfig(const FloatingWindowLimit
{
floatingWindowLimitsConfig_ = floatingWindowLimitsConfig;
}
+
+Rect WindowLayoutPolicy::GetInitalDividerRect(DisplayId displayId) const
+{
+ return IVALID_EMPTY_RECT;
+}
}
}
diff --git a/wmserver/src/window_layout_policy_cascade.cpp b/wmserver/src/window_layout_policy_cascade.cpp
index d0bbba6011..3bc081a01e 100644
--- a/wmserver/src/window_layout_policy_cascade.cpp
+++ b/wmserver/src/window_layout_policy_cascade.cpp
@@ -30,7 +30,7 @@ WindowLayoutPolicyCascade::WindowLayoutPolicyCascade(const sptr& node)
node->SetRequestRect(restoringDividerWindowRects_[displayId]);
}
restoringDividerWindowRects_.erase(displayId);
+ } else if (node->GetWindowType() == WindowType::WINDOW_TYPE_PLACE_HOLDER) {
+ Rect placeHolderRect = node->GetWindowMode() == WindowMode::WINDOW_MODE_SPLIT_PRIMARY ?
+ cascadeRectsMap_[node->GetDisplayId()].primaryLimitRect_ :
+ cascadeRectsMap_[node->GetDisplayId()].secondaryLimitRect_;
+ node->SetRequestRect(placeHolderRect); // init place holder window
}
UpdateWindowNode(node, true); // currently, update and add do the same process
}
@@ -530,5 +535,13 @@ void WindowLayoutPolicyCascade::SetCascadeRect(const sptr& node)
node->SetRequestRect(rect);
node->SetDecoStatus(true);
}
+Rect WindowLayoutPolicyCascade::GetInitalDividerRect(DisplayId displayId) const
+{
+ Rect dividerRect = {0, 0, 0, 0};
+ if (cascadeRectsMap_.find(displayId) != std::end(cascadeRectsMap_)) {
+ dividerRect = cascadeRectsMap_[displayId].dividerRect_;
+ }
+ return dividerRect;
+}
} // Rosen
} // OHOS
diff --git a/wmserver/src/window_manager_service.cpp b/wmserver/src/window_manager_service.cpp
index 074633675f..59c778d3ba 100644
--- a/wmserver/src/window_manager_service.cpp
+++ b/wmserver/src/window_manager_service.cpp
@@ -68,7 +68,7 @@ void WindowManagerService::OnStart()
if (!Init()) {
return;
}
- SingletonContainer::Get().Init();
+ WindowInnerManager::GetInstance().Start();
sptr listener = new DisplayChangeListener();
DisplayManagerServiceInner::GetInstance().RegisterDisplayChangeListener(listener);
RegisterSnapshotHandler();
@@ -256,7 +256,7 @@ void WindowManagerService::ConfigureWindowManagerService()
void WindowManagerService::OnStop()
{
- SingletonContainer::Get().SendMessage(InnerWMCmd::INNER_WM_DESTROY_THREAD);
+ WindowInnerManager::GetInstance().Stop();
WLOGFI("ready to stop service.");
}
diff --git a/wmserver/src/window_node_container.cpp b/wmserver/src/window_node_container.cpp
index e39450fee7..64c042456e 100644
--- a/wmserver/src/window_node_container.cpp
+++ b/wmserver/src/window_node_container.cpp
@@ -61,6 +61,8 @@ WindowNodeContainer::WindowNodeContainer(const sptr& displayInfo, S
layoutPolicy_ = layoutPolicys_[WindowLayoutMode::CASCADE];
layoutPolicy_->Launch();
+ Rect initalDividerRect = layoutPolicys_[WindowLayoutMode::CASCADE]->GetInitalDividerRect(displayId);
+ displayGroupController_->SetInitalDividerRect(displayId, initalDividerRect);
// init avoidAreaController
UpdateAvoidAreaFunc func = std::bind(&WindowNodeContainer::OnAvoidAreaChange, this,
std::placeholders::_1, std::placeholders::_2);
diff --git a/wmserver/src/window_pair.cpp b/wmserver/src/window_pair.cpp
index 37becea566..61000e6d2a 100644
--- a/wmserver/src/window_pair.cpp
+++ b/wmserver/src/window_pair.cpp
@@ -22,6 +22,8 @@
#include "window_helper.h"
#include "wm_trace.h"
+#include "window_inner_manager.h"
+
namespace OHOS {
namespace Rosen {
namespace {
@@ -39,13 +41,6 @@ WindowPair::~WindowPair()
Clear();
}
-void WindowPair::SendInnerMessage(InnerWMCmd cmd, DisplayId displayId)
-{
- WLOGI("Send inner message cmd id: %{public}u display id: %{public}u.", static_cast(cmd),
- static_cast(displayId));
- SingletonContainer::Get().SendMessage(cmd, displayId);
-}
-
void WindowPair::SendBroadcastMsg(sptr& node)
{
if (node == nullptr) {
@@ -171,7 +166,7 @@ void WindowPair::Clear()
primary_ = nullptr;
secondary_ = nullptr;
if (divider_ != nullptr) {
- SendInnerMessage(InnerWMCmd::INNER_WM_DESTROY_DIVIDER, displayId_);
+ WindowInnerManager::GetInstance().DestroyWindow();
divider_ = nullptr;
}
status_ = WindowPairStatus::STATUS_EMPTY;
@@ -329,7 +324,8 @@ void WindowPair::UpdateWindowPairStatus()
prevStatus == WindowPairStatus::STATUS_SINGLE_SECONDARY || prevStatus == WindowPairStatus::STATUS_EMPTY) &&
status_ == WindowPairStatus::STATUS_PAIRING) {
// create divider
- SendInnerMessage(InnerWMCmd::INNER_WM_CREATE_DIVIDER, displayId_);
+ WindowInnerManager::GetInstance().CreateWindow("dialog_divider_ui", WindowType::WINDOW_TYPE_DOCK_SLICE,
+ initalDivderRect_);
} else if ((prevStatus == WindowPairStatus::STATUS_PAIRED_DONE || prevStatus == WindowPairStatus::STATUS_PAIRING) &&
(status_ != WindowPairStatus::STATUS_PAIRED_DONE && status_ != WindowPairStatus::STATUS_PAIRING)) {
// clear pair
@@ -452,5 +448,10 @@ void WindowPair::SetAllAppWindowsRestoring(bool isAllAppWindowsRestoring)
{
isAllAppWindowsRestoring_ = isAllAppWindowsRestoring;
}
+
+void WindowPair::SetInitalDividerRect(const Rect& rect)
+{
+ initalDivderRect_ = rect;
+}
} // namespace Rosen
} // namespace OHOS
\ No newline at end of file