Removed build deps on ecore-x and libslp-utilx
[profile/ivi/taskmanager.git] / src / _logic.c
index 8285da0..041074a 100755 (executable)
@@ -19,7 +19,9 @@
 
 #include <appcore-common.h>
 #include <aul.h>
+#if HAVE_X
 #include <Ecore_X.h>
+#endif
 #include <vconf.h>
 
 #include "taskmanager.h"
@@ -37,14 +39,18 @@ _D("func\n");
        struct appdata *ad = (struct appdata *)data;
        retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
 
+       int ret = -1;
+
        _fini_pthread();
        if (ad->update_timer) {
                ecore_timer_del(ad->update_timer);
                ad->update_timer = NULL;
        }
-       _subt_einalist_item(ad, pid);
 
-       _D("mode(%d) count(%d)\n", ad->mode, ad->endcnt);
+       ret = _subt_einalist_item(ad, pid);
+       _D("mode(%d) count(%d) pid(%d) \n", ad->mode, ad->endcnt, pid);
+
+       if (ret != -1) {
        switch (ad->mode) {
        default:
        case MODE_END_INUSE:
@@ -74,6 +80,7 @@ _D("func\n");
                break;
        }
 }
+}
 
 static void _back_cb(void *data, Evas_Object *obj, void *event_info)
 {
@@ -165,7 +172,6 @@ int _app_create(struct appdata *ad)
        evas_object_smart_callback_add(gl, "scroll,drag,stop", _drag_stop_cb, ad);
        evas_object_smart_callback_add(gl, "scroll,anim,start", _anim_start_cb, ad);
        evas_object_smart_callback_add(gl, "scroll,anim,stop", _anim_stop_cb, ad);
-//     evas_object_smart_callback_add(gl, "edge,bottom", _moved_cb, ad);
        ad->gl = gl;
 
        bt = elm_button_add(nv);
@@ -182,12 +188,11 @@ int _app_create(struct appdata *ad)
 
 static void _get_win_geometry(struct appdata *ad)
 {
-       Ecore_X_Window focus_win;
-       Ecore_X_Window root_win;
-
-       focus_win = ecore_x_window_focus_get();
-       root_win = ecore_x_window_root_get(focus_win);
-       ecore_x_window_size_get(root_win, &ad->root_w, &ad->root_h);
+       Evas_Object *eo;
+       Ecore_Evas *ee;
+       ee = ecore_evas_ecore_evas_get(evas_object_evas_get(ad->win));
+       ecore_evas_screen_geometry_get(ee, 0, 0, &ad->root_w, &ad->root_h);
 }
 
 static void _vconf_noti_cb(keynode_t *node, void *data)
@@ -201,6 +206,8 @@ static void _set_vconf_noti(void *data)
                        _vconf_noti_cb, NULL);
 }
 
+/* X specific */
+#if HAVE_X
 /* this func is to exit taskmanager after launching application */
 static Eina_Bool __climsg_cb(void *data, int type, void *event)
 {
@@ -218,7 +225,9 @@ static Eina_Bool __climsg_cb(void *data, int type, void *event)
 
        pid_a = ev->data.l[1];
        pid_d = ev->data.l[3];
+#if HAVE_X
        a_deact = ecore_x_atom_get("_X_ILLUME_DEACTIVATE_WINDOW");
+#endif
 
        /* when pid_a == pid_d, this is useless data */
        if (pid_a == pid_d) {
@@ -236,6 +245,7 @@ static Eina_Bool __climsg_cb(void *data, int type, void *event)
 
        return ECORE_CALLBACK_CANCEL;
 }
+#endif
 
 static Eina_Bool _ask_kill_process(void *data)
 {
@@ -335,12 +345,16 @@ Eina_Bool _create_idler_cb(void *data)
 
        evas_object_show(ad->win);
 
+#if HAVE_X
        _key_grab(ad);
+#endif
 
        _init_pthread();
        _get_win_geometry(ad);
        _set_vconf_noti(ad);
+#if HAVE_X
        ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __climsg_cb, ad);
+#endif
 
        return ECORE_CALLBACK_CANCEL;
 }