summaryrefslogtreecommitdiffstats
path: root/src/libwindowmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libwindowmanager.cpp')
-rw-r--r--src/libwindowmanager.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/libwindowmanager.cpp b/src/libwindowmanager.cpp
index 515fea1..0127405 100644
--- a/src/libwindowmanager.cpp
+++ b/src/libwindowmanager.cpp
@@ -56,6 +56,7 @@ class LibWindowmanager::Impl {
// WM API
int requestSurface(json_object *object);
int requestSurfaceXDG(json_object *object);
+ int setRole(json_object *object);
int activateWindow(json_object *object);
int deactivateWindow(json_object *object);
int endDraw(json_object *object);
@@ -305,7 +306,7 @@ int LibWindowmanager::Impl::requestSurfaceXDG(json_object *object) {
return -EINVAL;
}
- // DrawingName in "object" is overwrited in api_call("RequestSurface")
+ // DrawingName in "object" is overwritten in api_call("RequestSurface")
// So it is neccesary to copy it.
const char *label = std::string(tmp_label).c_str();
@@ -337,6 +338,18 @@ int LibWindowmanager::Impl::requestSurfaceXDG(json_object *object) {
return rc;
}
+int LibWindowmanager::Impl::setRole(json_object *object) {
+ HMI_DEBUG("libwm", "called");
+ return this->api_call("setRole", object, [](bool ok, json_object *j) {
+ if (!ok) {
+ HMI_ERROR("libwm", "API Call setRole() failed: %s",
+ j != nullptr ? json_object_to_json_string_ext(
+ j, JSON_C_TO_STRING_PRETTY)
+ : "no-info");
+ }
+ });
+}
+
int LibWindowmanager::Impl::activateWindow(json_object *object) {
TRACE();
HMI_DEBUG("libwm", "called");
@@ -927,6 +940,16 @@ int LibWindowmanager::requestSurfaceXDG(const char* role, unsigned ivi_id) {
return this->d->requestSurfaceXDG(object);
}
+int LibWindowmanager::setRole(const char* role)
+{
+ pid_t pid = getpid(); // need surface rendering process
+ json_object* object = json_object_new_object();
+ json_object_object_add(object, "role", json_object_new_string(role));
+ json_object_object_add(object, "pid", json_object_new_int(pid));
+
+ return this->d->setRole(object);
+}
+
int LibWindowmanager::activateWindow(json_object *object) {
return this->d->activateWindow(object);
}