modify simple-egl
[src/libhomescreen.git] / sample / simple-egl / src / simple-egl.cpp
index 799729b..af39149 100644 (file)
@@ -569,15 +569,17 @@ init_hs(LibHomeScreen* hs){
                return -1;
        }
 
-       hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [](json_object *object){
-               const char *application_name = json_object_get_string(
-                       json_object_object_get(object, "application_name"));
-               HMI_DEBUG("simple-egl","Event_TapShortcut application_name = %s ", application_name);
-               if(strcmp(application_name, app_name.c_str()) == 0)
-               {
-                       HMI_DEBUG("simple-egl","try to activesurface %s ", app_name.c_str());
-                       wm->activateWindow(main_role);
-               }
+       hs->set_event_handler(LibHomeScreen::Event_ShowWindow, [hs](json_object *object){
+               HMI_DEBUG("simple-egl","try to activeWindow %s ", app_name.c_str());
+
+               struct json_object *param_obj = json_object_object_get(object, "parameter");
+               const char *area = json_object_get_string(
+                       json_object_object_get(param_obj, "area"));
+               // Application should call LibWindowmanager::activateWindow() in showWindow handler
+               if(area == nullptr)
+                       wm->activateWindow(main_role, "normal.full");
+               else
+                       wm->activateWindow(main_role, area);
        });
 
        return 0;
@@ -651,7 +653,8 @@ main(int argc, char **argv)
 
        eglSwapBuffers(window.display->egl.dpy, window.egl_surface);
 
-       wm->activateWindow(main_role);
+       // wm->activateWindow(main_role);
+       hs->publishSubscription();
 
        /* The mainloop here is a little subtle.  Redrawing will cause
         * EGL to read events so we can just call