2 * Copyright (c) 2009-2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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.
17 #include <Elementary.h>
18 #ifdef USE_TIZEN_SHELL
19 #include <tzsh_lockscreen_service.h>
28 Evas_Object *conformant;
31 static void _lockscreen_window_event_rect_mouse_down_cb(void *data, Evas *e, Evas_Object *src, void *event_info)
33 evas_object_smart_callback_call(data, SIGNAL_TOUCH_STARTED, NULL);
36 static void _lockscreen_window_event_rect_mouse_up_cb(void *data, Evas *e, Evas_Object *src, void *event_info)
38 evas_object_smart_callback_call(data, SIGNAL_TOUCH_ENDED, NULL);
41 static void _lockscreen_window_event_rect_geometry_changed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
44 evas_object_geometry_get(obj, &x, &y, &w, &h);
45 evas_object_geometry_set(data, x, y, w, h);
48 Evas_Object *lockscreen_window_create(void)
50 #ifdef USE_TIZEN_SHELL
52 tzsh_lockscreen_service_h lockscreen_service = NULL;
54 Evas_Object *win = elm_win_add(NULL, "LOCKSCREEN", ELM_WIN_NOTIFICATION);
55 if (!win) return NULL;
57 elm_win_alpha_set(win, EINA_TRUE);
58 elm_win_title_set(win, "LOCKSCREEN");
59 elm_win_borderless_set(win, EINA_TRUE);
60 elm_win_autodel_set(win, EINA_TRUE);
61 elm_win_role_set(win, "notification-normal");
62 elm_win_fullscreen_set(win, EINA_TRUE);
63 elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
65 #ifdef USE_TIZEN_SHELL
66 tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL);
68 ERR("tzsh_create failed");
73 lockscreen_service = tzsh_lockscreen_service_create(tzsh, elm_win_window_id_get(win));
74 if (!lockscreen_service) {
75 ERR("tzsh_lockscreen_service_create failed");
82 Evas_Object *conformant = elm_conformant_add(win);
83 evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
84 evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
85 elm_win_resize_object_add(win, conformant);
87 elm_object_signal_emit(conformant, "elm,state,indicator,overlap", "elm");
89 Evas_Object *event_rect = evas_object_rectangle_add(evas_object_evas_get(win));
90 evas_object_color_set(event_rect, 0, 0, 0, 0);
91 evas_object_layer_set(event_rect, EVAS_LAYER_MAX);
92 evas_object_repeat_events_set(event_rect, EINA_TRUE);
93 evas_object_event_callback_add(event_rect, EVAS_CALLBACK_MOUSE_DOWN, _lockscreen_window_event_rect_mouse_down_cb, win);
94 evas_object_event_callback_add(event_rect, EVAS_CALLBACK_MOUSE_UP, _lockscreen_window_event_rect_mouse_up_cb, win);
95 evas_object_show(event_rect);
97 evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _lockscreen_window_event_rect_geometry_changed_cb, event_rect);
98 evas_object_event_callback_add(win, EVAS_CALLBACK_MOVE, _lockscreen_window_event_rect_geometry_changed_cb, event_rect);
99 evas_object_show(win);
100 evas_object_show(conformant);
103 view.conformant = conformant;
108 void lockscreen_window_content_set(Evas_Object *content)
110 elm_object_part_content_set(view.conformant, NULL, content);