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.
19 #include <vconf-keys.h>
21 #include "lockscreen.h"
23 #include "simple-password.h"
24 #include "complex-password.h"
26 static double _get_move(Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2)
28 return ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
31 static void _flick_event_process(struct appdata *ad)
36 vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
37 if(locktype == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD){
38 simple_password_layout_create(ad);
39 } else if(locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD){
40 complex_password_layout_create(ad);
44 void _mouse_down_cb_s(void *data, Evas * evas, Evas_Object * obj, void *event_info)
46 LOGD("[ == %s == ]", __func__);
47 struct appdata *ad = data;
51 evas_pointer_output_xy_get(evas_object_evas_get(obj), &ad->posx[POS_DOWN], &ad->posy[POS_DOWN]);
52 if(ad->posy[POS_DOWN] < FLICK_LINE) {
56 ad->posx[POS_REC] = ad->posx[POS_DOWN];
57 ad->posy[POS_REC] = ad->posy[POS_DOWN];
61 void _mouse_move_cb_s(void *data, Evas * evas, Evas_Object * obj, void *event_info)
63 struct appdata *ad = data;
68 evas_pointer_output_xy_get(evas_object_evas_get(obj), &ad->posx[POS_MOVE], &ad->posy[POS_MOVE]);
69 if(ad->posy[POS_MOVE] < ad->posy[POS_REC]) {
70 double d = _get_move(ad->posx[POS_DOWN], ad->posy[POS_DOWN], ad->posx[POS_MOVE], ad->posy[POS_MOVE]);
71 if(d > (_X(84100)*1.3)) {
73 LOCK_SCREEN_TRACE_DBG("====move info up====");
74 _flick_event_process(ad);
76 ad->posx[POS_REC] = ad->posx[POS_MOVE];
77 ad->posy[POS_REC] = ad->posy[POS_MOVE];
82 void _mouse_up_cb_s(void *data, Evas * evas, Evas_Object * obj, void *event_info)
84 struct appdata *ad = data;
90 evas_pointer_output_xy_get(evas_object_evas_get(obj), &ad->posx[POS_UP], &ad->posy[POS_UP]);
91 if(ad->posy[POS_UP] < ad->posy[POS_REC]) {
92 double d = _get_move(ad->posx[POS_DOWN], ad->posy[POS_DOWN], ad->posx[POS_UP], ad->posy[POS_UP]);
93 if(d > (_X(84100)*1.3)) {
94 LOCK_SCREEN_TRACE_DBG("====move info up====");
95 _flick_event_process(ad);
101 void _slider_down_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info)
103 Evas_Event_Mouse_Down *ev = event_info;
104 struct appdata *ad = (struct appdata *) data;
107 LOCK_SCREEN_TRACE_DBG("appdata is NULL");
112 LOCK_SCREEN_TRACE_DBG("event_info is NULL");
116 if (ad->slider_rel1.x <= ev->canvas.x && ad->slider_rel1.y <= ev->canvas.y
117 && (ad->slider_rel1.x + ad->slider_rel1.w) >= ev->canvas.x
118 && (ad->slider_rel1.y + ad->slider_rel1.h) >= ev->canvas.y) {
121 edje_object_signal_emit(_EDJ(ad->slider), "press",
123 edje_object_signal_emit(_EDJ(ad->slider), "press02",
126 LOCK_SCREEN_TRACE_DBG("sliding is canceled");
131 void _slider_move_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info)
133 Evas_Event_Mouse_Move *ev = event_info;
134 struct appdata *ad = (struct appdata *) data;
140 LOCK_SCREEN_TRACE_DBG("appdata is NULL");
145 LOCK_SCREEN_TRACE_DBG("event_info is NULL");
154 if (ad->slider_rel1.x <= ev->cur.canvas.x
155 && ad->slider_rel1.y <= ev->cur.canvas.y
156 && (ad->slider_rel2.x + ad->slider_rel2.w) >= ev->cur.canvas.x
157 && (ad->slider_rel2.y + ad->slider_rel2.h) >= ev->cur.canvas.y) {
160 step_width = (ad->slider_rel2.x + ad->slider_rel2.w - ad->slider_rel1.x)
162 step_number = (ev->cur.canvas.x - ad->slider_rel1.x) / step_width;
164 alpha = 255 - (2.55 * step_number * 3);
166 if (step_number < 1) {
167 edje_object_signal_emit(_EDJ(ad->slider), "press02",
169 } else if (step_number < 2) {
170 edje_object_signal_emit(_EDJ(ad->slider), "press03",
172 } else if (step_number < 3) {
173 edje_object_signal_emit(_EDJ(ad->slider), "press04",
175 } else if (step_number < 4) {
176 edje_object_signal_emit(_EDJ(ad->slider), "press05",
178 } else if (step_number < 5) {
179 edje_object_signal_emit(_EDJ(ad->slider), "press06",
181 } else if (step_number < 6) {
182 edje_object_signal_emit(_EDJ(ad->slider), "press07",
184 } else if (step_number < 7) {
185 edje_object_signal_emit(_EDJ(ad->slider), "press08",
187 } else if (step_number < 8) {
188 edje_object_signal_emit(_EDJ(ad->slider), "press09",
190 } else if (step_number < 9) {
191 edje_object_signal_emit(_EDJ(ad->slider), "press10",
193 } else if (step_number < 10) {
194 edje_object_signal_emit(_EDJ(ad->slider), "press11",
196 } else if (step_number < 11) {
197 edje_object_signal_emit(_EDJ(ad->slider), "press12",
199 } else if (step_number < 12) {
200 edje_object_signal_emit(_EDJ(ad->slider), "press13",
202 } else if (step_number < 13) {
203 edje_object_signal_emit(_EDJ(ad->slider), "press14",
206 edje_object_signal_emit(_EDJ(ad->slider), "press15",
209 evas_object_color_set(ad->ly_main, alpha, alpha, alpha, alpha);
211 LOCK_SCREEN_TRACE_DBG("sliding is canceled");
214 evas_object_color_set(ad->ly_main, 255, 255, 255, 255);
216 edje_object_signal_emit(_EDJ(ad->slider), "release",
218 edje_object_signal_emit(_EDJ(ad->slider), "release",
224 void _slider_up_cb(void *data, Evas * evas, Evas_Object * obj, void *event_info)
226 Evas_Event_Mouse_Up *ev = event_info;
227 struct appdata *ad = (struct appdata *) data;
230 LOCK_SCREEN_TRACE_DBG("appdata is NULL");
235 LOCK_SCREEN_TRACE_DBG("event_info is NULL");
239 if (ad->bDrag == 1 && ad->slider_rel2.x <= ev->canvas.x
240 && ad->slider_rel2.y <= ev->canvas.y
241 && (ad->slider_rel2.x + ad->slider_rel2.w) >= ev->canvas.x
242 && (ad->slider_rel2.y + ad->slider_rel2.h) >= ev->canvas.y) {
245 LOCK_SCREEN_TRACE_DBG("sliding is canceled");
249 edje_object_signal_emit(_EDJ(ad->slider), "release", "lock.image.l");
250 edje_object_signal_emit(_EDJ(ad->slider), "release", "lock.image.r");
252 if (ad->bDrag == 1) {
253 LOCK_SCREEN_TRACE_DBG("unlock the lock-screen");
257 evas_object_color_set(ad->ly_main, 255, 255, 255, 255);