From 6d11d35f86649511e6a5b4b8ab6b6ae13cb4d556 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Thu, 2 Aug 2018 15:34:24 +0900 Subject: Fix source rectangle changes every state change Window Manager changes source rectangle size every state change. This patch changes it to set source rectangle first when the surface is created. Related commit: https://gerrit.automotivelinux.org/gerrit/#/c/15595/ Bug-AGL: SPEC-1584 Change-Id: Ia7429956053cfa18e6e82060f84f3b6fe755c0b1 Signed-off-by: Kazumasa Mitsunari --- src/controller_hooks.hpp | 3 +-- src/wayland_ivi_wm.cpp | 6 ++++++ src/wayland_ivi_wm.hpp | 1 + src/window_manager.cpp | 9 +++++---- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/controller_hooks.hpp b/src/controller_hooks.hpp index f259089..dd0a3aa 100644 --- a/src/controller_hooks.hpp +++ b/src/controller_hooks.hpp @@ -28,10 +28,9 @@ class WindowManager; struct controller_hooks { - WindowManager *app; + WindowManager *wmgr; void surface_created(uint32_t surface_id); - void surface_removed(uint32_t surface_id); void surface_visibility(uint32_t surface_id, uint32_t v); void surface_destination_rectangle(uint32_t surface_id, uint32_t x, uint32_t y, uint32_t w, uint32_t h); diff --git a/src/wayland_ivi_wm.cpp b/src/wayland_ivi_wm.cpp index 522295d..2a27d8c 100644 --- a/src/wayland_ivi_wm.cpp +++ b/src/wayland_ivi_wm.cpp @@ -536,6 +536,11 @@ void controller::create_screen(struct wl_output *output) this->screen = std::make_unique(0, this, output); } +void controller::get_surface_properties(uint32_t surface_id, int param) +{ + ivi_wm_surface_get(this->proxy.get(), surface_id, param); +} + void controller::layer_created(uint32_t id) { HMI_DEBUG("wm", "compositor::controller @ %p layer %u (%x)", this->proxy.get(), id, id); @@ -596,6 +601,7 @@ void controller::surface_size_changed(uint32_t id, int32_t width, HMI_DEBUG("wm", "compositor::surface %s @ %d w %i h %i", __func__, id, width, height); this->sprops[id].size = size{uint32_t(width), uint32_t(height)}; + this->surfaces[id]->set_source_rectangle(0, 0, width, height); } void controller::surface_added_to_layer(uint32_t layer_id, uint32_t surface_id) diff --git a/src/wayland_ivi_wm.hpp b/src/wayland_ivi_wm.hpp index d6b47af..d75caae 100644 --- a/src/wayland_ivi_wm.hpp +++ b/src/wayland_ivi_wm.hpp @@ -290,6 +290,7 @@ struct controller : public wayland_proxy void layer_create(uint32_t id, int32_t w, int32_t h); void surface_create(uint32_t id); void create_screen(struct wl_output *output); + void get_surface_properties(uint32_t surface_id, int param = 0); // Events void surface_visibility_changed(uint32_t id, int32_t visibility); diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 98ebcf1..c57ab09 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -576,6 +576,8 @@ void WindowManager::send_event(char const *evname, char const *label, char const */ void WindowManager::surface_created(uint32_t surface_id) { + this->controller->get_surface_properties(surface_id, IVI_WM_PARAM_SIZE); + auto layer_id = this->layers.get_layer_id(surface_id); if (!layer_id) { @@ -738,8 +740,6 @@ void WindowManager::surface_set_layout(int surface_id, const std::string& area) layer_id); // set destination to the display rectangle - s->set_source_rectangle(0, 0, w, h); - this->layout_commit(); s->set_destination_rectangle(x, y, w, h); // update area information @@ -1288,6 +1288,7 @@ WMError WindowManager::doEndDraw(unsigned req_num) HMI_SEQ_DEBUG(req_num, "visible %s", act.role.c_str()); //this->lm_enddraw(act.role.c_str()); } + this->layout_commit(); // Change current state this->changeCurrentState(req_num); @@ -1767,12 +1768,12 @@ const char* WindowManager::kDefaultOldRoleDb = "{ \ */ void controller_hooks::surface_created(uint32_t surface_id) { - this->app->surface_created(surface_id); + this->wmgr->surface_created(surface_id); } void controller_hooks::surface_removed(uint32_t surface_id) { - this->app->surface_removed(surface_id); + this->wmgr->surface_removed(surface_id); } void controller_hooks::surface_visibility(uint32_t /*surface_id*/, -- cgit 1.2.3-korg