summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2017-12-05 18:28:37 +0900
committerTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2017-12-11 14:01:15 +0900
commit9db485747fc03b152fbcc19c107ad3744d1a63e0 (patch)
tree76aa1b50f657eec6f6614525963474546d202f02
parentd98f1a66cdf83b70e3a84f0e3faeb72f12ac99bb (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: Iea43c65ce03a352773c47e125490990f32dc9695 Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
-rw-r--r--src/libwindowmanager.cpp51
-rw-r--r--src/libwindowmanager.h2
2 files changed, 53 insertions, 0 deletions
diff --git a/src/libwindowmanager.cpp b/src/libwindowmanager.cpp
index 4a9b951..18cde43 100644
--- a/src/libwindowmanager.cpp
+++ b/src/libwindowmanager.cpp
@@ -67,6 +67,7 @@ class LibWindowmanager::Impl {
// WM API
int requestSurface(json_object *object);
+ int requestSurfaceXDG(json_object *object);
int activateSurface(json_object *object);
int deactivateSurface(json_object *object);
int endDraw(json_object *object);
@@ -291,6 +292,52 @@ int LibWindowmanager::Impl::requestSurface(json_object *object) {
return rc;
}
+int LibWindowmanager::Impl::requestSurfaceXDG(json_object *object) {
+ TRACE();
+ HMI_DEBUG("libwm", "called");
+
+ json_object *val;
+ const char *tmp_label;
+ if (json_object_object_get_ex(object, this->kKeyDrawingName, &val)) {
+ tmp_label = json_object_get_string(val);
+ }
+ else {
+ HMI_DEBUG("libwm", "Not found key \"%s\"", this->kKeyDrawingName);
+ return -EINVAL;
+ }
+
+ // DrawingName in "object" is overwrited in api_call("RequestSurface")
+ // So it is neccesary to copy it.
+ const char *label = std::string(tmp_label).c_str();
+
+ if (this->labels.find(label) != this->labels.end()) {
+ HMI_ERROR("libwm", "Surface label already known!");
+ return -EINVAL;
+ }
+
+ // Store application name first
+ // because it may not return from setenv
+ HMI_DEBUG("libwm", "Insert application name: %s\n", label);
+ this->labels.insert(this->labels.end(), label);
+
+ /* send the request */
+ int rc = this->api_call("RequestSurfaceXDG", object, [](bool ok, json_object *j) {
+ if (!ok) {
+ HMI_ERROR("libwm", "Could not get surface ID from WM: %s",
+ j != nullptr ? json_object_to_json_string_ext(
+ j, JSON_C_TO_STRING_PRETTY)
+ : "no-info");
+ }
+ });
+
+ if (rc != 0) {
+ HMI_ERROR("libwm", "Erase application name: %s", label);
+ this->labels.erase(label);
+ }
+
+ return rc;
+}
+
int LibWindowmanager::Impl::activateSurface(json_object *object) {
TRACE();
HMI_DEBUG("libwm", "called");
@@ -513,6 +560,10 @@ int LibWindowmanager::requestSurface(json_object *object) {
return this->d->requestSurface(object);
}
+int LibWindowmanager::requestSurfaceXDG(json_object *object) {
+ return this->d->requestSurfaceXDG(object);
+}
+
int LibWindowmanager::activateSurface(json_object *object) {
return this->d->activateSurface(object);
}
diff --git a/src/libwindowmanager.h b/src/libwindowmanager.h
index 83dff5f..ec14617 100644
--- a/src/libwindowmanager.h
+++ b/src/libwindowmanager.h
@@ -40,6 +40,7 @@ public:
/* Key for json obejct */
const char *kKeyDrawingName = "drawing_name";
const char *kKeyDrawingArea = "drawing_area";
+ const char *kKeyIviId = "ivi_id";
enum EventType {
Event_Active = 0,
@@ -56,6 +57,7 @@ public:
// WM API
int requestSurface(json_object *object);
+ int requestSurfaceXDG(json_object *object);
int activateSurface(json_object *object);
int deactivateSurface(json_object *object);
int endDraw(json_object *object);