diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-11-29 21:30:33 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-12-03 13:09:11 +0900 |
commit | 7ca956bddffa9b251fc9df88a07c49a78e83a379 (patch) | |
tree | 1584a09c93951f02d4b4e2a49a122a15b8c44ff4 | |
parent | a96fae7e99c2d13bc864d919cbdbcd68ba9cb841 (diff) |
Fix app surface is set to position (0, 0)
Sometimes, ivi_wm_surface_size signal doesn't reach WM.
In that time, surface is not placed in the set place.
This patch fix the issue.
Change-Id: Id7137557d5aaae373fedbb70379179ab50205c60
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r-- | src/window_manager.cpp | 1 | ||||
-rw-r--r-- | src/wm_client.cpp | 13 | ||||
-rw-r--r-- | src/wm_client.hpp | 3 | ||||
-rw-r--r-- | src/wm_layer_control.cpp | 17 |
4 files changed, 31 insertions, 3 deletions
diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 5dc22be..77d41b7 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -288,7 +288,6 @@ void WindowManager::api_activate_window(char const *appid, char const *drawing_n } // Do allocate tasks - ret = this->checkPolicy(req_num); if (ret != WMError::SUCCESS) diff --git a/src/wm_client.cpp b/src/wm_client.cpp index 040c52b..3edf850 100644 --- a/src/wm_client.cpp +++ b/src/wm_client.cpp @@ -39,7 +39,7 @@ static const char kKeyError[] = "error"; static const char kKeyErrorDesc[] = "kErrorDescription"; WMClient::WMClient(const string &appid, unsigned layer, unsigned surface, const string &role) - : id(appid), layer(layer), + : id(appid), layer(layer), is_source_set(false), role2surface(0) { role2surface[role] = surface; @@ -57,6 +57,7 @@ WMClient::WMClient(const string &appid, unsigned layer, unsigned surface, const WMClient::WMClient(const string &appid, const string &role) : id(appid), layer(0), + is_source_set(false), role2surface(0), evname2list(0) { @@ -136,6 +137,16 @@ WMError WMClient::addSurface(unsigned surface) return (err == ILM_SUCCESS) ? WMError::SUCCESS : WMError::FAIL; } +void WMClient::setSurfaceSizeCorrectly() +{ + this->is_source_set = true; +} + +bool WMClient::isSourceSizeSet() +{ + return this->is_source_set; +} + bool WMClient::removeSurfaceIfExist(unsigned surface) { bool ret = false; diff --git a/src/wm_client.hpp b/src/wm_client.hpp index 9568324..53383fb 100644 --- a/src/wm_client.hpp +++ b/src/wm_client.hpp @@ -53,6 +53,8 @@ class WMClient unsigned surfaceID() const; void registerSurface(unsigned surface); WMError addSurface(unsigned surface); + bool isSourceSizeSet(); + void setSurfaceSizeCorrectly(); bool removeSurfaceIfExist(unsigned surface); #if GTEST_ENABLED @@ -65,6 +67,7 @@ class WMClient private: std::string id; unsigned layer; + bool is_source_set; std::string main_role; std::string area; unsigned surface; // currently, main application has only one surface. diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp index 011402d..17443de 100644 --- a/src/wm_layer_control.cpp +++ b/src/wm_layer_control.cpp @@ -394,7 +394,22 @@ WMError LayerControl::layoutChange(const WMAction& action) auto rect = this->getAreaSize(action.area); HMI_DEBUG("Set layout %d, %d, %d, %d",rect.x, rect.y, rect.w, rect.h); - ilm_commitChanges(); + + // Sometimes, ivi_wm_surface_size signal doesn't reach window manager, + // then, Window Manager set set source size = 0. + if(!action.client->isSourceSizeSet()) + { + ilmSurfaceProperties sp; + ilm_getPropertiesOfSurface(surface, &sp); + if((sp.origSourceHeight != sp.sourceHeight) || (sp.origSourceWidth != sp.sourceWidth)) + { + HMI_SEQ_NOTICE(action.req_num, "set source size w:%d h%d", sp.origSourceWidth, sp.origSourceHeight); + ilm_surfaceSetSourceRectangle(surface, 0, 0, sp.origSourceWidth, sp.origSourceHeight); + ilm_commitChanges(); + action.client->setSurfaceSizeCorrectly(); + } + } + ilm_surfaceSetDestinationRectangle(surface, rect.x, rect.y, rect.w, rect.h); ilm_commitChanges(); for(auto &wm_layer: this->wm_layers) |