Merge changes from topic '15921'
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Thu, 2 Aug 2018 16:14:39 +0000 (16:14 +0000)
committerGerrit Code Review <gerrit@automotivelinux.org>
Thu, 2 Aug 2018 16:14:39 +0000 (16:14 +0000)
* changes:
  Fix WM attach layers to different screen.
  Fix source rectangle changes every state change

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 f64ec03..8b04c64 100644 (file)
@@ -531,6 +531,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);
@@ -591,6 +596,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 a430927..b515a06 100644 (file)
@@ -292,6 +292,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 c44210f..aa42d82 100644 (file)
@@ -184,12 +184,12 @@ int WindowManager::init()
 
             // This protocol needs the output, so lets just add our mapping here...
             this->controller->add_proxy_to_id_mapping(
-                this->outputs.back()->proxy.get(),
+                this->outputs.front()->proxy.get(),
                 wl_proxy_get_id(reinterpret_cast<struct wl_proxy *>(
-                    this->outputs.back()->proxy.get())));
+                    this->outputs.front()->proxy.get())));
 
             // Create screen
-            this->controller->create_screen(this->outputs.back()->proxy.get());
+            this->controller->create_screen(this->outputs.front()->proxy.get());
 
             // Set display to controller
             this->controller->display = this->display;
@@ -574,6 +574,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)
     {
@@ -742,8 +744,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
@@ -1292,6 +1292,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);
@@ -1771,12 +1772,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*/,