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.
20 #include <system_info.h>
22 #include "lockscreen.h"
25 #define QP_EMUL_STR "Emulator"
27 static void win_del(void *data, Evas_Object * obj, void *event)
32 static Evas_Object *create_win(const char *name)
40 eo = elm_win_add(NULL, name, ELM_WIN_NOTIFICATION);
42 LOGE("[%s:%d] eo is NULL", __func__, __LINE__);
46 elm_win_title_set(eo, name);
47 elm_win_borderless_set(eo, EINA_TRUE);
48 evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
49 elm_win_alpha_set(eo, EINA_TRUE);
54 static void resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
59 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
62 static int _check_emul()
67 if (system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &info) == 0) {
68 if (info == NULL) return 0;
69 if (!strncmp(QP_EMUL_STR, info, strlen(info))) {
74 if (info != NULL) free(info);
79 static bool app_create(void *data)
81 struct appdata *ad = data;
82 LOGD("[ == %s == ]", __func__);
93 Evas_Object *win = NULL;
95 win = create_win("LOCK_SCREEN");
99 elm_win_conformant_set(ad->win, EINA_TRUE);
100 evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, resize_cb, NULL);
102 int ret = _app_create(ad);
109 static void app_service(service_h service, void *data)
111 struct appdata *ad = data;
112 LOGD("[ == %s == ]", __func__);
117 elm_win_activate(ad->win);
122 static void app_terminate(void *data)
124 struct appdata *ad = data;
125 LOGD("[ == %s == ]", __func__);
130 evas_object_del(ad->ly_main);
133 evas_object_del(ad->win);
136 static void app_pause(void *data)
138 struct appdata *ad = data;
139 LOGD("[ == %s == ]", __func__);
144 static void app_resume(void *data)
146 struct appdata *ad = data;
147 LOGD("[ == %s == ]", __func__);
152 static void device_orientation(app_device_orientation_e orientation, void * data)
154 struct appdata *ad = data;
155 LOGD("[ == %s == ]", __func__);
156 if (ad == NULL || ad->win == NULL)
160 int main(int argc, char *argv[])
164 app_event_callback_s event_callback;
166 event_callback.create = app_create;
167 event_callback.terminate = app_terminate;
168 event_callback.pause = app_pause;
169 event_callback.resume = app_resume;
170 event_callback.service = app_service;
171 event_callback.low_memory = NULL;
172 event_callback.low_battery = NULL;
173 event_callback.device_orientation = device_orientation;
174 event_callback.language_changed = NULL;
175 event_callback.region_format_changed = NULL;
177 memset(&ad, 0x0, sizeof(struct appdata));
180 setenv("ELM_ENGINE", "gl", 1);
183 return app_efl_main(&argc, &argv, &event_callback, &ad);