aboutsummaryrefslogtreecommitdiffstats
path: root/sample/template
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-11-14 11:14:04 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-11-21 16:51:10 +0800
commitc0146077906057bf97688a617870228eaad0cf54 (patch)
tree7d7bcc9a8a58c8c1f137be3872b643566c08e78c /sample/template
parent43452ff8a759da135525678528c159f1e4e68504 (diff)
homescreen-service: add five verbs. 1.showWindow: instead of tap_shortcut and show onscreen. 2.hideWindow: used when want to hide onscreen. 3.replyShowWindow: used when post onscreen reply information to application. 4.showNotification: used by application who want to display notification on homescreen top area. 5.showInformation: used by application who want to display information on homescreen botton area. homescreen: 1.add fullscreen transfer button. 2.display notification and information. Bug-AGL: SPEC-1931 Change-Id: Ie0753fe0656282b1ff8c04dcef625f2a4154edde Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Diffstat (limited to 'sample/template')
-rw-r--r--sample/template/main.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/sample/template/main.cpp b/sample/template/main.cpp
index fef270b..848d2c5 100644
--- a/sample/template/main.cpp
+++ b/sample/template/main.cpp
@@ -90,9 +90,7 @@ int main(int argc, char *argv[])
}
// Application should call requestSurface at first
- json_object *obj = json_object_new_object();
- json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(app_name.c_str()));
- if (wm->requestSurface(obj) != 0) {
+ if (wm->requestSurface(myname.c_str()) != 0) {
exit(EXIT_FAILURE);
}
@@ -122,11 +120,9 @@ int main(int argc, char *argv[])
json_object_object_get(object, wm->kKeyDrawingName));
const char *area = json_object_get_string(
json_object_object_get(object, wm->kKeyDrawingArea));
- fprintf(stderr, "Surface %s got syncDraw!\n", label);
+ fprintf(stderr, "Surface %s got syncDraw! area: %s.\n", label, area);
// Application should call LibWindowmanager::endDraw() in SyncDraw handler
- json_object *obj = json_object_new_object();
- json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(app_name.c_str()));
- wm->endDraw(obj);
+ wm->endDraw(app_name.c_str());
});
wm->set_event_handler(LibWindowmanager::Event_FlushDraw, [wm](json_object *object) {
const char *label = json_object_get_string(
@@ -145,13 +141,16 @@ int main(int argc, char *argv[])
hs->init(port, token.c_str());
// Set event handler
- hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [wm](json_object *object) {
- qDebug("Surface %s got tapShortcut\n", myname.c_str());
- // Application should call LibWindowmanager::endDraw() in TapShortcut handler
- json_object *obj = json_object_new_object();
- json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(myname.c_str()));
- json_object_object_add(obj, wm->kKeyDrawingArea, json_object_new_string("normal.full"));
- wm->activateSurface(obj);
+ hs->set_event_handler(LibHomeScreen::Event_ShowWindow, [hs, wm](json_object *object) {
+ qDebug("Surface %s got showWindow\n", myname.c_str());
+ struct json_object *param_obj = json_object_object_get(object, hs->_keyParameter);
+ const char *area = json_object_get_string(
+ json_object_object_get(param_obj, hs->_keyArea));
+ // Application should call LibWindowmanager::activateWindow() in showWindow handler
+ if(area == nullptr)
+ wm->activateWindow(myname.c_str(), hs->_areaNormal);
+ else
+ wm->activateWindow(myname.c_str(), area);
});
/*