2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.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__);
97 Evas_Object *win = NULL;
99 ecore_x_window_size_get(ecore_x_window_root_first_get(), &ad->win_w, &ad->win_h);
100 LOGD("[%s:%d] win_w : %d, win_h : %d", __func__, __LINE__, ad->win_w, ad->win_h);
102 win = create_win(PACKAGE);
106 elm_win_conformant_set(ad->win, EINA_TRUE);
107 evas_object_resize(win, ad->win_w, ad->win_h);
108 evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, resize_cb, NULL);
110 int ret = _app_create(ad);
117 static void app_service(service_h service, void *data)
119 struct appdata *ad = data;
120 LOGD("[ == %s == ]", __func__);
125 elm_win_activate(ad->win);
130 static void app_terminate(void *data)
132 struct appdata *ad = data;
133 LOGD("[ == %s == ]", __func__);
138 evas_object_del(ad->ly_main);
141 evas_object_del(ad->win);
144 static void app_pause(void *data)
146 struct appdata *ad = data;
147 LOGD("[ == %s == ]", __func__);
152 static void app_resume(void *data)
154 struct appdata *ad = data;
155 LOGD("[ == %s == ]", __func__);
160 static void device_orientation(app_device_orientation_e orientation, void * data)
162 struct appdata *ad = data;
163 LOGD("[ == %s == ]", __func__);
164 if (ad == NULL || ad->win == NULL)
168 int main(int argc, char *argv[])
172 app_event_callback_s event_callback;
174 event_callback.create = app_create;
175 event_callback.terminate = app_terminate;
176 event_callback.pause = app_pause;
177 event_callback.resume = app_resume;
178 event_callback.service = app_service;
179 event_callback.low_memory = NULL;
180 event_callback.low_battery = NULL;
181 event_callback.device_orientation = device_orientation;
182 event_callback.language_changed = NULL;
183 event_callback.region_format_changed = NULL;
185 memset(&ad, 0x0, sizeof(struct appdata));
188 setenv("ELM_ENGINE", "gl", 1);
191 return app_efl_main(&argc, &argv, &event_callback, &ad);