Fix tick callback 17/70217/2 accepted/tizen/common/20160520.171049 accepted/tizen/ivi/20160520.081234 accepted/tizen/mobile/20160520.081148 accepted/tizen/tv/20160520.081122 accepted/tizen/wearable/20160520.081104 submit/tizen/20160520.013728
authorDaehyeon Jung <darrenh.jung@samsung.com>
Wed, 18 May 2016 23:30:01 +0000 (08:30 +0900)
committerDaehyeon Jung <darrenh.jung@samsung.com>
Wed, 18 May 2016 23:41:28 +0000 (08:41 +0900)
Change-Id: I6a146efbfc5c0a7dc2706fdfa69aa72d5bbe2f74
Signed-off-by: Daehyeon Jung <darrenh.jung@samsung.com>
CMakeLists.txt
packaging/appcore-watch.spec
src/appcore-watch.c

index b068da0..5c27e0d 100644 (file)
@@ -42,6 +42,7 @@ pkg_check_modules(pkg_watch REQUIRED
                capi-appfw-app-common
                vconf
                elementary
+               ecore-wayland
                vconf-internal-keys
                libtzplatform-config
                capi-appfw-widget-application
index a59d439..fa9c568 100644 (file)
@@ -17,6 +17,7 @@ BuildRequires:  pkgconfig(capi-appfw-app-common)
 BuildRequires: pkgconfig(capi-appfw-widget-application)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(icu-uc)
+BuildRequires: pkgconfig(ecore-wayland)
 BuildRequires:  cmake
 
 
index 5f728df..2b99174 100755 (executable)
@@ -33,6 +33,7 @@
 #include <vconf.h>
 #include <alarm.h>
 #include <glib-object.h>
+#include <Ecore_Wayland.h>
 #include <widget_app.h>
 
 #include "appcore-watch.h"
@@ -966,6 +967,57 @@ static int __signal_alpm_handler(int ambient, void *data)
        return 0;
 }
 
+static Eina_Bool __show_cb(void *data, int type, void *event)
+{
+       Ecore_Wl_Event_Window_Show *ev = event;
+
+       _D("show %d %d", (unsigned int)ev->win, (unsigned int)ev->data[0]);
+
+       __do_app(WE_RESUME, &priv, NULL);
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool __hide_cb(void *data, int type, void *event)
+{
+       Ecore_Wl_Event_Window_Hide *ev = event;
+
+       _D("hide %d", (unsigned int)ev->win);
+
+       __do_app(WE_PAUSE, &priv, NULL);
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool __visibility_cb(void *data, int type, void *event)
+{
+       Ecore_Wl_Event_Window_Visibility_Change *ev = event;
+
+       _D("visibility %d %d", (unsigned int)ev->win, (unsigned int)ev->fully_obscured);
+
+       if (ev->fully_obscured)
+               __do_app(WE_PAUSE, &priv, NULL);
+       else
+               __do_app(WE_RESUME, &priv, NULL);
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool __lower_cb(void *data, int type, void *event)
+{
+       _D("lower");
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static void __add_climsg(void)
+{
+       ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_SHOW, __show_cb, NULL);
+       ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_HIDE, __hide_cb, NULL);
+       ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE, __visibility_cb, NULL);
+       ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_LOWER, __lower_cb, NULL);
+}
+
 static void __watch_core_signal_init(void)
 {
        _watch_core_listen_alpm_handler(__signal_alpm_handler, NULL);
@@ -1030,6 +1082,8 @@ static int __before_loop(struct watch_priv *watch, int argc, char **argv)
 
        elm_init(argc, argv);
 
+       __add_climsg();
+
        r = watch_core_init(watch->name, &w_ops, argc, argv);
        _retv_if(r < 0, -1);