2 #include "e_test_helper_intern.h"
3 #include "e_policy_wl.h"
4 #include "e_comp_canvas_intern.h"
5 #include "e_comp_intern.h"
7 #define BUS "org.enlightenment.wm"
8 #define PATH "/org/enlightenment/wm"
9 #define IFACE "org.enlightenment.wm.Test"
11 #define E_TH_SIGN_WIN_INFO "usiiiiibbbiibibbbi"
12 #define E_TC_TIMEOUT 10.0
14 typedef struct _Test_Helper_Reg_Win
19 Eina_Bool render_send;
20 } Test_Helper_Reg_Win;
23 typedef struct _Test_Helper_Data
25 Eldbus_Connection *conn;
26 Eldbus_Service_Interface *iface;
27 Ecore_Event_Handler *dbus_init_done_h;
34 Eina_Bool tc_timer_needs;
35 Ecore_Timer *tc_timer;
38 static Test_Helper_Data *th_data = NULL;
40 static Eina_Bool _e_test_helper_cb_property_get(const Eldbus_Service_Interface *iface, const char *name, Eldbus_Message_Iter *iter, const Eldbus_Message *msg, Eldbus_Message **err);
42 static Eldbus_Message *_e_test_helper_cb_testcase_start(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
43 static Eldbus_Message *_e_test_helper_cb_testcase_end(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
44 static Eldbus_Message *_e_test_helper_cb_testcase_timeout_set(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
45 static Eldbus_Message *_e_test_helper_cb_register_window(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
46 static Eldbus_Message *_e_test_helper_cb_deregister_window(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
47 static Eldbus_Message *_e_test_helper_cb_reset_register_window(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
48 static Eldbus_Message *_e_test_helper_cb_change_stack(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
49 static Eldbus_Message *_e_test_helper_cb_activate_window(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
50 static Eldbus_Message *_e_test_helper_cb_change_iconic_state(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
51 static Eldbus_Message *_e_test_helper_cb_set_transient_for(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
52 static Eldbus_Message *_e_test_helper_cb_unset_transient_for(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
53 static Eldbus_Message *_e_test_helper_cb_set_transient_for_below(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
54 static Eldbus_Message *_e_test_helper_cb_set_noti_level(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
55 static Eldbus_Message *_e_test_helper_cb_set_focus_skip(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
56 static Eldbus_Message *_e_test_helper_cb_get_client_info(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg);
57 static Eldbus_Message *_e_test_helper_cb_get_clients(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
58 static Eldbus_Message *_e_test_helper_cb_get_noti_level(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
59 static Eldbus_Message *_e_test_helper_cb_dpms(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
60 static Eldbus_Message *_e_test_helper_cb_ev_freeze(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
61 static Eldbus_Message *_e_test_helper_cb_kill_win(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
62 static Eldbus_Message *_e_test_helper_cb_ev_mouse(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
63 static Eldbus_Message *_e_test_helper_cb_ev_key(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
64 static Eldbus_Message *_e_test_helper_cb_hwc(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
65 static Eldbus_Message *_e_test_helper_cb_zone_rot_change(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
66 static Eldbus_Message *_e_test_helper_cb_zone_rot_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
67 static Eldbus_Message *_e_test_helper_cb_set_render_condition(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
68 static Eldbus_Message *_e_test_helper_cb_add_supported_aux_hint(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
69 static Eldbus_Message *_e_test_helper_cb_del_supported_aux_hint(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
70 static Eldbus_Message *_e_test_helper_cb_get_aux_hint(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
71 static Eina_Bool _e_test_helper_cb_img_render(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
72 static Eina_Bool _e_test_helper_cb_effect_start(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
73 static Eina_Bool _e_test_helper_cb_effect_end(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
77 E_TEST_HELPER_SIGNAL_CHANGE_VISIBILITY = 0,
78 E_TEST_HELPER_SIGNAL_RESTACK,
79 E_TEST_HELPER_SIGNAL_WINDOW_ROTATION_CHANGED,
80 E_TEST_HELPER_SIGNAL_FOCUS_CHANGED,
81 E_TEST_HELPER_SIGNAL_RENDER,
82 E_TEST_HELPER_AUX_HINT_CHANGED,
83 E_TEST_HELPER_SIGNAL_ICONIC_STATE_CHANGED,
86 static const Eldbus_Signal signals[] = {
87 [E_TEST_HELPER_SIGNAL_CHANGE_VISIBILITY] =
90 ELDBUS_ARGS({"ub", "window id, visibility"}),
93 [E_TEST_HELPER_SIGNAL_RESTACK] =
96 ELDBUS_ARGS({"u", "window id was restacked"}),
99 [E_TEST_HELPER_SIGNAL_WINDOW_ROTATION_CHANGED] =
101 "WinRotationChanged",
102 ELDBUS_ARGS({"ui", "a window id was rotated to given angle"}),
105 [E_TEST_HELPER_SIGNAL_FOCUS_CHANGED] =
108 ELDBUS_ARGS({"ub", "window id, focus state"}),
111 [E_TEST_HELPER_SIGNAL_RENDER] =
114 ELDBUS_ARGS({"u", "window id for tracing rendering"}),
117 [E_TEST_HELPER_AUX_HINT_CHANGED] =
120 ELDBUS_ARGS({"uuss", "window id, aux_hint id, aux_hint key, aux_hint value"}),
123 [E_TEST_HELPER_SIGNAL_ICONIC_STATE_CHANGED] =
125 "IconicStateChanged",
126 ELDBUS_ARGS({"ubb", "window id, iconic state"}),
132 static const Eldbus_Method methods[] ={
136 ELDBUS_ARGS({"b", "accept or not"}),
137 _e_test_helper_cb_testcase_start, 0
142 ELDBUS_ARGS({"b", "accept or not"}),
143 _e_test_helper_cb_testcase_end, 0
147 ELDBUS_ARGS({"bu", "needs timer and time in millisecond"}),
148 ELDBUS_ARGS({"b", "accept or not"}),
149 _e_test_helper_cb_testcase_timeout_set, 0
153 ELDBUS_ARGS({"u", "window id to be registered"}),
154 ELDBUS_ARGS({"b", "accept or not"}),
155 _e_test_helper_cb_register_window, 0
159 ELDBUS_ARGS({"u", "window id to be deregistered"}),
160 ELDBUS_ARGS({"b", "accept or not"}),
161 _e_test_helper_cb_deregister_window, 0
164 "ResetRegisterWindow",
166 ELDBUS_ARGS({"b", "accept or not"}),
167 _e_test_helper_cb_reset_register_window, 0
171 ELDBUS_ARGS({"uui", "window id to restack, above or below, stacking type"}),
173 _e_test_helper_cb_change_stack, 0
177 ELDBUS_ARGS({"u", "window id to activate"}),
179 _e_test_helper_cb_activate_window, 0
183 ELDBUS_ARGS({"ub", "window id to change iconic state, iconify or uniconify"}),
185 _e_test_helper_cb_change_iconic_state, 0
188 "SetWindowTransientFor",
189 ELDBUS_ARGS({"uu", "child window id to set transient_for, parent window id to set transient_for"}),
190 ELDBUS_ARGS({"b", "accept or not"}),
191 _e_test_helper_cb_set_transient_for, 0
194 "UnsetWindowTransientFor",
195 ELDBUS_ARGS({"u", "child window id to set transient_for"}),
196 ELDBUS_ARGS({"b", "accept or not"}),
197 _e_test_helper_cb_unset_transient_for, 0
200 "SetWindowTransientForBelow",
201 ELDBUS_ARGS({"uub", "child window id to set transient_for, parent window id to set transient_for, set or unset"}),
202 ELDBUS_ARGS({"b", "accept or not"}),
203 _e_test_helper_cb_set_transient_for_below, 0
206 "SetWindowNotiLevel",
207 ELDBUS_ARGS({"ui", "window id to set notification level, notification level"}),
209 _e_test_helper_cb_set_noti_level, 0
212 "SetWindowFocusSkip",
213 ELDBUS_ARGS({"ub", "window id to set focus skip, skip set or skip unset"}),
215 _e_test_helper_cb_set_focus_skip, 0
219 ELDBUS_ARGS({"u", "window id"}),
220 ELDBUS_ARGS({E_TH_SIGN_WIN_INFO, "information of ec"}),
221 _e_test_helper_cb_get_client_info, 0
226 ELDBUS_ARGS({"ua("E_TH_SIGN_WIN_INFO")", "array of ec"}),
227 _e_test_helper_cb_get_clients, 0
230 "GetWindowNotiLevel",
231 ELDBUS_ARGS({"u", "window id to get notification level"}),
232 ELDBUS_ARGS({"i", "notification level"}),
233 _e_test_helper_cb_get_noti_level, 0
237 ELDBUS_ARGS({"u", "DPMS 0=off or 1=on"}),
238 ELDBUS_ARGS({"b", "accept or not"}),
239 _e_test_helper_cb_dpms, 0
243 ELDBUS_ARGS({"u", "0=events will start to be processed or 1=freeze input events processing"}),
244 ELDBUS_ARGS({"b", "accept or not"}),
245 _e_test_helper_cb_ev_freeze, 0
249 ELDBUS_ARGS({"s", "window name to kill"}),
251 _e_test_helper_cb_kill_win, 0
255 ELDBUS_ARGS({"uii", "type 0=down 1=move 2=up, x position, y position"}),
256 ELDBUS_ARGS({"b", "accept or not"}),
257 _e_test_helper_cb_ev_mouse, 0
261 ELDBUS_ARGS({"us", "type 0=down 1=up, key name"}),
262 ELDBUS_ARGS({"b", "accept or not"}),
263 _e_test_helper_cb_ev_key, 0
267 ELDBUS_ARGS({"u", "0=off or 1=on"}),
268 ELDBUS_ARGS({"b", "accept or not"}),
269 _e_test_helper_cb_hwc, 0
272 "GetCurrentZoneRotation",
274 ELDBUS_ARGS({"i", "a angle of current zone"}),
275 _e_test_helper_cb_zone_rot_get, 0,
278 "ChangeZoneRotation",
279 ELDBUS_ARGS({"i", "(0, 90, 180, 270) = specific angle, -1 = unknown state"}),
280 ELDBUS_ARGS({"b", "accept or not"}),
281 _e_test_helper_cb_zone_rot_change, 0,
285 ELDBUS_ARGS({"us", "window id and type of rendering to trace"}),
286 ELDBUS_ARGS({"b", "accept or not"}),
287 _e_test_helper_cb_set_render_condition, 0,
290 "AddSupportedAuxHint",
291 ELDBUS_ARGS({"s", "Aux hint string to add supported aux hint"}),
292 ELDBUS_ARGS({"b", "accept or not"}),
293 _e_test_helper_cb_add_supported_aux_hint, 0,
296 "DelSupportedAuxHint",
297 ELDBUS_ARGS({"s", "Aux hint string to del supported aux hint"}),
298 ELDBUS_ARGS({"b", "accept or not"}),
299 _e_test_helper_cb_del_supported_aux_hint, 0,
303 ELDBUS_ARGS({"us", "window id and Aux hint string to get aux hint data"}),
304 ELDBUS_ARGS({"iss", "id, name, value"}),
305 _e_test_helper_cb_get_aux_hint, 0,
310 static const Eldbus_Property properties[] = {
311 { "Registrant", "au", NULL, NULL, 0 },
315 static const Eldbus_Service_Interface_Desc iface_desc = {
316 IFACE, methods, signals, properties, _e_test_helper_cb_property_get, NULL
320 _e_test_helper_registrant_clear(void)
322 Test_Helper_Reg_Win *reg_win = NULL;
324 EINA_SAFETY_ON_NULL_RETURN(th_data);
325 EINA_SAFETY_ON_NULL_RETURN(th_data->reg_wins);
327 EINA_LIST_FREE(th_data->reg_wins, reg_win)
329 if (reg_win->ec && reg_win->ec->frame)
330 e_comp_object_render_trace_set(reg_win->ec->frame, EINA_FALSE);
335 _e_test_helper_registrant_remove(Ecore_Window target_win)
337 Test_Helper_Reg_Win *reg_win = NULL;
338 Eina_List *l = NULL, *ll = NULL;
339 Eina_Bool res = EINA_FALSE;
341 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, EINA_FALSE);
342 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data->reg_wins, EINA_FALSE);
344 EINA_LIST_FOREACH_SAFE(th_data->reg_wins, l, ll, reg_win)
346 if (reg_win->win == target_win)
348 if (reg_win->ec && reg_win->ec->frame)
349 e_comp_object_render_trace_set(reg_win->ec->frame, EINA_FALSE);
350 th_data->reg_wins = eina_list_remove(th_data->reg_wins, reg_win);
359 _e_test_helper_message_append_client(Eldbus_Message_Iter *iter, E_Client *ec)
361 eldbus_message_iter_arguments_append
362 (iter, E_TH_SIGN_WIN_INFO,
363 e_pixmap_res_id_get(ec->pixmap),
364 e_client_util_name_get(ec) ?: "NO NAME",
367 ec->x, ec->y, ec->w, ec->h,
370 evas_object_layer_get(ec->frame),
373 evas_object_data_get(ec->frame, "effect_running"),
375 /* visibility & iconify */
377 evas_object_visible_get(ec->frame),
378 ec->visibility.opaque,
379 ec->visibility.obscured,
381 ec->iconic ? (e_client_is_iconified_by_client(ec) ? 2 : 1) : 0,
388 evas_object_focus_get(ec->frame),
391 ec->e.state.rot.ang.curr);
395 _e_test_helper_cb_dbus_init_done(void *data EINA_UNUSED, int type, void *event)
397 E_DBus_Conn_Init_Done_Event *e = event;
399 if ((e->status == E_DBUS_CONN_INIT_SUCCESS) && (e->conn_type == ELDBUS_CONNECTION_TYPE_SYSTEM))
401 th_data->conn = e_dbus_conn_connection_ref(ELDBUS_CONNECTION_TYPE_SYSTEM);
404 th_data->iface = eldbus_service_interface_register(th_data->conn, PATH, &iface_desc);
407 ecore_event_handler_del(th_data->dbus_init_done_h);
408 th_data->dbus_init_done_h = NULL;
410 return ECORE_CALLBACK_PASS_ON;
414 _e_test_helper_message_append_client_info_by_window_id(Eldbus_Message_Iter *iter, Ecore_Window win)
418 ec = e_pixmap_find_client_by_res_id(win);
422 _e_test_helper_message_append_client(iter, ec);
426 _e_test_helper_message_append_clients(Eldbus_Message_Iter *iter)
428 Eldbus_Message_Iter *array_of_ec;
433 EINA_SAFETY_ON_NULL_RETURN(th_data);
435 if (!(comp = e_comp)) return;
437 eldbus_message_iter_arguments_append(iter, "a("E_TH_SIGN_WIN_INFO")", &array_of_ec);
440 for (o = evas_object_top_get(comp->evas); o; o = evas_object_below_get(o))
442 Eldbus_Message_Iter* struct_of_ec;
444 ec = evas_object_data_get(o, "E_Client");
446 if (e_client_util_ignored_get(ec)) continue;
448 eldbus_message_iter_arguments_append(array_of_ec, "("E_TH_SIGN_WIN_INFO")", &struct_of_ec);
449 _e_test_helper_message_append_client(struct_of_ec, ec);
450 eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
453 eldbus_message_iter_container_close(iter, array_of_ec);
457 _e_test_helper_restack(Ecore_Window win, Ecore_Window target, int above)
459 E_Client *ec = NULL, *tec = NULL;
461 ec = e_pixmap_find_client_by_res_id(win);
462 tec = e_pixmap_find_client_by_res_id(target);
471 e_policy_stack_transient_child_raise(ec);
478 e_policy_stack_transient_child_lower(ec);
487 e_client_stack_above(ec, tec);
489 e_client_stack_below(ec, tec);
494 _e_test_helper_cb_tc_timeout(void *data)
496 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_DONE);
498 th_data->tc_running = EINA_FALSE;
499 _e_test_helper_registrant_clear();
501 if (th_data->tc_timer)
503 ecore_timer_del(th_data->tc_timer);
504 th_data->tc_timer = NULL;
507 return ECORE_CALLBACK_DONE;
512 _e_test_helper_send_change_visibility(Ecore_Window win, Eina_Bool vis)
514 Eldbus_Message *signal;
516 EINA_SAFETY_ON_NULL_RETURN(th_data);
518 signal = eldbus_service_signal_new(th_data->iface,
519 E_TEST_HELPER_SIGNAL_CHANGE_VISIBILITY);
520 eldbus_message_arguments_append(signal, "ub", win, vis);
521 eldbus_service_signal_send(th_data->iface, signal);
525 _e_test_helper_send_render(Ecore_Window win)
527 Eldbus_Message *signal;
529 EINA_SAFETY_ON_NULL_RETURN(th_data);
531 signal = eldbus_service_signal_new(th_data->iface, E_TEST_HELPER_SIGNAL_RENDER);
532 eldbus_message_arguments_append(signal, "u", win);
533 eldbus_service_signal_send(th_data->iface, signal);
537 _e_test_helper_send_aux_hint_change(Ecore_Window win, int hint_id, const char *hint_key, const char *hint_val)
539 Eldbus_Message *signal;
541 EINA_SAFETY_ON_NULL_RETURN(th_data);
543 signal = eldbus_service_signal_new(th_data->iface, E_TEST_HELPER_AUX_HINT_CHANGED);
544 eldbus_message_arguments_append(signal, "uuss", win, hint_id, hint_key, hint_val);
545 eldbus_service_signal_send(th_data->iface, signal);
548 static Test_Helper_Reg_Win *
549 _e_test_helper_find_win_on_reg_list(Ecore_Window win)
552 Test_Helper_Reg_Win *reg_win = NULL;
554 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, NULL);
555 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data->reg_wins, NULL);
557 EINA_LIST_FOREACH(th_data->reg_wins, l, reg_win)
559 if (reg_win->win == win)
566 /* Method Handlers */
567 static Eldbus_Message *
568 _e_test_helper_cb_testcase_start(const Eldbus_Service_Interface *iface EINA_UNUSED,
569 const Eldbus_Message *msg)
571 Eldbus_Message *reply;
572 Eina_Bool res = EINA_FALSE;
574 reply = eldbus_message_method_return_new(msg);
578 if (th_data->tc_timer)
579 ecore_timer_del(th_data->tc_timer);
581 if (th_data->tc_timer_needs)
582 th_data->tc_timer = ecore_timer_add(E_TC_TIMEOUT, _e_test_helper_cb_tc_timeout, NULL);
583 res = th_data->tc_running = EINA_TRUE;
586 eldbus_message_arguments_append(reply, "b", res);
591 static Eldbus_Message *
592 _e_test_helper_cb_testcase_end(const Eldbus_Service_Interface *iface EINA_UNUSED,
593 const Eldbus_Message *msg)
595 Eldbus_Message *reply;
596 Eina_Bool res = EINA_FALSE;
598 reply = eldbus_message_method_return_new(msg);
602 if (th_data->tc_timer)
604 ecore_timer_del(th_data->tc_timer);
605 th_data->tc_timer = NULL;
607 th_data->tc_running = EINA_FALSE;
611 eldbus_message_arguments_append(reply, "b", res);
616 static Eldbus_Message *
617 _e_test_helper_cb_testcase_timeout_set(const Eldbus_Service_Interface *iface EINA_UNUSED,
618 const Eldbus_Message *msg)
620 Eldbus_Message *reply;
621 Eina_Bool res = EINA_FALSE;
622 Eina_Bool set = EINA_TRUE;
623 uint32_t timeout = E_TC_TIMEOUT;
625 reply = eldbus_message_method_return_new(msg);
627 if (!eldbus_message_arguments_get(msg, "bu", &set, &timeout))
629 ERR("Error on eldbus_message_arguments_get()\n");
635 if (set != th_data->tc_timer_needs)
637 th_data->tc_timer_needs = set;
639 ecore_timer_del(th_data->tc_timer);
644 if (th_data->tc_timer)
645 ecore_timer_del(th_data->tc_timer);
647 if (th_data->tc_timer_needs)
648 th_data->tc_timer = ecore_timer_add(timeout, _e_test_helper_cb_tc_timeout, NULL);
653 eldbus_message_arguments_append(reply, "b", res);
658 eldbus_message_arguments_append(reply, "b", EINA_FALSE);
662 static Eldbus_Message *
663 _e_test_helper_cb_register_window(const Eldbus_Service_Interface *iface EINA_UNUSED,
664 const Eldbus_Message *msg)
666 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
668 Test_Helper_Reg_Win *new_win = NULL;
670 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
672 if (!eldbus_message_arguments_get(msg, "u", &id))
674 ERR("Error on eldbus_message_arguments_get()\n");
678 new_win = E_NEW(Test_Helper_Reg_Win, 1);
679 EINA_SAFETY_ON_NULL_GOTO(new_win, err);
682 new_win->ec = e_pixmap_find_client_by_res_id(id);
684 th_data->reg_wins = eina_list_append(th_data->reg_wins, new_win);
685 eldbus_message_arguments_append(reply, "b", EINA_TRUE);
690 eldbus_message_arguments_append(reply, "b", EINA_FALSE);
694 static Eldbus_Message *
695 _e_test_helper_cb_dpms(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
697 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
698 Eina_Bool accept = EINA_FALSE;
701 if (!eldbus_message_arguments_get(msg, "u", &dpms))
703 ERR("Error on eldbus_message_arguments_get()\n");
722 eldbus_message_arguments_append(reply, "b", accept);
727 static Eldbus_Message *
728 _e_test_helper_cb_ev_freeze(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
730 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
731 Eina_Bool accept = EINA_TRUE;
734 if (!eldbus_message_arguments_get(msg, "u", &freeze))
736 ERR("Error on eldbus_message_arguments_get()\n");
742 case 0: e_comp_all_thaw(); break;
743 case 1: e_comp_all_freeze(); break;
744 default: accept = EINA_FALSE; break;
747 eldbus_message_arguments_append(reply, "b", accept);
752 static Eldbus_Message *
753 _e_test_helper_cb_kill_win(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
755 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
757 Evas_Object *o = NULL;
758 char *win_name = NULL;
760 if (!eldbus_message_arguments_get(msg, "s", &win_name))
762 ERR("Error on eldbus_message_arguments_get()\n");
766 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
768 const char *ec_name = NULL;
769 ec = evas_object_data_get(o, "E_Client");
771 if (e_client_util_ignored_get(ec)) continue;
773 ec_name = e_client_util_name_get(ec) ?: "NO NAME";
775 if (e_util_strcmp(ec_name, win_name)) continue;
776 ELOGF("E_TEST_HELPER", "Window killed by request(ec: %s)", ec, ec? ec->icccm.name : "NO NAME");
777 e_client_act_kill_begin(ec);
783 static Eldbus_Message *
784 _e_test_helper_cb_ev_mouse(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
786 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
787 Eina_Bool accept = EINA_TRUE;
788 Ecore_Event_Mouse_Button *ev = NULL;
792 if (!eldbus_message_arguments_get(msg, "uii", &type, &x, &y))
794 ERR("Error on eldbus_message_arguments_get()\n");
798 ev = E_NEW(Ecore_Event_Mouse_Button, 1);
799 EINA_SAFETY_ON_NULL_RETURN_VAL(ev, reply);
801 ev->timestamp = (unsigned int)(ecore_time_unix_get() * (double)1000);
803 ev->x = ev->root.x = x;
804 ev->y = ev->root.y = y;
809 case 0: ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); break;
810 case 1: ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); break;
811 case 2: ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); break;
812 default: accept = EINA_FALSE; break;
815 eldbus_message_arguments_append(reply, "b", accept);
824 _e_test_helper_key_event_add(char *key_name, unsigned int type)
827 char *device_identifier = NULL;
829 EINA_SAFETY_ON_NULL_RETURN_VAL(key_name, EINA_FALSE);
830 EINA_SAFETY_ON_NULL_RETURN_VAL(e_devicemgr, EINA_FALSE);
831 EINA_SAFETY_ON_NULL_RETURN_VAL(e_devicemgr->last_device_kbd, EINA_FALSE);
833 device_identifier = (char *)e_devicemgr->last_device_kbd->identifier;
835 EINA_SAFETY_ON_NULL_RETURN_VAL(device_identifier, EINA_FALSE);
837 res = e_devicemgr_inputgen_key_event_add(key_name, (Eina_Bool)type, device_identifier);
841 ERR("[E_Test_Helper] Failed on generating key event ! (key_name=%s, type=%d)\n", key_name, type);
848 static Eldbus_Message *
849 _e_test_helper_cb_ev_key(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
851 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
852 Eina_Bool accept = EINA_FALSE;
856 if (!eldbus_message_arguments_get(msg, "us", &type, &key))
858 ERR("Error on eldbus_message_arguments_get()\n");
869 accept = _e_test_helper_key_event_add(key, type);
875 eldbus_message_arguments_append(reply, "b", accept);
880 static Eldbus_Message *
881 _e_test_helper_cb_hwc(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
883 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
884 Eina_Bool r, accept = EINA_FALSE;
887 r = eldbus_message_arguments_get(msg, "u", &on);
888 EINA_SAFETY_ON_FALSE_RETURN_VAL(r, reply);
894 case 0: accept = EINA_TRUE; e_comp_hwc_deactive_set(EINA_TRUE); break;
895 case 1: accept = EINA_TRUE; e_comp_hwc_deactive_set(EINA_FALSE); break;
900 eldbus_message_arguments_append(reply, "b", accept);
906 _e_test_helper_event_zone_rot_change_free(void *data EINA_UNUSED, void *event)
908 E_Event_Info_Rotation_Message *ev = event;
910 e_object_unref(E_OBJECT(ev->zone));
915 static Eldbus_Message *
916 _e_test_helper_cb_zone_rot_change(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
918 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
919 E_Event_Info_Rotation_Message *ev;
921 Eina_Bool r, accept = EINA_FALSE;
924 r = eldbus_message_arguments_get(msg, "i", &rot);
925 EINA_SAFETY_ON_FALSE_GOTO(r, end);
927 if ((rot < 0) || (rot > 270) || ((rot % 90) != 0))
930 zone = e_zone_current_get();
934 ev = E_NEW(E_Event_Info_Rotation_Message, 1);
935 if (EINA_UNLIKELY(!ev))
937 ERR("Failed to allocate 'E_Event_Info_Rotation_Message'");
941 e_object_ref(E_OBJECT(zone));
943 ev->message = E_INFO_ROTATION_MESSAGE_SET;
945 ecore_event_add(E_EVENT_INFO_ROTATION_MESSAGE, ev, _e_test_helper_event_zone_rot_change_free, NULL);
950 eldbus_message_arguments_append(reply, "b", accept);
955 static Eldbus_Message *
956 _e_test_helper_cb_zone_rot_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
959 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
963 r = eldbus_message_arguments_get(msg, "i", &rot);
964 EINA_SAFETY_ON_FALSE_GOTO(r, end);
966 if ((rot < 0) || (rot > 270) || ((rot % 90) != 0))
969 zone = e_zone_current_get();
973 eldbus_message_arguments_append(reply, "b", zone->rot.curr);
978 static Eldbus_Message *
979 _e_test_helper_cb_deregister_window(const Eldbus_Service_Interface *iface EINA_UNUSED,
980 const Eldbus_Message *msg)
982 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
984 Eina_Bool res = EINA_FALSE;
986 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
988 if (!eldbus_message_arguments_get(msg, "u", &id))
990 ERR("Error on eldbus_message_arguments_get()\n");
994 res = _e_test_helper_registrant_remove(id);
995 eldbus_message_arguments_append(reply, "b", res);
1000 static Eldbus_Message *
1001 _e_test_helper_cb_reset_register_window(const Eldbus_Service_Interface *iface EINA_UNUSED,
1002 const Eldbus_Message *msg)
1004 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1006 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
1008 _e_test_helper_registrant_clear();
1010 eldbus_message_arguments_append(reply, "b", EINA_TRUE);
1015 static Eldbus_Message*
1016 _e_test_helper_cb_change_stack(const Eldbus_Service_Interface *iface EINA_UNUSED,
1017 const Eldbus_Message *msg)
1019 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1020 Ecore_Window win, target;
1023 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
1025 if (!eldbus_message_arguments_get(msg, "uui", &win, &target, &above))
1027 ERR("error on eldbus_message_arguments_get()\n");
1031 if ((win) && (above != -1))
1032 _e_test_helper_restack(win, target, above);
1037 static Eldbus_Message*
1038 _e_test_helper_cb_activate_window(const Eldbus_Service_Interface *iface EINA_UNUSED,
1039 const Eldbus_Message *msg)
1041 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1042 Ecore_Window win = 0x0;
1043 E_Client *ec = NULL;
1045 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
1047 if (!eldbus_message_arguments_get(msg, "u", &win))
1049 ERR("error on eldbus_message_arguments_get()\n");
1055 ec = e_pixmap_find_client_by_res_id(win);
1056 e_policy_wl_activate(ec);
1062 static Eldbus_Message*
1063 _e_test_helper_cb_change_iconic_state(const Eldbus_Service_Interface *iface EINA_UNUSED,
1064 const Eldbus_Message *msg)
1066 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1067 Ecore_Window win = 0x0;
1068 Eina_Bool iconic = EINA_FALSE;
1069 E_Client *ec = NULL;
1071 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
1073 if (!eldbus_message_arguments_get(msg, "ub", &win, &iconic))
1075 ERR("error on eldbus_message_arguments_get()\n");
1081 ec = e_pixmap_find_client_by_res_id(win);
1083 e_policy_wl_iconify(ec);
1085 e_policy_wl_uniconify(ec);
1091 static Eldbus_Message*
1092 _e_test_helper_cb_set_transient_for(const Eldbus_Service_Interface *iface EINA_UNUSED,
1093 const Eldbus_Message *msg)
1095 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1096 Ecore_Window parent = 0x0, child = 0x0;
1097 E_Client *ec = NULL, *pec = NULL;
1098 Eina_Bool accept = EINA_FALSE;
1100 EINA_SAFETY_ON_NULL_GOTO(th_data, fin);
1102 if (!eldbus_message_arguments_get(msg, "uu", &child, &parent))
1104 ERR("error on eldbus_message_arguments_get()\n");
1108 if (parent && child)
1110 pec = e_pixmap_find_client_by_res_id(parent);
1111 EINA_SAFETY_ON_NULL_GOTO(pec, fin);
1113 ec = e_pixmap_find_client_by_res_id(child);
1114 EINA_SAFETY_ON_NULL_GOTO(ec, fin);
1116 e_policy_stack_transient_for_set(ec, pec);
1121 eldbus_message_arguments_append(reply, "b", accept);
1125 static Eldbus_Message*
1126 _e_test_helper_cb_unset_transient_for(const Eldbus_Service_Interface *iface EINA_UNUSED,
1127 const Eldbus_Message *msg)
1129 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1130 Ecore_Window child = 0x0;
1131 E_Client *ec = NULL;
1132 Eina_Bool accept = EINA_FALSE;
1134 EINA_SAFETY_ON_NULL_GOTO(th_data, fin);
1136 if (!eldbus_message_arguments_get(msg, "u", &child))
1138 ERR("error on eldbus_message_arguments_get()\n");
1144 ec = e_pixmap_find_client_by_res_id(child);
1145 EINA_SAFETY_ON_NULL_GOTO(ec, fin);
1147 e_policy_stack_transient_for_set(ec, NULL);
1152 eldbus_message_arguments_append(reply, "b", accept);
1156 static Eldbus_Message*
1157 _e_test_helper_cb_set_transient_for_below(const Eldbus_Service_Interface *iface EINA_UNUSED,
1158 const Eldbus_Message *msg)
1160 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1161 Ecore_Window parent = 0x0, child = 0x0;
1162 E_Client *ec = NULL, *pec = NULL;
1163 Eina_Bool set = EINA_FALSE;
1164 Eina_Bool accept = EINA_FALSE;
1166 EINA_SAFETY_ON_NULL_GOTO(th_data, fin);
1168 if (!eldbus_message_arguments_get(msg, "uub", &child, &parent, &set))
1170 ERR("error on eldbus_message_arguments_get()\n");
1174 if (parent && child)
1176 pec = e_pixmap_find_client_by_res_id(parent);
1177 EINA_SAFETY_ON_NULL_GOTO(pec, fin);
1179 ec = e_pixmap_find_client_by_res_id(child);
1180 EINA_SAFETY_ON_NULL_GOTO(ec, fin);
1184 e_policy_stack_transient_for_below_set(ec, pec, EINA_TRUE);
1189 e_policy_stack_transient_for_below_set(ec, NULL, EINA_TRUE);
1195 eldbus_message_arguments_append(reply, "b", accept);
1199 static Eldbus_Message*
1200 _e_test_helper_cb_set_noti_level(const Eldbus_Service_Interface *iface EINA_UNUSED,
1201 const Eldbus_Message *msg)
1203 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1204 Ecore_Window win = 0x0;
1206 E_Client *ec = NULL;
1208 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
1210 if (!eldbus_message_arguments_get(msg, "ui", &win, &layer))
1212 ERR("error on eldbus_message_arguments_get()\n");
1218 ec = e_pixmap_find_client_by_res_id(win);
1219 if (!ec) return reply;
1221 e_client_layer_set(ec, layer);
1227 static Eldbus_Message*
1228 _e_test_helper_cb_set_focus_skip(const Eldbus_Service_Interface *iface EINA_UNUSED,
1229 const Eldbus_Message *msg)
1231 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1232 Ecore_Window win = 0x0;
1233 Eina_Bool skip_set = EINA_FALSE;
1234 E_Client *ec = NULL;
1236 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
1238 if (!eldbus_message_arguments_get(msg, "ub", &win, &skip_set))
1240 ERR("error on eldbus_message_arguments_get()\n");
1246 ec = e_pixmap_find_client_by_res_id(win);
1247 if (!ec) return reply;
1249 ec->icccm.accepts_focus = ec->icccm.take_focus = !skip_set;
1250 ec->changes.accepts_focus = 1;
1257 static Eldbus_Message *
1258 _e_test_helper_cb_get_client_info(const Eldbus_Service_Interface *iface EINA_UNUSED,
1259 const Eldbus_Message *msg)
1261 Eldbus_Message *reply;
1264 reply = eldbus_message_method_return_new(msg);
1265 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, reply);
1267 if (!eldbus_message_arguments_get(msg, "u", &win))
1269 ERR("error getting window ID");
1273 _e_test_helper_message_append_client_info_by_window_id(eldbus_message_iter_get(reply), win);
1278 static Eldbus_Message *
1279 _e_test_helper_cb_get_clients(const Eldbus_Service_Interface *iface EINA_UNUSED,
1280 const Eldbus_Message *msg)
1282 Eldbus_Message *reply;
1284 reply = eldbus_message_method_return_new(msg);
1285 _e_test_helper_message_append_clients(eldbus_message_iter_get(reply));
1290 static Eldbus_Message *
1291 _e_test_helper_cb_get_noti_level(const Eldbus_Service_Interface *iface EINA_UNUSED,
1292 const Eldbus_Message *msg)
1294 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1295 Ecore_Window win = 0x0;
1296 E_Client *ec = NULL;
1299 if (!eldbus_message_arguments_get(msg, "u", &win))
1301 ERR("error on eldbus_message_arguments_get()\n");
1305 ec = e_pixmap_find_client_by_res_id(win);
1311 eldbus_message_arguments_append(reply, "i", layer);
1316 _e_test_helper_cb_visibility_change(void *data EINA_UNUSED,
1317 int type EINA_UNUSED,
1321 Ecore_Window win = 0;
1322 E_Event_Client *ev = event;
1323 Test_Helper_Reg_Win *reg_win = NULL;
1325 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON);
1326 if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON;
1329 win = e_pixmap_res_id_get(ec->pixmap);
1330 reg_win = _e_test_helper_find_win_on_reg_list(win);
1332 if (reg_win == NULL) return ECORE_CALLBACK_PASS_ON;
1334 if (reg_win->vis != !ec->visibility.obscured)
1335 _e_test_helper_send_change_visibility(win, !ec->visibility.obscured);
1337 reg_win->vis = !ec->visibility.obscured;
1339 return ECORE_CALLBACK_PASS_ON;
1343 _e_test_helper_cb_client_remove(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
1346 E_Event_Client *ev = event;
1347 Ecore_Window win = 0;
1349 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON);
1352 if (ec && ec->pixmap)
1353 win = e_pixmap_res_id_get(ec->pixmap);
1355 if (win <= 0) return ECORE_CALLBACK_PASS_ON;
1357 _e_test_helper_registrant_remove(win);
1359 return ECORE_CALLBACK_PASS_ON;
1363 _e_test_helper_cb_client_restack(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
1365 E_Event_Client *ev = event;
1367 Eldbus_Message *sig;
1370 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON);
1371 if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON;
1375 win = e_pixmap_res_id_get(ec->pixmap);
1376 if (!_e_test_helper_find_win_on_reg_list(win)) return ECORE_CALLBACK_PASS_ON;
1380 sig = eldbus_service_signal_new(th_data->iface, E_TEST_HELPER_SIGNAL_RESTACK);
1381 eldbus_message_arguments_append(sig, "u", win);
1382 eldbus_service_signal_send(th_data->iface, sig);
1385 return ECORE_CALLBACK_PASS_ON;
1389 _e_test_helper_cb_client_rotation_end(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
1391 E_Event_Client *ev = event;
1393 Eldbus_Message *sig;
1397 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON);
1398 if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON;
1402 win = e_pixmap_res_id_get(ec->pixmap);
1403 if (!_e_test_helper_find_win_on_reg_list(win)) return ECORE_CALLBACK_PASS_ON;
1405 rot = ec->e.state.rot.ang.curr;
1409 sig = eldbus_service_signal_new(th_data->iface, E_TEST_HELPER_SIGNAL_WINDOW_ROTATION_CHANGED);
1410 eldbus_message_arguments_append(sig, "ui", win, rot);
1411 eldbus_service_signal_send(th_data->iface, sig);
1414 return ECORE_CALLBACK_PASS_ON;
1418 _e_test_helper_cb_client_focus_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
1420 E_Event_Client *ev = event;
1421 E_Client *ec = NULL;
1422 Eldbus_Message *sig = NULL;
1423 Ecore_Window win = 0;
1425 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON);
1426 if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON;
1430 win = e_pixmap_res_id_get(ec->pixmap);
1431 if (!_e_test_helper_find_win_on_reg_list(win)) return ECORE_CALLBACK_PASS_ON;
1435 sig = eldbus_service_signal_new(th_data->iface, E_TEST_HELPER_SIGNAL_FOCUS_CHANGED);
1436 eldbus_message_arguments_append(sig, "ub", win, ec->focused);
1437 eldbus_service_signal_send(th_data->iface, sig);
1440 return ECORE_CALLBACK_PASS_ON;
1444 _e_test_helper_cb_property_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const char *name, Eldbus_Message_Iter *iter, const Eldbus_Message *msg EINA_UNUSED, Eldbus_Message **err EINA_UNUSED)
1446 EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, EINA_FALSE);
1448 Eldbus_Message_Iter *arr_of_win = NULL;
1449 Test_Helper_Reg_Win *reg_win = NULL;
1450 Eina_List *l = NULL;
1452 if (!e_util_strcmp(name, "Registrant"))
1454 arr_of_win = eldbus_message_iter_container_new(iter, 'a', "u");
1456 EINA_LIST_FOREACH(th_data->reg_wins, l, reg_win)
1458 eldbus_message_iter_basic_append(arr_of_win, 'u', reg_win->win);
1460 eldbus_message_iter_container_close(iter, arr_of_win);
1466 static Eldbus_Message *
1467 _e_test_helper_cb_set_render_condition(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1469 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1470 Ecore_Window win = 0x0;
1471 Eina_Bool accept = EINA_FALSE;
1474 if (!eldbus_message_arguments_get(msg, "us", &win, &cond))
1476 ERR("error on eldbus_message_arguments_get()\n");
1480 // a window should be registered for tracing, otherwise reply accept FALSE
1481 if (!th_data) goto fin;
1482 if (!th_data->tc_running) goto fin;
1483 if (!th_data->reg_wins) goto fin;
1484 if (!_e_test_helper_find_win_on_reg_list(win)) goto fin;
1486 // tracning condition on and off depending on "cond" string.
1487 if (!e_util_strcmp(cond, "effect"))
1489 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_COMP_OBJECT_EFFECT_START,
1490 _e_test_helper_cb_effect_start, NULL);
1491 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_COMP_OBJECT_EFFECT_END,
1492 _e_test_helper_cb_effect_end, NULL);
1497 eldbus_message_arguments_append(reply, "b", accept);
1502 static Eldbus_Message *
1503 _e_test_helper_cb_add_supported_aux_hint(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1505 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1506 Eina_Bool accept = EINA_FALSE;
1507 const Eina_List *supported_list = NULL;
1510 if (!eldbus_message_arguments_get(msg, "s", &hint))
1512 ERR("error on eldbus_message_arguments_get()\n");
1516 if (!th_data) goto fin;
1517 if (!th_data->tc_running) goto fin;
1519 supported_list = e_hints_aux_hint_supported_add(hint);
1521 if (eina_list_data_find(supported_list, hint))
1525 eldbus_message_arguments_append(reply, "b", accept);
1530 static Eldbus_Message *
1531 _e_test_helper_cb_del_supported_aux_hint(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1533 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1534 Eina_Bool accept = EINA_FALSE;
1535 const Eina_List *supported_list = NULL;
1538 if (!eldbus_message_arguments_get(msg, "s", &hint))
1540 ERR("error on eldbus_message_arguments_get()\n");
1544 if (!th_data) goto fin;
1545 if (!th_data->tc_running) goto fin;
1547 supported_list = e_hints_aux_hint_supported_del(hint);
1549 if (eina_list_data_find(supported_list, hint))
1553 eldbus_message_arguments_append(reply, "b", accept);
1558 static Eldbus_Message *
1559 _e_test_helper_cb_get_aux_hint(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1561 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1562 Ecore_Window win = 0x0;
1563 Test_Helper_Reg_Win *reg_win = NULL;
1564 E_Comp_Wl_Aux_Hint *ecah;
1569 const char *hint = NULL, *val = NULL;
1571 if (!eldbus_message_arguments_get(msg, "us", &win, &hint))
1573 ERR("error on eldbus_message_arguments_get()\n");
1577 if (!th_data) goto fin;
1578 if (!th_data->tc_running) goto fin;
1579 if (!th_data->reg_wins) goto fin;
1580 if (!(reg_win = _e_test_helper_find_win_on_reg_list(win))) goto fin;
1581 if (!(ec = reg_win->ec)) goto fin;
1583 EINA_LIST_REVERSE_FOREACH(ec->comp_data->aux_hint.hints, l, ecah)
1585 if ((!ecah->deleted) &&
1586 (!e_util_strcmp(ecah->hint, hint)))
1596 eldbus_message_arguments_append(reply, "iss", id, hint, val);
1602 _e_test_helper_cb_img_render(void *data EINA_UNUSED,
1603 int type EINA_UNUSED,
1607 E_Event_Comp_Object *ev = event;
1608 Ecore_Window win = 0;
1609 Test_Helper_Reg_Win *reg_win = NULL;
1611 if (!(ec = evas_object_data_get(ev->comp_object, "E_Client")))
1612 return ECORE_CALLBACK_DONE;
1614 // a window should be registered for tracing
1615 if (!th_data) return ECORE_CALLBACK_DONE;
1616 if (!th_data->tc_running) return ECORE_CALLBACK_DONE;
1617 if (!th_data->reg_wins) return ECORE_CALLBACK_DONE;
1619 win = e_pixmap_res_id_get(ec->pixmap);
1620 reg_win = _e_test_helper_find_win_on_reg_list(win);
1622 if (reg_win && reg_win->render_send)
1623 _e_test_helper_send_render(win);
1625 return ECORE_CALLBACK_DONE;
1629 _e_test_helper_cb_effect_start(void *data EINA_UNUSED,
1630 int type EINA_UNUSED,
1634 E_Event_Comp_Object *ev = event;
1635 Ecore_Window win = 0;
1636 Test_Helper_Reg_Win *reg_win = NULL;
1638 if (!(ec = evas_object_data_get(ev->comp_object, "E_Client")))
1639 return ECORE_CALLBACK_DONE;
1641 // a window should be registered for tracing
1642 if (!th_data) return ECORE_CALLBACK_DONE;
1643 if (!th_data->tc_running) return ECORE_CALLBACK_DONE;
1644 if (!th_data->reg_wins) return ECORE_CALLBACK_DONE;
1646 win = e_pixmap_res_id_get(ec->pixmap);
1647 reg_win = _e_test_helper_find_win_on_reg_list(win);
1649 if (reg_win && ec && ec->frame)
1651 reg_win->render_send = EINA_TRUE;
1652 e_comp_object_render_trace_set(ec->frame, EINA_TRUE);
1653 e_pixmap_image_refresh(ec->pixmap);
1654 e_comp_object_dirty(ec->frame);
1657 return ECORE_CALLBACK_DONE;
1661 _e_test_helper_cb_effect_end(void *data EINA_UNUSED,
1662 int type EINA_UNUSED,
1666 E_Event_Comp_Object *ev = event;
1667 Ecore_Window win = 0;
1668 Test_Helper_Reg_Win *reg_win = NULL;
1670 ec = evas_object_data_get(ev->comp_object, "E_Client");
1671 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ECORE_CALLBACK_DONE);
1673 // a window should be registered for tracing
1674 if (!th_data) return ECORE_CALLBACK_DONE;
1675 if (!th_data->tc_running) return ECORE_CALLBACK_DONE;
1676 if (!th_data->reg_wins) return ECORE_CALLBACK_DONE;
1678 win = e_pixmap_res_id_get(ec->pixmap);
1679 reg_win = _e_test_helper_find_win_on_reg_list(win);
1681 if (reg_win && ec->frame)
1683 e_comp_object_render_trace_set(ec->frame, EINA_FALSE);
1684 reg_win->render_send = EINA_FALSE;
1687 return ECORE_CALLBACK_DONE;
1691 _e_test_helper_hook_cb_client_aux_hint_change(void *data EINA_UNUSED, E_Client *ec)
1693 Ecore_Window win = 0;
1694 E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
1696 E_Comp_Wl_Aux_Hint *hint;
1698 EINA_SAFETY_ON_NULL_RETURN(th_data);
1699 if (!th_data->tc_running) return;
1701 win = e_pixmap_res_id_get(ec->pixmap);
1702 if (!_e_test_helper_find_win_on_reg_list(win)) return;
1706 EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint)
1710 _e_test_helper_send_aux_hint_change(win, hint->id, hint->hint, hint->val);
1717 _e_test_helper_cb_client_iconic_state_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
1719 E_Event_Client *ev = event;
1721 Eldbus_Message *sig;
1724 if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON;
1727 if (!ec) return ECORE_CALLBACK_PASS_ON;
1729 win = e_pixmap_res_id_get(ec->pixmap);
1730 if (!win) return ECORE_CALLBACK_PASS_ON;
1732 if (!_e_test_helper_find_win_on_reg_list(win)) return ECORE_CALLBACK_PASS_ON;
1734 sig = eldbus_service_signal_new(th_data->iface, E_TEST_HELPER_SIGNAL_ICONIC_STATE_CHANGED);
1735 eldbus_message_arguments_append(sig, "ubb", win, ec->iconic, e_client_is_iconified_by_client(ec));
1736 eldbus_service_signal_send(th_data->iface, sig);
1738 return ECORE_CALLBACK_PASS_ON;
1741 /* externally accessible functions */
1743 e_test_helper_init(void)
1745 Eina_Bool res = EINA_FALSE;
1747 EINA_SAFETY_ON_TRUE_GOTO((e_dbus_conn_init() <= 0), err);
1749 th_data = E_NEW(Test_Helper_Data, 1);
1750 EINA_SAFETY_ON_NULL_GOTO(th_data, err);
1752 th_data->dbus_init_done_h = ecore_event_handler_add(E_EVENT_DBUS_CONN_INIT_DONE, _e_test_helper_cb_dbus_init_done, NULL);
1753 EINA_SAFETY_ON_NULL_GOTO(th_data->dbus_init_done_h, err);
1755 res = e_dbus_conn_dbus_init(ELDBUS_CONNECTION_TYPE_SYSTEM);
1756 EINA_SAFETY_ON_FALSE_GOTO(res, err);
1758 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_CLIENT_VISIBILITY_CHANGE,
1759 _e_test_helper_cb_visibility_change, NULL);
1760 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_CLIENT_REMOVE,
1761 _e_test_helper_cb_client_remove, NULL);
1762 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_CLIENT_STACK,
1763 _e_test_helper_cb_client_restack, NULL);
1764 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_CLIENT_ROTATION_CHANGE_END,
1765 _e_test_helper_cb_client_rotation_end, NULL);
1766 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_CLIENT_FOCUS_IN,
1767 _e_test_helper_cb_client_focus_changed, NULL);
1768 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_CLIENT_FOCUS_OUT,
1769 _e_test_helper_cb_client_focus_changed, NULL);
1770 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_COMP_OBJECT_IMG_RENDER,
1771 _e_test_helper_cb_img_render, NULL);
1772 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_CLIENT_ICONIFY,
1773 _e_test_helper_cb_client_iconic_state_changed, NULL);
1774 E_LIST_HANDLER_APPEND(th_data->hdlrs, E_EVENT_CLIENT_UNICONIFY,
1775 _e_test_helper_cb_client_iconic_state_changed, NULL);
1777 E_LIST_HOOK_APPEND(th_data->hooks, E_CLIENT_HOOK_AUX_HINT_CHANGE,
1778 _e_test_helper_hook_cb_client_aux_hint_change, NULL);
1783 e_test_helper_shutdown();
1788 e_test_helper_shutdown(void)
1792 E_FREE_LIST(th_data->hdlrs, ecore_event_handler_del);
1794 _e_test_helper_registrant_clear();
1796 if (th_data->tc_timer)
1798 ecore_timer_del(th_data->tc_timer);
1799 th_data->tc_timer = NULL;
1802 if (th_data->dbus_init_done_h)
1804 ecore_event_handler_del(th_data->dbus_init_done_h);
1805 th_data->dbus_init_done_h = NULL;
1811 eldbus_service_interface_unregister(th_data->iface);
1813 e_dbus_conn_connection_unref(th_data->conn);
1814 th_data->conn = NULL;
1817 e_dbus_conn_shutdown();