Add support for subcompositor environment 09/60609/2 accepted/tizen/common/20160302.194002 accepted/tizen/common/20160311.204004 accepted/tizen/ivi/20160302.225412 accepted/tizen/ivi/20160311.150430 accepted/tizen/mobile/20160302.225323 accepted/tizen/mobile/20160311.143442 accepted/tizen/tv/20160302.225341 accepted/tizen/tv/20160311.144955 accepted/tizen/wearable/20160302.225356 accepted/tizen/wearable/20160311.145802 submit/tizen/20160302.122750 submit/tizen/20160311.113543
authorDaehyeon Jung <darrenh.jung@samsung.com>
Mon, 29 Feb 2016 09:24:34 +0000 (18:24 +0900)
committerDaehyeon Jung <darrenh.jung@samsung.com>
Mon, 29 Feb 2016 13:13:10 +0000 (22:13 +0900)
Change-Id: Ief4adc6d7c54ac70f850a75f2dd941cf8a1483c6
Signed-off-by: Daehyeon Jung <darrenh.jung@samsung.com>
include/appcore-watch.h
src/appcore-watch.c
src/watch_app_main.c

index 75d8e59..c8b3aaa 100755 (executable)
@@ -83,6 +83,7 @@ int watch_core_terminate();
 int watch_core_set_event_callback(enum watch_core_event event,
                        int (*cb)(void *, void *), void *data);
 
+const char *watch_core_get_appid();
 
 void watch_core_get_timeinfo(struct watch_time_s *timeinfo);
 
index a10cb41..de22d51 100755 (executable)
@@ -25,6 +25,8 @@
 #include <malloc.h>
 #include <assert.h>
 
+#include <bundle_internal.h>
+
 #include <Elementary.h>
 
 #include <app_control.h>
@@ -1009,14 +1011,6 @@ static int __signal_alpm_handler(int ambient, void *data)
        return 0;
 }
 
-static int  __watch_core_widget_init(void)
-{
-       _D("Initialize the widget");
-
-       return 0;
-
-}
-
 static void __watch_core_signal_init(void)
 {
        _watch_core_listen_alpm_handler(__signal_alpm_handler, NULL);
@@ -1039,13 +1033,48 @@ static int __before_loop(struct watch_priv *watch, int argc, char **argv)
        g_type_init();
 #endif
 
+       bundle *kb = NULL;
+       char *wayland_display = NULL;
+       char *xdg_runtime_dir = NULL;
+       char *width_str = NULL;
+       char *height_str = NULL;
+       int width = 360;
+       int height = 360;
+       kb = bundle_import_from_argv(argc, argv);
+       if (kb) {
+               bundle_get_str(kb, "XDG_RUNTIME_DIR", &xdg_runtime_dir);
+               bundle_get_str(kb, "WAYLAND_DISPLAY", &wayland_display);
+               bundle_get_str(kb, "WATCH_WIDTH", &width_str);
+               bundle_get_str(kb, "WATCH_HEIGHT", &height_str);
+
+               if (xdg_runtime_dir) {
+                       _E("senenv: %s", xdg_runtime_dir);
+                       setenv("XDG_RUNTIME_DIR", xdg_runtime_dir, 1);
+               } else
+                       _E("failed to get xdgruntimedir");
+
+               if (wayland_display) {
+                       _E("setenv: %s", wayland_display);
+                       setenv("WAYLAND_DISPLAY", wayland_display, 1);
+               } else
+                       _E("failed to get waylanddisplay");
+
+               if (width_str)
+                       width = atoi(width_str);
+
+               if (height_str)
+                       height = atoi(height_str);
+
+               bundle_free(kb);
+       } else
+               _E("failed to get launch argv");
+
        elm_init(argc, argv);
 
        r = watch_core_init(watch->name, &w_ops, argc, argv);
        _retv_if(r < 0, -1);
 
-       r = __watch_core_widget_init();
-       _retv_if(r < 0, r);
+       __widget_create(NULL, NULL, width, height, NULL);
 
        __watch_core_signal_init();
 
@@ -1107,3 +1136,7 @@ EXPORT_API void watch_core_get_timeinfo(struct watch_time_s *timeinfo)
        __get_timeinfo(timeinfo);
 }
 
+EXPORT_API const char *watch_core_get_appid()
+{
+       return priv.appid;
+}
index 140fc74..6b99141 100755 (executable)
@@ -618,7 +618,7 @@ EXPORT_API int watch_app_get_elm_win(Evas_Object **win)
        if (win == NULL)
                return watch_app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
 
-       ret_win = elm_win_add(NULL, NULL, ELM_WIN_BASIC);
+       ret_win = elm_win_add(NULL, watch_core_get_appid(), ELM_WIN_BASIC);
        if (ret_win == NULL)
                return watch_app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);