X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwindow_manager.cpp;h=fc333d4049fe5473b55417d75f7dcde0f5941fd1;hb=c4798401800dd1f325aca5333e1d3eebdda0abe3;hp=34115f79a3f5454557fa126cb03e36bdc834a5dd;hpb=ffcfd15b087f7104f87aa2b30b76058a1bcfb1f4;p=apps%2Fagl-service-windowmanager.git diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 34115f7..fc333d4 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -130,6 +130,8 @@ WindowManager::WindowManager() this->lc = std::make_shared(root); + HMI_DEBUG("Layer Controller initialized"); + /* try { { @@ -166,6 +168,11 @@ int WindowManager::init() // TODO: application requests by old role, // so create role map (old, new) // Load old_role.db + LayerControlCallbacks lmcb; + lmcb.surfaceCreated = [&](unsigned pid, unsigned surface){ + this->surface_created(surface); + }; + this->lc->init(lmcb); this->loadOldRoleDb(); // Store my context for calling callback from PolicyManager @@ -720,6 +727,7 @@ void WindowManager::send_event(char const *evname, char const *label, char const */ void WindowManager::surface_created(uint32_t surface_id) { + HMI_DEBUG("current : %d", surface_id); /* this->controller->get_surface_properties(surface_id, IVI_WM_PARAM_SIZE); auto layer_id = this->layers.get_layer_id(surface_id); @@ -810,6 +818,7 @@ void WindowManager::timerHandler() void WindowManager::startTransitionWrapper(vector &actions) { WMError ret; + // req_num is guaranteed by Window Manager unsigned req_num = g_app_list.currentRequestNumber(); if (actions.empty()) @@ -847,7 +856,9 @@ void WindowManager::startTransitionWrapper(vector &actions) goto error; } } - act.appid = appid; + auto client = g_app_list.lookUpClient(appid); + act.req_num = req_num; + act.client = client; } ret = g_app_list.setAction(req_num, act); @@ -1038,9 +1049,9 @@ void WindowManager::emit_syncdraw(char const *label, char const *area, int x, in void WindowManager::emit_syncdraw(const string &role, const string &area) { -/* rect rect = this->layers.getAreaSize(area); + rect rect = this->lc->getAreaSize(area); this->send_event(kListEventName[Event_SyncDraw], - role.c_str(), area.c_str(), rect.x, rect.y, rect.w, rect.h); */ + role.c_str(), area.c_str(), rect.x, rect.y, rect.w, rect.h); } void WindowManager::emit_flushdraw(char const *label) @@ -1254,6 +1265,7 @@ WMError WindowManager::startTransition(unsigned req_num) return ret; } + g_app_list.reqDump(); for (const auto &action : actions) { if (action.visible == TaskVisible::VISIBLE) @@ -1281,12 +1293,14 @@ WMError WindowManager::startTransition(unsigned req_num) // Make it deactivate here for (const auto &x : actions) { - if (g_app_list.contains(x.appid)) + this->lc->visibilityChange(x); + /* if (g_app_list.contains(x.appid)) { auto client = g_app_list.lookUpClient(x.appid); - this->deactivate(client->surfaceID(x.role)); - } + //this->deactivate(client->surfaceID(x.role)); + } */ } + this->lc->commitChange(); ret = WMError::NO_LAYOUT_CHANGE; } return ret; @@ -1312,9 +1326,6 @@ WMError WindowManager::doEndDraw(unsigned req_num) if(act.visible != TaskVisible::NO_CHANGE) { // layout change - if(!g_app_list.contains(act.appid)){ - ret = WMError::NOT_REGISTERED; - } ret = this->lc->layoutChange(act); if(ret != WMError::SUCCESS) { @@ -1359,7 +1370,8 @@ WMError WindowManager::layoutChange(const WMAction &action) // Visibility is not change -> no redraw is required return WMError::SUCCESS; } - auto client = g_app_list.lookUpClient(action.appid); + WMError ret = this->lc->layoutChange(action); + /* auto client = g_app_list.lookUpClient(action.appid); unsigned surface = client->surfaceID(action.role); if (surface == 0) { @@ -1368,14 +1380,14 @@ WMError WindowManager::layoutChange(const WMAction &action) return WMError::NOT_REGISTERED; } // Layout Manager - WMError ret = this->setSurfaceSize(surface, action.area); + WMError ret = this->setSurfaceSize(surface, action.area); */ return ret; } WMError WindowManager::visibilityChange(const WMAction &action) { HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), "Change visibility"); - if(!g_app_list.contains(action.appid)){ + /* if(!g_app_list.contains(action.appid)){ return WMError::NOT_REGISTERED; } auto client = g_app_list.lookUpClient(action.appid); @@ -1385,17 +1397,18 @@ WMError WindowManager::visibilityChange(const WMAction &action) HMI_SEQ_ERROR(g_app_list.currentRequestNumber(), "client doesn't have surface with role(%s)", action.role.c_str()); return WMError::NOT_REGISTERED; - } + } */ + WMError ret = this->lc->visibilityChange(action); - if (action.visible != TaskVisible::INVISIBLE) +/* if (action.visible != TaskVisible::INVISIBLE) { this->activate(surface); // Layout Manager task } else { this->deactivate(surface); // Layout Manager task - } - return WMError::SUCCESS; + } */ + return ret; } WMError WindowManager::setSurfaceSize(unsigned surface, const string &area) @@ -1420,7 +1433,7 @@ void WindowManager::emitScreenUpdated(unsigned req_num) { if(action.visible != TaskVisible::INVISIBLE) { - json_object_array_add(jarray, json_object_new_string(action.appid.c_str())); + json_object_array_add(jarray, json_object_new_string(action.client->appID().c_str())); } } json_object_object_add(j, kKeyIds, jarray);