diff options
author | 2018-08-30 21:00:53 +0900 | |
---|---|---|
committer | 2018-08-30 21:00:53 +0900 | |
commit | 3a9996eb359accdbadb0e5eaa5259c910b7ae46a (patch) | |
tree | 8a02d9eec6e010dceb3c375620a6e11d53dcaaa9 /src | |
parent | 59844dbc6fd2676d69cba702a9c43ffbc625a5d5 (diff) |
temporary change
Change-Id: I48618fd00e607176c95b4e3950fca7dbb058a3b1
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r-- | src/request.hpp | 3 | ||||
-rw-r--r-- | src/window_manager.cpp | 19 | ||||
-rw-r--r-- | src/wm_layer_control.cpp | 105 | ||||
-rw-r--r-- | src/wm_layer_control.hpp | 7 |
4 files changed, 123 insertions, 11 deletions
diff --git a/src/request.hpp b/src/request.hpp index 6b2bda1..84973de 100644 --- a/src/request.hpp +++ b/src/request.hpp @@ -19,6 +19,7 @@ #include <string> #include <vector> +#include <memory> namespace wm { @@ -52,6 +53,8 @@ struct WMAction std::string area; TaskVisible visible; bool end_draw_finished; + std::shared_ptr<WMAction> client; + unsigned req_num; }; struct WMRequest diff --git a/src/window_manager.cpp b/src/window_manager.cpp index ea3c794..95b0d5a 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -470,14 +470,11 @@ void WindowManager::api_activate_surface(char const *appid, char const *drawing_ } auto client = g_app_list.lookUpClient(id); - unsigned srfc = client->surfaceID(role); - if(srfc == 0) - { - HMI_ERROR("role sould be set with surface"); - reply("role sould be set with surface"); - return; - } - g_app_list.removeFloatingSurface(client->surfaceID()); + // unsigned srfc = client->surfaceID(role); + // unsigned layer = client->layerID(); + + // g_app_list.removeFloatingSurface(client->surfaceID()); + // g_app_list.removeFloatingSurface(client); Task task = Task::TASK_ALLOCATE; unsigned req_num = 0; @@ -1321,14 +1318,14 @@ WMError WindowManager::doEndDraw(unsigned req_num) if(!g_app_list.contains(act.appid)){ ret = WMError::NOT_REGISTERED; } - ret = this->layoutChange(act); + ret = this->lc->layoutChange(act); if(ret != WMError::SUCCESS) { HMI_SEQ_WARNING(req_num, "Failed to manipulate surfaces while state change : %s", errorDescription(ret)); return ret; } - ret = this->visibilityChange(act); + ret = this->lc->visibilityChange(act); if (ret != WMError::SUCCESS) { HMI_SEQ_WARNING(req_num, @@ -1339,7 +1336,7 @@ WMError WindowManager::doEndDraw(unsigned req_num) //this->lc_enddraw(act.role.c_str()); } } - this->layout_commit(); + this->lc->commitChange(); HMI_SEQ_INFO(req_num, "emit flushDraw"); diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp index 9c60286..3f39d65 100644 --- a/src/wm_layer_control.cpp +++ b/src/wm_layer_control.cpp @@ -17,6 +17,8 @@ #include <unistd.h>
#include "wm_layer_control.hpp"
#include "wm_layer.hpp"
+#include "wm_client.hpp"
+#include "request.hpp"
#include "json_helper.hpp"
#define LC_AREA_PATH "/etc/areas.db"
@@ -319,6 +321,52 @@ WMError LayerControl::loadAreaDb(const std::string& path) return WMError::SUCCESS;
}
+WMError LayerControl::layoutChange(const WMAction& action)
+{
+ WMError ret = WMError::FAIL;
+ if (action.visible == TaskVisible::INVISIBLE)
+ {
+ // Visibility is not change -> no redraw is required
+ return WMError::SUCCESS;
+ }
+ if(action.client == nullptr)
+ {
+ HMI_SEQ_ERROR(action.req_num, "client may vanish");
+ return WMError::NOT_REGISTERED;
+ }
+ unsigned layer = action.client->layerID();
+
+ // Layout Manager
+ // WMError ret = this->setLayerSize(layer, action.area);
+ auto rect = this->getAreaSize(action.area);
+ ilmErrorTypes err = ilm_layerSetDestinationRectangle(layer, rect.x, rect.y, rect.w, rect.h);
+ if(err == ILM_SUCCESS)
+ {
+ ret = WMError::SUCCESS;
+ }
+ return ret;
+}
+
+WMError LayerControl::visibilityChange(const WMAction& action)
+{
+ WMError ret = WMError::FAIL;
+ if(action.client == nullptr)
+ {
+ HMI_SEQ_ERROR(action.req_num, "client may vanish");
+ return WMError::NOT_REGISTERED;
+ }
+
+ if (action.visible != TaskVisible::INVISIBLE)
+ {
+ ret = this->makeVisible(action.client.get());
+ }
+ else
+ {
+ ret = this->makeInvisible(action.client.get());
+ }
+ return ret;
+}
+
void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool created)
{
this->cb.test(id);
@@ -477,4 +525,61 @@ void LayerControl::dispatchPropertyChangeEvent(unsigned id, }
}
+WMError LayerControl::makeVisible(const WMClient* client)
+{
+ WMError ret = WMError::FAIL;
+ // Don't check here the client is not nullptr
+ unsigned layer = client->layerID();
+ bool contains;// = this->checkBackGround(action.client->role());
+ if(contains)
+ {
+ std::shared_ptr<WMLayer> l;
+ // Move background from back ground layer
+ for(const auto& wm_layer : this->wm_layers)
+ {
+ if(wm_layer->layerName() == "BackGroundLayer")
+ {
+ //wm_layer.removeLayer(layer);
+ }
+ else
+ {
+ if(wm_layer->checkIDBelongTo(layer))
+ {
+ l = wm_layer;
+ }
+ }
+ }
+ if(l != nullptr)
+ {
+ // make invisible first
+ ilm_layerSetVisibility(layer, 0);
+ ilm_commitChanges();
+ //l->addLayer(layer);
+ }
+ }
+ for(const auto& wm_layer : this->wm_layers)
+ {
+ // make visible
+ //l->makeVisible(layer);
+ }
+
+ return ret;
+}
+
+WMError LayerControl::makeInvisible(const WMClient* client)
+{
+ WMError ret = WMError::FAIL;
+ // Don't check here the client is not nullptr
+ unsigned layer = client->layerID();
+ bool contains;// = this->checkBackGround(client->role());
+ if(contains)
+ {
+ // Pop from background
+ }
+ else
+ {
+
+ }
+ return ret;
+}
} // namespace wm
\ No newline at end of file diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp index db482bf..ea122a3 100644 --- a/src/wm_layer_control.hpp +++ b/src/wm_layer_control.hpp @@ -54,6 +54,9 @@ class LayerControlCallbacks { class WMLayer;
class LayerState;
+class WMAction;
+class WMClient;
+
class LayerControl
{
public:
@@ -73,12 +76,16 @@ class LayerControl WMError updateLayer(LayerState& layer_state);
WMError commitChange();
void undoUpdate();
+ WMError layoutChange(const WMAction& action);
+ WMError visibilityChange(const WMAction &action);
// Don't use this function.
void dispatchCreateEvent(ilmObjectType object, unsigned id, bool created);
void dispatchPropertyChangeEvent(unsigned id, struct ilmSurfaceProperties*, t_ilm_notification_mask);
void dispatchPropertyChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask);
private:
+ WMError makeVisible(const WMClient* client);
+ WMError makeInvisible(const WMClient* client);
WMError loadLayerSetting(const std::string& path);
WMError loadAreaDb(const std::string& path);
|