add ces2019 source
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>
Mon, 3 Dec 2018 08:45:35 +0000 (17:45 +0900)
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>
Mon, 3 Dec 2018 08:45:35 +0000 (17:45 +0900)
CMakeLists.txt
package/webbrowser/config.xml
package/webbrowser/runxdg.toml
src/runxdg.cpp
src/runxdg.hpp

index af5e6b7..1aca3ff 100644 (file)
@@ -45,10 +45,15 @@ add_executable (runxdg ${SRC_FILES})
 
 TARGET_LINK_LIBRARIES (runxdg ${LIBRARIES})
 
-install (TARGETS runxdg DESTINATION bin)
+#install (TARGETS runxdg DESTINATION bin)
 
 add_custom_command(TARGET runxdg POST_BUILD
   COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/package ${PROJECT_BINARY_DIR})
+#  COMMAND cp -rf ${PROJECT_BINARY_DIR}/runxdg ${PROJECT_BINARY_DIR}/package/simple-egl/bin
+#  COMMAND cp -rf ${PROJECT_BINARY_DIR}/runxdg ${PROJECT_BINARY_DIR}/package/hvac/bin
+#  COMMAND cp -rf ${PROJECT_BINARY_DIR}/runxdg ${PROJECT_BINARY_DIR}/package/navi/bin
+#  COMMAND cp -rf ${PROJECT_BINARY_DIR}/runxdg ${PROJECT_BINARY_DIR}/package/video/bin
+#  COMMAND cp -rf ${PROJECT_BINARY_DIR}/runxdg ${PROJECT_BINARY_DIR}/package/webbrowser/bin)
 
 add_custom_target(widget
   # simple egl
index 68cab15..031fef7 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" id="webbrowser" version="0.1">
-  <name>WebBrowser</name>
+<widget xmlns="http://www.w3.org/ns/widgets" id="browser" version="5.0">
+  <name>browser</name>
   <icon src="icon.svg"/>
   <content src="bin/runxdg" type="application/vnd.agl.native"/>
   <description>Web Browser (Chromium)</description>
index ed275e4..fec7a38 100644 (file)
@@ -1,22 +1,25 @@
 [application]
 # role: identifier for WindowManager (used in layers.json)
 # e.g. role = "WebBrowser"
-role = "WebBrowser"
+role = "browser"
 
 # launch by "POSIX"(fork/exec), "AFM_DBUS"(afm via dbus),  "AFM_WEBSOCKET"(afm via websockt)
 method = "POSIX"
 
 # path: path to the executable
 # e.g.
-#   path = "/usr/bin/chromium"
-path = "/usr/bin/weston-simple-egl"
+path = "/usr/bin/chromium"
 
-# params: arguments of the excecutable
+# params: arguments of the excecutable 
 # e.g.
-#   params = [
-#     "--mus",
-#     "--no-sandbox",
-#     "--window-size=1080,1488",
-#     "--ozone-platform=wayland",
-#     "<URL>"
-#   ]
+   params = [
+     "--touch-events=enabled",
+     "--enable-wayland-ime",
+     "--use-ime-service",
+     "--mus",
+     "--no-sandbox",
+     "--kiosk",
+     "--window-size=1920,1080",
+     "--ozone-platform=wayland",
+     "http://map.google.co.jp"
+   ]
index 1b9c08c..5fd4ac1 100644 (file)
@@ -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", &para);
+         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);
index ce0c016..4844ed9 100644 (file)
@@ -134,6 +134,7 @@ class RunXDG
                                               t_ilm_uint id,
                                               t_ilm_bool created,
                                               void *user_data);
+    inline bool getStatus(void) {return m_pending_create;}
   private:
     std::string m_role;
     std::string m_path;
@@ -159,6 +160,7 @@ class RunXDG
     int parse_config(const char *file);
 
     void setup_surface(int id);
+    bool is_first;
 };
 
 #endif  // RUNXDG_HPP