diff options
author | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2017-12-05 18:28:37 +0900 |
---|---|---|
committer | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2017-12-12 12:39:11 +0000 |
commit | 68462c7180f69f2c9df1e161a0f86a1f52f33360 (patch) | |
tree | 68f9cf96844c8b7495464dbcfacd5630a48e5962 /src/libwindowmanager.cpp | |
parent | c2e7ca876cc70b52d39e0cce3aa8dffcd5f90cc8 (diff) |
Support XDG application
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>
Diffstat (limited to 'src/libwindowmanager.cpp')
-rw-r--r-- | src/libwindowmanager.cpp | 51 |
1 files changed, 51 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); } |