2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <system_info.h>
23 #include "lockscreen.h"
26 #define QP_EMUL_STR "Emulator"
28 static void win_del(void *data, Evas_Object * obj, void *event)
33 static Evas_Object *create_win(const char *name)
41 eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
43 LOGE("[%s:%d] eo is NULL", __func__, __LINE__);
47 elm_win_title_set(eo, name);
48 elm_win_borderless_set(eo, EINA_TRUE);
49 evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
50 ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
51 evas_object_resize(eo, w, h);
52 elm_win_alpha_set(eo, EINA_TRUE);
57 static void resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
62 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
65 static int _check_emul()
70 if (system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &info) == 0) {
71 if (info == NULL) return 0;
72 if (!strncmp(QP_EMUL_STR, info, strlen(info))) {
77 if (info != NULL) free(info);
82 static bool app_create(void *data)
84 struct appdata *ad = data;
85 LOGD("[ == %s == ]", __func__);
96 Evas_Object *win = NULL;
98 ecore_x_window_size_get(ecore_x_window_root_first_get(), &ad->win_w, &ad->win_h);
99 LOGD("[%s:%d] win_w : %d, win_h : %d", __func__, __LINE__, ad->win_w, ad->win_h);
101 win = create_win(PACKAGE);
105 elm_win_conformant_set(ad->win, EINA_TRUE);
106 evas_object_resize(win, ad->win_w, ad->win_h);
107 evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, resize_cb, NULL);
109 int ret = _app_create(ad);
116 static void app_service(service_h service, void *data)
118 struct appdata *ad = data;
119 LOGD("[ == %s == ]", __func__);
124 elm_win_activate(ad->win);
129 static void app_terminate(void *data)
131 struct appdata *ad = data;
132 LOGD("[ == %s == ]", __func__);
137 evas_object_del(ad->ly_main);
140 evas_object_del(ad->win);
143 static void app_pause(void *data)
145 struct appdata *ad = data;
146 LOGD("[ == %s == ]", __func__);
151 static void app_resume(void *data)
153 struct appdata *ad = data;
154 LOGD("[ == %s == ]", __func__);
159 static void device_orientation(app_device_orientation_e orientation, void * data)
161 struct appdata *ad = data;
162 LOGD("[ == %s == ]", __func__);
163 if (ad == NULL || ad->win == NULL)
167 int main(int argc, char *argv[])
171 app_event_callback_s event_callback;
173 event_callback.create = app_create;
174 event_callback.terminate = app_terminate;
175 event_callback.pause = app_pause;
176 event_callback.resume = app_resume;
177 event_callback.service = app_service;
178 event_callback.low_memory = NULL;
179 event_callback.low_battery = NULL;
180 event_callback.device_orientation = device_orientation;
181 event_callback.language_changed = NULL;
182 event_callback.region_format_changed = NULL;
184 memset(&ad, 0x0, sizeof(struct appdata));
187 setenv("ELM_ENGINE", "gl", 1);
190 return app_efl_main(&argc, &argv, &event_callback, &ad);