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;
277 if (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NORMAL) break;
279 name = bd->client.icccm.name;
280 clas = bd->client.icccm.class;
282 if (clas == NULL || name == NULL) continue;
283 if (strncmp(clas,"MINIAPP_TRAY",strlen("MINIAPP_TRAY"))!= 0) continue;
284 if (strncmp(name,"MINIAPP_TRAY",strlen("MINIAPP_TRAY"))!= 0) continue;
286 /* open mini app tray */
287 INF("open app tray");
288 ecore_x_client_message32_send(bd->client.win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
289 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
291 cov->atom_app_tray_open,
298 _quickpanel_open(void)
302 const char *name = NULL;
303 const char *clas = NULL;
305 Eina_List *borders, *l;
308 borders = e_border_client_list();
309 EINA_LIST_REVERSE_FOREACH(borders, l, bd)
312 if (!bd->visible) continue;
313 if (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NORMAL) break;
315 name = bd->client.icccm.name;
316 clas = bd->client.icccm.class;
318 if (clas == NULL || name == NULL) continue;
319 if (strncmp(clas,"QUICKPANEL",strlen("QUICKPANEL"))!= 0) continue;
320 if (strncmp(name,"QUICKPANEL",strlen("QUICKPANEL"))!= 0) continue;
322 /* open quickpanel */
323 INF("open quickpanel");
324 ecore_x_e_illume_quickpanel_state_send
325 (ecore_x_e_illume_zone_get(bd->client.win),
326 ECORE_X_ILLUME_QUICKPANEL_STATE_ON);
332 _coordinate_calibrate(Ecore_X_Window win, int *x, int *y)
340 angle = _win_angle_get(win);
341 ecore_x_window_geometry_get(win, NULL, NULL, &w, &h);
369 _mouse_win_fake_tap(Cover *cov, Ecore_Event_Mouse_Button *ev)
373 /* find target window to send message */
374 _mouse_in_win_get(cov, ev->root.x, ev->root.y);
376 ecore_x_pointer_xy_get(target_win, &x, &y);
377 ecore_x_mouse_in_send(target_win, x, y);
378 ecore_x_mouse_move_send(target_win, x, y);
379 ecore_x_mouse_down_send(target_win, x, y, 1);
380 ecore_x_mouse_up_send(target_win, x, y, 1);
381 ecore_x_mouse_out_send(target_win, x, y);
385 _message_control_panel_open_send(Cover *cov)
387 ecore_x_client_message32_send(target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
388 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
390 cov->atom_control_panel_open,
395 _message_back_send(Cover *cov)
397 ecore_x_client_message32_send(target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
398 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
400 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_BACK,
405 _message_scroll_send(Cover *cov, int type)
410 atom = ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_SCROLL;
411 if (cov->lock_screen) atom = ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_MOUSE;
413 ecore_x_pointer_xy_get(target_win, &x, &y);
414 _coordinate_calibrate(target_win, &x, &y);
416 ecore_x_client_message32_send(target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
417 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
424 _message_mouse_send(Cover *cov, int type)
428 ecore_x_pointer_xy_get(cov->down_win, &x, &y);
429 _coordinate_calibrate(cov->down_win, &x, &y);
431 ecore_x_client_message32_send(cov->down_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
432 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
434 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_MOUSE,
439 _message_read_send(Cover *cov)
443 /* find target window to send message */
444 _mouse_in_win_get(cov, cov->x, cov->y);
446 ecore_x_pointer_xy_get(target_win, &x, &y);
447 _coordinate_calibrate(target_win, &x, &y);
449 ecore_x_client_message32_send(target_win, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL,
450 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
452 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ,
457 _mouse_longpress(void *data)
464 dx = cov->x - cov->dx;
465 dy = cov->y - cov->dy;
466 if (((dx * dx) + (dy * dy)) < (distance * distance))
468 cov->longpressed = EINA_TRUE;
469 INFO(cov, "longpress");
471 if (!cov->mouse_double_down) _message_read_send(cov);
474 /* send message to start longpress,
475 keep previous target window to send mouse-up event */
476 cov->down_win = target_win;
478 _message_mouse_send(cov, MOUSE_BUTTON_DOWN);
485 _mouse_double_down(void *data)
488 ecore_timer_del(cov->double_down_timer);
489 cov->double_down_timer = NULL;
494 _mouse_double_down_timeout(Cover *cov)
496 double long_time = 0.5;
497 double short_time = 0.3;
501 dx = cov->x - cov->dx;
502 dy = cov->y - cov->dy;
504 if ((cov->double_down_timer) &&
505 (((dx * dx) + (dy * dy)) < (distance * distance)))
507 /* start double tap and move from here */
508 cov->mouse_double_down = EINA_TRUE;
512 ecore_timer_del(cov->timer);
515 /* check longpress after double down */
516 cov->timer = ecore_timer_add(long_time, _mouse_longpress, cov);
519 if (cov->double_down_timer)
521 ecore_timer_del(cov->double_down_timer);
522 cov->double_down_timer = NULL;
526 cov->double_down_timer = ecore_timer_add(short_time, _mouse_double_down, cov);
530 _mouse_tap(void *data)
533 cov->tap_timer = NULL;
535 _message_read_send(cov);
541 _mouse_down(Cover *cov, Ecore_Event_Mouse_Button *ev)
543 double longtime = 0.5;
551 cov->dt = ev->timestamp;
552 cov->longpressed = EINA_FALSE;
553 cov->timer = ecore_timer_add(longtime, _mouse_longpress, cov);
558 ecore_timer_del(cov->tap_timer);
559 cov->tap_timer = NULL;
562 /* check mouse double down - not two fingers, refer to double click */
563 _mouse_double_down_timeout(cov);
567 _circle_draw_check(Cover *cov)
569 Ecore_Event_Mouse_Move *ev, *t_ev, *b_ev, *l_ev, *r_ev;
570 Evas_Coord_Point m_tb, m_lr;
573 int min_x, min_y, max_x, max_y;
574 int left = 0, right = 0, top = 0, bottom = 0;
577 count = eina_inarray_count(cov->two_finger_move);
578 if (count < 10 || count > 60) goto inarray_free;
583 EINA_INARRAY_FOREACH(cov->two_finger_move, ev)
620 t_ev = eina_inarray_nth(cov->two_finger_move, top);
621 b_ev = eina_inarray_nth(cov->two_finger_move, bottom);
622 m_tb.x = (t_ev->x + b_ev->x) / 2;
623 m_tb.y = (t_ev->y + b_ev->y) / 2;
626 l_ev = eina_inarray_nth(cov->two_finger_move, left);
627 r_ev = eina_inarray_nth(cov->two_finger_move, right);
628 m_lr.x = (l_ev->x + r_ev->x) / 2;
629 m_lr.y = (l_ev->y + r_ev->y) / 2;
631 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)));
635 if (left > bottom) i++;
636 if (bottom > right) i++;
637 if (right > top) i++;
639 if ((i >= 3) && (distance < 60))
641 INFO(cov, "two finger circle draw");
642 _message_back_send(cov);
646 eina_inarray_free(cov->two_finger_move);
650 _mouse_up(Cover *cov, Ecore_Event_Mouse_Button *ev)
652 double timeout = 0.15;
653 double double_tap_timeout = 0.25;
658 if (cov->three_finger_down)
660 cov->three_finger_down = EINA_FALSE;
662 dx = ev->x - cov->dx;
663 dy = ev->y - cov->dy;
665 if (((dx * dx) + (dy * dy)) > (4 * distance * distance)
666 && ((ev->timestamp - cov->dt) < (timeout * 3000)))
668 /* get root window rotation */
669 angle = _win_angle_get(target_win);
671 if (abs(dx) > abs(dy)) /* left or right */
673 if (dx > 0) /* right */
675 INFO(cov, "three finger swipe right");
690 INFO(cov, "three finger swipe left");
704 else /* up or down */
706 if (dy > 0) /* down */
708 INFO(cov, "three finger swipe down");
719 INFO(cov, "three finger swipe up");
733 /* for two finger panning */
734 if (cov->two_finger_down)
736 cov->two_finger_down = EINA_FALSE;
738 _message_scroll_send(cov, MOUSE_BUTTON_UP);
739 cov->lock_screen = EINA_FALSE;
741 /* to check 2 finger mouse move */
742 if (cov->two_finger_move) _circle_draw_check(cov);
744 dx = ev->x - cov->dx;
745 dy = ev->y - cov->dy;
747 if (((dx * dx) + (dy * dy)) < (distance * distance))
749 if (ev->double_click)
751 INFO(cov, "two finger double click");
752 _message_control_panel_open_send(cov);
758 if (cov->mouse_double_down)
760 /* reset double down and moving: action up/down */
761 cov->mouse_double_down = EINA_FALSE;
763 if (cov->longpressed)
765 /* mouse up after longpress */
766 _message_mouse_send(cov, MOUSE_BUTTON_UP);
770 /* delete timer which is used for checking longpress */
773 ecore_timer_del(cov->timer);
777 if (cov->longpressed)
779 cov->longpressed = EINA_FALSE;
783 dx = ev->x - cov->dx;
784 dy = ev->y - cov->dy;
785 if (((dx * dx) + (dy * dy)) < (distance * distance))
787 if (ev->double_click)
789 INFO(cov, "double_click");
790 ecore_x_e_illume_access_action_activate_send(target_win);
794 cov->tap_timer = ecore_timer_add(double_tap_timeout,
798 else if (((dx * dx) + (dy * dy)) > (4 * distance * distance)
799 && ((ev->timestamp - cov->dt) < (timeout * 2000)))
801 /* get root window rotation */
802 angle = _win_angle_get(target_win);
804 if (abs(dx) > abs(dy)) /* left or right */
806 if (dx > 0) /* right */
808 INFO(cov, "single flick right");
812 ecore_x_e_illume_access_action_up_send(target_win);
816 ecore_x_e_illume_access_action_down_send(target_win);
821 ecore_x_e_illume_access_action_read_next_send
829 INFO(cov, "single flick left");
833 ecore_x_e_illume_access_action_down_send(target_win);
837 ecore_x_e_illume_access_action_up_send(target_win);
842 ecore_x_e_illume_access_action_read_prev_send
848 else /* up or down */
850 if (dy > 0) /* down */
852 INFO(cov, "single flick down");
856 ecore_x_e_illume_access_action_read_prev_send
861 ecore_x_e_illume_access_action_read_next_send
867 ecore_x_e_illume_access_action_down_send(target_win);
873 INFO(cov, "single flick up");
877 ecore_x_e_illume_access_action_read_next_send
882 ecore_x_e_illume_access_action_read_prev_send
888 ecore_x_e_illume_access_action_up_send(target_win);
896 cov->longpressed = EINA_FALSE;
900 _mouse_move(Cover *cov __UNUSED__, Ecore_Event_Mouse_Move *ev __UNUSED__)
902 //FIXME: why here, after long press you cannot go below..
903 //if (!cov->down) return;
905 //FIXME: one finger cannot come here
906 //_record_mouse_history(cov, ev);
907 if (cov->two_finger_move) eina_inarray_push(cov->two_finger_move, ev);
909 _message_scroll_send(cov, MOUSE_MOVE);
913 _mouse_wheel(Cover *cov __UNUSED__, Ecore_Event_Mouse_Wheel *ev __UNUSED__)
915 if (ev->z == -1) /* up */
917 #if ECORE_VERSION_MAJOR >= 1
918 # if ECORE_VERSION_MINOR >= 8
919 ecore_x_e_illume_access_action_up_send(target_win);
923 else if (ev->z == 1) /* down */
925 #if ECORE_VERSION_MAJOR >= 1
926 # if ECORE_VERSION_MINOR >= 8
927 ecore_x_e_illume_access_action_down_send(target_win);
934 _cb_mouse_down(void *data __UNUSED__,
938 Ecore_Event_Mouse_Button *ev = event;
942 EINA_LIST_FOREACH(covers, l, cov)
944 /* sometimes the mouse down event has improper multi.device value */
947 if (ev->window == cov->win)
949 //XXX change specific number
950 if (ev->multi.device == 0)
952 _target_window_find();
953 _mouse_down(cov, ev);
956 else if (cov->n_taps == 2 &&
957 !(cov->two_finger_down) &&
960 /* prevent longpress client message by two finger */
963 ecore_timer_del(cov->timer);
967 cov->two_finger_down = EINA_TRUE;
969 _lock_screen_check(cov);
970 _message_scroll_send(cov, MOUSE_BUTTON_DOWN);
972 /* to check 2 finger mouse move */
973 cov->two_finger_move = eina_inarray_new(sizeof(Ecore_Event_Mouse_Move), 0);
976 else if (cov->n_taps == 3 &&
977 !(cov->three_finger_down) &&
980 cov->three_finger_down = EINA_TRUE;
982 if (cov->two_finger_down)
984 cov->two_finger_down = EINA_FALSE;
986 _message_scroll_send(cov, MOUSE_BUTTON_UP);
987 cov->lock_screen = EINA_FALSE;
989 eina_inarray_free(cov->two_finger_move);
992 return ECORE_CALLBACK_PASS_ON;
995 return ECORE_CALLBACK_PASS_ON;
999 _cb_mouse_up(void *data __UNUSED__,
1000 int type __UNUSED__,
1003 Ecore_Event_Mouse_Button *ev = event;
1007 EINA_LIST_FOREACH(covers, l, cov)
1011 if (ev->window == cov->win)
1013 /* the first finger: 1, from the second finger: 0 */
1014 if (ev->buttons == 1) _mouse_up(cov, ev);
1016 return ECORE_CALLBACK_PASS_ON;
1019 return ECORE_CALLBACK_PASS_ON;
1023 _cb_mouse_move(void *data __UNUSED__,
1024 int type __UNUSED__,
1027 Ecore_Event_Mouse_Move *ev = event;
1031 EINA_LIST_FOREACH(covers, l, cov)
1036 if (ev->window == cov->win)
1038 //if (ev->multi.device == multi_device[0] || ev->multi.device == multi_device[1])
1039 if (cov->two_finger_down && cov->n_taps == 2)
1040 _mouse_move(cov, ev);
1041 else if (cov->longpressed && /* client message for moving is available only after long press is detected */
1042 !(cov->mouse_double_down) && /* mouse move after double down should not send read message */
1043 !(cov->two_finger_down) && ev->multi.device == 0)
1046 _message_read_send(cov);
1048 else if (cov->mouse_double_down && /* client message for moving is available only after long press is detected */
1049 !(cov->two_finger_down) && ev->multi.device == 0)
1051 if (cov->longpressed)
1053 /* send message to notify move after longpress */
1054 _message_mouse_send(cov, MOUSE_MOVE);
1058 return ECORE_CALLBACK_PASS_ON;
1061 return ECORE_CALLBACK_PASS_ON;
1065 _cb_mouse_wheel(void *data __UNUSED__,
1066 int type __UNUSED__,
1069 Ecore_Event_Mouse_Wheel *ev = event;
1073 EINA_LIST_FOREACH(covers, l, cov)
1075 if (ev->window == cov->win)
1077 _mouse_wheel(cov, ev);
1078 return ECORE_CALLBACK_PASS_ON;
1081 return ECORE_CALLBACK_PASS_ON;
1085 _cover_new(E_Zone *zone)
1089 cov = E_NEW(Cover, 1);
1090 if (!cov) return NULL;
1095 ee = ecore_evas_new(NULL,
1096 zone->container->x + zone->x,
1097 zone->container->y + zone->y,
1100 ecore_evas_alpha_set(ee, EINA_TRUE);
1101 cov->win = (Ecore_X_Window)ecore_evas_window_get(ee);
1103 /* create infomation */
1105 e = ecore_evas_get(ee);
1106 cov->info = evas_object_rectangle_add(e);
1107 evas_object_color_set(cov->info, 255, 255, 255, 100);
1108 evas_object_move(cov->info, zone->container->x + zone->x, zone->container->y + zone->y);
1109 evas_object_resize(cov->info, zone->w, 30);
1110 evas_object_show(cov->info);
1112 cov->text = evas_object_text_add(e);
1113 evas_object_text_style_set(cov->text, EVAS_TEXT_STYLE_PLAIN);
1114 evas_object_text_font_set(cov->text, "DejaVu", 14);
1115 evas_object_text_text_set(cov->text, "screen-reader module");
1117 evas_object_color_set(cov->text, 0, 0, 0, 255);
1118 evas_object_resize(cov->text, (zone->w / 8), 20);
1119 evas_object_move(cov->text, zone->container->x + zone->x + 5, zone->container->y + zone->y + 5);
1120 evas_object_show(cov->text);
1123 cov->win = ecore_x_window_input_new(zone->container->manager->root,
1124 zone->container->x + zone->x,
1125 zone->container->y + zone->y,
1129 ecore_x_input_multi_select(cov->win);
1131 ecore_x_icccm_title_set(cov->win, "screen-reader-input");
1132 ecore_x_netwm_name_set(cov->win, "screen-reader-input");
1134 ecore_x_window_ignore_set(cov->win, 1);
1135 ecore_x_window_configure(cov->win,
1136 ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING |
1137 ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE,
1139 zone->container->layers[8].win,
1140 ECORE_X_WINDOW_STACK_ABOVE);
1141 ecore_x_window_show(cov->win);
1142 ecore_x_window_raise(cov->win);
1150 Eina_List *l, *l2, *l3;
1153 EINA_LIST_FOREACH(e_manager_list(), l, man)
1156 EINA_LIST_FOREACH(man->containers, l2, con)
1159 EINA_LIST_FOREACH(con->zones, l3, zone)
1161 Cover *cov = _cover_new(zone);
1164 covers = eina_list_append(covers, cov);
1167 cov->atom_control_panel_open = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_CONTROL_PANEL_OPEN_");
1168 cov->atom_app_tray_open = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_APP_TRAY_OPEN_");
1176 _covers_shutdown(void)
1180 EINA_LIST_FREE(covers, cov)
1182 ecore_x_window_ignore_set(cov->win, 0);
1183 ecore_x_window_free(cov->win);
1184 evas_object_del(cov->info);
1185 evas_object_del(cov->text);
1189 ecore_timer_del(cov->timer);
1193 if (cov->double_down_timer)
1195 ecore_timer_del(cov->double_down_timer);
1196 cov->double_down_timer = NULL;
1201 ecore_timer_del(cov->tap_timer);
1202 cov->tap_timer = NULL;
1210 _cb_zone_add(void *data __UNUSED__,
1211 int type __UNUSED__,
1212 void *event __UNUSED__)
1216 return ECORE_CALLBACK_PASS_ON;
1220 _cb_zone_del(void *data __UNUSED__,
1221 int type __UNUSED__,
1222 void *event __UNUSED__)
1226 return ECORE_CALLBACK_PASS_ON;
1230 _cb_zone_move_resize(void *data __UNUSED__,
1231 int type __UNUSED__,
1232 void *event __UNUSED__)
1236 return ECORE_CALLBACK_PASS_ON;
1242 handlers = eina_list_append
1243 (handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
1244 _cb_mouse_down, NULL));
1245 handlers = eina_list_append
1246 (handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
1247 _cb_mouse_up, NULL));
1248 handlers = eina_list_append
1249 (handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
1250 _cb_mouse_move, NULL));
1251 handlers = eina_list_append
1252 (handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
1253 _cb_mouse_wheel, NULL));
1254 handlers = eina_list_append
1255 (handlers, ecore_event_handler_add(E_EVENT_ZONE_ADD,
1256 _cb_zone_add, NULL));
1257 handlers = eina_list_append
1258 (handlers, ecore_event_handler_add(E_EVENT_ZONE_DEL,
1259 _cb_zone_del, NULL));
1260 handlers = eina_list_append
1261 (handlers, ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE,
1262 _cb_zone_move_resize, NULL));
1266 _events_shutdown(void)
1268 E_FREE_LIST(handlers, ecore_event_handler_del);
1272 _cb_property_change(void *data __UNUSED__,
1273 int type __UNUSED__,
1277 Ecore_X_Event_Window_Property *event = ev;
1279 if (!g_enable) return ECORE_CALLBACK_PASS_ON;
1281 if (event->atom == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
1283 bd = e_border_focused_get();
1286 target_win = bd->client.win;
1287 _screen_reader_support_check();
1291 if (event->atom == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL &&
1292 event->win == target_win)
1294 _screen_reader_support_check();
1297 return ECORE_CALLBACK_PASS_ON;
1301 _move_module_enable_set(int enable)
1303 E_Manager *man = e_manager_current_get();
1305 if (!man) ERR("cannot get current manager");
1309 INF("send enaable message");
1310 e_msg_send("screen-reader", "enable", 0, E_OBJECT(man), NULL, NULL, NULL);
1314 INF("send disaable message");
1315 e_msg_send("screen-reader", "disable", 0, E_OBJECT(man), NULL, NULL, NULL);
1320 _vconf_cb_accessibility_tts_change(keynode_t *node,
1327 enable = vconf_keynode_get_bool(node);
1328 if (g_enable == enable) return;
1333 INF("[screen reader module] module enable");
1339 /* send a message to the move module */
1340 _move_module_enable_set(enable);
1344 INF("[screen reader module] module disable");
1348 /* send a message to the move module */
1349 _move_module_enable_set(enable);
1352 elm_config_access_set(enable);
1353 elm_config_all_flush();
1356 /***************************************************************************/
1358 EAPI E_Module_Api e_modapi =
1360 E_MODULE_API_VERSION, "Screen Reader"
1364 e_modapi_init(E_Module *m)
1366 vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS,
1367 _vconf_cb_accessibility_tts_change,
1370 ecore_x_event_mask_set(ecore_x_window_root_first_get(),
1371 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
1372 ecore_x_event_mask_set(ecore_x_window_root_first_get(),
1373 ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1374 property_handler = ecore_event_handler_add
1375 (ECORE_X_EVENT_WINDOW_PROPERTY, _cb_property_change, NULL);
1377 if (vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &g_enable) != 0)
1378 INF("vconf get failed\n");
1387 /* send a message to the move module */
1388 _move_module_enable_set(g_enable);
1395 /* send a message to the move module */
1396 _move_module_enable_set(g_enable);
1399 elm_config_access_set(g_enable);
1400 elm_config_all_flush();
1407 e_modapi_shutdown(E_Module *m __UNUSED__)
1409 INF("[screen-reader module] module shutdown");
1410 if (property_handler) ecore_event_handler_del(property_handler);
1419 e_modapi_save(E_Module *m __UNUSED__)