Merged with devel
[platform/core/uifw/e17-extra-modules.git] / move-tizen / src / e_mod_move_indicator_widget.c
1 #include "e_mod_move_shared_types.h"
2 #include "e_mod_move_debug.h"
3 #include "e_mod_move.h"
4
5 /* local subsystem functions */
6 static Eina_Bool      _e_mod_move_indicator_widget_apptray_move_set(E_Move_Indicator_Widget *indi_widget, Eina_Bool state);
7 static Eina_Bool      _e_mod_move_indicator_widget_quickpanel_move_set(E_Move_Indicator_Widget *indi_widget, Eina_Bool state);
8 static Eina_Bool      _e_mod_move_indicator_widget_apptray_move_get(E_Move_Indicator_Widget *indi_widget);
9 static Eina_Bool      _e_mod_move_indicator_widget_quickpanel_move_get(E_Move_Indicator_Widget *indi_widget);
10 static Eina_Bool      _e_mod_move_indicator_widget_move_started_set(E_Move_Indicator_Widget *indi_widget, Eina_Bool state);
11 static Eina_Bool      _e_mod_move_indicator_widget_move_started_get(E_Move_Indicator_Widget *indi_widget);
12 static Eina_Bool      _e_mod_move_indicator_widget_cb_motion_start_internal_apptray_check(E_Move_Border *at_mb);
13 static Eina_Bool      _e_mod_move_indicator_widget_cb_motion_start_internal_quickpanel_check(E_Move_Border *qp_mb);
14 static Eina_Bool      _e_mod_move_indicator_widget_quickpanel_flick_process(E_Move_Indicator_Widget *indi_widget, E_Move_Border *mb2, int angle, Eina_Bool state);
15 static Eina_Bool      _e_mod_move_indicator_widget_apptray_flick_process(E_Move_Indicator_Widget *indi_widget, E_Move_Border *mb2, int angle, Eina_Bool state);
16 static Eina_Bool      _e_mod_move_indicator_widget_home_region_release_check(E_Move_Indicator_Widget  *indi_widget, Eina_Bool apptray_move, int angle, Evas_Point pos);
17 static Eina_Bool      _e_mod_move_indicator_widget_cb_motion_start(void *data, void *event_info);
18 static Eina_Bool      _e_mod_move_indicator_widget_cb_motion_move(void *data, void *event_info);
19 static Eina_Bool      _e_mod_move_indicator_widget_cb_motion_end(void *data, void *event_info);
20 static void           _e_mod_move_indicator_widget_obj_event_setup(E_Move_Indicator_Widget *indicator_widget, E_Move_Widget_Object *mwo);
21 static Eina_Bool      _e_mod_move_indicator_widget_scrollable_object_movable_check(E_Move_Indicator_Widget *indi_widget, E_Move_Border *mb, Evas_Point pos);
22 static Eina_Bool      _e_mod_move_indicator_widget_target_window_find_by_pointer(Ecore_X_Window *win, int x, int y);
23 static Ecore_X_Window _e_mod_move_indicator_widget_event_win_find(void *event_info);
24 static Eina_Bool      _e_mod_move_indicator_widget_target_window_policy_check(E_Move_Border *mb);
25 static Eina_Bool      _e_mod_move_indicator_widget_event_send_policy_check(E_Move_Indicator_Widget *indi_widget, Evas_Point pos);
26 static void           _e_mod_move_indicator_widget_active_indicator_win_find_and_set(void);
27
28 /* local subsystem functions */
29 static Eina_Bool
30 _e_mod_move_indicator_widget_apptray_move_set(E_Move_Indicator_Widget *indi_widget,
31                                               Eina_Bool                state)
32 {
33    E_CHECK_RETURN(indi_widget, EINA_FALSE);
34    indi_widget->apptray_move = state;
35    return EINA_TRUE;
36 }
37
38 static Eina_Bool
39 _e_mod_move_indicator_widget_quickpanel_move_set(E_Move_Indicator_Widget *indi_widget,
40                                                  Eina_Bool                state)
41 {
42    E_CHECK_RETURN(indi_widget, EINA_FALSE);
43    indi_widget->quickpanel_move = state;
44    return EINA_TRUE;
45 }
46
47 static Eina_Bool
48 _e_mod_move_indicator_widget_apptray_move_get(E_Move_Indicator_Widget *indi_widget)
49 {
50    E_CHECK_RETURN(indi_widget, EINA_FALSE);
51    return indi_widget->apptray_move;
52 }
53
54 static Eina_Bool
55 _e_mod_move_indicator_widget_quickpanel_move_get(E_Move_Indicator_Widget *indi_widget)
56 {
57    E_CHECK_RETURN(indi_widget, EINA_FALSE);
58    return indi_widget->quickpanel_move;
59 }
60
61 static Eina_Bool
62 _e_mod_move_indicator_widget_move_started_set(E_Move_Indicator_Widget *indi_widget,
63                                               Eina_Bool                state)
64 {
65    E_CHECK_RETURN(indi_widget, EINA_FALSE);
66    indi_widget->move_started = state;
67    return EINA_TRUE;
68 }
69
70 static Eina_Bool
71 _e_mod_move_indicator_widget_move_started_get(E_Move_Indicator_Widget *indi_widget)
72 {
73    E_CHECK_RETURN(indi_widget, EINA_FALSE);
74    return indi_widget->move_started;
75 }
76
77 static Eina_Bool
78 _e_mod_move_indicator_widget_cb_motion_start_internal_apptray_check(E_Move_Border *at_mb)
79 {
80    E_Move        *m;
81    E_Move_Border *find_mb = NULL;
82    Eina_Bool      found = EINA_FALSE;
83    m = e_mod_move_util_get();
84
85    E_CHECK_RETURN(m, EINA_FALSE);
86    E_CHECK_RETURN(at_mb, EINA_FALSE);
87    E_CHECK_RETURN(TYPE_APPTRAY_CHECK(at_mb), EINA_FALSE);
88    E_CHECK_RETURN(at_mb->visible, EINA_FALSE);
89    E_CHECK_RETURN(e_mod_move_util_compositor_object_visible_get(at_mb),
90                   EINA_FALSE);
91    if (e_mod_move_apptray_objs_animation_state_get(at_mb)) return EINA_FALSE;
92
93    // check if notification window is on-screen.
94    EINA_INLIST_REVERSE_FOREACH(m->borders, find_mb)
95      {
96         if (TYPE_INDICATOR_CHECK(find_mb)) continue;
97         if (find_mb->visible
98              && REGION_INTERSECTS_WITH_ZONE(find_mb, at_mb->bd->zone))
99           {
100               found = EINA_TRUE;
101               break;
102           }
103      }
104    if (found
105         && (find_mb->bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NOTIFICATION))
106      {
107         return EINA_FALSE;
108      }
109    // check if notification window is on-screen.
110
111    e_mod_move_apptray_dim_show(at_mb);
112    e_mod_move_apptray_objs_add(at_mb);
113
114    // apptray_objs_animation_layer_set
115    e_mod_move_apptray_objs_animation_layer_set(at_mb);
116
117    return EINA_TRUE;
118 }
119
120 static Eina_Bool
121 _e_mod_move_indicator_widget_cb_motion_start_internal_quickpanel_check(E_Move_Border *qp_mb)
122 {
123    E_Move_Border *mini_apptray_mb = NULL;
124
125    E_CHECK_RETURN(qp_mb, EINA_FALSE);
126    E_CHECK_RETURN(TYPE_QUICKPANEL_CHECK(qp_mb), EINA_FALSE);
127    E_CHECK_RETURN(qp_mb->visible, EINA_FALSE);
128    E_CHECK_RETURN(e_mod_move_util_compositor_object_visible_get(qp_mb),
129                   EINA_FALSE);
130
131    // Quickpanel is under rotation state.
132    // I think there is another exception case.
133    // It's posible that WM doesn't send rotation change request yet.
134    // In this case the value of wait_for_done is zero,
135    // it means quickpanel isn't rotating for now, but going to be rotated.
136    if (qp_mb->bd)
137      if (qp_mb->bd->client.e.state.rot.wait_for_done) return EINA_FALSE;
138
139    if (e_mod_move_quickpanel_objs_animation_state_get(qp_mb)) return EINA_FALSE;
140
141    mini_apptray_mb = e_mod_move_mini_apptray_find();
142    if (e_mod_move_mini_apptray_objs_animation_state_get(mini_apptray_mb))
143      return EINA_FALSE;
144
145    if (!(qp_mb->m->qp_scroll_with_clipping))
146      e_mod_move_quickpanel_dim_show(qp_mb);
147
148    // Set Composite Mode & Rotation Lock & Make below win's mirror object
149    e_mod_move_quickpanel_stage_init(qp_mb);
150
151    e_mod_move_quickpanel_objs_add(qp_mb);
152
153    return EINA_TRUE;
154 }
155
156 static Eina_Bool
157 _e_mod_move_indicator_widget_quickpanel_flick_process(E_Move_Indicator_Widget  *indi_widget,
158                                                       E_Move_Border            *mb2, // mb2 : quickpanel
159                                                       int                       angle,
160                                                       Eina_Bool                 state)
161 {
162    E_Move                   *m = NULL;
163    E_Move_Border            *mb = NULL;
164    E_Move_Widget_Object     *mwo = NULL;
165    Eina_List                *l;
166    E_Zone                   *zone = NULL;
167    int mx = 0, my = 0, ax = 0, ay = 0;
168
169    E_CHECK_RETURN(indi_widget, EINA_FALSE);
170    mb = e_mod_move_border_client_find(indi_widget->win);
171    E_CHECK_RETURN(mb, EINA_FALSE);
172    E_CHECK_RETURN(mb2, EINA_FALSE);
173    E_CHECK_RETURN(TYPE_QUICKPANEL_CHECK(mb2), EINA_FALSE);
174    E_CHECK_RETURN(state, EINA_FALSE);
175
176    m = mb->m;
177    zone = mb->bd->zone;
178
179    EINA_LIST_FOREACH(indi_widget->objs, l, mwo) // indicator click unset
180      {
181         if (!mwo) continue;
182         e_mod_move_event_click_set(mwo->event, EINA_FALSE);
183      }
184
185    _e_mod_move_indicator_widget_apptray_move_set(indi_widget, EINA_FALSE);
186    _e_mod_move_indicator_widget_quickpanel_move_set(indi_widget, EINA_FALSE);
187
188    // flick data free
189    if (mb->flick_data) e_mod_move_flick_data_free(mb);
190
191    switch (angle)
192      {
193       case  90:
194          mx = 0; my = 0;
195          if (m->qp_scroll_with_clipping)
196            {
197               ax = zone->x + mb2->w;
198               ay = zone->y + mb2->h;
199            }
200          else
201            {
202               ax = mx; ay = my;
203            }
204          break;
205       case 180:
206          mx = 0; my = zone->h - mb2->h;
207          if (m->qp_scroll_with_clipping)
208            {
209               ax = zone->x; ay = zone->y;
210            }
211          else
212            {
213               ax = mx; ay = my;
214            }
215          break;
216       case 270:
217          mx = zone->w - mb2->w; my = 0;
218          if (m->qp_scroll_with_clipping)
219            {
220               ax = zone->x; ay = zone->y;
221            }
222          else
223            {
224               ax = mx; ay = my;
225            }
226          break;
227       case   0:
228       default :
229          mx = 0; my = 0;
230          if (m->qp_scroll_with_clipping)
231            {
232               ax = zone->x + mb2->w;
233               ay = zone->y + mb2->h;
234            }
235          else
236            {
237               ax = mx; ay = my;
238            }
239          break;
240      }
241
242    e_mod_move_quickpanel_e_border_move(mb2, mx, my);
243    e_mod_move_quickpanel_objs_animation_move(mb2, ax, ay);
244
245    return EINA_TRUE;
246 }
247
248 static Eina_Bool
249 _e_mod_move_indicator_widget_apptray_flick_process(E_Move_Indicator_Widget *indi_widget,
250                                                    E_Move_Border           *mb2, // mb2 : apptray
251                                                    int                      angle,
252                                                    Eina_Bool                state)
253 {
254    E_Move_Border            *mb = NULL;
255    E_Move_Widget_Object     *mwo = NULL;
256    Eina_List                *l;
257    E_Zone                   *zone = NULL;
258    int x = 0;
259    int y = 0;
260
261    E_CHECK_RETURN(indi_widget, EINA_FALSE);
262    mb = e_mod_move_border_client_find(indi_widget->win);
263    E_CHECK_RETURN(mb, EINA_FALSE);
264    E_CHECK_RETURN(mb2, EINA_FALSE);
265    E_CHECK_RETURN(TYPE_APPTRAY_CHECK(mb2), EINA_FALSE);
266    E_CHECK_RETURN(state, EINA_FALSE);
267
268    zone = mb->bd->zone;
269
270    EINA_LIST_FOREACH(indi_widget->objs, l, mwo) // indicator click unset
271      {
272         if (!mwo) continue;
273         e_mod_move_event_click_set(mwo->event, EINA_FALSE);
274      }
275
276    _e_mod_move_indicator_widget_apptray_move_set(indi_widget, EINA_FALSE);
277    _e_mod_move_indicator_widget_quickpanel_move_set(indi_widget, EINA_FALSE);
278
279    // flick data free
280    if (mb->flick_data) e_mod_move_flick_data_free(mb);
281
282    switch (angle)
283      {
284       case  90:
285          x = 0;
286          y = 0;
287          break;
288       case 180:
289          x = 0;
290          y = zone->h - mb2->h;
291          break;
292       case 270:
293          x = zone->w - mb2->w;
294          y = 0;
295          break;
296       case   0:
297       default :
298          x = 0;
299          y = 0;
300          break;
301      }
302
303    e_mod_move_apptray_e_border_move(mb2, x, y);
304    e_mod_move_apptray_objs_animation_move(mb2, x, y);
305
306    return EINA_TRUE;
307 }
308
309 static Eina_Bool
310 _e_mod_move_indicator_widget_home_region_release_check(E_Move_Indicator_Widget *indi_widget,
311                                                        Eina_Bool                apptray_move /* if home button is pressd, then apptray_move set true */,
312                                                        int                      angle,
313                                                        Evas_Point               pos /* mouse up position */)
314 {
315    E_Move_Border *mb = NULL;
316    int            region_check;
317    Eina_Bool      ret = EINA_FALSE;
318    E_Zone        *zone = NULL;
319    E_Move        *m = NULL;
320
321    m = e_mod_move_util_get();
322    E_CHECK_RETURN(m, EINA_FALSE);
323    E_CHECK_RETURN(indi_widget, EINA_FALSE);
324    mb = e_mod_move_border_client_find(indi_widget->win);
325    E_CHECK_RETURN(mb, EINA_FALSE);
326    E_CHECK_RETURN(apptray_move, EINA_FALSE);
327    E_CHECK_RETURN(mb->bd, EINA_FALSE);
328    zone = mb->bd->zone;
329    E_CHECK_RETURN(zone, EINA_FALSE);
330
331    switch (angle)
332      {
333       case   0:
334          region_check = m->indicator_widget_geometry[E_MOVE_ANGLE_0].h;
335          if (pos.y < region_check) ret = EINA_TRUE;
336          break;
337       case  90:
338          region_check = m->indicator_widget_geometry[E_MOVE_ANGLE_90].w;
339          if (pos.x < region_check) ret = EINA_TRUE;
340          break;
341       case 180:
342          region_check = zone->h - m->indicator_widget_geometry[E_MOVE_ANGLE_180].h;
343          if (pos.y > region_check) ret = EINA_TRUE;
344          break;
345       case 270:
346          region_check = zone->w - m->indicator_widget_geometry[E_MOVE_ANGLE_270].w;
347          if (pos.x > region_check) ret = EINA_TRUE;
348          break;
349       default :
350          SL(LT_EVENT_OBJ,
351             "[MOVE] ev:%15.15s , invalid angle:%d, (%d,%d)  %s()\n",
352             "EVAS_OBJ", angle, pos.x, pos.y,
353             __func__)
354          break;
355      }
356    return ret;
357 }
358
359 static Eina_Bool
360 _e_mod_move_indicator_widget_cb_motion_start(void *data,
361                                              void *event_info)
362 {
363    E_Move *m = NULL;
364    E_Move_Indicator_Widget *indi_widget = (E_Move_Indicator_Widget *)data;
365
366    E_Move_Border *mb = NULL;
367    E_Move_Border *ev_mb = NULL;
368    E_Move_Border *qp_mb = NULL;
369    E_Move_Border *at_mb = NULL;
370    E_Move_Event_Motion_Info *info;
371    E_Move_Widget_Object *mwo = NULL;
372    Evas_Event_Mouse_Down *mouse_down_event = NULL;
373    Eina_Bool clicked = EINA_FALSE;
374    Eina_List *l;
375    E_Move_Scroll_Region_Indicator scroll_region = E_MOVE_SCROLL_REGION_NONE;
376    Ecore_X_Window ev_win = 0;
377
378    info  = (E_Move_Event_Motion_Info *)event_info;
379    m = e_mod_move_util_get();
380
381    E_CHECK_RETURN(indi_widget, EINA_FALSE);
382
383    // clicked window indicator policy check
384    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
385      {
386         if (!mwo) continue;
387         ev_win = e_mod_move_event_win_get(mwo->event);
388      }
389    ev_mb = e_mod_move_border_client_find(ev_win);
390    E_CHECK_RETURN(_e_mod_move_indicator_widget_target_window_policy_check(ev_mb),
391                   EINA_FALSE);
392
393    mb = e_mod_move_border_client_find(indi_widget->win);
394
395    if (!m || !mb || !indi_widget || !info) return EINA_FALSE;
396
397    mouse_down_event = info->event_info;
398    E_CHECK_RETURN(mouse_down_event, EINA_FALSE);
399    if (mouse_down_event->button != 1)
400      return EINA_FALSE;
401
402    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
403      {
404         if (!mwo) continue;
405         clicked = e_mod_move_event_click_get(mwo->event);
406      }
407    if (clicked)
408      return EINA_FALSE;
409
410    SL(LT_EVENT_OBJ,
411      "[MOVE] ev:%15.15s w:0x%08x INDI_WIDGET_MOTION_START (%4d,%4d)\n",
412      "EVAS_OBJ", mb->bd->win,
413      info->coord.x, info->coord.y);
414
415    _e_mod_move_indicator_widget_apptray_move_set(indi_widget, EINA_FALSE);
416    _e_mod_move_indicator_widget_quickpanel_move_set(indi_widget, EINA_FALSE);
417
418    /* check if apptray or quickpanel exists on the current zone */
419    at_mb = e_mod_move_apptray_find();
420    if ((at_mb) &&
421        (REGION_INSIDE_ZONE(at_mb, mb->bd->zone)))
422      {
423         L(LT_EVENT_OBJ,
424           "[MOVE] ev:%15.15s w:0x%08x INDI_WIDGET_MOTION_START %s\n",
425           "EVAS_OBJ", mb->bd->win,
426           "apptray exists. return.");
427         return EINA_FALSE;
428      }
429
430    qp_mb = e_mod_move_quickpanel_find();
431    if ((qp_mb) &&
432        (REGION_INSIDE_ZONE(qp_mb, mb->bd->zone)))
433      {
434         L(LT_EVENT_OBJ,
435           "[MOVE] ev:%15.15s w:0x%08x INDI_WIDGET_MOTION_START %s\n",
436           "EVAS_OBJ", mb->bd->win,
437           "quickpanel exists. return.");
438         return EINA_FALSE;
439      }
440
441    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
442      {
443         if (!mwo) continue;
444         e_mod_move_event_click_set(mwo->event, EINA_TRUE);
445      }
446
447    E_CHECK_GOTO(e_mod_move_flick_data_new(mb), error_cleanup);
448    e_mod_move_flick_data_init(mb, info->coord.x, info->coord.y);
449
450    scroll_region = e_mod_move_indicator_region_scroll_check(mb->angle, info->coord);
451
452    if (scroll_region == E_MOVE_SCROLL_REGION_APPTRAY)
453      {
454         if (e_mod_move_panel_scrollable_get(mb, E_MOVE_PANEL_TYPE_APPTRAY))
455           {
456              if (_e_mod_move_indicator_widget_cb_motion_start_internal_apptray_check(at_mb))
457                {
458                   e_mod_move_apptray_e_border_raise(at_mb);
459                   _e_mod_move_indicator_widget_apptray_move_set(indi_widget, EINA_TRUE);
460                   e_mod_move_apptray_objs_animation_start_position_set(at_mb,
461                                                                        mb->angle);
462                   // send apptray to "move start message".
463                   e_mod_move_apptray_anim_state_send(at_mb, EINA_TRUE);
464                }
465           }
466      }
467    else if (scroll_region == E_MOVE_SCROLL_REGION_QUICKPANEL)
468      {
469         if (e_mod_move_panel_scrollable_get(mb, E_MOVE_PANEL_TYPE_QUICKPANEL))
470           {
471              if (_e_mod_move_indicator_widget_cb_motion_start_internal_quickpanel_check(qp_mb))
472                {
473                   _e_mod_move_indicator_widget_quickpanel_move_set(indi_widget, EINA_TRUE);
474                   e_mod_move_quickpanel_objs_animation_start_position_set(qp_mb,
475                                                                           mb->angle);
476                   // send quickpanel to "move start message".
477                   e_mod_move_quickpanel_anim_state_send(qp_mb, EINA_TRUE);
478                }
479           }
480      }
481
482    indi_widget->pos = info->coord; // save mouse click position
483
484    return EINA_TRUE;
485
486 error_cleanup:
487
488    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
489      {
490         if (!mwo) continue;
491         e_mod_move_event_click_set(mwo->event, EINA_FALSE);
492      }
493
494    _e_mod_move_indicator_widget_apptray_move_set(indi_widget, EINA_FALSE);
495    _e_mod_move_indicator_widget_quickpanel_move_set(indi_widget, EINA_FALSE);
496
497    return EINA_FALSE;
498 }
499
500 static Eina_Bool
501 _e_mod_move_indicator_widget_cb_motion_move(void *data,
502                                             void *event_info)
503 {
504    E_Move                   *m = NULL;
505    E_Move_Indicator_Widget  *indi_widget = (E_Move_Indicator_Widget *)data;
506    E_Move_Border            *mb = NULL;
507    E_Move_Border            *qp_mb = NULL;
508    E_Move_Border            *at_mb = NULL;
509    E_Move_Event_Motion_Info *info;
510    E_Move_Widget_Object     *mwo = NULL;
511    E_Zone                   *zone = NULL;
512    Eina_List                *l;
513    Eina_Bool                 click = EINA_FALSE;
514    Eina_Bool                 need_move = EINA_FALSE;
515    Eina_Bool                 contents = EINA_FALSE;
516
517    int cx, cy, cw, ch;
518    int x = 0, y = 0;
519    int angle;
520
521    info  = (E_Move_Event_Motion_Info *)event_info;
522    m = e_mod_move_util_get();
523
524    E_CHECK_RETURN(indi_widget, EINA_FALSE);
525    mb = e_mod_move_border_client_find(indi_widget->win);
526
527    if (!m || !mb || !info) return EINA_FALSE;
528
529    SL(LT_EVENT_OBJ,
530       "[MOVE] ev:%15.15s w:0x%08x INDI_WIDGET_MOTION_MOVE a:%d (%4d,%4d)\n",
531       "EVAS_OBJ", mb->bd->win, mb->angle,
532       info->coord.x, info->coord.y);
533
534    angle = mb->angle;
535    zone = mb->bd->zone;
536
537    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
538      {
539         if (!mwo) continue;
540         click = e_mod_move_event_click_get(mwo->event);
541      }
542
543    E_CHECK_RETURN(click, EINA_FALSE);
544
545    if (_e_mod_move_indicator_widget_quickpanel_move_get(indi_widget))
546      {
547         qp_mb = e_mod_move_quickpanel_find();
548         E_CHECK_RETURN(qp_mb, EINA_FALSE);
549
550         contents = e_mod_move_border_contents_rect_get(qp_mb, &cx, &cy ,&cw, &ch);
551
552         switch (angle)
553           {
554            case   0:
555               if (info->coord.y < qp_mb->h)
556                 {
557                    if (contents)
558                      {
559                         if (info->coord.y < ch)
560                           {
561                              y = info->coord.y - ch;
562                              need_move = EINA_TRUE;
563                           }
564                      }
565                    else
566                      {
567                         y = info->coord.y - qp_mb->h;
568                         need_move = EINA_TRUE;
569                      }
570                 }
571               break;
572            case  90:
573               if (info->coord.x < qp_mb->w)
574                 {
575                    if (contents)
576                      {
577                         if (info->coord.x < cw)
578                           {
579                              x = info->coord.x - cw;
580                              need_move = EINA_TRUE;
581                           }
582                      }
583                    else
584                      {
585                         x = info->coord.x - qp_mb->w;
586                         need_move = EINA_TRUE;
587                      }
588                 }
589               break;
590            case 180:
591               if (info->coord.y > (zone->h - qp_mb->h))
592                 {
593                    if (contents)
594                      {
595                         if (info->coord.y > cy)
596                           {
597                              y = info->coord.y - cy;
598                              need_move = EINA_TRUE;
599                           }
600                      }
601                    else
602                      {
603                         y = info->coord.y;
604                         need_move = EINA_TRUE;
605                      }
606                 }
607               break;
608            case 270:
609               if (info->coord.x > (zone->w - qp_mb->w))
610                 {
611                    if (contents)
612                      {
613                         if (info->coord.x > cx)
614                           {
615                              x = info->coord.x - cx;
616                              need_move = EINA_TRUE;
617                           }
618                      }
619                    else
620                      {
621                         x = info->coord.x;
622                         need_move = EINA_TRUE;
623                      }
624                 }
625               break;
626            default :
627               break;
628           }
629
630         if (_e_mod_move_indicator_widget_scrollable_object_movable_check(indi_widget, mb, info->coord))
631           {
632              if (m->qp_scroll_with_clipping)
633                 e_mod_move_quickpanel_objs_move(qp_mb,
634                                                 info->coord.x,
635                                                 info->coord.y);
636              else
637                {
638                   if (need_move)
639                      e_mod_move_quickpanel_objs_move(qp_mb, x, y);
640                }
641           }
642      }
643    else if (_e_mod_move_indicator_widget_apptray_move_get(indi_widget))
644      {
645         at_mb = e_mod_move_apptray_find();
646         E_CHECK_RETURN(at_mb, EINA_FALSE);
647
648         switch (angle)
649           {
650            case   0:
651               if (info->coord.y < at_mb->h)
652                 {
653                    y = info->coord.y - at_mb->h;
654                    need_move = EINA_TRUE;
655                 }
656               break;
657            case  90:
658               if (info->coord.x < at_mb->w)
659                 {
660                    x = info->coord.x - at_mb->w;
661                    need_move = EINA_TRUE;
662                 }
663               break;
664            case 180:
665               if (info->coord.y > (zone->h - at_mb->h))
666                 {
667                    y = info->coord.y;
668                    need_move = EINA_TRUE;
669                 }
670               break;
671            case 270:
672               if (info->coord.x > (zone->w - at_mb->w))
673                 {
674                    x = info->coord.x;
675                    need_move = EINA_TRUE;
676                 }
677               break;
678            default :
679               break;
680           }
681         if (need_move)
682           e_mod_move_apptray_objs_move(at_mb, x, y);
683      }
684
685    indi_widget->pos = info->coord; // save mouse move position
686
687    return EINA_TRUE;
688 }
689
690 static Eina_Bool
691 _e_mod_move_indicator_widget_cb_motion_end(void *data,
692                                            void *event_info)
693 {
694    E_Move                   *m = NULL;
695    E_Move_Indicator_Widget  *indi_widget = (E_Move_Indicator_Widget *)data;
696    E_Move_Border            *mb = NULL;
697    E_Move_Border            *qp_mb = NULL;
698    E_Move_Border            *at_mb = NULL;
699    E_Move_Event_Motion_Info *info;
700    E_Move_Widget_Object     *mwo = NULL;
701    Eina_List                *l;
702    E_Zone                   *zone;
703    Evas_Event_Mouse_Up      *mouse_up_event;
704    Eina_Bool                 click = EINA_FALSE;
705    Eina_Bool                 flick_state = EINA_FALSE;
706    Eina_Bool                 qp_mv_state = EINA_FALSE;
707    Eina_Bool                 at_mv_state = EINA_FALSE;
708
709    int cx, cy, cw, ch;
710    int check_h, check_w;
711    int angle = 0;
712    int mx = 0, my = 0, ax = 0, ay = 0;
713
714    info  = (E_Move_Event_Motion_Info *)event_info;
715    m = e_mod_move_util_get();
716
717    E_CHECK_RETURN(indi_widget, EINA_FALSE);
718    mb = e_mod_move_border_client_find(indi_widget->win);
719
720    if (!m || !mb || !info) return EINA_FALSE;
721
722    mouse_up_event = info->event_info;
723    E_CHECK_RETURN(mouse_up_event, EINA_FALSE);
724    if (mouse_up_event->button != 1)
725      return EINA_FALSE;
726
727    SL(LT_EVENT_OBJ,
728       "[MOVE] ev:%15.15s w:0x%08x ,angle:%d, (%d,%d)  %s()\n",
729       "EVAS_OBJ", mb->bd->win, mb->angle, info->coord.x, info->coord.y,
730       __func__);
731
732    angle = mb->angle;
733    zone = mb->bd->zone;
734
735    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
736      {
737         if (!mwo) continue;
738         click = e_mod_move_event_click_get(mwo->event);
739      }
740    E_CHECK_GOTO(click, error_cleanup);
741
742    qp_mv_state = _e_mod_move_indicator_widget_quickpanel_move_get(indi_widget);
743    at_mv_state = _e_mod_move_indicator_widget_apptray_move_get(indi_widget);
744    if (!qp_mv_state && !at_mv_state) goto finish;
745
746    e_mod_move_flick_data_update(mb, info->coord.x, info->coord.y);
747    flick_state = e_mod_move_flick_state_get(mb, EINA_TRUE);
748
749    if (qp_mv_state)
750      {
751         qp_mb = e_mod_move_quickpanel_find();
752         if (_e_mod_move_indicator_widget_quickpanel_flick_process(indi_widget, qp_mb,
753                                                                   angle, flick_state))
754           {
755              return EINA_TRUE;
756           }
757      }
758    if (at_mv_state)
759      {
760         at_mb = e_mod_move_apptray_find();
761
762         // if release position is on indicator's home button then, do not flick.
763         if (_e_mod_move_indicator_widget_home_region_release_check(indi_widget,
764                                                                    EINA_TRUE, /* upper if phrase check _e_mod_move_indicator_apptray_move_get(mb) value TURE or FALSE. */
765                                                                    angle,
766                                                                    info->coord))
767           {
768              flick_state = EINA_FALSE;
769           }
770
771         if (_e_mod_move_indicator_widget_apptray_flick_process(indi_widget, at_mb,
772                                                                angle, flick_state))
773           {
774              return EINA_TRUE;
775           }
776      }
777
778    mx = zone->x;
779    my = zone->y;
780    ax = mx;
781    ay = my;
782
783    switch (angle)
784      {
785       case   0:
786          if (at_mb)
787            {
788               check_h = at_mb->h;
789               if (check_h) check_h /= 2;
790               if (info->coord.y < check_h)
791                 {
792                    my = at_mb->h * -1;
793                    ay = my;
794                 }
795            }
796          if (qp_mb)
797            {
798               check_h = qp_mb->h;
799               if (check_h) check_h /= 2;
800               if (info->coord.y < check_h)
801                 {
802                    if (m->qp_scroll_with_clipping)
803                      {
804                         my = qp_mb->h * -1;
805                      }
806                    else
807                      {
808                         if (e_mod_move_border_contents_rect_get(qp_mb, &cx, &cy ,&cw, &ch))
809                           {
810                              check_h = ch;
811                              if (check_h) check_h /= 2;
812                              if (info->coord.y < check_h)
813                                {
814                                   my = qp_mb->h * -1;
815                                   ay = ch * -1;
816                                }
817                           }
818                      }
819                 }
820                else
821                 {
822                    if (m->qp_scroll_with_clipping)
823                      {
824                         ax = zone->x + qp_mb->w,
825                         ay = zone->y + qp_mb->h;
826                      }
827                 }
828            }
829          break;
830       case  90:
831          if (at_mb)
832            {
833               check_w = at_mb->w;
834               if (check_w) check_w /= 2;
835               if (info->coord.x < check_w)
836                 {
837                    mx = at_mb->w * -1;
838                    ax = mx;
839                 }
840            }
841          if (qp_mb)
842            {
843               check_w = qp_mb->w;
844               if (check_w) check_w /= 2;
845               if (info->coord.x < check_w)
846                 {
847                    if (m->qp_scroll_with_clipping)
848                      {
849                         mx = qp_mb->w * -1;
850                      }
851                    else
852                      {
853                         if (e_mod_move_border_contents_rect_get(qp_mb, &cx, &cy ,&cw, &ch))
854                           {
855                              check_w = cw;
856                              if (check_w) check_w /= 2;
857                              if (info->coord.x < check_w)
858                                {
859                                   mx = qp_mb->w * -1;
860                                   ax = cw * -1;
861                                }
862                           }
863                      }
864                 }
865                else
866                 {
867                    if (m->qp_scroll_with_clipping)
868                      {
869                         ax = zone->x + qp_mb->w;
870                         ay = zone->y + qp_mb->h;
871                      }
872                 }
873            }
874          break;
875       case 180:
876          if (at_mb)
877            {
878               check_h = at_mb->h;
879               if (check_h) check_h /= 2;
880               if (info->coord.y > (zone->h - check_h))
881                 {
882                    my = zone->h;
883                    ay = my;
884                 }
885                else
886                 {
887                    my = zone->h - at_mb->h;
888                    ay = my;
889                 }
890            }
891          if (qp_mb)
892            {
893               check_h = qp_mb->h;
894               if (check_h) check_h /= 2;
895               if (info->coord.y > (zone->h - check_h))
896                 {
897                    if (m->qp_scroll_with_clipping)
898                      {
899                         my = zone->h;
900                         ax = zone->x + qp_mb->w;
901                         ay = zone->y + qp_mb->h;
902                      }
903                    else
904                      {
905                         if (e_mod_move_border_contents_rect_get(qp_mb, &cx, &cy ,&cw, &ch))
906                           {
907                              check_h = ch;
908                              if (check_h) check_h /= 2;
909                              if (info->coord.y > (cy + check_h))
910                                {
911                                   my = zone->h;
912                                   ay = ch;
913                                }
914                           }
915                      }
916                 }
917            }
918          break;
919       case 270:
920          if (at_mb)
921            {
922               check_w = at_mb->w;
923               if (check_w) check_w /= 2;
924               if (info->coord.x > (zone->w - check_w))
925                 {
926                    mx = zone->w;
927                    ax = mx;
928                 }
929                else
930                 {
931                    mx = zone->w - at_mb->w;
932                    ax = mx;
933                 }
934            }
935          if (qp_mb)
936            {
937               check_w = qp_mb->w;
938               if (check_w) check_w /= 2;
939               if (info->coord.x > (zone->w - check_w))
940                 {
941                    if (m->qp_scroll_with_clipping)
942                      {
943                         mx = zone->w;
944                         ax = zone->x + qp_mb->w;
945                         ay = zone->y + qp_mb->h;
946                      }
947                    else
948                      {
949                         if (e_mod_move_border_contents_rect_get(qp_mb, &cx, &cy ,&cw, &ch))
950                           {
951                              check_w = cw;
952                              if (check_w) check_w /= 2;
953                              if (info->coord.x > (cx + check_w))
954                                {
955                                   mx = zone->w;
956                                   ax = cw;
957                                }
958                           }
959                      }
960                 }
961            }
962          break;
963       default :
964          break;
965      }
966
967    if (at_mb)
968      {
969         e_mod_move_apptray_e_border_move(at_mb, mx, my);
970         e_mod_move_apptray_objs_animation_move(at_mb, ax, ay);
971      }
972    else if (qp_mb)
973      {
974         e_mod_move_quickpanel_e_border_move(qp_mb, mx, my);
975         if (_e_mod_move_indicator_widget_scrollable_object_movable_check(indi_widget, mb, info->coord))
976           e_mod_move_quickpanel_objs_animation_move(qp_mb, ax, ay);
977         else
978           e_mod_move_quickpanel_objs_animation_move_with_time(qp_mb, ax, ay, 0.0000001);
979         // time :0.0 calls animation_frame with pos : 0.0  calls once.
980         // so I use small time value, it makes animation_frame with pos: 1.0 call once
981      }
982
983 finish:
984    indi_widget->pos = info->coord; // save mouse up position
985    _e_mod_move_indicator_widget_move_started_set(indi_widget, EINA_FALSE);
986
987    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
988      {
989         if (!mwo) continue;
990         e_mod_move_event_click_set(mwo->event, EINA_FALSE);
991      }
992
993 error_cleanup:
994    if (mb->flick_data) e_mod_move_flick_data_free(mb);
995    _e_mod_move_indicator_widget_apptray_move_set(indi_widget, EINA_FALSE);
996    _e_mod_move_indicator_widget_quickpanel_move_set(indi_widget, EINA_FALSE);
997
998    return EINA_TRUE;
999 }
1000
1001 static void
1002 _e_mod_move_indicator_widget_obj_event_setup(E_Move_Indicator_Widget *indicator_widget,
1003                                              E_Move_Widget_Object    *mwo)
1004 {
1005    E_CHECK(indicator_widget);
1006    E_CHECK(mwo);
1007
1008    mwo->event = e_mod_move_event_new(indicator_widget->win, mwo->obj);
1009    E_CHECK(mwo->event);
1010
1011    e_mod_move_event_data_type_set(mwo->event, E_MOVE_EVENT_DATA_TYPE_WIDGET_INDICATOR);
1012    e_mod_move_event_angle_cb_set(mwo->event,
1013                                  e_mod_move_util_win_prop_angle_get);
1014    e_mod_move_event_cb_set(mwo->event, E_MOVE_EVENT_TYPE_MOTION_START,
1015                            _e_mod_move_indicator_widget_cb_motion_start,
1016                            indicator_widget);
1017    e_mod_move_event_cb_set(mwo->event, E_MOVE_EVENT_TYPE_MOTION_MOVE,
1018                            _e_mod_move_indicator_widget_cb_motion_move,
1019                            indicator_widget);
1020    e_mod_move_event_cb_set(mwo->event, E_MOVE_EVENT_TYPE_MOTION_END,
1021                            _e_mod_move_indicator_widget_cb_motion_end,
1022                            indicator_widget);
1023    e_mod_move_event_win_find_cb_set(mwo->event,
1024                                     _e_mod_move_indicator_widget_event_win_find);
1025    e_mod_move_event_propagate_type_set(mwo->event,
1026                                        E_MOVE_EVENT_PROPAGATE_TYPE_IMMEDIATELY);
1027 }
1028
1029 static Eina_Bool
1030 _e_mod_move_indicator_widget_scrollable_object_movable_check(E_Move_Indicator_Widget *indicator_widget,
1031                                                              E_Move_Border           *mb,
1032                                                              Evas_Point              pos)
1033 {
1034    E_Move *m = NULL;
1035    int check_val = 0;
1036    Eina_Bool ret = EINA_FALSE;
1037    Eina_Bool move_started = EINA_FALSE;
1038    Eina_Bool position_check = EINA_FALSE;
1039
1040    E_CHECK_RETURN(indicator_widget, EINA_FALSE);
1041    E_CHECK_RETURN(mb, EINA_FALSE);
1042
1043    m = e_mod_move_util_get();
1044    E_CHECK_RETURN(m, EINA_FALSE);
1045
1046    move_started = _e_mod_move_indicator_widget_move_started_get(indicator_widget);
1047    if (move_started) return EINA_TRUE;
1048
1049    switch (mb->angle)
1050      {
1051       case 90:
1052          check_val = m->indicator_widget_geometry[E_MOVE_ANGLE_90].w;
1053          if (pos.x > check_val) position_check = EINA_TRUE;
1054          break;
1055       case 180:
1056          check_val = m->indicator_widget_geometry[E_MOVE_ANGLE_180].y;
1057          if (pos.y < check_val) position_check = EINA_TRUE;
1058          break;
1059       case 270:
1060          check_val = m->indicator_widget_geometry[E_MOVE_ANGLE_270].x;
1061          if (pos.x < check_val) position_check = EINA_TRUE;
1062          break;
1063       case 0:
1064       default:
1065          check_val = m->indicator_widget_geometry[E_MOVE_ANGLE_0].h;
1066          if (pos.y > check_val) position_check = EINA_TRUE;
1067          break;
1068      }
1069
1070    if (position_check)
1071      {
1072          _e_mod_move_indicator_widget_move_started_set(indicator_widget, EINA_TRUE);
1073          ret = EINA_TRUE;
1074      }
1075
1076    return ret;
1077 }
1078
1079 static Eina_Bool
1080 _e_mod_move_indicator_widget_target_window_find_by_pointer(Ecore_X_Window *win,
1081                                                            int x,
1082                                                            int y)
1083 {
1084    E_Move        *m = NULL;
1085    E_Move_Border *find_mb = NULL;
1086    Eina_Bool      found = EINA_FALSE;
1087    Eina_Bool      ret = EINA_FALSE;
1088    Ecore_X_Window noti_win = 0;
1089    Eina_Bool      noti_win_saved = EINA_FALSE;
1090
1091    E_CHECK_RETURN(win, EINA_FALSE);
1092    m = e_mod_move_util_get();
1093    E_CHECK_RETURN(m, EINA_FALSE);
1094
1095    EINA_INLIST_REVERSE_FOREACH(m->borders, find_mb)
1096      {
1097         if (!find_mb->bd) continue;
1098
1099         // finding visible border
1100         if (!find_mb->visible) continue;
1101
1102         // finding pointed border
1103         if (!E_INSIDE(x, y, find_mb->bd->x, find_mb->bd->y,
1104                             find_mb->bd->w, find_mb->bd->h))
1105           continue;
1106
1107         // if notification , alpha, and indicator_state_none then search again below.
1108         if ((TYPE_NOTIFICATION_CHECK(find_mb) || TYPE_APP_SELECTOR_CHECK(find_mb))
1109             && (find_mb->argb)
1110             && (find_mb->indicator_state == E_MOVE_INDICATOR_STATE_NONE))
1111           {
1112              if (!noti_win_saved)
1113                {
1114                   noti_win = find_mb->bd->client.win;
1115                   noti_win_saved = EINA_TRUE;
1116                }
1117              continue;
1118           }
1119         else
1120           {
1121              found = EINA_TRUE;
1122              break;
1123           }
1124      }
1125
1126    if (found)
1127      {
1128         if ((find_mb)
1129             && (find_mb->indicator_state == E_MOVE_INDICATOR_STATE_ON))
1130           {
1131              *win = find_mb->bd->client.win;
1132              ret = EINA_TRUE;
1133           }
1134         else
1135           {
1136              if (noti_win_saved)
1137                {
1138                   *win = noti_win;
1139                   ret = EINA_TRUE;
1140                }
1141              else
1142                {
1143                   *win = find_mb->bd->client.win;
1144                   ret = EINA_TRUE;
1145                }
1146           }
1147      }
1148
1149    return ret;
1150 }
1151
1152 static Ecore_X_Window
1153 _e_mod_move_indicator_widget_event_win_find(void *event_info)
1154 {
1155    E_Move_Event_Motion_Info *info = NULL;
1156    Ecore_X_Window            win = 0, res_win = 0;
1157    info  = (E_Move_Event_Motion_Info *)event_info;
1158
1159    E_CHECK_RETURN(info, 0);
1160
1161    if (_e_mod_move_indicator_widget_target_window_find_by_pointer(&win,
1162                                                                   info->coord.x,
1163                                                                   info->coord.y))
1164      {
1165          res_win = win;
1166      }
1167
1168    SL(LT_EVENT_OBJ,
1169       "[MOVE] ev:%15.15s INDICATOR_WIDGET_EVENT_WIN_FIND w:0x%08x (%4d,%4d)\n",
1170       "EVAS_OBJ", res_win, info->coord.x, info->coord.y);
1171
1172    return res_win;
1173 }
1174
1175 static Eina_Bool
1176 _e_mod_move_indicator_widget_target_window_policy_check(E_Move_Border *mb)
1177 {
1178    E_Move        *m = e_mod_move_util_get();
1179    E_Zone        *zone = NULL;
1180    Eina_Bool      ret = EINA_FALSE;
1181    E_Border      *bd = NULL;
1182
1183    E_CHECK_RETURN(m, EINA_FALSE);
1184    E_CHECK_RETURN(mb, EINA_FALSE);
1185
1186    bd = mb->bd;
1187    E_CHECK_RETURN(bd, EINA_FALSE);
1188    zone = bd->zone;
1189    E_CHECK_RETURN(zone, EINA_FALSE);
1190
1191    if (REGION_EQUAL_TO_ZONE(mb, zone)  // check fullscreen
1192        && (zone->id == 0)              // change zone->id comparing to bd's profile property (mobile)
1193        && (mb->indicator_state == E_MOVE_INDICATOR_STATE_ON)
1194        && (mb->indicator_type == E_MOVE_INDICATOR_TYPE_1))
1195      {
1196          ret = EINA_TRUE;
1197      }
1198
1199    return ret;
1200 }
1201
1202 static Eina_Bool
1203 _e_mod_move_indicator_widget_event_send_policy_check(E_Move_Indicator_Widget *indi_widget,
1204                                                      Evas_Point               pos)
1205 {
1206    int x = 0, y = 0, w = 0, h = 0;
1207    Eina_Bool ret = EINA_FALSE;
1208
1209    E_CHECK_RETURN(indi_widget, EINA_FALSE);
1210
1211    e_mod_move_widget_objs_geometry_get(indi_widget->objs, &x ,&y, &w, &h);
1212
1213    if (E_INSIDE(pos.x, pos.y, x, y, w, h)) ret = EINA_TRUE;
1214
1215    return ret;
1216 }
1217
1218 /* find active indicator window window and set property */
1219 static void
1220 _e_mod_move_indicator_widget_active_indicator_win_find_and_set(void)
1221 {
1222    E_Move                  *m = NULL;
1223    Ecore_X_Window           target_win;
1224    E_Move_Border           *target_mb = NULL;
1225
1226    m = e_mod_move_util_get();
1227    E_CHECK(m);
1228
1229    if (e_mod_move_indicator_widget_target_window_find(&target_win))
1230      {
1231         target_mb = e_mod_move_border_client_find(target_win);
1232         E_CHECK(target_mb);
1233         if ((TYPE_NOTIFICATION_CHECK(target_mb) || TYPE_APP_SELECTOR_CHECK(target_mb))
1234             && (target_mb->argb)
1235             && (target_mb->indicator_state == E_MOVE_INDICATOR_STATE_NONE))
1236           {
1237              ;
1238           }
1239         else
1240            e_mod_move_util_prop_active_indicator_win_set(target_win, m);
1241      }
1242 }
1243
1244 /* externally accessible functions */
1245
1246 /* set current indicator widget */
1247 EINTERN void
1248 e_mod_move_indicator_widget_set(E_Move_Indicator_Widget *indi_widget)
1249 {
1250    E_Move *m = NULL;
1251
1252    m = e_mod_move_util_get();
1253    E_CHECK(m);
1254
1255    if (m->indicator_widget)
1256      {
1257         e_mod_move_indicator_widget_del(m->indicator_widget);
1258      }
1259
1260    m->indicator_widget = indi_widget;
1261 }
1262
1263 /* get current indicator widget */
1264 EINTERN E_Move_Indicator_Widget *
1265 e_mod_move_indicator_widget_get(void)
1266 {
1267    E_Move *m = NULL;
1268    m = e_mod_move_util_get();
1269    E_CHECK_RETURN(m, NULL);
1270
1271    return m->indicator_widget;
1272 }
1273
1274 /* find indicator widget target window */
1275 EINTERN Eina_Bool
1276 e_mod_move_indicator_widget_target_window_find(Ecore_X_Window *win)
1277 {
1278    E_Move        *m = NULL;
1279    E_Move_Border *find_mb = NULL;
1280    Eina_Bool      found = EINA_FALSE;
1281    E_Zone        *zone = NULL;
1282    Eina_Bool      ret = EINA_FALSE;
1283
1284    E_CHECK_RETURN(win, EINA_FALSE);
1285    m = e_mod_move_util_get();
1286    E_CHECK_RETURN(m, EINA_FALSE);
1287
1288    // fix later
1289    EINA_INLIST_REVERSE_FOREACH(m->borders, find_mb)
1290      {
1291         if (!find_mb->bd) continue;
1292         // the first OnScreen & FullScreen Window
1293         zone = find_mb->bd->zone;
1294         if (find_mb->visible
1295             && REGION_EQUAL_TO_ZONE(find_mb, zone)  // check fullscreen
1296             && (zone->id == 0)) // change zone->id comparing to bd's profile property (mobile)
1297           {
1298              found = EINA_TRUE;
1299              break;
1300           }
1301      }
1302
1303    if (found
1304        && !(TYPE_APPTRAY_CHECK(find_mb))
1305        && !(TYPE_MINI_APPTRAY_CHECK(find_mb))
1306        && !(TYPE_QUICKPANEL_CHECK(find_mb)))
1307      {
1308         *win = find_mb->bd->client.win;
1309         ret = EINA_TRUE;
1310      }
1311
1312    return ret;
1313 }
1314
1315 /* find indicator widget's target window and apply indicator widget control */
1316 EINTERN void
1317 e_mod_move_indicator_widget_apply(void)
1318 {
1319    E_Move                  *m = NULL;
1320    E_Move_Indicator_Widget *indi_widget = NULL;
1321    Ecore_X_Window           target_win;
1322    E_Move_Border           *target_mb = NULL;
1323
1324    m = e_mod_move_util_get();
1325    E_CHECK(m);
1326    if ((m->screen_reader_state) || (m->setup_wizard_state))
1327      {
1328         _e_mod_move_indicator_widget_active_indicator_win_find_and_set();
1329         return;
1330      }
1331
1332    if (e_mod_move_indicator_widget_target_window_find(&target_win))
1333      {
1334         target_mb = e_mod_move_border_client_find(target_win);
1335         // if previous indicator widget is created
1336         if ((indi_widget = e_mod_move_indicator_widget_get()))
1337           {
1338              // if current indicator widget's win is equal to finded win
1339              // then just return.
1340              if ((indi_widget->win == target_win)) return;
1341              else
1342                {
1343                   // if current indicator widget's win is not equal to finded win
1344                   // then del previous indicator_widget and add new indicator widget.
1345                   e_mod_move_indicator_widget_del(indi_widget);
1346                   e_mod_move_indicator_widget_set(e_mod_move_indicator_widget_add(target_win));
1347                   if ((target_mb) &&
1348                       (TYPE_NOTIFICATION_CHECK(target_mb) || TYPE_APP_SELECTOR_CHECK(target_mb)) &&
1349                       (target_mb->argb) &&
1350                       (target_mb->indicator_state == E_MOVE_INDICATOR_STATE_NONE))
1351                     {
1352                       ;
1353                     }
1354                   else
1355                     e_mod_move_util_prop_active_indicator_win_set(target_win, m);
1356                }
1357           }
1358         else
1359           {
1360              //if previous indicator widget is not creagted
1361              //then add new indicator widget.
1362              e_mod_move_indicator_widget_set(e_mod_move_indicator_widget_add(target_win));
1363
1364              if ((target_mb) &&
1365                  (TYPE_NOTIFICATION_CHECK(target_mb) || TYPE_APP_SELECTOR_CHECK(target_mb)) &&
1366                  (target_mb->argb) &&
1367                  (target_mb->indicator_state == E_MOVE_INDICATOR_STATE_NONE))
1368                {
1369                   ;
1370                }
1371              else
1372                e_mod_move_util_prop_active_indicator_win_set(target_win, m);
1373           }
1374      }
1375    else
1376      {
1377         // if current window does not require indicator widget
1378         // and previous indicator widget is created,
1379         // then del previous indicator_widget
1380         if ((indi_widget = e_mod_move_indicator_widget_get()))
1381           {
1382              e_mod_move_indicator_widget_del(indi_widget);
1383              e_mod_move_indicator_widget_set(NULL);
1384           }
1385      }
1386 }
1387
1388 /* create E_Move_Border related Indicator_Widget */
1389 EINTERN E_Move_Indicator_Widget *
1390 e_mod_move_indicator_widget_add(Ecore_X_Window win)
1391 {
1392    E_Move                  *m = NULL;
1393    E_Move_Border           *mb = NULL;
1394    E_Move_Indicator_Widget *indi_widget = NULL;
1395    E_Move_Widget_Object    *mwo = NULL;
1396    Eina_List               *l;
1397    int                      x;
1398    int                      y;
1399    int                      w;
1400    int                      h;
1401
1402    m = e_mod_move_util_get();
1403    E_CHECK_RETURN(m, EINA_FALSE);
1404
1405    mb = e_mod_move_border_client_find(win);
1406    E_CHECK_RETURN(mb, NULL);
1407
1408    indi_widget = E_NEW(E_Move_Indicator_Widget, 1);
1409    E_CHECK_RETURN(indi_widget, NULL);
1410
1411    indi_widget->win = win;
1412    indi_widget->objs = e_mod_move_widget_objs_add(m);
1413    if (indi_widget->objs)
1414      {
1415         switch (mb->angle)
1416           {
1417              case 90:
1418                 x = m->indicator_widget_geometry[E_MOVE_ANGLE_90].x;
1419                 y = m->indicator_widget_geometry[E_MOVE_ANGLE_90].y;
1420                 w = m->indicator_widget_geometry[E_MOVE_ANGLE_90].w;
1421                 h = m->indicator_widget_geometry[E_MOVE_ANGLE_90].h;
1422                 break;
1423              case 180:
1424                 x = m->indicator_widget_geometry[E_MOVE_ANGLE_180].x;
1425                 y = m->indicator_widget_geometry[E_MOVE_ANGLE_180].y;
1426                 w = m->indicator_widget_geometry[E_MOVE_ANGLE_180].w;
1427                 h = m->indicator_widget_geometry[E_MOVE_ANGLE_180].h;
1428                 break;
1429              case 270:
1430                 x = m->indicator_widget_geometry[E_MOVE_ANGLE_270].x;
1431                 y = m->indicator_widget_geometry[E_MOVE_ANGLE_270].y;
1432                 w = m->indicator_widget_geometry[E_MOVE_ANGLE_270].w;
1433                 h = m->indicator_widget_geometry[E_MOVE_ANGLE_270].h;
1434                 break;
1435              case 0:
1436              default:
1437                 x = m->indicator_widget_geometry[E_MOVE_ANGLE_0].x;
1438                 y = m->indicator_widget_geometry[E_MOVE_ANGLE_0].y;
1439                 w = m->indicator_widget_geometry[E_MOVE_ANGLE_0].w;
1440                 h = m->indicator_widget_geometry[E_MOVE_ANGLE_0].h;
1441                 break;
1442           }
1443         e_mod_move_widget_objs_move(indi_widget->objs, x, y);
1444         e_mod_move_widget_objs_resize(indi_widget->objs, w, h);
1445         e_mod_move_widget_objs_layer_set(indi_widget->objs, EVAS_LAYER_MAX-2);
1446         e_mod_move_widget_objs_color_set(indi_widget->objs, 0, 0, 0, 0);
1447         e_mod_move_widget_objs_show(indi_widget->objs);
1448         e_mod_move_widget_objs_raise(indi_widget->objs);
1449
1450         // Set Input Shape Mask
1451         if ((indi_widget->input_region_id = e_manager_comp_input_region_id_new(m->man)))
1452           {
1453              e_manager_comp_input_region_id_set(m->man,
1454                                                 indi_widget->input_region_id,
1455                                                 x, y, w, h);
1456           }
1457         else
1458           goto error_cleanup;
1459      }
1460    else
1461      {
1462         goto error_cleanup;
1463      }
1464
1465    // Set Event Handler
1466    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
1467      {
1468         if (!mwo) continue;
1469         _e_mod_move_indicator_widget_obj_event_setup(indi_widget, mwo);
1470      }
1471    return indi_widget;
1472
1473 error_cleanup:
1474    if (indi_widget->objs) e_mod_move_widget_objs_del(indi_widget->objs);
1475    memset(indi_widget, 0, sizeof(E_Move_Indicator_Widget));
1476    E_FREE(indi_widget);
1477    return NULL;
1478 }
1479
1480 /* delete indicator_widget */
1481 EINTERN void
1482 e_mod_move_indicator_widget_del(E_Move_Indicator_Widget *indi_widget)
1483 {
1484    E_Move        *m = NULL;
1485    E_Move_Border *mb = NULL;
1486    E_Move_Border *at_mb = NULL;
1487    E_Move_Border *qp_mb = NULL;
1488    E_Zone        *zone = NULL;
1489    int x = 0; int y = 0;
1490    int mx = 0, my = 0, ax = 0, ay = 0;
1491
1492    E_CHECK(indi_widget);
1493    m = e_mod_move_util_get();
1494
1495    if (e_mod_move_indicator_widget_click_get(indi_widget))
1496      ecore_x_mouse_up_send(indi_widget->win,
1497                            indi_widget->pos.x,
1498                            indi_widget->pos.y,
1499                            1);
1500
1501    if ((mb = e_mod_move_border_client_find(indi_widget->win)))
1502      {
1503         if (indi_widget->input_region_id)
1504           e_manager_comp_input_region_id_del(m->man, indi_widget->input_region_id);
1505
1506         // if indicaor widget is deleted, then apptray or quickpanel's mirror object hide with animation
1507         if (indi_widget->quickpanel_move)
1508           {
1509              qp_mb = e_mod_move_quickpanel_find();
1510              E_CHECK_GOTO(qp_mb, error_cleanup);
1511              zone = qp_mb->bd->zone;
1512
1513              switch (mb->angle)
1514                {
1515                 case  90:
1516                    mx = qp_mb->w * -1; my = 0;
1517                    if (m->qp_scroll_with_clipping)
1518                      {
1519                         ax = zone->x; ay = zone->y;
1520                      }
1521                    else
1522                      {
1523                         ax = mx; ay = my;
1524                      }
1525                    break;
1526                 case 180:
1527                    mx = 0; my = zone->h;
1528                    if (m->qp_scroll_with_clipping)
1529                      {
1530                         ax = zone->x + qp_mb->w;
1531                         ay = zone->y + qp_mb->h;
1532                      }
1533                    else
1534                      {
1535                         ax = mx; ay = my;
1536                      }
1537                    break;
1538                 case 270:
1539                    mx = zone->w; my = 0;
1540                    if (m->qp_scroll_with_clipping)
1541                      {
1542                         ax = zone->x + qp_mb->w;
1543                         ay = zone->y + qp_mb->h;
1544                      }
1545                    else
1546                      {
1547                         ax = mx; ay = my;
1548                      }
1549                    break;
1550                 case   0:
1551                 default :
1552                    mx = 0; my = qp_mb->h * -1;
1553                    if (m->qp_scroll_with_clipping)
1554                      {
1555                         ax = zone->x; ay = zone->y;
1556                      }
1557                    else
1558                      {
1559                         ax = mx; ay = my;
1560                      }
1561                    break;
1562                }
1563
1564              if (e_mod_move_quickpanel_objs_animation_state_get(qp_mb))
1565                {
1566                   e_mod_move_quickpanel_objs_animation_stop(qp_mb);
1567                   e_mod_move_quickpanel_objs_animation_clear(qp_mb);
1568                }
1569              e_mod_move_quickpanel_objs_add(qp_mb);
1570              e_mod_move_quickpanel_e_border_move(qp_mb, mx, my);
1571              e_mod_move_quickpanel_objs_animation_move(qp_mb, ax, ay);
1572              L(LT_EVENT_OBJ,
1573                "[MOVE] ev:%15.15s Indicator Widget Deleted: Hide QuickPanel %s():%d\n",
1574                "EVAS_OBJ", __func__, __LINE__);
1575           }
1576
1577         if (indi_widget->apptray_move)
1578           {
1579              at_mb = e_mod_move_apptray_find();
1580              E_CHECK_GOTO(at_mb, error_cleanup);
1581              zone = at_mb->bd->zone;
1582
1583              switch (mb->angle)
1584                {
1585                 case   0:
1586                    x = 0;
1587                    y = at_mb->h * -1;
1588                    break;
1589                 case  90:
1590                    x = at_mb->w * -1;
1591                    y = 0;
1592                    break;
1593                 case 180:
1594                    x = 0;
1595                    y = zone->h;
1596                    break;
1597                 case 270:
1598                    x = zone->w;
1599                    y = 0;
1600                    break;
1601                 default :
1602                    x = 0;
1603                    y = at_mb->h * -1;
1604                    break;
1605                }
1606              if (e_mod_move_apptray_objs_animation_state_get(at_mb))
1607                {
1608                   e_mod_move_apptray_objs_animation_stop(at_mb);
1609                   e_mod_move_apptray_objs_animation_clear(at_mb);
1610                }
1611              e_mod_move_apptray_objs_add(at_mb);
1612
1613              // apptray_objs_animation_layer_set
1614              e_mod_move_apptray_objs_animation_layer_set(at_mb);
1615
1616              e_mod_move_apptray_e_border_move(at_mb, x, y);
1617              e_mod_move_apptray_objs_animation_move(at_mb, x, y);
1618              L(LT_EVENT_OBJ,
1619                "[MOVE] ev:%15.15s Indicator Widget Deleted: Hide Apptray %s():%d\n",
1620                "EVAS_OBJ", __func__, __LINE__);
1621           }
1622      }
1623
1624 error_cleanup:
1625    if (indi_widget->objs) e_mod_move_widget_objs_del(indi_widget->objs);
1626    memset(indi_widget, 0, sizeof(E_Move_Indicator_Widget));
1627    E_FREE(indi_widget);
1628    if (m) m->indicator_widget = NULL;
1629 }
1630
1631 EINTERN Eina_Bool
1632 e_mod_move_indicator_widget_angle_change(Ecore_X_Window win)
1633 {
1634    E_Move                  *m = NULL;
1635    E_Move_Indicator_Widget *indi_widget = NULL;
1636    Eina_Bool                ret = EINA_FALSE;
1637    E_Move_Border           *mb = NULL;
1638    int                      x;
1639    int                      y;
1640    int                      w;
1641    int                      h;
1642
1643    m = e_mod_move_util_get();
1644    E_CHECK_RETURN(m, EINA_FALSE);
1645
1646    indi_widget = e_mod_move_indicator_widget_get();
1647    E_CHECK_RETURN(indi_widget, EINA_FALSE);
1648
1649    if ((indi_widget->win == win))
1650      {
1651         if ((mb = e_mod_move_border_client_find(win)))
1652           {
1653              switch (mb->angle)
1654                {
1655                   case 90:
1656                      x = m->indicator_widget_geometry[E_MOVE_ANGLE_90].x;
1657                      y = m->indicator_widget_geometry[E_MOVE_ANGLE_90].y;
1658                      w = m->indicator_widget_geometry[E_MOVE_ANGLE_90].w;
1659                      h = m->indicator_widget_geometry[E_MOVE_ANGLE_90].h;
1660                      break;
1661                   case 180:
1662                      x = m->indicator_widget_geometry[E_MOVE_ANGLE_180].x;
1663                      y = m->indicator_widget_geometry[E_MOVE_ANGLE_180].y;
1664                      w = m->indicator_widget_geometry[E_MOVE_ANGLE_180].w;
1665                      h = m->indicator_widget_geometry[E_MOVE_ANGLE_180].h;
1666                      break;
1667                   case 270:
1668                      x = m->indicator_widget_geometry[E_MOVE_ANGLE_270].x;
1669                      y = m->indicator_widget_geometry[E_MOVE_ANGLE_270].y;
1670                      w = m->indicator_widget_geometry[E_MOVE_ANGLE_270].w;
1671                      h = m->indicator_widget_geometry[E_MOVE_ANGLE_270].h;
1672                      break;
1673                   case 0:
1674                   default:
1675                      x = m->indicator_widget_geometry[E_MOVE_ANGLE_0].x;
1676                      y = m->indicator_widget_geometry[E_MOVE_ANGLE_0].y;
1677                      w = m->indicator_widget_geometry[E_MOVE_ANGLE_0].w;
1678                      h = m->indicator_widget_geometry[E_MOVE_ANGLE_0].h;
1679                      break;
1680                 }
1681               e_mod_move_widget_objs_move(indi_widget->objs, x, y);
1682               e_mod_move_widget_objs_resize(indi_widget->objs, w, h);
1683
1684               //change Input Shape Mask
1685               if (indi_widget->input_region_id)
1686                 {
1687                    e_manager_comp_input_region_id_set(m->man,
1688                                                       indi_widget->input_region_id,
1689                                                       x, y, w, h);
1690                 }
1691               ret = EINA_TRUE;
1692            }
1693      }
1694    return ret;
1695 }
1696
1697 EINTERN Eina_Bool
1698 e_mod_move_indicator_widget_scrollable_check(void)
1699 {
1700    E_Move_Border *lockscr_mb = NULL;
1701    E_Move_Border *taskmgr_mb = NULL;
1702    E_Move_Border *pwlock_mb = NULL;
1703
1704    // if lockscreen is exist & visible, then do not show  apptray & quickpanel
1705    if ((lockscr_mb = e_mod_move_lockscreen_find()))
1706      {
1707         if (lockscr_mb->visibility == E_MOVE_VISIBILITY_STATE_VISIBLE)
1708           {
1709              L(LT_EVENT_OBJ,
1710                "[MOVE] ev:%15.15s  %s %s()\n",
1711                "EVAS_OBJ","Lockscreen is exist.", __func__);
1712              return EINA_FALSE;
1713           }
1714      }
1715    // if taskmanage is exist & visible, then do not show  apptray & quickpanel
1716    if ((taskmgr_mb = e_mod_move_taskmanager_find()))
1717      {
1718         if (taskmgr_mb->visibility == E_MOVE_VISIBILITY_STATE_VISIBLE)
1719           {
1720              L(LT_EVENT_OBJ,
1721                "[MOVE] ev:%15.15s  %s %s()\n",
1722                "EVAS_OBJ","TaskManager is exist.", __func__);
1723              return EINA_FALSE;
1724           }
1725      }
1726
1727    // if pwlock is exist & visible, then do not show  apptray & quickpanel
1728    if ((pwlock_mb = e_mod_move_pwlock_find()))
1729      {
1730         if (pwlock_mb->visibility == E_MOVE_VISIBILITY_STATE_VISIBLE)
1731           {
1732              L(LT_EVENT_OBJ,
1733                "[MOVE] ev:%15.15s  %s %s()\n",
1734                "EVAS_OBJ","PWLOCK is exist.", __func__);
1735              return EINA_FALSE;
1736           }
1737      }
1738
1739    return EINA_TRUE;
1740 }
1741
1742 EINTERN Eina_Bool
1743 e_mod_move_indicator_widget_click_get(E_Move_Indicator_Widget* indi_widget)
1744 {
1745    Eina_Bool             click = EINA_FALSE;
1746    E_Move_Widget_Object *mwo = NULL;
1747    Eina_List             *l;
1748
1749    E_CHECK_RETURN(indi_widget, EINA_FALSE);
1750    E_CHECK_RETURN(indi_widget->objs, EINA_FALSE);
1751
1752    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
1753      {
1754         if (!mwo) continue;
1755         click = e_mod_move_event_click_get(mwo->event);
1756      }
1757
1758    return click;
1759 }
1760
1761 EINTERN Eina_Bool
1762 e_mod_move_indicator_widget_event_clear(E_Move_Indicator_Widget* indi_widget)
1763 {
1764    Eina_Bool             click = EINA_FALSE;
1765    E_Move_Widget_Object *mwo = NULL;
1766    Eina_List             *l;
1767    E_Move_Border         *mb = NULL;
1768
1769    E_CHECK_RETURN(indi_widget, EINA_FALSE);
1770    E_CHECK_RETURN(indi_widget->objs, EINA_FALSE);
1771
1772    click = e_mod_move_indicator_widget_click_get(indi_widget);
1773    E_CHECK_RETURN(click, EINA_FALSE);
1774
1775    EINA_LIST_FOREACH(indi_widget->objs, l, mwo)
1776      {
1777         if (!mwo) continue;
1778         e_mod_move_event_data_clear(mwo->event);
1779         e_mod_move_event_click_set(mwo->event, EINA_FALSE);
1780      }
1781
1782    _e_mod_move_indicator_widget_apptray_move_set(indi_widget, EINA_FALSE);
1783    _e_mod_move_indicator_widget_quickpanel_move_set(indi_widget, EINA_FALSE);
1784
1785    mb = e_mod_move_border_client_find(indi_widget->win);
1786    if (mb && mb->flick_data) e_mod_move_flick_data_free(mb);
1787    return EINA_TRUE;
1788 }
1789
1790 EINTERN Eina_Bool
1791 e_mod_move_indicator_widget_state_change(Ecore_X_Window win, Eina_Bool state)
1792 {
1793    E_Move_Indicator_Widget *indi_widget = NULL;
1794    E_Move_Border           *mb = NULL;
1795
1796    if ((indi_widget = e_mod_move_indicator_widget_get()))
1797      {
1798         if ((indi_widget->win == win)
1799             && (!state))
1800           {
1801              // indicator state disable -> delete current indicator widget
1802              e_mod_move_indicator_widget_del(indi_widget);
1803              e_mod_move_indicator_widget_set(NULL);
1804           }
1805      }
1806    else
1807      {
1808         mb = e_mod_move_border_client_find(win);
1809         if ((mb)
1810             && (mb->indicator_type == E_MOVE_INDICATOR_TYPE_1)
1811             && (state))
1812           e_mod_move_indicator_widget_apply();
1813      }
1814
1815    return EINA_TRUE;
1816 }
1817
1818 EINTERN Eina_Bool
1819 e_mod_move_indicator_widget_type_change(Ecore_X_Window win, E_Move_Indicator_Type type)
1820 {
1821    E_Move_Indicator_Widget *indi_widget = NULL;
1822    E_Move_Border           *mb = NULL;
1823
1824    if ((indi_widget = e_mod_move_indicator_widget_get()))
1825      {
1826         if ((indi_widget->win == win)
1827             && (type != E_MOVE_INDICATOR_TYPE_1))
1828           {
1829              // indicator type is not type_1 -> delete current indicator widget
1830              e_mod_move_indicator_widget_del(indi_widget);
1831              e_mod_move_indicator_widget_set(NULL);
1832 #if 1
1833              // change later
1834              e_mod_move_indicator_widget_apply();
1835 #endif
1836           }
1837      }
1838    else
1839      {
1840         mb = e_mod_move_border_client_find(win);
1841         if ((mb)
1842             && (mb->indicator_state == E_MOVE_INDICATOR_STATE_ON)
1843             && (type == E_MOVE_INDICATOR_TYPE_1))
1844           e_mod_move_indicator_widget_apply();
1845      }
1846
1847    return EINA_TRUE;
1848 }
1849
1850 EINTERN Eina_Bool
1851 e_mod_move_indicator_widget_angle_change_post_job(void)
1852 {
1853    E_Move_Indicator_Widget *indi_widget = NULL;
1854    E_Move_Border           *mb = NULL;
1855    E_Border                *bd = NULL;
1856    E_Zone                  *zone = NULL;
1857    int                      angle = 0;
1858    int                      x = 0, y = 0;
1859
1860    indi_widget = e_mod_move_indicator_widget_get();
1861    E_CHECK_RETURN(indi_widget, EINA_FALSE);
1862
1863    mb = e_mod_move_border_client_find(indi_widget->win);
1864    E_CHECK_RETURN(mb, EINA_FALSE);
1865
1866    bd = mb->bd;
1867    E_CHECK_RETURN(bd, EINA_FALSE);
1868
1869    zone = bd->zone;
1870    E_CHECK_RETURN(zone, EINA_FALSE);
1871
1872    angle = mb->angle;
1873
1874    if (e_mod_move_indicator_widget_click_get(indi_widget))
1875      {
1876          switch (angle)
1877            {
1878             case   0:
1879                x = zone->x;
1880                y = zone->y;
1881                break;
1882             case  90:
1883                x = zone->x;
1884                y = zone->y;
1885                break;
1886             case 180:
1887                x = zone->x + zone->w;
1888                y = zone->y + zone->h;
1889                break;
1890             case 270:
1891                x = zone->x + zone->w;
1892                y = zone->y + zone->h;
1893                break;
1894             default :
1895                break;
1896            }
1897      }
1898
1899    if (mb->flick_data)
1900      e_mod_move_flick_data_init(mb, x, y);
1901
1902    return EINA_TRUE;
1903 }