Fix source rectangle changes every state change 21/15921/1
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Thu, 2 Aug 2018 06:34:24 +0000 (15:34 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Thu, 2 Aug 2018 06:38:25 +0000 (15:38 +0900)
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 <knimitz@witz-inc.co.jp>
src/controller_hooks.hpp
src/wayland_ivi_wm.cpp
src/wayland_ivi_wm.hpp
src/window_manager.cpp

index f259089..dd0a3aa 100644 (file)
@@ -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);
index 522295d..2a27d8c 100644 (file)
@@ -536,6 +536,11 @@ void controller::create_screen(struct wl_output *output)
     this->screen = std::make_unique<struct screen>(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)
index d6b47af..d75caae 100644 (file)
@@ -290,6 +290,7 @@ struct controller : public wayland_proxy<struct ivi_wm>
     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);
index 98ebcf1..c57ab09 100644 (file)
@@ -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*/,