Make lockscreen less dependent of ecore_x. 36/15736/2
authorFabio Mello <fabio.mello@intel.com>
Wed, 15 Jan 2014 15:28:37 +0000 (13:28 -0200)
committerFabio Mello <fabio.mello@intel.com>
Tue, 11 Feb 2014 17:04:09 +0000 (15:04 -0200)
Change-Id: Idaff7c954e7b7a813d61c7917ddec408822635f6
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Signed-off-by: Fabio Mello <fabio.mello@intel.com>
src/lockscreen.c
src/lockscreen.h
src/util.c

index d44327e..4e97d8c 100755 (executable)
@@ -17,7 +17,6 @@
 
 #include <app.h>
 #include <vconf.h>
-#include <Ecore_X.h>
 #include <system_info.h>
 
 #include "lockscreen.h"
@@ -38,7 +37,7 @@ static Evas_Object *create_win(const char *name)
        Evas_Object *eo;
        int w, h;
 
-       eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       eo = elm_win_add(NULL, name, ELM_WIN_NOTIFICATION);
        if (!eo) {
                LOGE("[%s:%d] eo is NULL", __func__, __LINE__);
                return NULL;
@@ -47,8 +46,6 @@ static Evas_Object *create_win(const char *name)
        elm_win_title_set(eo, name);
        elm_win_borderless_set(eo, EINA_TRUE);
        evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
-       ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
-       evas_object_resize(eo, w, h);
        elm_win_alpha_set(eo, EINA_TRUE);
 
        return eo;
@@ -95,15 +92,11 @@ static bool app_create(void *data)
 
        Evas_Object *win = NULL;
 
-       ecore_x_window_size_get(ecore_x_window_root_first_get(), &ad->win_w, &ad->win_h);
-       LOGD("[%s:%d] win_w : %d, win_h : %d", __func__, __LINE__, ad->win_w, ad->win_h);
-
-       win = create_win(PACKAGE);
+       win = create_win("LOCK_SCREEN");
        if (win == NULL)
                return false;
        ad->win = win;
        elm_win_conformant_set(ad->win, EINA_TRUE);
-       evas_object_resize(win, ad->win_w, ad->win_h);
        evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, resize_cb, NULL);
 
        int ret = _app_create(ad);
index ccc91f2..782057a 100755 (executable)
@@ -55,8 +55,6 @@ struct appdata {
        Evas_Object *win;
        Evas_Object *ly_main;//top_layout
 
-       Evas_Coord win_w;
-       Evas_Coord win_h;
        Evas_Coord posx[POS_MAX];
        Evas_Coord posy[POS_MAX];
 
index 50afbb0..6170b8e 100755 (executable)
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <Ecore_X.h>
 #include <Elementary.h>
 #include <utilX.h>
 #include <vconf.h>
@@ -48,8 +47,6 @@ void _set_win_property(Evas_Object * win)
                return;
        }
 
-       ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
-
        utilx_set_system_notification_level(ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_NORMAL);
 
        utilx_set_window_opaque_state(ecore_x_display_get(), xwin, UTILX_OPAQUE_STATE_ON);
@@ -109,7 +106,6 @@ Evas_Object *_make_top_layout(struct appdata *ad)
        elm_win_resize_object_add(ad->win, conform);
        elm_object_content_set(conform, eo);
        evas_object_show(conform);
-       evas_object_resize(eo, ad->win_w, ad->win_h);
 
        return eo;
 }
@@ -262,13 +258,16 @@ static void _pm_state_cb(keynode_t * node, void *data)
 static Eina_Bool _init_widget_cb(void *data)
 {
        struct appdata *ad = data;
+       int width, height;
        LOGD("[ == %s == ]", __func__);
        if (ad == NULL)
                return ECORE_CALLBACK_CANCEL;
 
+       elm_win_screen_size_get(ad->win, NULL, NULL, &width, &height);
+
        ad->slider = _make_slider(ad->ly_main);
-       evas_object_resize(ad->slider, ad->win_w, SLIDER_RATIO_H * ad->win_h);
-       evas_object_move(ad->slider, 0, SLIDER_RATIO_Y * ad->win_h);
+       evas_object_resize(ad->slider, width, SLIDER_RATIO_H * height);
+       evas_object_move(ad->slider, 0, SLIDER_RATIO_Y * height);
        evas_object_show(ad->slider);
        evas_object_geometry_get(
                        edje_object_part_object_get(_EDJ(ad->slider), "lock.wrapper.image.l"),
@@ -318,11 +317,14 @@ static Eina_Bool _init_widget_cb(void *data)
 
 int _app_create(struct appdata *ad)
 {
+       Ecore_Evas *ee;
        if (ad == NULL)
                return -1;
        LOGD("[ == %s == ]", __func__);
 
-       ecore_x_icccm_name_class_set(elm_win_xwindow_get(ad->win), "LOCK_SCREEN", "LOCK_SCREEN");
+       ee = ecore_evas_object_ecore_evas_get(ad->win);
+       ecore_evas_name_class_set(ee, "LOCK_SCREEN", "LOCK_SCREEN");
+
        evas_object_show(ad->win);
        _set_win_property(ad->win);