diff --git a/wayland_adapter/framework/BUILD.gn b/wayland_adapter/framework/BUILD.gn index b4117363f1d38d50b922b6c07a560c22c7c3c379..b8feb357f14efd10c284f6c3957d8f59daa68dd5 100644 --- a/wayland_adapter/framework/BUILD.gn +++ b/wayland_adapter/framework/BUILD.gn @@ -44,7 +44,6 @@ ft_source_set("wayland_framewok_sources") { } deps = [ - "$window_manager_path/dm/ft_build:libdm", "$window_manager_path/wm/ft_build:libwm", "$display_server_root/rosen/modules/render_service_base/ft_build:librender_service_base", "$display_server_root/rosen/modules/render_service_client/ft_build:librender_service_client", diff --git a/wayland_adapter/framework/core/wayland_surface.cpp b/wayland_adapter/framework/core/wayland_surface.cpp index 4f09be3eb2c16b4fe732fa2cbbbd6f719a5d331e..a5103fb51cb9a89e17b318b59ec81fc925a7d3b2 100644 --- a/wayland_adapter/framework/core/wayland_surface.cpp +++ b/wayland_adapter/framework/core/wayland_surface.cpp @@ -17,7 +17,6 @@ #include "wayland_objects_pool.h" #include "ui/rs_surface_extractor.h" -#include "display_manager.h" namespace FT { namespace Wayland { @@ -241,10 +240,6 @@ void WaylandSurface::HandleCommit() { void WaylandSurface::CreateWindow() { OHOS::sptr option(new OHOS::Rosen::WindowOption()); - if (rect_.width == 0 || rect_.height == 0) { - InitWindowRect(); - } - option->SetWindowRect({rect_.x, rect_.y, rect_.width, rect_.height}); option->SetWindowType(OHOS::Rosen::WindowType::APP_MAIN_WINDOW_BASE); option->SetWindowMode(OHOS::Rosen::WindowMode::WINDOW_MODE_FLOATING); @@ -274,6 +269,14 @@ void WaylandSurface::CreateWindow() renderContext_->InitializeEglContext(); rsSurface_->SetRenderContext(renderContext_.get()); #endif + + OHOS::Rosen::Rect rect = window_->GetRect(); + rect_.width = rect.width_; + rect_.height = rect.height_; + + for (auto &cb : rectCallbacks_) { + cb(rect_); + } } void WaylandSurface::CopyBuffer(struct wl_shm_buffer *shm) @@ -323,16 +326,5 @@ void WaylandSurface::CopyBuffer(struct wl_shm_buffer *shm) canvas->drawBitmap(srcBitmap, 0, 0); rsSurface_->FlushFrame(framePtr); } - -void WaylandSurface::InitWindowRect() -{ - auto display = OHOS::Rosen::DisplayManager::GetInstance().GetDefaultDisplay(); - rect_.width = display->GetWidth(); - rect_.height = display->GetHeight(); - - for (auto &cb : rectCallbacks_) { - cb(rect_); - } -} } // namespace Wayland } // namespace FT diff --git a/wayland_adapter/framework/core/wayland_surface.h b/wayland_adapter/framework/core/wayland_surface.h index e56b03f499fb15aa397c35de1cf4963f38f5c709..c7d81f4cb228ebb2b6d7e04420d6b54d5fe84874 100644 --- a/wayland_adapter/framework/core/wayland_surface.h +++ b/wayland_adapter/framework/core/wayland_surface.h @@ -72,7 +72,6 @@ private: void HandleCommit(); void CreateWindow(); void CopyBuffer(struct wl_shm_buffer *shm); - void InitWindowRect(); struct wl_resource *parent_ = nullptr; std::list commitCallbacks_;