1 #include <Elementary.h>
4 #include "e_mod_main.h"
9 #define INFO(cov, txt) \
10 evas_object_text_text_set(cov->text, txt); \
13 #define INFO(cov, txt) INF("%s -> %x", txt, target_win)
16 #define MOUSE_BUTTON_DOWN 0
18 #define MOUSE_BUTTON_UP 2
24 Ecore_X_Window down_win;
26 Ecore_Timer *double_down_timer;
27 Ecore_Timer *tap_timer;
30 int x, y, dx, dy, mx, my;
31 int mouse_history[HISTORY_MAX];
34 Eina_Inarray *two_finger_move;
37 Ecore_X_Atom atom_control_panel_open;
38 Ecore_X_Atom atom_app_tray_open;
40 Eina_Bool longpressed : 1;
41 Eina_Bool two_finger_down : 1;
42 Eina_Bool three_finger_down : 1;
43 Eina_Bool mouse_double_down : 1;
44 Eina_Bool lock_screen : 1;
53 static int g_enable = 0;
54 static Ecore_X_Window target_win = 0;
55 static Ecore_X_Window unfocused_win = 0;
57 static Eina_List *covers = NULL;
58 static Eina_List *handlers = NULL;
59 static Ecore_Event_Handler *property_handler = NULL;
61 static void _move_module_enable_set(int enable);
64 _mouse_in_win_get(Cover *cov, int x, int y)
69 Ecore_X_Window win = 0;
73 skip = alloca(sizeof(Ecore_X_Window) * eina_list_count(covers));
75 EINA_LIST_FOREACH(covers, l, cov2)
80 win = ecore_x_window_shadow_tree_at_xy_with_skip_get
81 (cov->zone->container->manager->root, x, y, skip, i);
83 if (win != target_win)
87 bd = e_border_focused_get();
88 if (bd && (bd->client.win != target_win))
89 unfocused_win = target_win;
96 _win_angle_get(Ecore_X_Window win)
105 unsigned char *prop_data = NULL;
107 root = ecore_x_window_root_get(win);
108 ret = ecore_x_window_prop_property_get(root,
109 ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE,
110 ECORE_X_ATOM_CARDINAL,
111 32, &prop_data, &count);
113 if (ret && prop_data)
114 memcpy (&angle, prop_data, sizeof (int));
116 if (prop_data) free (prop_data);
122 _cov_data_reset(Cover *cov)
125 cov->longpressed = EINA_FALSE;
126 cov->two_finger_down = EINA_FALSE;
127 cov->two_finger_move = EINA_FALSE;
128 cov->mouse_double_down = EINA_FALSE;
129 cov->three_finger_down = EINA_FALSE;
130 cov->lock_screen = EINA_FALSE;
134 ecore_timer_del(cov->timer);
138 if (cov->double_down_timer)
140 ecore_timer_del(cov->double_down_timer);
141 cov->double_down_timer = NULL;
146 ecore_timer_del(cov->tap_timer);
147 cov->tap_timer = NULL;
152 _screen_reader_support_check()
159 ret = ecore_x_window_prop_card32_get
160 (target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1);
162 if ((ret >= 0) && (val == 2))
164 /* hide input window */
165 EINA_LIST_FOREACH(covers, l, cov)
167 ecore_x_window_hide(cov->win);
168 _cov_data_reset(cov);
171 _move_module_enable_set(EINA_FALSE);
175 /* show input window */
176 EINA_LIST_FOREACH(covers, l, cov)
178 ecore_x_window_show(cov->win);
181 _move_module_enable_set(EINA_TRUE);
186 _target_window_find()
193 /* find proper target window to send a meesage */
194 Eina_List *borders, *l;
197 borders = e_border_client_list();
198 EINA_LIST_REVERSE_FOREACH(borders, l, bd)
200 if (!bd->visible) continue;
201 if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) break;
203 ret = ecore_x_window_prop_card32_get
204 (bd->client.win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1);
206 if ((ret >= 0) && (val == 1))
208 win = bd->client.win;
213 /* there would be an unfocused window which does not have 'val == 1'
214 such as an window of virtual keyboard. if the window is selected by
215 _mouse_in_win_get(); previously with the unfocused window, the target
216 window should be the unfocused window */
217 if (win) target_win = win;
220 if (unfocused_win) target_win = unfocused_win;
223 bd = e_border_focused_get();
224 if (bd) target_win = bd->client.win;
230 _lock_screen_check(Cover *cov)
234 const char *name = NULL;
235 const char *clas = NULL;
237 Eina_List *borders, *l;
239 cov->lock_screen = EINA_FALSE;
241 borders = e_border_client_list();
242 EINA_LIST_REVERSE_FOREACH(borders, l, bd)
245 if (!bd->visible) continue;
247 name = bd->client.icccm.name;
248 clas = bd->client.icccm.class;
250 if (clas == NULL || name == NULL) continue;
251 if (strncmp(clas,"LOCK_SCREEN",strlen("LOCK_SCREEN"))!= 0) continue;
252 if (strncmp(name,"LOCK_SCREEN",strlen("LOCK_SCREEN"))!= 0) continue;
254 INF("lock screen is detected");
255 cov->lock_screen = EINA_TRUE;
262 _app_tray_open(Cover *cov)
266 const char *name = NULL;
267 const char *clas = NULL;
269 Eina_List *borders, *l;
272 borders = e_border_client_list();
273 EINA_LIST_REVERSE_FOREACH(borders, l, bd)
276 if (!bd->visible) continue;
278 /* UTILITY type such as keyboard window could come first, before NORMAL
279 type such as app tray, quickpanel window comes */
280 if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UTILITY) continue;
281 if (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NORMAL) break;
283 name = bd->client.icccm.name;
284 clas = bd->client.icccm.class;
286 if (clas == NULL || name == NULL) continue;
287 if (strncmp(clas,"MINIAPP_TRAY",strlen("MINIAPP_TRAY"))!= 0) continue;
288 if (strncmp(name,"MINIAPP_TRAY",strlen("MINIAPP_TRAY"))!= 0) continue;
290 /* open mini app tray */
291 INF("open app tray");
292 ecore_x_client_message32_send(bd->client.win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
293 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
295 cov->atom_app_tray_open,
302 _quickpanel_open(void)
306 const char *name = NULL;
307 const char *clas = NULL;
309 Eina_List *borders, *l;
312 borders = e_border_client_list();
313 EINA_LIST_REVERSE_FOREACH(borders, l, bd)
316 if (!bd->visible) continue;
318 /* UTILITY type such as keyboard window could come first, before NORMAL
319 type such as app tray, quickpanel window comes */
320 if (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UTILITY) continue;
321 if (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NORMAL) break;
323 name = bd->client.icccm.name;
324 clas = bd->client.icccm.class;
326 if (clas == NULL || name == NULL) continue;
327 if (strncmp(clas,"QUICKPANEL",strlen("QUICKPANEL"))!= 0) continue;
328 if (strncmp(name,"QUICKPANEL",strlen("QUICKPANEL"))!= 0) continue;
330 /* open quickpanel */
331 INF("open quickpanel");
332 ecore_x_e_illume_quickpanel_state_send
333 (ecore_x_e_illume_zone_get(bd->client.win),
334 ECORE_X_ILLUME_QUICKPANEL_STATE_ON);
336 /* set unfocused window to quickpanel (unfocused window), otherwise
337 target window would set to focused window in _target_window_find(); */
338 target_win = bd->client.win;
339 unfocused_win = bd->client.win;
345 _coordinate_calibrate(Ecore_X_Window win, int *x, int *y)
353 angle = _win_angle_get(win);
354 ecore_x_window_geometry_get(win, NULL, NULL, &w, &h);
382 _mouse_win_fake_tap(Cover *cov, Ecore_Event_Mouse_Button *ev)
386 /* find target window to send message */
387 _mouse_in_win_get(cov, ev->root.x, ev->root.y);
389 ecore_x_pointer_xy_get(target_win, &x, &y);
390 ecore_x_mouse_in_send(target_win, x, y);
391 ecore_x_mouse_move_send(target_win, x, y);
392 ecore_x_mouse_down_send(target_win, x, y, 1);
393 ecore_x_mouse_up_send(target_win, x, y, 1);
394 ecore_x_mouse_out_send(target_win, x, y);
398 _message_control_panel_open_send(Cover *cov)
400 ecore_x_client_message32_send(target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
401 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
403 cov->atom_control_panel_open,
408 _message_back_send(Cover *cov)
410 ecore_x_client_message32_send(target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
411 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
413 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_BACK,
418 _message_scroll_send(Cover *cov, int type)
423 atom = ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_SCROLL;
424 if (cov->lock_screen) atom = ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_MOUSE;
426 ecore_x_pointer_xy_get(target_win, &x, &y);
427 _coordinate_calibrate(target_win, &x, &y);
429 ecore_x_client_message32_send(target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
430 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
437 _message_mouse_send(Cover *cov, int type)
441 ecore_x_pointer_xy_get(cov->down_win, &x, &y);
442 _coordinate_calibrate(cov->down_win, &x, &y);
444 ecore_x_client_message32_send(cov->down_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
445 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
447 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_MOUSE,
452 _message_read_send(Cover *cov)
456 /* find target window to send message */
457 _mouse_in_win_get(cov, cov->x, cov->y);
459 ecore_x_pointer_xy_get(target_win, &x, &y);
460 _coordinate_calibrate(target_win, &x, &y);
462 ecore_x_client_message32_send(target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
463 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
465 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ,
470 _mouse_longpress(void *data)
477 dx = cov->x - cov->dx;
478 dy = cov->y - cov->dy;
479 if (((dx * dx) + (dy * dy)) < (distance * distance))
481 cov->longpressed = EINA_TRUE;
482 INFO(cov, "longpress");
484 if (!cov->mouse_double_down) _message_read_send(cov);
487 /* send message to start longpress,
488 keep previous target window to send mouse-up event */
489 cov->down_win = target_win;
491 _message_mouse_send(cov, MOUSE_BUTTON_DOWN);
498 _mouse_double_down(void *data)
501 ecore_timer_del(cov->double_down_timer);
502 cov->double_down_timer = NULL;
507 _mouse_double_down_timeout(Cover *cov)
509 double long_time = 0.5;
510 double short_time = 0.3;
514 dx = cov->x - cov->dx;
515 dy = cov->y - cov->dy;
517 if ((cov->double_down_timer) &&
518 (((dx * dx) + (dy * dy)) < (distance * distance)))
520 /* start double tap and move from here */
521 cov->mouse_double_down = EINA_TRUE;
525 ecore_timer_del(cov->timer);
528 /* check longpress after double down */
529 cov->timer = ecore_timer_add(long_time, _mouse_longpress, cov);
532 if (cov->double_down_timer)
534 ecore_timer_del(cov->double_down_timer);
535 cov->double_down_timer = NULL;
539 cov->double_down_timer = ecore_timer_add(short_time, _mouse_double_down, cov);
543 _mouse_tap(void *data)
546 cov->tap_timer = NULL;
548 _message_read_send(cov);
554 _mouse_down(Cover *cov, Ecore_Event_Mouse_Button *ev)
556 double longtime = 0.5;
564 cov->dt = ev->timestamp;
565 cov->longpressed = EINA_FALSE;
566 cov->timer = ecore_timer_add(longtime, _mouse_longpress, cov);
571 ecore_timer_del(cov->tap_timer);
572 cov->tap_timer = NULL;
575 /* check mouse double down - not two fingers, refer to double click */
576 _mouse_double_down_timeout(cov);
580 _circle_draw_check(Cover *cov)
582 Ecore_Event_Mouse_Move *ev, *t_ev, *b_ev, *l_ev, *r_ev;
583 Evas_Coord_Point m_tb, m_lr;
586 int min_x, min_y, max_x, max_y;
587 int left = 0, right = 0, top = 0, bottom = 0;
590 count = eina_inarray_count(cov->two_finger_move);
591 if (count < 10 || count > 60) goto inarray_free;
596 EINA_INARRAY_FOREACH(cov->two_finger_move, ev)
633 t_ev = eina_inarray_nth(cov->two_finger_move, top);
634 b_ev = eina_inarray_nth(cov->two_finger_move, bottom);
635 m_tb.x = (t_ev->x + b_ev->x) / 2;
636 m_tb.y = (t_ev->y + b_ev->y) / 2;
639 l_ev = eina_inarray_nth(cov->two_finger_move, left);
640 r_ev = eina_inarray_nth(cov->two_finger_move, right);
641 m_lr.x = (l_ev->x + r_ev->x) / 2;
642 m_lr.y = (l_ev->y + r_ev->y) / 2;
644 distance = (int) sqrt(((m_tb.x - m_lr.x) * (m_tb.x - m_lr.x)) + ((m_tb.y - m_lr.y) * (m_tb.y - m_lr.y)));
648 if (left > bottom) i++;
649 if (bottom > right) i++;
650 if (right > top) i++;
652 if ((i >= 3) && (distance < 60))
654 INFO(cov, "two finger circle draw");
655 _message_back_send(cov);
659 eina_inarray_free(cov->two_finger_move);
663 _mouse_up(Cover *cov, Ecore_Event_Mouse_Button *ev)
665 double timeout = 0.15;
666 double double_tap_timeout = 0.25;
671 if (cov->three_finger_down)
673 cov->three_finger_down = EINA_FALSE;
675 dx = ev->x - cov->dx;
676 dy = ev->y - cov->dy;
678 if (((dx * dx) + (dy * dy)) > (4 * distance * distance)
679 && ((ev->timestamp - cov->dt) < (timeout * 3000)))
681 /* get root window rotation */
682 angle = _win_angle_get(target_win);
684 if (abs(dx) > abs(dy)) /* left or right */
686 if (dx > 0) /* right */
688 INFO(cov, "three finger swipe right");
703 INFO(cov, "three finger swipe left");
717 else /* up or down */
719 if (dy > 0) /* down */
721 INFO(cov, "three finger swipe down");
732 INFO(cov, "three finger swipe up");
746 /* for two finger panning */
747 if (cov->two_finger_down)
749 cov->two_finger_down = EINA_FALSE;
751 _message_scroll_send(cov, MOUSE_BUTTON_UP);
752 cov->lock_screen = EINA_FALSE;
754 /* to check 2 finger mouse move */
755 if (cov->two_finger_move) _circle_draw_check(cov);
757 dx = ev->x - cov->dx;
758 dy = ev->y - cov->dy;
760 if (((dx * dx) + (dy * dy)) < (distance * distance))
762 if (ev->double_click)
764 INFO(cov, "two finger double click");
765 _message_control_panel_open_send(cov);
771 if (cov->mouse_double_down)
773 /* reset double down and moving: action up/down */
774 cov->mouse_double_down = EINA_FALSE;
776 if (cov->longpressed)
778 /* mouse up after longpress */
779 _message_mouse_send(cov, MOUSE_BUTTON_UP);
783 /* delete timer which is used for checking longpress */
786 ecore_timer_del(cov->timer);
790 if (cov->longpressed)
792 cov->longpressed = EINA_FALSE;
796 dx = ev->x - cov->dx;
797 dy = ev->y - cov->dy;
798 if (((dx * dx) + (dy * dy)) < (distance * distance))
800 if (ev->double_click)
802 INFO(cov, "double_click");
803 ecore_x_e_illume_access_action_activate_send(target_win);
807 cov->tap_timer = ecore_timer_add(double_tap_timeout,
811 else if (((dx * dx) + (dy * dy)) > (4 * distance * distance)
812 && ((ev->timestamp - cov->dt) < (timeout * 2000)))
814 /* get root window rotation */
815 angle = _win_angle_get(target_win);
817 if (abs(dx) > abs(dy)) /* left or right */
819 if (dx > 0) /* right */
821 INFO(cov, "single flick right");
825 ecore_x_e_illume_access_action_up_send(target_win);
829 ecore_x_e_illume_access_action_down_send(target_win);
834 ecore_x_e_illume_access_action_read_next_send
842 INFO(cov, "single flick left");
846 ecore_x_e_illume_access_action_down_send(target_win);
850 ecore_x_e_illume_access_action_up_send(target_win);
855 ecore_x_e_illume_access_action_read_prev_send
861 else /* up or down */
863 if (dy > 0) /* down */
865 INFO(cov, "single flick down");
869 ecore_x_e_illume_access_action_read_prev_send
874 ecore_x_e_illume_access_action_read_next_send
880 ecore_x_e_illume_access_action_down_send(target_win);
886 INFO(cov, "single flick up");
890 ecore_x_e_illume_access_action_read_next_send
895 ecore_x_e_illume_access_action_read_prev_send
901 ecore_x_e_illume_access_action_up_send(target_win);
909 cov->longpressed = EINA_FALSE;
913 _mouse_move(Cover *cov __UNUSED__, Ecore_Event_Mouse_Move *ev __UNUSED__)
915 //FIXME: why here, after long press you cannot go below..
916 //if (!cov->down) return;
918 //FIXME: one finger cannot come here
919 //_record_mouse_history(cov, ev);
920 if (cov->two_finger_move) eina_inarray_push(cov->two_finger_move, ev);
922 _message_scroll_send(cov, MOUSE_MOVE);
926 _mouse_wheel(Cover *cov __UNUSED__, Ecore_Event_Mouse_Wheel *ev __UNUSED__)
928 if (ev->z == -1) /* up */
930 #if ECORE_VERSION_MAJOR >= 1
931 # if ECORE_VERSION_MINOR >= 8
932 ecore_x_e_illume_access_action_up_send(target_win);
936 else if (ev->z == 1) /* down */
938 #if ECORE_VERSION_MAJOR >= 1
939 # if ECORE_VERSION_MINOR >= 8
940 ecore_x_e_illume_access_action_down_send(target_win);
947 _cb_mouse_down(void *data __UNUSED__,
951 Ecore_Event_Mouse_Button *ev = event;
955 EINA_LIST_FOREACH(covers, l, cov)
957 /* sometimes the mouse down event has improper multi.device value */
960 if (ev->window == cov->win)
962 //XXX change specific number
963 if (ev->multi.device == 0)
965 _target_window_find();
966 _mouse_down(cov, ev);
969 else if (cov->n_taps == 2 &&
970 !(cov->two_finger_down) &&
973 /* prevent longpress client message by two finger */
976 ecore_timer_del(cov->timer);
980 cov->two_finger_down = EINA_TRUE;
982 _lock_screen_check(cov);
983 _message_scroll_send(cov, MOUSE_BUTTON_DOWN);
985 /* to check 2 finger mouse move */
986 cov->two_finger_move = eina_inarray_new(sizeof(Ecore_Event_Mouse_Move), 0);
989 else if (cov->n_taps == 3 &&
990 !(cov->three_finger_down) &&
993 cov->three_finger_down = EINA_TRUE;
995 if (cov->two_finger_down)
997 cov->two_finger_down = EINA_FALSE;
999 _message_scroll_send(cov, MOUSE_BUTTON_UP);
1000 cov->lock_screen = EINA_FALSE;
1002 eina_inarray_free(cov->two_finger_move);
1005 return ECORE_CALLBACK_PASS_ON;
1008 return ECORE_CALLBACK_PASS_ON;
1012 _cb_mouse_up(void *data __UNUSED__,
1013 int type __UNUSED__,
1016 Ecore_Event_Mouse_Button *ev = event;
1020 EINA_LIST_FOREACH(covers, l, cov)
1024 if (ev->window == cov->win)
1026 /* the first finger: 1, from the second finger: 0 */
1027 if (ev->buttons == 1) _mouse_up(cov, ev);
1029 return ECORE_CALLBACK_PASS_ON;
1032 return ECORE_CALLBACK_PASS_ON;
1036 _cb_mouse_move(void *data __UNUSED__,
1037 int type __UNUSED__,
1040 Ecore_Event_Mouse_Move *ev = event;
1044 EINA_LIST_FOREACH(covers, l, cov)
1049 if (ev->window == cov->win)
1051 //if (ev->multi.device == multi_device[0] || ev->multi.device == multi_device[1])
1052 if (cov->two_finger_down && cov->n_taps == 2)
1053 _mouse_move(cov, ev);
1054 else if (cov->longpressed && /* client message for moving is available only after long press is detected */
1055 !(cov->mouse_double_down) && /* mouse move after double down should not send read message */
1056 !(cov->two_finger_down) && ev->multi.device == 0)
1059 _message_read_send(cov);
1061 else if (cov->mouse_double_down && /* client message for moving is available only after long press is detected */
1062 !(cov->two_finger_down) && ev->multi.device == 0)
1064 if (cov->longpressed)
1066 /* send message to notify move after longpress */
1067 _message_mouse_send(cov, MOUSE_MOVE);
1071 return ECORE_CALLBACK_PASS_ON;
1074 return ECORE_CALLBACK_PASS_ON;
1078 _cb_mouse_wheel(void *data __UNUSED__,
1079 int type __UNUSED__,
1082 Ecore_Event_Mouse_Wheel *ev = event;
1086 EINA_LIST_FOREACH(covers, l, cov)
1088 if (ev->window == cov->win)
1090 _mouse_wheel(cov, ev);
1091 return ECORE_CALLBACK_PASS_ON;
1094 return ECORE_CALLBACK_PASS_ON;
1098 _cover_new(E_Zone *zone)
1102 cov = E_NEW(Cover, 1);
1103 if (!cov) return NULL;
1108 ee = ecore_evas_new(NULL,
1109 zone->container->x + zone->x,
1110 zone->container->y + zone->y,
1113 ecore_evas_alpha_set(ee, EINA_TRUE);
1114 cov->win = (Ecore_X_Window)ecore_evas_window_get(ee);
1116 /* create infomation */
1118 e = ecore_evas_get(ee);
1119 cov->info = evas_object_rectangle_add(e);
1120 evas_object_color_set(cov->info, 255, 255, 255, 100);
1121 evas_object_move(cov->info, zone->container->x + zone->x, zone->container->y + zone->y);
1122 evas_object_resize(cov->info, zone->w, 30);
1123 evas_object_show(cov->info);
1125 cov->text = evas_object_text_add(e);
1126 evas_object_text_style_set(cov->text, EVAS_TEXT_STYLE_PLAIN);
1127 evas_object_text_font_set(cov->text, "DejaVu", 14);
1128 evas_object_text_text_set(cov->text, "screen-reader module");
1130 evas_object_color_set(cov->text, 0, 0, 0, 255);
1131 evas_object_resize(cov->text, (zone->w / 8), 20);
1132 evas_object_move(cov->text, zone->container->x + zone->x + 5, zone->container->y + zone->y + 5);
1133 evas_object_show(cov->text);
1136 cov->win = ecore_x_window_input_new(zone->container->manager->root,
1137 zone->container->x + zone->x,
1138 zone->container->y + zone->y,
1142 ecore_x_input_multi_select(cov->win);
1144 ecore_x_icccm_title_set(cov->win, "screen-reader-input");
1145 ecore_x_netwm_name_set(cov->win, "screen-reader-input");
1147 ecore_x_window_ignore_set(cov->win, 1);
1148 ecore_x_window_configure(cov->win,
1149 ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
1150 ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
1152 zone->container->layers[8].win,
1153 ECORE_X_WINDOW_STACK_ABOVE);
1154 ecore_x_window_show(cov->win);
1155 ecore_x_window_raise(cov->win);
1163 Eina_List *l, *l2, *l3;
1166 EINA_LIST_FOREACH(e_manager_list(), l, man)
1169 EINA_LIST_FOREACH(man->containers, l2, con)
1172 EINA_LIST_FOREACH(con->zones, l3, zone)
1174 Cover *cov = _cover_new(zone);
1177 covers = eina_list_append(covers, cov);
1180 cov->atom_control_panel_open = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_CONTROL_PANEL_OPEN_");
1181 cov->atom_app_tray_open = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_APP_TRAY_OPEN_");
1189 _covers_shutdown(void)
1193 EINA_LIST_FREE(covers, cov)
1195 ecore_x_window_ignore_set(cov->win, 0);
1196 ecore_x_window_free(cov->win);
1197 evas_object_del(cov->info);
1198 evas_object_del(cov->text);
1202 ecore_timer_del(cov->timer);
1206 if (cov->double_down_timer)
1208 ecore_timer_del(cov->double_down_timer);
1209 cov->double_down_timer = NULL;
1214 ecore_timer_del(cov->tap_timer);
1215 cov->tap_timer = NULL;
1223 _cb_zone_add(void *data __UNUSED__,
1224 int type __UNUSED__,
1225 void *event __UNUSED__)
1229 return ECORE_CALLBACK_PASS_ON;
1233 _cb_zone_del(void *data __UNUSED__,
1234 int type __UNUSED__,
1235 void *event __UNUSED__)
1239 return ECORE_CALLBACK_PASS_ON;
1243 _cb_zone_move_resize(void *data __UNUSED__,
1244 int type __UNUSED__,
1245 void *event __UNUSED__)
1249 return ECORE_CALLBACK_PASS_ON;
1255 handlers = eina_list_append
1256 (handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
1257 _cb_mouse_down, NULL));
1258 handlers = eina_list_append
1259 (handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
1260 _cb_mouse_up, NULL));
1261 handlers = eina_list_append
1262 (handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
1263 _cb_mouse_move, NULL));
1264 handlers = eina_list_append
1265 (handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
1266 _cb_mouse_wheel, NULL));
1267 handlers = eina_list_append
1268 (handlers, ecore_event_handler_add(E_EVENT_ZONE_ADD,
1269 _cb_zone_add, NULL));
1270 handlers = eina_list_append
1271 (handlers, ecore_event_handler_add(E_EVENT_ZONE_DEL,
1272 _cb_zone_del, NULL));
1273 handlers = eina_list_append
1274 (handlers, ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
1275 _cb_zone_move_resize, NULL));
1279 _events_shutdown(void)
1281 E_FREE_LIST(handlers, ecore_event_handler_del);
1285 _cb_property_change(void *data __UNUSED__,
1286 int type __UNUSED__,
1290 Ecore_X_Event_Window_Property *event = ev;
1292 if (!g_enable) return ECORE_CALLBACK_PASS_ON;
1294 if (event->atom == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
1296 bd = e_border_focused_get();
1299 /* if there was an unfocused window, the target window is changed
1300 in the _target_window_find();. so reset unfocused window here */
1301 if (unfocused_win) unfocused_win = 0;
1303 target_win = bd->client.win;
1304 _screen_reader_support_check();
1308 if (event->atom == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL &&
1309 event->win == target_win)
1311 _screen_reader_support_check();
1314 return ECORE_CALLBACK_PASS_ON;
1318 _move_module_enable_set(int enable)
1320 E_Manager *man = e_manager_current_get();
1322 if (!man) ERR("cannot get current manager");
1326 INF("send enaable message");
1327 e_msg_send("screen-reader", "enable", 0, E_OBJECT(man), NULL, NULL, NULL);
1331 INF("send disaable message");
1332 e_msg_send("screen-reader", "disable", 0, E_OBJECT(man), NULL, NULL, NULL);
1337 _vconf_cb_accessibility_tts_change(keynode_t *node,
1344 enable = vconf_keynode_get_bool(node);
1345 if (g_enable == enable) return;
1350 INF("[screen reader module] module enable");
1356 /* send a message to the move module */
1357 _move_module_enable_set(enable);
1361 INF("[screen reader module] module disable");
1365 /* send a message to the move module */
1366 _move_module_enable_set(enable);
1369 elm_config_access_set(enable);
1370 elm_config_all_flush();
1373 /***************************************************************************/
1375 EAPI E_Module_Api e_modapi =
1377 E_MODULE_API_VERSION, "Screen Reader"
1381 e_modapi_init(E_Module *m)
1383 vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS,
1384 _vconf_cb_accessibility_tts_change,
1387 ecore_x_event_mask_set(ecore_x_window_root_first_get(),
1388 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
1389 ecore_x_event_mask_set(ecore_x_window_root_first_get(),
1390 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1391 property_handler = ecore_event_handler_add
1392 (ECORE_X_EVENT_WINDOW_PROPERTY, _cb_property_change, NULL);
1394 if (vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &g_enable) != 0)
1395 INF("vconf get failed\n");
1404 /* send a message to the move module */
1405 _move_module_enable_set(g_enable);
1412 /* send a message to the move module */
1413 _move_module_enable_set(g_enable);
1416 elm_config_access_set(g_enable);
1417 elm_config_all_flush();
1424 e_modapi_shutdown(E_Module *m __UNUSED__)
1426 INF("[screen-reader module] module shutdown");
1427 if (property_handler) ecore_event_handler_del(property_handler);
1436 e_modapi_save(E_Module *m __UNUSED__)