Change active/inactive state spec 35/19835/1
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 4 Feb 2019 08:30:56 +0000 (17:30 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 4 Feb 2019 08:30:56 +0000 (17:30 +0900)
"active" state means "visible" on source code currently.
Specification in HMI-FW spec 0.9.2 says it's not visible.
https://wiki.automotivelinux.org/hmiframework

It's the right to have resources such as buffers(surface).
But from the view point of implementation of windowmanager-service,
it is difficult to control resources of application.
So this patch fixes just adding the methods to change
the state of client.

Change-Id: If445af3cdf724827ccf28f40af28cca4a2ffcbc1
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/window_manager.cpp
src/wm_client.cpp
src/wm_client.hpp

index abd4552..4fcab5f 100644 (file)
@@ -804,7 +804,6 @@ WMError WindowManager::startTransition(unsigned req_num)
         for (const auto &x : actions)
         {
             this->lc->visibilityChange(x);
-            x.client->emitActive(false);
             x.client->emitVisible(false);
         }
         this->lc->renderLayers();
@@ -841,8 +840,6 @@ WMError WindowManager::doEndDraw(unsigned req_num)
                 return ret;
             }
             ret = this->lc->visibilityChange(act);
-
-            act.client->emitActive((act.visible == VISIBLE));
             act.client->emitVisible((act.visible == VISIBLE));
 
             if (ret != WMError::SUCCESS)
index ff08a00..d3f0364 100644 (file)
@@ -72,6 +72,8 @@ WMClient::WMClient(const string &appid, const string &role)
     : id(appid),
       layer(0),
       is_source_set(false),
+      is_active(false),
+      main_role(role),
       role2surface(0),
       evname2afb_event(0)
 {
@@ -90,6 +92,8 @@ WMClient::WMClient(const string &appid, const string &role)
 WMClient::WMClient(const string &appid, unsigned layer, const string &role)
     : id(appid),
       layer(layer),
+      is_source_set(false),
+      is_active(false),
       main_role(role),
       role2surface(0),
       evname2afb_event(0)
@@ -131,6 +135,20 @@ void WMClient::registerSurface(unsigned surface)
     this->surface = surface;
 }
 
+void WMClient::activate()
+{
+    if(!this->isActive())
+        this->emitActive(true); // emit when state is changed
+    this->is_active = true;
+}
+
+void WMClient::deactivate()
+{
+    if(this->isActive())
+        this->emitActive(false); // emit when state is changed
+    this->is_active = false;
+}
+
 /**
  * Add surface to the client
  *
index 3ffa786..17d2221 100644 (file)
@@ -48,11 +48,14 @@ class WMClient
     unsigned layerID() const;
     unsigned surfaceID() const;
     void registerSurface(unsigned surface);
+    void activate();
+    void deactivate();
     std::string area() const {return this->app_area;};
     void setArea(const std::string area) {this->app_area = area;}
     WMError addSurface(unsigned surface);
     bool isSourceSizeSet();
     void setSurfaceSizeCorrectly();
+    bool isActive() { return this->is_active;}
     bool removeSurfaceIfExist(unsigned surface);
 
     bool subscribe(afb_req_t req, const std::string &event_name);
@@ -68,6 +71,7 @@ class WMClient
     std::string id;
     unsigned layer;
     bool is_source_set;
+    bool is_active;
     std::string main_role;
     std::string app_area;
     unsigned surface; // currently, main application has only one surface.