summaryrefslogtreecommitdiffstats
path: root/src/libwindowmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libwindowmanager.cpp')
-rw-r--r--src/libwindowmanager.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libwindowmanager.cpp b/src/libwindowmanager.cpp
index e03f638..db59dab 100644
--- a/src/libwindowmanager.cpp
+++ b/src/libwindowmanager.cpp
@@ -35,6 +35,7 @@ extern "C" {
using std::string;
using std::vector;
+using std::unordered_map;
namespace {
/* Key for json obejct */
@@ -64,6 +65,7 @@ class LibWindowmanager::Impl {
int deactivateWindow(json_object *object);
int endDraw(json_object *object);
int setRenderOrder(json_object* object);
+ int changeAreaSize(json_object* object);
int getDisplayInfo(json_object *object);
int getAreaInfo(json_object *in_obj, json_object *out_obj);
@@ -451,6 +453,17 @@ int LibWindowmanager::Impl::setRenderOrder(json_object *object) {
});
}
+int LibWindowmanager::Impl::changeAreaSize(json_object* object) {
+ TRACE();
+ return this->api_call(__func__, object, [](bool ok, json_object *j) {
+ if (!ok) {
+ HMI_ERROR("libwm", "API Call changeAreaSize() failed: %s",
+ j != nullptr ? json_object_to_json_string_ext(j, JSON_C_TO_STRING_PRETTY)
+ : "no-info");
+ }
+ });
+}
+
int LibWindowmanager::Impl::getDisplayInfo(json_object *object) {
TRACE();
HMI_DEBUG("libwm", "called");
@@ -1116,6 +1129,27 @@ int LibWindowmanager::setRenderOrder(const vector<string>& render_order) {
return this->d->setRenderOrder(object);
}
+int LibWindowmanager::changeAreaSize(const ChangeAreaReq &req) {
+ json_object* object = json_object_new_object();
+ json_object_object_add(object, "save", json_object_new_boolean(req.getSave()));
+ json_object *array = json_object_new_array();
+ unordered_map<string, Rect> _req_area_size = req.getReq();
+
+ for(const auto& i: _req_area_size) {
+ json_object *elem = json_object_new_object();
+ json_object_object_add(elem, "name", json_object_new_string(i.first.c_str()));
+ json_object *rect = json_object_new_object();
+ json_object_object_add(rect, "x", json_object_new_int(i.second.left()));
+ json_object_object_add(rect, "y", json_object_new_int(i.second.top()));
+ json_object_object_add(rect, "w", json_object_new_int(i.second.width()));
+ json_object_object_add(rect, "h", json_object_new_int(i.second.height()));
+ json_object_object_add(elem, "rect", rect);
+ json_object_array_add(array, elem);
+ }
+ json_object_object_add(object, "areas", array);
+ return this->d->changeAreaSize(object);
+}
+
void LibWindowmanager::set_event_handler(enum EventType et, handler_fun f) {
return this->d->set_event_handler(et, std::move(f));
}