X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Frunxdg.cpp;h=5fd4ac173a7f859c4c498804bb8b1b09991b73b6;hb=da5c9797c0fb75db76cdaca322d19ca05f502dab;hp=1b9c08c7ac2f87748cfcde9673ba8257e3e17123;hpb=f0432213c7c40d70fef06f9ceb665463d23b32e6;p=staging%2Fxdg-launcher.git diff --git a/src/runxdg.cpp b/src/runxdg.cpp index 1b9c08c..5fd4ac1 100644 --- a/src/runxdg.cpp +++ b/src/runxdg.cpp @@ -35,7 +35,6 @@ #include "runxdg.hpp" #define RUNXDG_CONFIG "runxdg.toml" -#define AREA_NORMAL_FULL "normal.full" void fatal(const char* format, ...) { @@ -73,7 +72,7 @@ void RunXDG::notify_ivi_control_cb (ilmObjectType object, t_ilm_uint id, pid_t surf_pid = surf_props.creatorPid; if (!created) { - AGL_DEBUG("ivi surface (id=%d, pid=%d) destroyed.", id, surf_pid); + AGL_DEBUG("ivi surface (id=%d, pid=%d)surf_pid destroyed.", id, surf_pid); m_launcher->unregister_surfpid(surf_pid); m_surfaces.erase(surf_pid); return; @@ -299,7 +298,10 @@ int RunXDG::init_wm (void) std::function< void(json_object*) > h_syncdraw = [this](json_object* object) { AGL_DEBUG("Got Event_SyncDraw"); - this->m_wm->endDraw(this->m_role.c_str()); + json_object* obj = json_object_new_object(); + json_object_object_add(obj, this->m_wm->kKeyDrawingName, + json_object_new_string(this->m_role.c_str())); + this->m_wm->endDraw(obj); }; std::function< void(json_object*) > h_flushdraw= [](json_object* object) { @@ -325,8 +327,27 @@ int RunXDG::init_hs (void) } std::function< void(json_object*) > handler = [this] (json_object* object) { - AGL_DEBUG("Activesurface %s ", this->m_role.c_str()); - this->m_wm->activateWindow(this->m_role.c_str(), AREA_NORMAL_FULL); + json_object *val; + + if (json_object_object_get_ex(object, "application_name", &val)) { + const char *name = json_object_get_string(val); + + AGL_DEBUG("Event_TapShortcut <%s>", name); + + json_object *para, *area; + json_object_object_get_ex(object, "parameter", ¶); + json_object_object_get_ex(para, "area", &area); + const char *displayArea = json_object_get_string(area); + AGL_DEBUG("display area=%s",displayArea); + + json_object *obj = json_object_new_object(); + json_object_object_add(obj, this->m_wm->kKeyDrawingName, + json_object_new_string(this->m_role.c_str())); + json_object_object_add(obj, this->m_wm->kKeyDrawingArea, + json_object_new_string(displayArea)); + this->m_wm->activateWindow(obj); + + } }; m_hs->set_event_handler(LibHomeScreen::Event_TapShortcut, handler); @@ -424,6 +445,7 @@ RunXDG::RunXDG (int port, const char* token, const char* id) m_id = std::string(id); m_port = port; m_token = std::string(token); + is_first = true; auto path = std::string(getenv("AFM_APP_INSTALL_DIR")); @@ -447,7 +469,6 @@ RunXDG::RunXDG (int port, const char* token, const char* id) // Setup ilmController API m_ic = new ILMControl(notify_ivi_control_cb_static, this); - AGL_DEBUG("RunXDG created."); } @@ -456,14 +477,27 @@ void RunXDG::setup_surface (int id) std::string sid = std::to_string(id); // This surface is mine, register pair app_name and ivi id. - AGL_DEBUG("requestSurfaceXDG(%s,%d)", m_role.c_str(), id); - m_wm->requestSurfaceXDG(this->m_role.c_str(), id); + json_object *obj = json_object_new_object(); + json_object_object_add(obj, m_wm->kKeyDrawingName, + json_object_new_string(m_role.c_str())); + json_object_object_add(obj, m_wm->kKeyIviId, + json_object_new_string(sid.c_str())); + + AGL_DEBUG("requestSurfaceXDG(%s,%s)", m_role.c_str(), sid.c_str()); + m_wm->requestSurfaceXDG(obj); if (m_pending_create) { // Recovering 1st time tap_shortcut is dropped because // the application has not been run yet (1st time launch) m_pending_create = false; - m_wm->activateWindow(this->m_role.c_str(), AREA_NORMAL_FULL); + + AGL_DEBUG("requestSurface(%s,%s)", m_role.c_str(), sid.c_str()); + json_object *obj = json_object_new_object(); + json_object_object_add(obj, m_wm->kKeyDrawingName, + json_object_new_string(m_role.c_str())); + json_object_object_add(obj, m_wm->kKeyDrawingArea, + json_object_new_string("normal.full")); + m_wm->activateWindow(obj); } } @@ -493,7 +527,6 @@ void POSIXLauncher::unregister_surfpid (pid_t surf_pid) pid_t POSIXLauncher::find_surfpid_by_rid (pid_t rid) { - AGL_DEBUG("find surfpid by rid(%d)", rid); if (std::count(m_pid_v.begin(), m_pid_v.end(), rid)) { AGL_DEBUG("found return(%d)", rid); return rid; @@ -558,7 +591,9 @@ void RunXDG::start (void) // in case, target app has already run if (m_launcher->m_rid) { + AGL_DEBUG("RunXDG::start"); pid_t surf_pid = m_launcher->find_surfpid_by_rid(m_launcher->m_rid); + AGL_DEBUG("surf_pid--=%d",surf_pid); if (surf_pid > 0) { AGL_DEBUG("match: surf:pid=%d, afm:rid=%d", surf_pid, m_launcher->m_rid);