Add example:weston-terminal sandbox/ruke47/weston-terminal
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
Sat, 10 Nov 2018 17:53:32 +0000 (17:53 +0000)
committerTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
Sat, 10 Nov 2018 17:53:32 +0000 (17:53 +0000)
Example of launching weston-terminal

Issue:
  1. --fullscreen doesn't work
  2. scaled, not dot-by-dot

Change-Id: I0c3034bc9584228de4f0eb68723ea3f000344843
Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
CMakeLists.txt
package/weston-terminal/bin/runxdg [new file with mode: 0755]
package/weston-terminal/config.xml [new file with mode: 0644]
package/weston-terminal/icon.svg [new file with mode: 0644]
package/weston-terminal/runxdg.toml [new file with mode: 0644]
src/runxdg.cpp
src/runxdg.hpp

index af5e6b7..67bd88f 100644 (file)
@@ -10,6 +10,7 @@ find_package(PkgConfig REQUIRED)
 pkg_check_modules(GLIB REQUIRED glib-2.0)
 pkg_check_modules(GIO REQUIRED gio-2.0)
 pkg_check_modules(ILMCONTROL REQUIRED ilmControl)
+pkg_check_modules(ILMINPUT REQUIRED ilmInput)
 
 # No configuration
 # configure_file (
@@ -22,6 +23,7 @@ pkg_check_modules(ILMCONTROL REQUIRED ilmControl)
 include_directories(
   "include"
   "${ILMCONTROL_INCLUDE_DIRS}"
+  "${ILMINPUT_INCLUDE_DIRS}"
   "${GLIB_INCLUDE_DIRS}"
   "${GIO_INCLUDE_DIRS}"
   )
@@ -34,6 +36,7 @@ SET(LIBRARIES
   windowmanager
   homescreen
   ${ILMCONTROL_LIBRARIES}
+  ${ILMINPUT_LIBRARIES}
   afbwsc
   json-c
   pthread
@@ -64,4 +67,6 @@ add_custom_target(widget
   # test for webbrowser
   COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/webbrowser.wgt ${PROJECT_BINARY_DIR}/package/webbrowser
 
+  # test for weston-terminal
+  COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/weston-terminal.wgt ${PROJECT_BINARY_DIR}/package/weston-terminal
 )
diff --git a/package/weston-terminal/bin/runxdg b/package/weston-terminal/bin/runxdg
new file mode 100755 (executable)
index 0000000..dac903c
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/runxdg $@
diff --git a/package/weston-terminal/config.xml b/package/weston-terminal/config.xml
new file mode 100644 (file)
index 0000000..619f682
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="weston-terminal" version="0.1">
+  <name>weston-terminal</name>
+  <icon src="icon.svg"/>
+  <content src="bin/runxdg" type="application/vnd.agl.native"/>
+  <description>Launcher for XDG application on AGL HomeScreen 2017</description>
+  <author>Panasonic Corporation</author>
+  <license>MIT</license>
+  <feature name="urn:AGL:widget:required-api">
+    <param name="homescreen" value="ws" />
+    <param name="windowmanager" value="ws" />
+  </feature>
+  <feature name="urn:AGL:widget:required-permission">
+    <param name="urn:AGL:permission::public:no-htdocs" value="required" />
+    <param name="http://tizen.org/privilege/internal/dbus" value="required" />
+  </feature>
+</widget>
diff --git a/package/weston-terminal/icon.svg b/package/weston-terminal/icon.svg
new file mode 100644 (file)
index 0000000..882e3c4
--- /dev/null
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+
+<svg
+   xmlns:i="&amp;ns_ai;"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   id="Settings_Inactive_1_"
+   x="0px"
+   y="0px"
+   viewBox="0 0 300 300"
+   style="enable-background:new 0 0 300 300;"
+   xml:space="preserve"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="settings_inactive.svg"><metadata
+     id="metadata5617"><rdf:RDF><cc:Work
+         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+     id="defs5615" /><sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1421"
+     inkscape:window-height="786"
+     id="namedview5613"
+     showgrid="false"
+     inkscape:zoom="0.78666667"
+     inkscape:cx="-90.254237"
+     inkscape:cy="150"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="Settings_Inactive_1_" /><style
+     type="text/css"
+     id="style5578">
+       .st0{fill:#FFFFFF;}
+       .st1{font-family:'Roboto-Regular';}
+       .st2{font-size:25px;}
+       .st3{letter-spacing:6;}
+       .st4{fill:url(#SVGID_1_);}
+       .st5{fill:url(#SVGID_2_);}
+       .st6{fill:url(#SVGID_3_);}
+</style><switch
+     id="switch5580"
+     transform="matrix(1.3307804,0,0,1.3314313,-62.924861,-27.945794)"><g
+       i:extraneous="self"
+       id="g5582"><g
+         id="g5584"><linearGradient
+           id="SVGID_1_"
+           gradientUnits="userSpaceOnUse"
+           x1="4.0481"
+           y1="287.94919"
+           x2="320.4859"
+           y2="-15.4029"
+           gradientTransform="matrix(1,0.00546456,-0.00546456,1,-2.0192,-3.0212)"><stop
+             offset="0"
+             style="stop-color:#00ADDC"
+             id="stop5587" /><stop
+             offset="1"
+             style="stop-color:#6BFBFF"
+             id="stop5589" /></linearGradient><path
+           class="st4"
+           d="m 160,238.8 c -0.2,0 -0.4,0 -0.6,0 C 101.4,238.5 54.5,191.1 54.8,133.1 55.2,75.3 102.3,28.5 160,28.5 c 0.2,0 0.4,0 0.6,0 58,0.3 104.9,47.7 104.6,105.7 l 0,0 C 264.8,192 217.7,238.8 160,238.8 Z m 0,-206.6 c -55.7,0 -101.2,45.2 -101.5,100.9 -0.3,55.9 45,101.7 100.9,102 0.2,0 0.4,0 0.6,0 55.7,0 101.2,-45.2 101.5,-100.9 0.3,-55.9 -45,-101.7 -100.9,-102 -0.2,0 -0.4,0 -0.6,0 z"
+           id="path5591"
+           style="fill:url(#SVGID_1_)"
+           inkscape:connector-curvature="0" /><g
+           id="g5593"><g
+             id="g5595"><linearGradient
+               id="SVGID_2_"
+               gradientUnits="userSpaceOnUse"
+               x1="79.180397"
+               y1="226.0817"
+               x2="282.75201"
+               y2="-4.8608999"><stop
+                 offset="0"
+                 style="stop-color:#00ADDC"
+                 id="stop5598" /><stop
+                 offset="1"
+                 style="stop-color:#6BFBFF"
+                 id="stop5600" /></linearGradient><path
+               class="st5"
+               d="m 159.9,163.9 c -16.3,0 -29.5,-13.2 -29.5,-29.4 0,-16.2 13.2,-29.4 29.5,-29.4 l 0,3.9 c -14.1,0 -25.5,11.4 -25.5,25.5 0,14 11.5,25.5 25.5,25.5 14.1,0 25.6,-11.4 25.6,-25.5 l 3.9,0 c 0,16.2 -13.2,29.4 -29.5,29.4 z"
+               id="path5602"
+               style="fill:url(#SVGID_2_)"
+               inkscape:connector-curvature="0" /></g><g
+             id="g5604"><linearGradient
+               id="SVGID_3_"
+               gradientUnits="userSpaceOnUse"
+               x1="79.245697"
+               y1="226.1393"
+               x2="282.81741"
+               y2="-4.8032999"><stop
+                 offset="0"
+                 style="stop-color:#00ADDC"
+                 id="stop5607" /><stop
+                 offset="1"
+                 style="stop-color:#6BFBFF"
+                 id="stop5609" /></linearGradient><path
+               class="st6"
+               d="m 171.7,197.3 -23.4,0 c -2.2,0 -4,-1.8 -4,-3.9 l 0,-12.4 c -2,-0.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.7,-1.1 2.7,-1.1 l 0,0 c 1.1,0 2.1,0.4 2.9,1.2 l 16.6,16.6 c 0.8,0.8 1.2,1.8 1.2,2.9 0,1 -0.4,2 -1.1,2.7 l -8.8,8.8 c 1,2 1.8,4 2.5,6 l 12.4,0 c 2.2,0 3.9,1.8 3.9,4 l 0,23.4 c 0,2.2 -1.8,4 -3.9,4 l -12.5,0 c -0.7,2 -1.5,4 -2.5,6 l 8.9,8.9 c 1.5,1.5 1.5,4 -0.1,5.6 l -16.6,16.6 c -0.8,0.8 -1.8,1.2 -2.9,1.2 l 0,0 c -1,0 -2,-0.4 -2.7,-1.1 l -8.9,-8.9 c -1.9,1 -3.9,1.8 -5.9,2.5 l 0,12.5 c 0,2.1 -1.8,3.8 -4,3.8 z"
+               id="path5611"
+               style="fill:url(#SVGID_3_)"
+               inkscape:connector-curvature="0" /></g></g></g></g></switch></svg>
\ No newline at end of file
diff --git a/package/weston-terminal/runxdg.toml b/package/weston-terminal/runxdg.toml
new file mode 100644 (file)
index 0000000..abd7c14
--- /dev/null
@@ -0,0 +1,25 @@
+[application]
+# role: identifier for WindowManager (used in layers.json)
+# e.g. role = "WebBrowser"
+role = "weston-terminal"
+
+# 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-terminal"
+
+# params: arguments of the excecutable
+# e.g.
+#   params = [
+#     "--mus",
+#     "--no-sandbox",
+#     "--window-size=1080,1488",
+#     "--ozone-platform=wayland",
+#     "<URL>"
+#   ]
+params = [
+  "--fullscreen"
+]
index 3ff942c..1ce3881 100644 (file)
@@ -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) {
@@ -332,9 +337,13 @@ int RunXDG::init_hs (void)
     if (json_object_object_get_ex(object, "application_name", &val)) {
       const char *name = json_object_get_string(val);
 
-      AGL_DEBUG("Event_TapShortcut <%s>", name);
+         const char *app_id = this->m_id.c_str();
+         int len = strlen(name);
 
-      if (strcmp(name, this->m_role.c_str()) == 0) {
+      AGL_DEBUG("Event_TapShortcut <appid=%s,%s,%d>", name, app_id, len);
+
+         if (strcmp(name, app_id) == 0 ||
+                 (strncmp(name, app_id, len) == 0 && ('@' == app_id[len]))) {
         // check app exist and re-launch if needed
         AGL_DEBUG("Activesurface %s ", this->m_role.c_str());
 
@@ -454,7 +463,7 @@ RunXDG::RunXDG (int port, const char* token, const char* id)
     AGL_FATAL("Error in config");
   }
 
-  AGL_DEBUG("id=[%s], name=[%s], path=[%s], port=%lu, token=[%s]",
+  AGL_DEBUG("id=[%s], role=[%s], path=[%s], port=%lu, token=[%s]",
             m_id.c_str(), m_role.c_str(), m_path.c_str(),
             m_port, m_token.c_str());
 
@@ -471,9 +480,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();
@@ -599,7 +608,8 @@ 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();
       }
     }
   }
index ce0c016..3a51c58 100644 (file)
@@ -30,6 +30,7 @@
 #include <gio/gio.h>
 
 #include <ilm/ilm_control.h>
+#include <ilm/ilm_input.h>
 
 #include <libwindowmanager.h>
 #include <libhomescreen.hpp>
@@ -149,7 +150,9 @@ class RunXDG
     LibHomeScreen *m_hs;
     ILMControl *m_ic;
 
-    std::map<int, int> m_surfaces;  // pair of <afm:rid, ivi:id>
+       t_ilm_surface m_ivi_id;
+
+       std::map<int, int> m_surfaces;  // pair of <afm:rid, ivi:id>
 
     bool m_pending_create = false;
 
@@ -158,7 +161,7 @@ class RunXDG
 
     int parse_config(const char *file);
 
-    void setup_surface(int id);
+    void setup_surface(void);
 };
 
 #endif  // RUNXDG_HPP