aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2017-12-05 17:16:35 +0900
committerTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2017-12-05 18:27:40 +0900
commit4675cf37125f57a5e55931156e1d9dc5605a6e81 (patch)
tree5ce87cc544ccbc1f36c8a0b8183ba8a8a063aae6
parenta81cf2c4626d6658550d899333db03a28f0cd185 (diff)
Support XDG applicationsandbox/ruke47/xdg-launcher
To run XDG application on AGL HomeScreen/WindowManager, a new binding API of WindowManager is added. This api is used only by AGL XDG-Launcher and all xdg applications should be packed as wgt compatible to AGL Application framework. Bug-AGL: SPEC-1096 Change-Id: I5881a9a1087b4319bb13065be5b862f148c192fa Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
-rw-r--r--generate-binding-glue.py7
-rw-r--r--src/afb_binding_api.cpp10
-rw-r--r--src/app.cpp30
-rw-r--r--src/app.hpp9
4 files changed, 56 insertions, 0 deletions
diff --git a/generate-binding-glue.py b/generate-binding-glue.py
index 376350a..a7be2da 100644
--- a/generate-binding-glue.py
+++ b/generate-binding-glue.py
@@ -133,6 +133,13 @@ API = {
],
},
{
+ 'name': 'requestsurfacexdg',
+ 'args': [
+ { 'name': 'drawing_name', 'type': 'char const*', 'jtype': 'string' },
+ { 'name': 'ivi_id', 'type': 'char const*', 'jtype': 'string' },
+ ],
+ },
+ {
'name': 'activatesurface',
'args': [
{ 'name': 'drawing_name', 'type': 'char const*', 'jtype': 'string' },
diff --git a/src/afb_binding_api.cpp b/src/afb_binding_api.cpp
index 3c75524..735a572 100644
--- a/src/afb_binding_api.cpp
+++ b/src/afb_binding_api.cpp
@@ -38,6 +38,16 @@ binding_api::result_type binding_api::requestsurface(
return Ok(json_object_new_int(r.unwrap()));
}
+binding_api::result_type binding_api::requestsurfacexdg(
+ char const *drawing_name, char const *ivi_id) {
+ auto r = this->app->api_request_surface(drawing_name, ivi_id);
+ if (r != nullptr) {
+ HMI_DEBUG("wm", "%s failed with error: %s", __func__, r);
+ return Err<json_object *>(r);
+ }
+ return Ok(json_object_new_object());
+}
+
binding_api::result_type binding_api::activatesurface(
char const *drawing_name, char const *drawing_area) {
HMI_DEBUG("wm", "%s drawing_name %s, drawing_area %s", __func__, drawing_name, drawing_area);
diff --git a/src/app.cpp b/src/app.cpp
index 307217e..82701b7 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -686,6 +686,36 @@ result<int> App::api_request_surface(char const *drawing_name) {
return Err<int>("Surface already present");
}
+char const *App::api_request_surface(char const *drawing_name,
+ char const *ivi_id) {
+ ST();
+
+ auto lid = this->layers.get_layer_id(std::string(drawing_name));
+ unsigned sid = std::stol(ivi_id);
+
+ if (!lid) {
+ return "Drawing name does not match any role";
+ }
+
+ auto rname = this->lookup_id(drawing_name);
+
+ if (rname) {
+ return "Surface already present";
+ }
+
+ // register pair drawing_name and ivi_id
+ this->id_alloc.register_name_id(drawing_name, sid);
+ this->layers.add_surface(sid, *lid);
+
+ // this surface is already created
+ HMI_DEBUG("wm", "surface_id is %u, layer_id is %u", sid, *lid);
+
+ this->controller->layers[*lid]->add_surface(
+ this->controller->surfaces[sid].get());
+
+ return nullptr;
+}
+
void App::activate(int id) {
auto ip = this->controller->sprops.find(id);
if (ip != this->controller->sprops.end()) {
diff --git a/src/app.hpp b/src/app.hpp
index 413d1c9..59f3104 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -81,6 +81,14 @@ struct id_allocator {
return sid;
}
+ // Insert a new ID which defined outside
+ void register_name_id(std::string const &name, unsigned sid) {
+ this->id2name[sid] = name;
+ this->name2id[name] = sid;
+ HMI_DEBUG("wm", "register id %u with name %s", sid, name.c_str());
+ return;
+ }
+
// Lookup by ID or by name
optional<unsigned> lookup(std::string const &name) const {
auto i = this->name2id.find(name);
@@ -178,6 +186,7 @@ struct App {
void set_pending_events();
result<int> api_request_surface(char const *drawing_name);
+ char const *api_request_surface(char const *drawing_name, char const *ivi_id);
char const *api_activate_surface(char const *drawing_name, char const *drawing_area);
char const *api_deactivate_surface(char const *drawing_name);
char const *api_enddraw(char const *drawing_name);