3 #include "e_test_event.h"
5 #define E_TEST_WORK_TIME 3.0
6 #define E_TC_SIGN_WIN_INFO "usiiiiibbbiibbbbbi"
8 static const char effect_started[] = "effect,started";
9 static const char effect_done[] = "effect,done";
10 static const char launch_done[] = "launch,done";
12 /* callbacks - event */
14 _cb_resource_id(void *data,
15 struct tizen_resource *tizen_resource,
18 Ecore_Window *res_id = (Ecore_Window *)data;
20 etRunner::get().finishWork();
24 _cb_geometry(void *data EINA_UNUSED,
25 struct wl_output *wl_output EINA_UNUSED,
26 int x, int y, int w, int h,
27 int subpixel EINA_UNUSED,
28 const char *make EINA_UNUSED,
29 const char *model EINA_UNUSED,
30 int transform EINA_UNUSED)
32 etRunner::get().output.x = x;
33 etRunner::get().output.y = y;
34 etRunner::get().output.w = w;
35 etRunner::get().output.h = h;
39 _cb_mode(void *data EINA_UNUSED,
40 struct wl_output *wl_output EINA_UNUSED,
43 int refresh EINA_UNUSED)
45 if (flags & WL_OUTPUT_MODE_CURRENT)
47 etRunner::get().output.w = w;
48 etRunner::get().output.h = h;
51 etRunner::get().finishWork();
55 _cb_done(void *data EINA_UNUSED,
56 struct wl_output *output EINA_UNUSED)
62 _cb_scale(void *data EINA_UNUSED,
63 struct wl_output *output EINA_UNUSED,
64 int scale EINA_UNUSED)
69 /* callbacks - method */
70 static void _cb_method_win_info_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
71 static void _cb_method_win_info_list_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
72 static void _cb_method_window_register(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
73 static void _cb_method_zone_rotation_change(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
74 static void _cb_method_window_effect(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
75 static void _cb_method_set_tc_start_end(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
76 static void _cb_method_set_tc_timeout(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
77 static void _cb_method_transient_for_below(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
78 static void _cb_method_aux_hint_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
80 /* callbacks - signal */
81 static void _cb_signal_vis_changed(void *data, const Eldbus_Message *msg);
82 static void _cb_signal_stack_changed(void *data, const Eldbus_Message *msg);
83 static void _cb_signal_win_rot_changed(void *data, const Eldbus_Message *msg);
84 static void _cb_signal_focus_changed(void *data, const Eldbus_Message *msg);
85 static void _cb_signal_render_while_effect_run(void *data, const Eldbus_Message *msg);
86 static void _cb_signal_aux_hint_changed(void *data, const Eldbus_Message *msg);
88 /* callbacks - ecore */
89 static Eina_Bool _cb_ecore_key_down(void *data, int type, void *event);
90 static Eina_Bool _cb_ecore_key_up(void *data, int type, void *event);
92 /* callbacks - evas */
93 static void _cb_evas_key_down(void * data, Evas * evas, Evas_Object * obj, void * event_info);
94 static void _cb_evas_key_up(void * data, Evas * evas, Evas_Object * obj, void * event_info);
96 /* callbacks - smart */
97 static void _cb_evas_smart_cb_effect_started(void *data, Evas_Object * obj, void *event_info);
98 static void _cb_evas_smart_cb_effect_done(void *data, Evas_Object * obj, void *event_info);
99 static void _cb_evas_smart_cb_launch_done(void *data, Evas_Object * obj, void *event_info);
101 /* callbacks - timer */
102 static Eina_Bool _cb_work_timeout(void *data);
104 /* callbacks - gesture */
105 static Eina_Bool _cb_gesture_tap(void *data, int type, void *event);
106 static Eina_Bool _cb_gesture_edge_swipe(void *data, int type, void *event);
107 static Eina_Bool _cb_gesture_edge_drag(void *data, int type, void *event);
109 /**********************
111 **********************/
112 static const struct tizen_resource_listener _e_test_tizen_resource_listener =
117 static const struct wl_output_listener _e_test_output_listener =
125 /**********************
127 **********************/
128 etRunner etRunner::inst;
133 Eina_Bool res = EINA_FALSE;
135 worker.waitTime = E_TEST_WORK_TIME;
137 logDomain = eina_log_domain_register("e-tc", EINA_COLOR_BLUE);
140 if (!ecore_wl2_connected_display_get(NULL))
141 ecore_wl2_display_connect(NULL);
143 // init tizen_extension protocol
144 res = initProtocols();
145 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
150 dbus.conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
151 EINA_SAFETY_ON_NULL_RETURN_VAL(dbus.conn, EINA_FALSE);
153 dbus.ds_obj = eldbus_object_get(dbus.conn,
154 "org.enlightenment.wm",
155 "/org/enlightenment/wm");
156 EINA_SAFETY_ON_NULL_RETURN_VAL(dbus.ds_obj, EINA_FALSE);
158 dbus.ds_proxy = eldbus_proxy_get(dbus.ds_obj,
159 "org.enlightenment.wm.Test");
160 EINA_SAFETY_ON_NULL_RETURN_VAL(dbus.ds_proxy, EINA_FALSE);
162 dbus.deviced_obj = eldbus_object_get(dbus.conn,
163 "org.tizen.system.deviced",
164 "/Org/Tizen/System/DeviceD/Display");
165 EINA_SAFETY_ON_NULL_RETURN_VAL(dbus.deviced_obj, EINA_FALSE);
167 dbus.deviced_proxy = eldbus_proxy_get(dbus.deviced_obj,
168 "org.tizen.system.deviced.display");
169 EINA_SAFETY_ON_NULL_RETURN_VAL(dbus.deviced_proxy, EINA_FALSE);
171 // reset registered window of e_test_helper
172 res = resetRegisterWin();
173 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
175 // init input generator
176 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | EFL_UTIL_INPUT_DEVTYPE_KEYBOARD, NULL);
177 EINA_SAFETY_ON_NULL_RETURN_VAL(inputGenerator, EINA_FALSE);
179 // init gesture handler
180 gestureHandler = efl_util_gesture_initialize();
181 EINA_SAFETY_ON_NULL_RETURN_VAL(gestureHandler, EINA_FALSE);
183 // add signal handlers
184 res = addSignalHandlers();
185 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
193 eina_log_domain_unregister(logDomain);
195 freeLastWinInfoList();
198 // deinit tizen_extension protocol
201 tizen_policy_destroy(tzPolicy);
207 tizen_surface_destroy(tzSurface);
213 tizen_launch_splash_destroy(tzlaunch_splash);
214 tzlaunch_splash = NULL;
219 tizen_launch_effect_destroy(tzlaunch_effect);
220 tzlaunch_effect = NULL;
224 eldbus_proxy_unref(dbus.deviced_proxy);
225 eldbus_object_unref(dbus.deviced_obj);
226 eldbus_proxy_unref(dbus.ds_proxy);
227 eldbus_object_unref(dbus.ds_obj);
228 eldbus_connection_unref(dbus.conn);
231 // deinit input generator
232 efl_util_input_deinitialize_generator(inputGenerator);
234 // deinit gesture handler
235 efl_util_gesture_deinitialize(gestureHandler);
239 etRunner::registerWin(etWin *tw)
241 Eldbus_Pending *p = NULL;
242 Eina_Bool accepted = EINA_FALSE;
244 p = eldbus_proxy_call(dbus.ds_proxy,
246 _cb_method_window_register,
251 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
259 etRunner::deregisterWin(etWin *tw)
261 Eldbus_Pending *p = NULL;
262 Eina_Bool accepted = EINA_FALSE;
264 p = eldbus_proxy_call(dbus.ds_proxy,
266 _cb_method_window_register,
271 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
279 etRunner::resetRegisterWin()
281 Eldbus_Pending *p = NULL;
282 Eina_Bool accepted = EINA_FALSE;
284 p = eldbus_proxy_call(dbus.ds_proxy,
285 "ResetRegisterWindow",
286 _cb_method_window_register,
290 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
298 etRunner::setWinActivate(etWin *tw)
300 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
302 tw->updateGeometry();
304 tizen_policy_activate(tzPolicy,
305 getWlSurface(tw->elm_win));
311 etRunner::requestKillWinByName(const char *name)
313 Eldbus_Pending *p = NULL;
315 EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
317 p = eldbus_proxy_call(dbus.ds_proxy,
324 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
330 etRunner::setWinIconic(etWin *tw,
333 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
336 tizen_policy_iconify(tzPolicy,
337 getWlSurface(tw->elm_win));
339 tizen_policy_uniconify(tzPolicy,
340 getWlSurface(tw->elm_win));
346 etRunner::setWinStack(etWin *tw,
350 Eldbus_Pending *p = NULL;
351 p = eldbus_proxy_call(dbus.ds_proxy,
358 sibiling? sibiling->native_win : 0,
360 EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE);
366 etRunner::setWinRaise(etWin *tw)
368 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
370 tizen_policy_raise(tzPolicy, getWlSurface(tw->elm_win));
376 etRunner::setWinLower(etWin *tw)
378 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
380 tizen_policy_lower(tzPolicy, getWlSurface(tw->elm_win));
386 etRunner::setWinTransientFor(etWin *tw_child,
390 EINA_SAFETY_ON_NULL_RETURN_VAL(tw_child, EINA_FALSE);
393 tizen_policy_set_transient_for(tzPolicy,
394 tw_child->native_win,
395 tw_parent->native_win);
397 tizen_policy_unset_transient_for(tzPolicy,
398 tw_child->native_win);
404 etRunner::setWinTransientForBelow(etWin *tw_child,
408 Eina_Bool accepted = EINA_FALSE;
409 Eldbus_Pending *p = NULL;
411 p = eldbus_proxy_call(dbus.ds_proxy,
412 "SetWindowTransientForBelow",
413 _cb_method_transient_for_below,
417 tw_child->native_win,
418 tw_parent->native_win,
420 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
428 etRunner::setWinNotiLevel(etWin *tw,
429 efl_util_notification_level_e lv)
431 Eina_Bool res = EINA_FALSE;
433 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
435 res = efl_util_set_notification_window_level(tw->elm_win, lv);
436 EINA_SAFETY_ON_FALSE_RETURN_VAL(res == EFL_UTIL_ERROR_NONE, EINA_FALSE);
441 efl_util_notification_level_e
442 etRunner::getWinNotiLevel(etWin *tw)
444 Eina_Bool res = EINA_FALSE;
445 efl_util_notification_level_e lv = EFL_UTIL_NOTIFICATION_LEVEL_NONE;
447 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EFL_UTIL_NOTIFICATION_LEVEL_NONE);
449 res = efl_util_get_notification_window_level(tw->elm_win, &lv);
450 EINA_SAFETY_ON_FALSE_RETURN_VAL(res == EFL_UTIL_ERROR_NONE, EFL_UTIL_NOTIFICATION_LEVEL_NONE);
456 etRunner::setFocusSkip(etWin *tw, Eina_Bool set)
458 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
461 tizen_policy_set_focus_skip(tzPolicy,
462 getWlSurface(tw->elm_win));
464 tizen_policy_unset_focus_skip(tzPolicy,
465 getWlSurface(tw->elm_win));
471 etRunner::setFocusSkipEcoreWl2(etWin *tw, Eina_Bool set)
473 Ecore_Wl2_Window *wlwin = NULL;
475 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
477 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(tw->elm_win);
478 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, EINA_FALSE);
480 ecore_wl2_window_focus_skip_set(wlwin, set);
486 etRunner::setZoneRotation(int angle)
488 Eldbus_Pending *p = NULL;
489 Eina_Bool allowed = EINA_FALSE;
491 p = eldbus_proxy_call(dbus.ds_proxy,
492 "ChangeZoneRotation",
493 _cb_method_zone_rotation_change,
498 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
506 etRunner::addAuxHint(etWin *tw, int hint_id, const char *hint_key, const char *hint_val)
508 Ecore_Wl2_Window *wlwin = NULL;
510 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
512 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(tw->elm_win);
513 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, EINA_FALSE);
515 ecore_wl2_window_aux_hint_add(wlwin, hint_id, hint_key, hint_val);
521 etRunner::changeAuxHint(etWin *tw, int hint_id, const char *hint_val)
523 Ecore_Wl2_Window *wlwin = NULL;
525 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
527 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(tw->elm_win);
528 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, EINA_FALSE);
530 ecore_wl2_window_aux_hint_change(wlwin, hint_id, hint_val);
536 etRunner::delAuxHint(etWin *tw, int hint_id)
538 Ecore_Wl2_Window *wlwin = NULL;
540 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
542 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(tw->elm_win);
543 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, EINA_FALSE);
545 ecore_wl2_window_aux_hint_del(wlwin, hint_id);
551 etRunner::setTCStart()
553 Eldbus_Pending *p = NULL;
554 Eina_Bool res = EINA_FALSE;
556 p = eldbus_proxy_call(dbus.ds_proxy,
558 _cb_method_set_tc_start_end,
562 EINA_SAFETY_ON_NULL_GOTO(p, err);
566 EINA_SAFETY_ON_FALSE_GOTO(res, err);
578 Eldbus_Pending *p = NULL;
579 Eina_Bool res = EINA_FALSE;
581 p = eldbus_proxy_call(dbus.ds_proxy,
583 _cb_method_set_tc_start_end,
587 if (p == NULL) res = EINA_FALSE;
591 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
597 etRunner::setTCTimeout(Eina_Bool set, int timeout)
599 Eldbus_Pending *p = NULL;
600 Eina_Bool res = EINA_FALSE;
602 if (timeout < 0) return EINA_FALSE;
604 p = eldbus_proxy_call(dbus.ds_proxy,
606 _cb_method_set_tc_timeout,
612 EINA_SAFETY_ON_NULL_GOTO(p, err);
616 EINA_SAFETY_ON_FALSE_GOTO(res, err);
626 etRunner::getWinInfo(etWin *tw)
628 Eldbus_Pending *p = NULL;
632 EINA_SAFETY_ON_NULL_RETURN_VAL(tw, EINA_FALSE);
634 win = tw->native_win;
639 p = eldbus_proxy_call(dbus.ds_proxy,
641 _cb_method_win_info_get,
646 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
650 if ((tw->native_win == win) && (!tw->effect))
656 if (tw->native_win != win)
658 ERR("Something Wrong. Difference with quering window"
659 "and received window from server");
660 tw->native_win = win;
667 etRunner::getWinInfoList()
669 Eldbus_Pending *p = NULL;
670 Window_Info_List *info_list = NULL;
672 Eina_List *result = NULL;
674 info_list = E_NEW(Window_Info_List, 1);
675 EINA_SAFETY_ON_NULL_RETURN_VAL(info_list, NULL);
679 p = eldbus_proxy_call(dbus.ds_proxy,
681 _cb_method_win_info_list_get,
685 EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL);
689 if (info_list->retry)
691 info_list->retry = EINA_FALSE;
692 EINA_LIST_CAST_FREE(info_list->list, tw, etWin*)
704 result = eina_list_clone(info_list->list);
707 freeLastWinInfoList();
708 listWinInfo = result;
714 etRunner::freeWinInfoList(Eina_List *list)
718 EINA_SAFETY_ON_NULL_RETURN(list);
720 if (listWinInfo == list)
723 EINA_LIST_CAST_FREE(list, tw, etWin*)
733 etRunner::freeLastWinInfoList()
736 freeWinInfoList(listWinInfo);
742 etRunner::setLastWinInfoList(Eina_List *list)
744 EINA_SAFETY_ON_NULL_RETURN(list);
746 freeLastWinInfoList();
752 etRunner::getWinId(Evas_Object *elm_win)
754 struct wl_surface *surf = NULL;
756 struct tizen_resource *tzres = NULL;
758 surf = getWlSurface(elm_win);
759 EINA_SAFETY_ON_NULL_RETURN_VAL(surf, 0);
761 tzres = tizen_surface_get_tizen_resource(tzSurface, surf);
762 EINA_SAFETY_ON_NULL_RETURN_VAL(tzres, 0);
764 tizen_resource_add_listener(tzres,
765 &_e_test_tizen_resource_listener, &id);
769 tizen_resource_destroy(tzres);
775 etRunner::getWlSurface(Evas_Object *elm_win)
777 Ecore_Wl2_Window *wlwin = NULL;
778 struct wl_surface *surf = NULL;
780 EINA_SAFETY_ON_NULL_RETURN_VAL(elm_win, NULL);
782 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(elm_win);
783 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, NULL);
785 surf = ecore_wl2_window_surface_get(wlwin);
786 EINA_SAFETY_ON_NULL_RETURN_VAL(surf, NULL);
792 etRunner::setDpms(Eina_Bool on)
794 Eldbus_Pending *p = NULL;
795 p = eldbus_proxy_call(dbus.ds_proxy,
802 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
807 etRunner::setDevctlDisplayLock(Eina_Bool lock)
809 Eldbus_Pending *p = NULL;
813 p = eldbus_proxy_call(dbus.deviced_proxy,
826 p = eldbus_proxy_call(dbus.deviced_proxy,
835 EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE);
841 etRunner::setDevctlDisplayOn(Eina_Bool on)
843 Eldbus_Pending *p = NULL;
845 p = eldbus_proxy_call(dbus.deviced_proxy,
851 on? "lcdon" : "lcdoff");
852 EINA_SAFETY_ON_TRUE_RETURN_VAL(p != NULL, EINA_FALSE);
858 etRunner::feedMouseDown(int x, int y)
860 Eldbus_Pending *p = NULL;
861 p = eldbus_proxy_call(dbus.ds_proxy,
869 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
874 etRunner::feedMouseMove(int x, int y)
876 Eldbus_Pending *p = NULL;
877 p = eldbus_proxy_call(dbus.ds_proxy,
885 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
890 etRunner::feedMouseUp(int x, int y)
892 Eldbus_Pending *p = NULL;
893 p = eldbus_proxy_call(dbus.ds_proxy,
901 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
906 etRunner::feedKeyDown(const char *key)
908 Eldbus_Pending *p = NULL;
909 p = eldbus_proxy_call(dbus.ds_proxy,
917 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
922 etRunner::feedKeyUp(const char *key)
924 Eldbus_Pending *p = NULL;
925 p = eldbus_proxy_call(dbus.ds_proxy,
933 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
938 etRunner::generateMouseDown(int x, int y)
940 // Using efl_util_input_generate instead of generate event by eldbus
941 int ret = EFL_UTIL_ERROR_NONE;
943 if (inputGenerator == NULL)
945 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, NULL);
949 ret = efl_util_input_generate_touch(inputGenerator,
951 EFL_UTIL_INPUT_TOUCH_BEGIN,
953 if (ret != EFL_UTIL_ERROR_NONE)
955 efl_util_input_deinitialize_generator(inputGenerator);
956 inputGenerator = NULL;
964 etRunner::generateMouseMove(int x, int y)
966 // Using efl_util_input_generate instead of generate event by eldbus
967 int ret = EFL_UTIL_ERROR_NONE;
969 if (inputGenerator == NULL)
971 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, NULL);
975 ret = efl_util_input_generate_touch(inputGenerator,
977 EFL_UTIL_INPUT_TOUCH_UPDATE,
979 if (ret != EFL_UTIL_ERROR_NONE)
981 efl_util_input_deinitialize_generator(inputGenerator);
982 inputGenerator = NULL;
990 etRunner::generateMouseUp(int x, int y)
992 // Using efl_util_input_generate instead of generate event by eldbus
993 int ret = EFL_UTIL_ERROR_NONE;
995 if (inputGenerator == NULL)
997 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, NULL);
1001 ret = efl_util_input_generate_touch(inputGenerator,
1003 EFL_UTIL_INPUT_TOUCH_END,
1005 if (ret != EFL_UTIL_ERROR_NONE)
1007 efl_util_input_deinitialize_generator(inputGenerator);
1008 inputGenerator = NULL;
1016 etRunner::generateKeyPress(const char *keyname)
1018 // Using efl_util_input_generate instead of generate event by eldbus
1019 int ret = EFL_UTIL_ERROR_NONE;
1021 if (inputGenerator == NULL)
1023 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD, NULL);
1027 ret = efl_util_input_generate_key(inputGenerator,
1030 if (ret != EFL_UTIL_ERROR_NONE)
1032 efl_util_input_deinitialize_generator(inputGenerator);
1033 inputGenerator = NULL;
1041 etRunner::generateKeyRelease(const char *keyname)
1043 // Using efl_util_input_generate instead of generate event by eldbus
1044 int ret = EFL_UTIL_ERROR_NONE;
1046 if (inputGenerator == NULL)
1048 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD, NULL);
1052 ret = efl_util_input_generate_key(inputGenerator,
1055 if (ret != EFL_UTIL_ERROR_NONE)
1057 efl_util_input_deinitialize_generator(inputGenerator);
1058 inputGenerator = NULL;
1066 etRunner::generateKeyEvent(const char *keyname, double delay)
1068 Eina_Bool res = EINA_FALSE;
1070 res = etRunner::get().generateKeyPress(keyname);
1071 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
1073 res = etRunner::get().generateKeyRelease(keyname);
1074 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
1080 etRunner::generateTouchDown(int idx, int x, int y)
1082 // Using efl_util_input_generate instead of generate event by eldbus
1083 int ret = EFL_UTIL_ERROR_NONE;
1085 if (inputGenerator == NULL)
1087 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, NULL);
1091 ret = efl_util_input_generate_touch(inputGenerator,
1093 EFL_UTIL_INPUT_TOUCH_BEGIN,
1095 if (ret != EFL_UTIL_ERROR_NONE)
1097 efl_util_input_deinitialize_generator(inputGenerator);
1098 inputGenerator = NULL;
1106 etRunner::generateTouchMove(int idx, int x, int y)
1108 // Using efl_util_input_generate instead of generate event by eldbus
1109 int ret = EFL_UTIL_ERROR_NONE;
1111 if (inputGenerator == NULL)
1113 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, NULL);
1117 ret = efl_util_input_generate_touch(inputGenerator,
1119 EFL_UTIL_INPUT_TOUCH_UPDATE,
1121 if (ret != EFL_UTIL_ERROR_NONE)
1123 efl_util_input_deinitialize_generator(inputGenerator);
1124 inputGenerator = NULL;
1132 etRunner::generateTouchUp(int idx, int x, int y)
1134 // Using efl_util_input_generate instead of generate event by eldbus
1135 int ret = EFL_UTIL_ERROR_NONE;
1137 if (inputGenerator == NULL)
1139 inputGenerator = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, NULL);
1143 ret = efl_util_input_generate_touch(inputGenerator,
1145 EFL_UTIL_INPUT_TOUCH_END,
1147 if (ret != EFL_UTIL_ERROR_NONE)
1149 efl_util_input_deinitialize_generator(inputGenerator);
1150 inputGenerator = NULL;
1158 etRunner::setSplashLaunch(const char *path, int type)
1160 const char *effect_type = "launch";
1161 struct wl_array option;
1163 // init tzlaunch_splash
1164 if (tzlaunch_splash)
1166 tizen_launch_splash_destroy(tzlaunch_splash);
1167 tzlaunch_splash = NULL;
1169 if (tzlaunch_effect) tzlaunch_splash = tizen_launch_effect_create_splash_img(tzlaunch_effect);
1170 EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch_splash, EINA_FALSE);
1172 wl_array_init(&option);
1173 tizen_launch_splash_launch(tzlaunch_splash, path, type,
1175 effect_type, NULL, &option);
1176 wl_array_release(&option);
1182 etRunner::setSplashOwner()
1185 EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch_splash, EINA_FALSE);
1187 tizen_launch_splash_owner(tzlaunch_splash, (int)getpid());
1193 etRunner::setWinEffect(etWin *tw)
1195 Eldbus_Pending *p = NULL;
1196 Eina_Bool accepted = EINA_FALSE;
1198 this->ev.elm_win = tw->elm_win;
1200 p = eldbus_proxy_call(dbus.ds_proxy,
1202 _cb_method_window_effect,
1208 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
1215 etRunner::freezeEvent()
1217 Eldbus_Pending *p = NULL;
1218 p = eldbus_proxy_call(dbus.ds_proxy,
1225 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
1230 etRunner::thawEvent()
1232 Eldbus_Pending *p = NULL;
1233 p = eldbus_proxy_call(dbus.ds_proxy,
1240 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
1245 etRunner::addSupportedAuxHint(const char *hint)
1247 Eldbus_Pending *p = NULL;
1248 p = eldbus_proxy_call(dbus.ds_proxy,
1249 "AddSupportedAuxHint",
1255 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
1260 etRunner::delSupportedAuxHint(const char *hint)
1262 Eldbus_Pending *p = NULL;
1263 p = eldbus_proxy_call(dbus.ds_proxy,
1264 "DelSupportedAuxHint",
1270 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
1274 std::shared_ptr<auxHintEventItem>
1275 etRunner::getAuxHint(etWin *tw, const char *hint_key)
1277 Eldbus_Pending *p = NULL;
1278 auxHintEventItem *hint = NULL;
1280 p = eldbus_proxy_call(dbus.ds_proxy,
1282 _cb_method_aux_hint_get,
1288 EINA_SAFETY_ON_NULL_RETURN_VAL(p, nullptr);
1294 std::shared_ptr<auxHintEventItem> shared_hint = std::make_shared<auxHintEventItem>(tw->native_win, E_TC_EVENT_TYPE_AUX_HINT_CHANGED, hint->getID(), hint->getHint().c_str(), hint->getVal().c_str());
1302 std::shared_ptr<eventItem>
1303 etRunner::waitEvent(etWin *win, E_TC_Event_Type ev_type)
1305 std::shared_ptr<eventItem> recv_item = NULL;
1306 std::list<std::shared_ptr<eventItem>>::iterator itr;
1311 case E_TC_EVENT_TYPE_VIS_ON:
1312 case E_TC_EVENT_TYPE_VIS_OFF:
1313 case E_TC_EVENT_TYPE_VIS_CHANGED:
1314 ev_type = E_TC_EVENT_TYPE_VIS_CHANGED;
1316 case E_TC_EVENT_TYPE_STACK_RAISE:
1317 case E_TC_EVENT_TYPE_STACK_LOWER:
1318 case E_TC_EVENT_TYPE_STACK_ABOVE:
1319 case E_TC_EVENT_TYPE_STACK_BELOW:
1320 case E_TC_EVENT_TYPE_STACK_CHANGED:
1321 ev_type = E_TC_EVENT_TYPE_STACK_CHANGED;
1327 // Add event callbacks if needs
1328 if (ev_type == E_TC_EVENT_TYPE_EFFECT_EVAS_CB)
1330 ev.elm_win = win->elm_win;
1331 ev.native_win = win->native_win;
1332 ev.effect.state_smcb = E_TC_EVAS_SMART_CB_STATE_NONE;
1334 evas_object_smart_callback_add(this->ev.elm_win, effect_started, _cb_evas_smart_cb_effect_started, this);
1335 evas_object_smart_callback_add(this->ev.elm_win, effect_done, _cb_evas_smart_cb_effect_done, this);
1336 evas_object_smart_callback_add(this->ev.elm_win, launch_done, _cb_evas_smart_cb_launch_done, this);
1338 else if (ev_type == E_TC_EVENT_TYPE_INPUT_EVAS_KEY)
1340 ev.elm_win = win->elm_win;
1341 ev.native_win = win->native_win;
1342 evas_object_event_callback_add(this->ev.elm_win, EVAS_CALLBACK_KEY_DOWN, _cb_evas_key_down, this);
1343 evas_object_event_callback_add(this->ev.elm_win, EVAS_CALLBACK_KEY_UP, _cb_evas_key_up, this);
1345 ev.key.evas_state = EINA_FALSE;
1348 // pre-waiting events
1351 if (*ev.wait_event_index == ev.last_event)
1353 work(0.5); // waiting additional time
1354 if (*ev.wait_event_index == ev.last_event)
1356 std::shared_ptr<eventItem> res = std::make_shared<eventItem>(0, E_TC_EVENT_TYPE_NONE);
1357 res->result = EINA_FALSE;
1358 res->isTimeout = EINA_TRUE;
1363 // search from latest waitEvent called point
1364 itr = ev.wait_event_index;
1365 if (itr == ev.recv_queue.end()) itr = ev.recv_queue.begin();
1368 for (; itr != ev.recv_queue.end() ; itr++)
1371 if ((recv_item->isSameWin(win?win->native_win:0)) &&
1372 (recv_item->isSameType(ev_type)))
1374 ev.wait_event_index = itr;
1375 recv_item->result = EINA_TRUE;
1380 if (recv_item == NULL)
1382 recv_item = std::make_shared<eventItem>(0, E_TC_EVENT_TYPE_NONE);
1383 recv_item->result = EINA_FALSE;
1389 etRunner::flushEventQueue()
1391 std::list<std::shared_ptr<eventItem>>::iterator itr;
1392 std::shared_ptr<eventItem> ei = NULL;
1393 if (!ev.recv_queue.empty())
1394 ev.recv_queue.erase(ev.recv_queue.begin(), ev.recv_queue.end());
1395 ev.wait_event_index = ev.recv_queue.end();
1396 ev.last_event = NULL;
1397 ev.last_checkpoint = NULL;
1401 etRunner::insertEventQueue(std::shared_ptr<eventItem> ei)
1403 EINA_SAFETY_ON_NULL_RETURN_VAL(ei, EINA_FALSE);
1405 ev.recv_queue.push_back(ei);
1412 etRunner::insertEventQueue(Ecore_Window id, E_TC_Event_Type ev_type)
1414 std::shared_ptr<eventItem> ei = std::make_shared<eventItem>(id, ev_type);
1415 EINA_SAFETY_ON_NULL_RETURN_VAL(ei, EINA_FALSE);
1417 ev.recv_queue.push_back(ei);
1424 etRunner::isEventOccuredAfterCheckpoint(etWin *tw, E_TC_Event_Type ev_type)
1426 std::list<std::shared_ptr<eventItem>>::iterator itr;
1427 std::shared_ptr<eventItem> ei = NULL;
1428 Ecore_Window id = tw->native_win;
1430 for(itr = ev.recv_queue.begin() ; itr != ev.recv_queue.end() ; itr++)
1434 if (ev.last_checkpoint && ev.last_checkpoint != ei)
1437 if (ei->isSameWin(id) && ei->isSameType(ev_type))
1445 etRunner::setEventCheckpoint()
1447 ev.last_checkpoint = ev.last_event;
1452 etRunner::addSignalHandlers()
1454 Eldbus_Signal_Handler *sh = NULL;
1455 Ecore_Event_Handler *eh = NULL;
1459 sh = eldbus_proxy_signal_handler_add(dbus.ds_proxy,
1460 "VisibilityChanged",
1461 _cb_signal_vis_changed,
1463 EINA_SAFETY_ON_NULL_GOTO(sh, err);
1464 ev.sh_list = eina_list_append(ev.sh_list, sh);
1466 sh = eldbus_proxy_signal_handler_add(dbus.ds_proxy,
1468 _cb_signal_stack_changed,
1470 EINA_SAFETY_ON_NULL_GOTO(sh, err);
1471 ev.sh_list = eina_list_append(ev.sh_list, sh);
1473 sh = eldbus_proxy_signal_handler_add(dbus.ds_proxy,
1474 "WinRotationChanged",
1475 _cb_signal_win_rot_changed,
1477 EINA_SAFETY_ON_NULL_GOTO(sh, err);
1478 ev.sh_list = eina_list_append(ev.sh_list, sh);
1480 sh = eldbus_proxy_signal_handler_add(dbus.ds_proxy,
1482 _cb_signal_focus_changed,
1484 EINA_SAFETY_ON_NULL_GOTO(sh, err);
1485 ev.sh_list = eina_list_append(ev.sh_list, sh);
1487 sh = eldbus_proxy_signal_handler_add(dbus.ds_proxy,
1489 _cb_signal_render_while_effect_run,
1491 EINA_SAFETY_ON_NULL_GOTO(sh, err);
1492 ev.sh_list = eina_list_append(ev.sh_list, sh);
1494 sh = eldbus_proxy_signal_handler_add(dbus.ds_proxy,
1496 _cb_signal_aux_hint_changed,
1498 EINA_SAFETY_ON_NULL_GOTO(sh, err);
1499 ev.sh_list = eina_list_append(ev.sh_list, sh);
1501 eh = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _cb_ecore_key_down, this);
1502 EINA_SAFETY_ON_NULL_GOTO(eh, err);
1503 ev.eh_list = eina_list_append(ev.eh_list, eh);
1505 eh = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _cb_ecore_key_up, this);
1506 EINA_SAFETY_ON_NULL_GOTO(eh, err);
1507 ev.eh_list = eina_list_append(ev.eh_list, eh);
1509 eh = ecore_event_handler_add(EFL_UTIL_EVENT_GESTURE_TAP, _cb_gesture_tap, this);
1510 EINA_SAFETY_ON_NULL_GOTO(eh, err);
1511 ev.eh_list = eina_list_append(ev.eh_list, eh);
1513 eh = ecore_event_handler_add(EFL_UTIL_EVENT_GESTURE_EDGE_SWIPE, _cb_gesture_edge_swipe, this);
1514 EINA_SAFETY_ON_NULL_GOTO(eh, err);
1515 ev.eh_list = eina_list_append(ev.eh_list, eh);
1517 eh = ecore_event_handler_add(EFL_UTIL_EVENT_GESTURE_EDGE_DRAG, _cb_gesture_edge_drag, this);
1518 EINA_SAFETY_ON_NULL_GOTO(eh, err);
1519 ev.eh_list = eina_list_append(ev.eh_list, eh);
1521 ev.key.ecore_state = EINA_FALSE;
1526 printf("failed to init handlers\n");
1527 delSignalHandlers();
1532 etRunner::delSignalHandlers()
1534 Eldbus_Signal_Handler *sh = NULL;
1535 Ecore_Event_Handler *eh = NULL;
1537 EINA_LIST_CAST_FREE(ev.sh_list, sh, Eldbus_Signal_Handler*)
1539 eldbus_signal_handler_del(sh);
1542 EINA_LIST_CAST_FREE(ev.eh_list, eh, Ecore_Event_Handler*)
1544 ecore_event_handler_del(eh);
1553 /* give a turn to deal with deferred job for given time*/
1554 addTimer(worker.waitTime);
1559 etRunner::work(double time)
1561 /* give a turn to deal with deferred job for given time*/
1562 if (time < 0.0) time = 0.0;
1569 etRunner::finishWork()
1578 etRunner::printWinInfoList()
1581 Eina_List *l = NULL, *ll = NULL;
1583 printf("--------------------------------------------------------------------------------------------------------------------------\n");
1584 l = getWinInfoList();
1585 EINA_LIST_CAST_FOREACH(l, ll, tw, etWin*)
1587 printf("%04d WinID:%5u alpha:%d %5d,%5d (%5dx%5d) vis(Win:%d Obj:%d Opaque:%2d Type:%2d Skip:%d) Icon:%d Focus(Win:%d Obj:%d) :: %20s\n",
1589 (unsigned int)tw->native_win,
1591 tw->x, tw->y, tw->w, tw->h,
1603 printf("--------------------------------------------------------------------------------------------------------------------------\n");
1607 etRunner::delTimer()
1609 if (!worker.timer) return;
1611 ecore_timer_del(worker.timer);
1612 worker.timer = NULL;
1616 etRunner::addTimer()
1620 worker.timer = ecore_timer_add(worker.waitTime,
1626 etRunner::addTimer(double time)
1630 worker.timer = ecore_timer_add(time,
1636 etRunner::waitForDestroy()
1638 work(E_TEST_WORK_TIME);
1642 etRunner::initProtocols()
1644 Eina_Iterator *globals = NULL;
1645 Ecore_Wl2_Global *global = NULL;
1646 struct wl_registry *registry = NULL;
1648 registry = ecore_wl2_display_registry_get(ecore_wl2_connected_display_get(NULL));
1649 globals = ecore_wl2_display_globals_get(ecore_wl2_connected_display_get(NULL));
1651 EINA_SAFETY_ON_NULL_GOTO(registry, err);
1652 EINA_SAFETY_ON_NULL_GOTO(globals, err);
1654 EINA_ITERATOR_FOREACH(globals, global)
1656 if (!strcmp(global->interface, "tizen_policy"))
1658 tzPolicy = (struct tizen_policy *)
1659 wl_registry_bind(registry,
1661 &tizen_policy_interface,
1662 (global->version > 7)? 7 : global->version);
1664 if (!strcmp(global->interface, "tizen_surface"))
1666 tzSurface = (struct tizen_surface *)
1667 wl_registry_bind(registry,
1669 &tizen_surface_interface,
1670 (global->version > 1)? 1 : global->version);
1672 if (!strcmp(global->interface, "tizen_launch_effect"))
1674 tzlaunch_effect = (struct tizen_launch_effect *)
1675 wl_registry_bind(registry,
1677 &tizen_launch_effect_interface,
1678 (global->version > 1)? 1 : global->version);
1680 if (!strcmp(global->interface, "wl_output"))
1682 wlOutput = (struct wl_output *)
1683 wl_registry_bind(registry,
1685 &wl_output_interface,
1686 (global->version > 2)? 2 : global->version);
1687 wl_output_add_listener(wlOutput, &_e_test_output_listener, NULL);
1693 wl_output_destroy(wlOutput);
1699 EINA_SAFETY_ON_NULL_GOTO(tzPolicy, err);
1700 EINA_SAFETY_ON_NULL_GOTO(tzSurface, err);
1701 EINA_SAFETY_ON_NULL_GOTO(tzlaunch_effect, err);
1703 eina_iterator_free(globals);
1708 eina_iterator_free(globals);
1712 /* callbacks - method */
1714 _cb_method_win_info_get(void *data,
1715 const Eldbus_Message *msg,
1718 const char *name = NULL, *text = NULL, *wname = NULL;
1720 Eina_Bool res = EINA_FALSE;
1724 res = eldbus_message_error_get(msg, &name, &text);
1725 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1727 res = eldbus_message_arguments_get
1732 &tw->x, &tw->y, &tw->w, &tw->h,
1748 // change window name from char * to Eina_Stringshare
1750 eina_stringshare_del(tw->name);
1751 tw->name = eina_stringshare_add(wname);
1755 if ((name) || (text))
1757 ERR("errname:%s errmsg:%s\n", name, text);
1760 etRunner::get().finishWork();
1764 _cb_method_win_info_list_get(void *data,
1765 const Eldbus_Message *msg,
1768 const char *name = NULL, *text = NULL, *wname = NULL;
1769 Eldbus_Message_Iter *array = NULL, *ec = NULL;
1770 Window_Info_List *info_list = (Window_Info_List *)data;
1771 Eina_Bool res = EINA_FALSE, animating = EINA_FALSE;
1773 if (info_list == NULL)
1776 res = eldbus_message_error_get(msg, &name, &text);
1777 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1779 res = eldbus_message_arguments_get(msg, "a(" E_TC_SIGN_WIN_INFO ")", &array);
1780 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1782 while (eldbus_message_iter_get_and_next(array, 'r', &ec))
1784 etWin *tw = new etWin();
1787 res = eldbus_message_iter_arguments_get(
1792 &tw->x, &tw->y, &tw->w, &tw->h,
1808 // change name to eina_stringshare
1811 WRN("Failed to get win info\n");
1815 tw->name = eina_stringshare_add(wname);
1819 animating = EINA_TRUE;
1823 WRN("Failed to get win info\n");
1828 info_list->list = eina_list_append(info_list->list, tw);
1832 info_list->retry = EINA_TRUE;
1835 if ((name) || (text))
1837 ERR("errname:%s errmsg:%s\n", name, text);
1840 etRunner::get().finishWork();
1844 _cb_method_window_register(void *data,
1845 const Eldbus_Message *msg,
1848 const char *name = NULL, *text = NULL;
1849 Eina_Bool res = EINA_FALSE;
1850 Eina_Bool *accepted = (Eina_Bool *)data;
1852 *accepted = EINA_FALSE;
1854 res = eldbus_message_error_get(msg, &name, &text);
1855 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1857 res = eldbus_message_arguments_get(msg, "b", accepted);
1860 if ((name) || (text))
1862 ERR("errname: %s errmsg: %s\n", name, text);
1865 etRunner::get().finishWork();
1869 _cb_method_zone_rotation_change(void *data,
1870 const Eldbus_Message *msg,
1873 const char *name = NULL, *text = NULL;
1874 Eina_Bool res = EINA_FALSE;
1875 Eina_Bool *allowed = (Eina_Bool *)data;
1877 *allowed = EINA_FALSE;
1879 res = eldbus_message_error_get(msg, &name, &text);
1880 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1882 res = eldbus_message_arguments_get(msg, "b", allowed);
1883 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1884 EINA_SAFETY_ON_FALSE_GOTO(*allowed, finish);
1887 if ((name) || (text))
1889 ERR("errname: %s errmsg: %s\n", name, text);
1892 etRunner::get().finishWork();
1896 _cb_method_window_effect(void *data,
1897 const Eldbus_Message *msg,
1900 const char *name = NULL, *text = NULL;
1901 Eina_Bool res = EINA_FALSE;
1902 Eina_Bool *allowed = (Eina_Bool *)data;
1904 *allowed = EINA_FALSE;
1906 res = eldbus_message_error_get(msg, &name, &text);
1907 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1909 res = eldbus_message_arguments_get(msg, "b", allowed);
1910 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1911 EINA_SAFETY_ON_FALSE_GOTO(*allowed, finish);
1914 if ((name) || (text))
1916 ERR("errname: %s errmsg: %s\n", name, text);
1919 etRunner::get().finishWork();
1923 _cb_method_set_tc_start_end(void *data,
1924 const Eldbus_Message *msg,
1927 const char *name = NULL, *text = NULL;
1928 Eina_Bool res = EINA_FALSE;
1929 Eina_Bool *accept = (Eina_Bool *)data;
1931 *accept = EINA_FALSE;
1933 res = eldbus_message_error_get(msg, &name, &text);
1934 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1936 res = eldbus_message_arguments_get(msg, "b", accept);
1937 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1938 EINA_SAFETY_ON_FALSE_GOTO(*accept, finish);
1941 if ((name) || (text))
1943 ERR("errname: %s errmsg: %s\n", name, text);
1946 etRunner::get().finishWork();
1950 _cb_method_set_tc_timeout(void *data,
1951 const Eldbus_Message *msg,
1954 const char *name = NULL, *text = NULL;
1955 Eina_Bool res = EINA_FALSE;
1956 Eina_Bool *accept = (Eina_Bool *)data;
1958 *accept = EINA_FALSE;
1960 res = eldbus_message_error_get(msg, &name, &text);
1961 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1963 res = eldbus_message_arguments_get(msg, "b", accept);
1964 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1965 EINA_SAFETY_ON_FALSE_GOTO(*accept, finish);
1968 if ((name) || (text))
1970 ERR("errname: %s errmsg: %s\n", name, text);
1973 etRunner::get().finishWork();
1977 _cb_method_transient_for_below(void *data,
1978 const Eldbus_Message *msg,
1981 const char *name = NULL, *text = NULL;
1982 Eina_Bool res = EINA_FALSE;
1983 Eina_Bool *accept = (Eina_Bool *)data;
1985 *accept = EINA_FALSE;
1987 res = eldbus_message_error_get(msg, &name, &text);
1988 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1990 res = eldbus_message_arguments_get(msg, "b", accept);
1991 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1992 EINA_SAFETY_ON_FALSE_GOTO(*accept, finish);
1995 if ((name) || (text))
1997 ERR("errname: %s errmsg: %s\n", name, text);
2000 etRunner::get().finishWork();
2004 _cb_method_aux_hint_get(void *data,
2005 const Eldbus_Message *msg,
2008 auxHintEventItem **hint = (auxHintEventItem **) data;
2009 const char *name = NULL, *text = NULL;
2010 Eina_Bool res = EINA_FALSE;
2012 const char *hint_key, *hint_val;
2014 res = eldbus_message_error_get(msg, &name, &text);
2015 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2017 res = eldbus_message_arguments_get(msg, "iss", &id, &hint_key, &hint_val);
2018 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2020 *hint = new auxHintEventItem(0, E_TC_EVENT_TYPE_AUX_HINT_CHANGED, id, hint_key, hint_val);
2023 if ((name) || (text))
2025 ERR("errname: %s errmsg: %s\n", name, text);
2028 etRunner::get().finishWork();
2031 /* callbacks - signal */
2033 _cb_signal_vis_changed(void *data,
2034 const Eldbus_Message *msg)
2036 etRunner *runner = (etRunner *)data;
2037 const char *name = NULL, *text = NULL;
2038 Eina_Bool res = EINA_FALSE;
2042 res = eldbus_message_error_get(msg, &name, &text);
2043 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2045 res = eldbus_message_arguments_get(msg, "ub", &id, &vis);
2046 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2048 runner->insertEventQueue(id, E_TC_EVENT_TYPE_VIS_CHANGED);
2051 if ((name) || (text))
2053 ERR("errname:%s errmsg:%s\n", name, text);
2058 _cb_signal_stack_changed(void *data,
2059 const Eldbus_Message *msg)
2061 etRunner *runner = (etRunner *)data;
2062 const char *name = NULL, *text = NULL;
2063 Eina_Bool res = EINA_FALSE;
2064 Ecore_Window id = 0;
2066 res = eldbus_message_error_get(msg, &name, &text);
2067 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2069 res = eldbus_message_arguments_get(msg, "u", &id);
2070 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2072 runner->insertEventQueue(id, E_TC_EVENT_TYPE_STACK_CHANGED);
2075 if ((name) || (text))
2077 ERR("errname:%s errmsg:%s\n", name, text);
2082 _cb_signal_win_rot_changed(void *data,
2083 const Eldbus_Message *msg)
2085 etRunner *runner = (etRunner *)data;
2086 const char *name = NULL, *text = NULL;
2087 Eina_Bool res = EINA_FALSE;
2091 res = eldbus_message_error_get(msg, &name, &text);
2092 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2094 /* TODO unused 'window id' and 'angle' */
2095 res = eldbus_message_arguments_get(msg, "ui", &id, &angle);
2096 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2098 runner->insertEventQueue(id, E_TC_EVENT_TYPE_WINDOW_ROTATION_CHANGE);
2101 if ((name) || (text))
2103 ERR("errname:%s errmsg:%s\n", name, text);
2108 _cb_signal_focus_changed(void *data,
2109 const Eldbus_Message *msg)
2111 etRunner *runner = (etRunner *)data;
2112 const char *name = NULL, *text = NULL;
2113 Eina_Bool res = EINA_FALSE;
2114 Ecore_Window id = 0;
2116 res = eldbus_message_error_get(msg, &name, &text);
2117 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2119 res = eldbus_message_arguments_get(msg, "u", &id);
2120 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2122 runner->insertEventQueue(id, E_TC_EVENT_TYPE_FOCUS_CHANGED);
2125 if ((name) || (text))
2127 ERR("errname:%s errmsg:%s\n", name, text);
2132 _cb_signal_render_while_effect_run(void *data,
2133 const Eldbus_Message *msg)
2135 etRunner *runner = (etRunner *)data;
2136 const char *name = NULL, *text = NULL;
2137 Eina_Bool res = EINA_FALSE;
2138 Ecore_Window id = 0;
2140 res = eldbus_message_error_get(msg, &name, &text);
2141 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2143 res = eldbus_message_arguments_get(msg, "u", &id);
2144 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2146 runner->insertEventQueue(id, E_TC_EVENT_TYPE_EFFECT);
2149 if ((name) || (text))
2151 ERR("errname:%s errmsg:%s\n", name, text);
2156 _cb_signal_aux_hint_changed(void *data,
2157 const Eldbus_Message *msg)
2159 etRunner *runner = (etRunner *)data;
2160 const char *name = NULL, *text = NULL;
2161 Eina_Bool res = EINA_FALSE;
2162 Ecore_Window win = 0;
2164 std::shared_ptr<auxHintEventItem> hint = NULL;
2165 const char *hint_key, *hint_val;
2167 res = eldbus_message_error_get(msg, &name, &text);
2168 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2170 res = eldbus_message_arguments_get(msg, "uuss", &win, &hint_id, &hint_key, &hint_val);
2171 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2173 hint = std::make_shared<auxHintEventItem>(win, E_TC_EVENT_TYPE_AUX_HINT_CHANGED, hint_id, hint_key, hint_val);
2174 EINA_SAFETY_ON_NULL_GOTO(hint, finish);
2176 runner->insertEventQueue(hint);
2179 if ((name) || (text))
2181 ERR("errname:%s errmsg:%s\n", name, text);
2185 /* callbacks - timer */
2187 _cb_work_timeout(void *data)
2189 etRunner::get().finishWork();
2190 return ECORE_CALLBACK_CANCEL;
2193 /* callbacks - ecore */
2195 _cb_ecore_key_down(void *data, int type, void *event)
2197 Ecore_Event_Key *ev = (Ecore_Event_Key *)event;
2198 etRunner *runner = (etRunner *)data;
2200 if (runner->ev.key.name == NULL) return ECORE_CALLBACK_PASS_ON;
2202 if (!strncmp(runner->ev.key.name, ev->keyname, strlen(ev->keyname)))
2204 if (runner->ev.key.ecore_state == EINA_FALSE &&
2205 type == ECORE_EVENT_KEY_DOWN)
2207 runner->ev.key.ecore_state = EINA_TRUE;
2211 return ECORE_CALLBACK_PASS_ON;
2215 _cb_ecore_key_up(void *data, int type, void *event)
2217 Ecore_Event_Key *ev = (Ecore_Event_Key *)event;
2218 etRunner *runner = (etRunner *)data;
2220 if (runner->ev.key.name == NULL) return ECORE_CALLBACK_PASS_ON;
2222 if (!strncmp(runner->ev.key.name, ev->keyname, strlen(ev->keyname)))
2224 if (runner->ev.key.ecore_state == EINA_TRUE &&
2225 type == ECORE_EVENT_KEY_UP)
2227 runner->ev.key.ecore_state = EINA_FALSE;
2228 runner->insertEventQueue(0, E_TC_EVENT_TYPE_INPUT_ECORE_KEY);
2232 return ECORE_CALLBACK_PASS_ON;
2235 /* callbacks - evas */
2237 _cb_evas_key_down(void *data, Evas * evas, Evas_Object * obj, void * event_info)
2239 Evas_Event_Key_Down *ev;
2240 etRunner *runner = (etRunner *)data;
2242 ev = (Evas_Event_Key_Down *)event_info;
2244 if (!strncmp(runner->ev.key.name, ev->keyname, strlen(ev->keyname)))
2246 if (runner->ev.key.evas_state == EINA_FALSE &&
2247 runner->ev.elm_win == obj)
2249 runner->ev.key.evas_state = EINA_TRUE;
2255 _cb_evas_key_up(void * data, Evas * evas, Evas_Object * obj, void * event_info)
2257 Evas_Event_Key_Up *ev;
2258 etRunner *runner = (etRunner *)data;
2260 ev = (Evas_Event_Key_Up *)event_info;
2262 if (!strncmp(runner->ev.key.name, ev->keyname, strlen(ev->keyname)))
2264 if (runner->ev.key.evas_state == EINA_TRUE &&
2265 runner->ev.elm_win == obj)
2267 runner->ev.key.evas_state = EINA_FALSE;
2268 runner->ev.elm_win = NULL;
2270 runner->insertEventQueue(runner->ev.native_win, E_TC_EVENT_TYPE_INPUT_EVAS_KEY);
2275 /* callbacks - smart object */
2277 _cb_evas_smart_cb_effect_started(void *data, Evas_Object * obj, void *event_info)
2279 etRunner *runner = (etRunner *)data;
2280 if (runner && runner->ev.elm_win == obj)
2282 runner->ev.effect.state_smcb = E_TC_EVAS_SMART_CB_STATE_EFFECT_STARTED;
2287 _cb_evas_smart_cb_effect_done(void *data, Evas_Object * obj, void *event_info)
2289 etRunner *runner = (etRunner *)data;
2290 if (runner && runner->ev.elm_win == obj)
2292 runner->ev.effect.state_smcb |= E_TC_EVAS_SMART_CB_STATE_EFFECT_DONE;
2294 runner->insertEventQueue(runner->ev.native_win, E_TC_EVENT_TYPE_EFFECT_EVAS_CB);
2296 evas_object_smart_callback_del(runner->ev.elm_win, effect_started, _cb_evas_smart_cb_effect_started);
2297 evas_object_smart_callback_del(runner->ev.elm_win, effect_done, _cb_evas_smart_cb_effect_done);
2298 evas_object_smart_callback_del(runner->ev.elm_win, launch_done, _cb_evas_smart_cb_launch_done);
2303 _cb_evas_smart_cb_launch_done(void *data, Evas_Object * obj, void *event_info)
2305 etRunner *runner = (etRunner *)data;
2306 if (runner && runner->ev.elm_win == obj)
2308 runner->ev.effect.state_smcb |= E_TC_EVAS_SMART_CB_STATE_LAUNCH_DONE;
2310 if((runner->ev.effect.state_smcb & E_TC_EVAS_SMART_CB_STATE_EFFECT_STARTED) &&
2311 (runner->ev.effect.state_smcb & E_TC_EVAS_SMART_CB_STATE_EFFECT_DONE) &&
2312 (runner->ev.effect.state_smcb & E_TC_EVAS_SMART_CB_STATE_LAUNCH_DONE))
2314 runner->insertEventQueue(runner->ev.native_win, E_TC_EVENT_TYPE_EFFECT_EVAS_CB);
2316 evas_object_smart_callback_del(runner->ev.elm_win, effect_started, _cb_evas_smart_cb_effect_started);
2317 evas_object_smart_callback_del(runner->ev.elm_win, effect_done, _cb_evas_smart_cb_effect_done);
2318 evas_object_smart_callback_del(runner->ev.elm_win, launch_done, _cb_evas_smart_cb_launch_done);
2324 _cb_gesture_tap(void *data, int type, void *event)
2326 etRunner *runner = (etRunner *)data;
2327 efl_util_event_gesture_tap_s *ev =
2328 (efl_util_event_gesture_tap_s *)event;
2330 if ((ev->fingers == (unsigned int)runner->ev.gesture.tap.fingers) &&
2331 (ev->repeats == (unsigned int)runner->ev.gesture.tap.repeats))
2333 runner->insertEventQueue(0, E_TC_EVENT_TYPE_GESTURE_TAP);
2334 //ecore_event_handler_del(runner->ev.key.eh);
2337 return ECORE_CALLBACK_PASS_ON;
2341 _cb_gesture_tap_delay_timer(void *data)
2343 etRunner *runner = (etRunner *)data;
2346 for (i = 0; i < runner->ev.gesture.tap.fingers; i++)
2348 if (!runner->ev.gesture.tap.pressed)
2350 runner->generateTouchDown(i, 100 * (i + 1), 100 * (i + 1));
2354 runner->generateTouchUp(i, 100 * (i + 1), 100 * (i + 1));
2358 runner->ev.gesture.timer = NULL;
2360 runner->ev.gesture.tap.pressed = !runner->ev.gesture.tap.pressed;
2361 if (!runner->ev.gesture.tap.pressed)
2363 runner->ev.gesture.tap.current_repeats--;
2366 if (runner->ev.gesture.tap.current_repeats > 0)
2368 runner->ev.gesture.timer = ecore_timer_add(0.11,
2369 _cb_gesture_tap_delay_timer,
2373 return ECORE_CALLBACK_CANCEL;
2377 etRunner::generateTapGesture()
2379 ev.gesture.tap.current_repeats = ev.gesture.tap.repeats;
2380 ev.gesture.tap.pressed = EINA_FALSE;
2382 ev.gesture.timer = ecore_timer_add(0.11,
2383 _cb_gesture_tap_delay_timer,
2390 _cb_gesture_edge_swipe(void *data, int type, void *event)
2392 etRunner *runner = (etRunner *)data;
2393 efl_util_event_gesture_edge_swipe_s *ev =
2394 (efl_util_event_gesture_edge_swipe_s *)event;
2396 if ((ev->fingers == (unsigned int)runner->ev.gesture.edge.fingers) &&
2397 (ev->edge == (unsigned int)runner->ev.gesture.edge.edge))
2399 if (runner->ev.gesture.timer)
2400 runner->ev.gesture.edge.get_event = EINA_TRUE;
2403 return ECORE_CALLBACK_PASS_ON;
2407 _cb_gesture_edge_swipe_delay_timer(void *data)
2409 etRunner *runner = (etRunner *)data;
2410 int i, cnt, fingers, w, h;
2411 efl_util_gesture_edge_e edge;
2413 cnt = ++runner->ev.gesture.edge.touch_count;
2414 fingers = runner->ev.gesture.edge.fingers;
2415 edge = runner->ev.gesture.edge.edge;
2416 w = runner->output.w - 1;
2417 h = runner->output.h - 1;
2421 for (i = 0; i < fingers; i++)
2425 case EFL_UTIL_GESTURE_EDGE_TOP:
2426 runner->generateTouchDown(i, 100 * (i + 1), 1);
2428 case EFL_UTIL_GESTURE_EDGE_RIGHT:
2429 runner->generateTouchDown(i, w - 1, 100 * (i + 1));
2431 case EFL_UTIL_GESTURE_EDGE_BOTTOM:
2432 runner->generateTouchDown(i, 100 * (i + 1), h - 1);
2434 case EFL_UTIL_GESTURE_EDGE_LEFT:
2435 runner->generateTouchDown(i, 1, 100 * (i + 1));
2444 for (i = 0; i < fingers; i++)
2448 case EFL_UTIL_GESTURE_EDGE_TOP:
2449 runner->generateTouchMove(i, 100 * (i + 1), 40 * cnt * cnt);
2451 case EFL_UTIL_GESTURE_EDGE_RIGHT:
2452 runner->generateTouchMove(i, (w - 1) - (40 * cnt * cnt), 100 * (i + 1));
2454 case EFL_UTIL_GESTURE_EDGE_BOTTOM:
2455 runner->generateTouchMove(i, 100 * (i + 1), (h - 1) - (40 * cnt * cnt));
2457 case EFL_UTIL_GESTURE_EDGE_LEFT:
2458 runner->generateTouchMove(i, 40 * cnt * cnt, 100 * (i + 1));
2468 for (i = 0; i < fingers; i++)
2472 case EFL_UTIL_GESTURE_EDGE_TOP:
2473 runner->generateTouchUp(i, 100 * (i + 1), 40 * cnt * cnt);
2475 case EFL_UTIL_GESTURE_EDGE_RIGHT:
2476 runner->generateTouchUp(i, (w - 1) - (40 * cnt * cnt), 100 * (i + 1));
2478 case EFL_UTIL_GESTURE_EDGE_BOTTOM:
2479 runner->generateTouchUp(i, 100 * (i + 1), (h - 1) - (40 * cnt * cnt));
2481 case EFL_UTIL_GESTURE_EDGE_LEFT:
2482 runner->generateTouchUp(i, 40 * cnt * cnt, 100 * (i + 1));
2489 runner->ev.gesture.timer = NULL;
2490 if (runner->ev.gesture.edge.get_event)
2492 runner->insertEventQueue(0, E_TC_EVENT_TYPE_GESTURE_EDGE_SWIPE);
2493 //ecore_event_handler_del(runner->ev.key.eh);
2495 return ECORE_CALLBACK_CANCEL;
2498 runner->ev.gesture.timer = NULL;
2499 runner->ev.gesture.timer = ecore_timer_add(0.11,
2500 _cb_gesture_edge_swipe_delay_timer,
2503 return ECORE_CALLBACK_CANCEL;
2507 etRunner::generateEdgeSwipeGesture()
2509 ev.gesture.edge.touch_count = 0;
2510 ev.gesture.edge.get_event = EINA_FALSE;
2512 ev.gesture.timer = ecore_timer_add(0.11,
2513 _cb_gesture_edge_swipe_delay_timer,
2520 _cb_gesture_edge_drag(void *data, int type, void *event)
2522 etRunner *runner = (etRunner *)data;
2523 efl_util_event_gesture_edge_drag_s *ev =
2524 (efl_util_event_gesture_edge_drag_s *)event;
2526 if ((ev->fingers == (unsigned int)runner->ev.gesture.edge.fingers) &&
2527 (ev->edge == (unsigned int)runner->ev.gesture.edge.edge) &&
2528 (ev->mode == EFL_UTIL_GESTURE_MODE_END))
2530 runner->insertEventQueue(0, E_TC_EVENT_TYPE_GESTURE_EDGE_DRAG);
2531 //ecore_event_handler_del(runner->ev.key.eh);
2534 return ECORE_CALLBACK_PASS_ON;
2538 _cb_gesture_edge_drag_delay_timer(void *data)
2540 etRunner *runner = (etRunner *)data;
2541 int i, cnt, fingers, w, h;
2542 efl_util_gesture_edge_e edge;
2544 cnt = ++runner->ev.gesture.edge.touch_count;
2545 fingers = runner->ev.gesture.edge.fingers;
2546 edge = runner->ev.gesture.edge.edge;
2547 w = runner->output.w - 1;
2548 h = runner->output.h - 1;
2552 for (i = 0; i < fingers; i++)
2556 case EFL_UTIL_GESTURE_EDGE_TOP:
2557 runner->generateTouchDown(i, 100 * (i + 1), 1);
2559 case EFL_UTIL_GESTURE_EDGE_RIGHT:
2560 runner->generateTouchDown(i, w - 1, 100 * (i + 1));
2562 case EFL_UTIL_GESTURE_EDGE_BOTTOM:
2563 runner->generateTouchDown(i, 100 * (i + 1), h - 1);
2565 case EFL_UTIL_GESTURE_EDGE_LEFT:
2566 runner->generateTouchDown(i, 1, 100 * (i + 1));
2575 for (i = 0; i < fingers; i++)
2579 case EFL_UTIL_GESTURE_EDGE_TOP:
2580 runner->generateTouchMove(i, 100 * (i + 1), 50 * cnt);
2582 case EFL_UTIL_GESTURE_EDGE_RIGHT:
2583 runner->generateTouchMove(i, (w - 1) - (50 * cnt), 100 * (i + 1));
2585 case EFL_UTIL_GESTURE_EDGE_BOTTOM:
2586 runner->generateTouchMove(i, 100 * (i + 1), (h - 1) - (50 * cnt));
2588 case EFL_UTIL_GESTURE_EDGE_LEFT:
2589 runner->generateTouchMove(i, 50 * cnt, 100 * (i + 1));
2599 for (i = 0; i < fingers; i++)
2603 case EFL_UTIL_GESTURE_EDGE_TOP:
2604 runner->generateTouchUp(i, 100 * (i + 1), 50 * cnt);
2606 case EFL_UTIL_GESTURE_EDGE_RIGHT:
2607 runner->generateTouchUp(i, (w - 1) - (50 * cnt), 100 * (i + 1));
2609 case EFL_UTIL_GESTURE_EDGE_BOTTOM:
2610 runner->generateTouchUp(i, 100 * (i + 1), (h - 1) - (50 * cnt));
2612 case EFL_UTIL_GESTURE_EDGE_LEFT:
2613 runner->generateTouchUp(i, 50 * cnt, 100 * (i + 1));
2620 runner->ev.gesture.timer = NULL;
2621 return ECORE_CALLBACK_CANCEL;
2624 runner->ev.gesture.timer = NULL;
2625 runner->ev.gesture.timer = ecore_timer_add(0.11,
2626 _cb_gesture_edge_drag_delay_timer,
2629 return ECORE_CALLBACK_CANCEL;
2633 etRunner::generateEdgeDragGesture()
2635 ev.gesture.edge.touch_count = 0;
2637 ev.gesture.timer = ecore_timer_add(0.11,
2638 _cb_gesture_edge_drag_delay_timer,