X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Frunxdg.cpp;h=356e24fbd25e6dbc8bed1ae211d4340d4b867704;hb=refs%2Fchanges%2F31%2F19331%2F2;hp=5553ff5ddc0f12bf3726a37a4ed0d5176bb87f03;hpb=bb595dc5286a2a41e81cac530d0b4550ffa35441;p=staging%2Fxdg-launcher.git diff --git a/src/runxdg.cpp b/src/runxdg.cpp index 5553ff5..356e24f 100644 --- a/src/runxdg.cpp +++ b/src/runxdg.cpp @@ -83,7 +83,8 @@ void RunXDG::notify_ivi_control_cb (ilmObjectType object, t_ilm_uint id, m_launcher->register_surfpid(surf_pid); if (m_launcher->m_rid && surf_pid == m_launcher->find_surfpid_by_rid(m_launcher->m_rid)) { - setup_surface(id); + m_ivi_id = id; + setup_surface(); } m_surfaces[surf_pid] = id; } else if (object == ILM_LAYER) { @@ -279,12 +280,16 @@ int RunXDG::init_wm (void) return -1; } - std::function< void(json_object*) > h_active = [](json_object* object) { + std::function< void(json_object*) > h_active = [this](json_object* object) { AGL_DEBUG("Got Event_Active"); + t_ilm_surface s_ids[1] = { this->m_ivi_id }; + ilm_setInputFocus(s_ids, 1, ILM_INPUT_DEVICE_KEYBOARD, ILM_TRUE); }; - std::function< void(json_object*) > h_inactive = [](json_object* object) { + std::function< void(json_object*) > h_inactive = [this](json_object* object) { AGL_DEBUG("Got Event_Inactive"); + t_ilm_surface s_ids[1] = { this->m_ivi_id }; + ilm_setInputFocus(s_ids, 1, ILM_INPUT_DEVICE_KEYBOARD, ILM_FALSE); }; std::function< void(json_object*) > h_visible = [](json_object* object) { @@ -410,7 +415,29 @@ int RunXDG::parse_config (const char *path_to_config) auto params = app->get_array_of("params"); for (const auto& param : *params) { + // replace special string "@port@" and "@token@" + size_t found = param.find("@port@"); + if (found != std::string::npos) { + std::string sub1 = param.substr(0, found); + std::string sub2 = param.substr(found + 6, param.size() - found); + std::string str = sub1 + std::to_string(m_port) + sub2; + pl->m_args_v.push_back(str); + AGL_DEBUG("params[%s] (match @port@)", str.c_str()); + continue; + } + + found = param.find("@token@"); + if (found != std::string::npos) { + std::string sub1 = param.substr(0, found); + std::string sub2 = param.substr(found + 7, param.size() - found); + std::string str = sub1 + m_token + sub2; + pl->m_args_v.push_back(str); + AGL_DEBUG("params[%s] (match @token@)", str.c_str()); + continue; + } + pl->m_args_v.push_back(param); + AGL_DEBUG("params[%s]", param.c_str()); } @@ -449,9 +476,9 @@ RunXDG::RunXDG (int port, const char* token, const char* id) AGL_DEBUG("RunXDG created."); } -void RunXDG::setup_surface (int id) +void RunXDG::setup_surface (void) { - std::string sid = std::to_string(id); + std::string sid = std::to_string(m_ivi_id); // This surface is mine, register pair app_name and ivi id. json_object *obj = json_object_new_object(); @@ -566,6 +593,8 @@ void RunXDG::start (void) AGL_DEBUG("waiting for notification: surafce created"); m_pending_create = true; + ilm_commitChanges(); + // in case, target app has already run if (m_launcher->m_rid) { pid_t surf_pid = m_launcher->find_surfpid_by_rid(m_launcher->m_rid); @@ -577,10 +606,13 @@ void RunXDG::start (void) int id = itr->second; AGL_DEBUG("surface %d for <%s> already exists", id, m_role.c_str()); - setup_surface(id); + m_ivi_id = id; + setup_surface(); } } } + + ilm_commitChanges(); m_launcher->loop(e_flag); }