2 * Copyright (c) 2011-2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #define LOG_TAG "TIZEN_N_EFL_UTIL"
24 #include <sys/types.h>
28 #include <tbm_bufmgr.h>
29 #include <tbm_surface.h>
30 #include <tbm_surface_internal.h>
31 #include <Elementary.h>
32 #include <Ecore_Evas.h>
36 #include <X11/extensions/Xvlib.h>
37 #include <X11/extensions/Xvproto.h>
38 #include <X11/extensions/Xdamage.h>
42 #endif /* end of X11 */
45 #include <Ecore_Wayland.h>
46 #include <wayland-client.h>
47 #include <wayland-tbm-client.h>
48 #include <tizen-extension-client-protocol.h>
49 #include <screenshooter-client-protocol.h>
50 #endif /* end of WAYLAND */
52 /* callback handler index */
53 #define CBH_NOTI_LEV 0
54 #define CBH_SCR_MODE 1
57 typedef void (*Efl_Util_Cb)(Evas_Object *, int, void *);
59 typedef struct _Efl_Util_Callback_Info
64 } Efl_Util_Callback_Info;
67 typedef struct _Efl_Util_Wl_Surface_Lv_Info
69 void *surface; /* wl_surface */
71 Eina_Bool wait_for_done;
73 } Efl_Util_Wl_Surface_Lv_Info;
75 typedef struct _Efl_Util_Wl_Surface_Scr_Mode_Info
77 void *surface; /* wl_surface */
79 Eina_Bool wait_for_done;
81 } Efl_Util_Wl_Surface_Scr_Mode_Info;
83 typedef struct _Efl_Util_Wl_Surface_Brightness_Info
85 void *surface; /* wl_surface */
87 Eina_Bool wait_for_done;
89 } Efl_Util_Wl_Surface_Brightness_Info;
91 typedef struct _Efl_Util_Wl_Output_Info
93 struct wl_output *output;
94 int offset_x, offset_y, width, height;
95 } Efl_Util_Wl_Output_Info;
98 typedef struct _Efl_Util_Data
101 /* x11 related stuffs */
105 Ecore_Event_Handler *handler; /* x11 client message handler */
106 Ecore_X_Display *dpy;
108 #endif /* end of X11 */
111 /* wayland related stuffs */
115 struct wl_display *dpy;
116 struct wl_event_queue *queue;
120 struct tizen_policy *proto;
121 Eina_Hash *hash_noti_lv;
122 Eina_Hash *hash_scr_mode;
126 struct screenshooter *screenshooter;
127 struct wayland_tbm_client *tbm_client;
128 Eina_List *output_list;
132 struct tizen_input_device_manager *devicemgr;
133 int request_notified;
137 struct tizen_display_policy *proto;
138 Eina_Hash *hash_brightness;
141 #endif /* end of WAYLAND */
145 Eina_List *info_list; /* list of callback info */
146 unsigned int atom; /* x11 atom */
147 } cb_handler[CBH_MAX];
150 static Efl_Util_Data _eflutil =
158 #endif /* end of X11 */
163 { NULL, NULL, NULL }, /* tizen_policy protocol */
164 { NULL, NULL, NULL }, /* screenshooter protocol */
165 { NULL, -1 } /* tizen_input_device_manager protocol */
167 #endif /* end of WAYLAND */
169 { NULL, 0 }, /* handler for notification level */
170 { NULL, 0 } /* handler for screen mode */
174 static Eina_Bool _cb_info_add(Evas_Object *win, Efl_Util_Cb cb, void *data, int idx);
175 static Eina_Bool _cb_info_del_by_win(Evas_Object *win, int idx);
176 static Eina_List *_cb_info_list_get(int idx);
177 static Efl_Util_Callback_Info *_cb_info_find_by_win(Evas_Object *win, int idx);
179 static Efl_Util_Callback_Info *_cb_info_find_by_xwin(unsigned int xwin, int idx);
180 static Eina_Bool _cb_x11_client_msg(void *data, int type, void *event);
181 static Eina_Bool _x11_init(void);
182 #endif /* end of X11 */
184 static Eina_Bool _wl_init(void);
185 static void _cb_wl_reg_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version);
186 static void _cb_wl_reg_global_remove(void *data, struct wl_registry *reg, unsigned int name);
187 static Efl_Util_Callback_Info *_cb_info_find_by_wlsurf(void *wlsurf, int idx);
188 static void _cb_wl_tz_policy_conformant(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t is_conformant);
189 static void _cb_wl_tz_policy_conformant_area(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h);
190 static void _cb_wl_tz_policy_notification_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, int32_t level, uint32_t state);
191 static void _cb_wl_tz_policy_transient_for_done(void *data, struct tizen_policy *tizen_policy, uint32_t child_id);
192 static void _cb_wl_tz_policy_scr_mode_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t mode, uint32_t state);
193 static void _cb_wl_tz_policy_iconify_state_changed(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, uint32_t iconified, uint32_t force);
194 static void _cb_wl_tz_policy_supported_aux_hints(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints);
195 static void _cb_wl_tz_policy_allowed_aux_hint(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, int id);
197 static void _cb_wl_tz_display_policy_brightness_done(void *data, struct tizen_display_policy *tizen_display_policy, struct wl_surface *surface_resource, int32_t brightness, uint32_t state);
199 static void _cb_device_add(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, uint32_t serial EINA_UNUSED, const char *identifier EINA_UNUSED, struct tizen_input_device *device EINA_UNUSED, struct wl_seat *seat EINA_UNUSED);
200 static void _cb_device_remove(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, uint32_t serial EINA_UNUSED, const char *identifier EINA_UNUSED, struct tizen_input_device *device EINA_UNUSED, struct wl_seat *seat EINA_UNUSED);
201 static void _cb_error(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, uint32_t errorcode);
202 static void _cb_block_expired(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED);
204 static const struct wl_registry_listener _wl_reg_listener =
207 _cb_wl_reg_global_remove
210 struct tizen_policy_listener _wl_tz_policy_listener =
212 _cb_wl_tz_policy_conformant,
213 _cb_wl_tz_policy_conformant_area,
214 _cb_wl_tz_policy_notification_done,
215 _cb_wl_tz_policy_transient_for_done,
216 _cb_wl_tz_policy_scr_mode_done,
217 _cb_wl_tz_policy_iconify_state_changed,
218 _cb_wl_tz_policy_supported_aux_hints,
219 _cb_wl_tz_policy_allowed_aux_hint,
222 struct tizen_input_device_manager_listener _wl_tz_devmgr_listener =
230 struct tizen_display_policy_listener _wl_tz_display_policy_listener =
232 _cb_wl_tz_display_policy_brightness_done,
234 #endif /* end of WAYLAND */
237 _cb_info_add(Evas_Object *win,
242 Efl_Util_Callback_Info *info;
244 info = _cb_info_find_by_win(win, idx);
247 _eflutil.cb_handler[idx].info_list
248 = eina_list_remove(_eflutil.cb_handler[idx].info_list,
253 info = (Efl_Util_Callback_Info *)calloc(1, sizeof(Efl_Util_Callback_Info));
254 if (!info) return EINA_FALSE;
260 _eflutil.cb_handler[idx].info_list
261 = eina_list_append(_eflutil.cb_handler[idx].info_list,
265 if (!_eflutil.x11.handler)
266 _eflutil.x11.handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
269 #endif /* end of X11 */
275 _cb_info_del_by_win(Evas_Object *win,
278 Efl_Util_Callback_Info *info;
280 info = _cb_info_find_by_win(win, idx);
281 if (!info) return EINA_FALSE;
283 _eflutil.cb_handler[idx].info_list
284 = eina_list_remove(_eflutil.cb_handler[idx].info_list,
289 unsigned int count = eina_list_count(_eflutil.cb_handler[idx].info_list);
290 if ((count == 0) && (_eflutil.x11.handler))
292 ecore_event_handler_del(_eflutil.x11.handler);
293 _eflutil.x11.handler = NULL;
301 _cb_info_list_get(int idx)
303 return _eflutil.cb_handler[idx].info_list;
306 static Efl_Util_Callback_Info *
307 _cb_info_find_by_win(Evas_Object *win,
311 Efl_Util_Callback_Info *info;
313 l = _cb_info_list_get(idx);
314 EINA_LIST_FOREACH(l, ll, info)
316 if (info->win == win) return info;
323 static Efl_Util_Callback_Info *
324 _cb_info_find_by_xwin(unsigned int xwin,
328 Efl_Util_Callback_Info *info;
331 l = _cb_info_list_get(idx);
332 EINA_LIST_FOREACH(l, ll, info)
334 xwin2 = elm_win_xwindow_get(info->win);
335 if (xwin == xwin2) return info;
342 _cb_x11_client_msg(void *data,
346 Ecore_X_Event_Client_Message *ev;
348 Efl_Util_Callback_Info *info;
351 if (!ev) return ECORE_CALLBACK_PASS_ON;
354 if (xwin == 0) return ECORE_CALLBACK_PASS_ON;
356 if (ev->message_type == _eflutil.cb_handler[CBH_NOTI_LEV].atom)
358 info = _cb_info_find_by_xwin(xwin, CBH_NOTI_LEV);
360 /* permission denied */
361 if ((ev->data.l[1] == 0) &&
366 EFL_UTIL_ERROR_PERMISSION_DENIED,
370 else if (ev->message_type == _eflutil.cb_handler[CBH_SCR_MODE].atom)
372 info = _cb_info_find_by_xwin(xwin, CBH_SCR_MODE);
374 /* permission denied */
375 if ((ev->data.l[1] == 0) &&
380 EFL_UTIL_ERROR_PERMISSION_DENIED,
384 return ECORE_CALLBACK_PASS_ON;
390 if (_eflutil.x11.init) return EINA_TRUE;
392 _eflutil.x11.dpy = ecore_x_display_get();
393 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.x11.dpy, EINA_FALSE);
395 _eflutil.x11.init = EINA_TRUE;
399 #endif /* end of X11 */
405 struct wl_registry *reg = NULL;
407 if (_eflutil.wl.init) return EINA_TRUE;
411 _eflutil.wl.dpy = ecore_wl_display_get();
412 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.dpy, fail);
414 _eflutil.wl.queue = wl_display_create_queue(_eflutil.wl.dpy);
415 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.queue, fail);
417 reg = wl_display_get_registry(_eflutil.wl.dpy);
418 EINA_SAFETY_ON_NULL_GOTO(reg, fail);
420 wl_proxy_set_queue((struct wl_proxy*)reg, _eflutil.wl.queue);
421 wl_registry_add_listener(reg, &_wl_reg_listener, NULL);
423 _eflutil.wl.init = EINA_TRUE;
427 if (_eflutil.wl.queue)
429 wl_event_queue_destroy(_eflutil.wl.queue);
430 _eflutil.wl.queue = NULL;
434 wl_registry_destroy(reg);
440 _cb_wl_output_geometry(void *data, struct wl_output *wl_output, int x, int y,
441 int physical_width, int physical_height, int subpixel,
442 const char *make, const char *model, int transform)
444 Efl_Util_Wl_Output_Info *output = wl_output_get_user_data(wl_output);
445 if (wl_output == output->output)
447 output->offset_x = x;
448 output->offset_y = y;
453 _cb_wl_output_mode(void *data, struct wl_output *wl_output, uint32_t flags,
454 int width, int height, int refresh)
456 Efl_Util_Wl_Output_Info *output = wl_output_get_user_data(wl_output);
457 if (wl_output == output->output && (flags & WL_OUTPUT_MODE_CURRENT))
459 output->width = width;
460 output->height = height;
465 _cb_wl_output_done(void *data, struct wl_output *wl_output)
470 _cb_wl_output_scale(void *data, struct wl_output *wl_output, int32_t factor)
474 static const struct wl_output_listener output_listener =
476 _cb_wl_output_geometry,
483 _cb_wl_screenshot_done(void *data, struct screenshooter *screenshooter)
485 Eina_Bool *shot_done = (Eina_Bool*)data;
487 *shot_done = EINA_TRUE;
490 static const struct screenshooter_listener screenshooter_listener =
492 _cb_wl_screenshot_done
496 _cb_wl_reg_global(void *data,
497 struct wl_registry *reg,
499 const char *interface,
500 unsigned int version)
502 if (!strcmp(interface, "tizen_policy"))
504 struct tizen_policy *proto;
505 proto = wl_registry_bind(reg,
507 &tizen_policy_interface,
511 tizen_policy_add_listener(proto,
512 &_wl_tz_policy_listener,
515 _eflutil.wl.policy.hash_noti_lv = eina_hash_pointer_new(free);
516 _eflutil.wl.policy.hash_scr_mode = eina_hash_pointer_new(free);
517 _eflutil.wl.policy.proto = proto;
519 else if (strcmp(interface, "wl_output") == 0)
521 Efl_Util_Wl_Output_Info *output = calloc(1, sizeof(Efl_Util_Wl_Output_Info));
522 EINA_SAFETY_ON_NULL_RETURN(output);
524 _eflutil.wl.shot.output_list = eina_list_append(_eflutil.wl.shot.output_list, output);
526 output->output = wl_registry_bind(reg, name, &wl_output_interface, version);
527 wl_output_add_listener(output->output, &output_listener, output);
529 else if (strcmp(interface, "screenshooter") == 0)
531 _eflutil.wl.shot.screenshooter = wl_registry_bind(reg, name, &screenshooter_interface, version);
532 screenshooter_add_listener(_eflutil.wl.shot.screenshooter, &screenshooter_listener, NULL);
534 else if (strcmp(interface, "tizen_input_device_manager") == 0)
536 _eflutil.wl.devmgr.devicemgr = wl_registry_bind(reg, name, &tizen_input_device_manager_interface, version);
537 tizen_input_device_manager_add_listener(_eflutil.wl.devmgr.devicemgr, &_wl_tz_devmgr_listener, NULL);
539 else if (!strcmp(interface, "tizen_display_policy"))
541 _eflutil.wl.display_policy.proto = wl_registry_bind(reg, name, &tizen_display_policy_interface, version);
542 if (!_eflutil.wl.display_policy.proto) return;
544 tizen_display_policy_add_listener(_eflutil.wl.display_policy.proto,
545 &_wl_tz_display_policy_listener,
548 _eflutil.wl.display_policy.hash_brightness = eina_hash_pointer_new(free);
554 _cb_wl_reg_global_remove(void *data,
555 struct wl_registry *reg,
558 _eflutil.wl.policy.proto = NULL;
559 eina_hash_free(_eflutil.wl.policy.hash_noti_lv);
560 eina_hash_free(_eflutil.wl.policy.hash_scr_mode);
562 _eflutil.wl.display_policy.proto = NULL;
563 eina_hash_free(_eflutil.wl.display_policy.hash_brightness);
566 static Efl_Util_Callback_Info *
567 _cb_info_find_by_wlsurf(void *wlsurf,
571 Efl_Util_Callback_Info *info;
572 Ecore_Wl_Window *wlwin2 = NULL;
573 void *wlsurf2 = NULL;
575 l = _cb_info_list_get(idx);
576 EINA_LIST_FOREACH(l, ll, info)
578 wlwin2 = elm_win_wl_window_get(info->win);
579 wlsurf2 = ecore_wl_window_surface_get(wlwin2);
580 if (wlsurf== wlsurf2) return info;
587 _cb_wl_tz_policy_conformant(void *data, struct tizen_policy *tizen_policy,
588 struct wl_surface *surface, uint32_t is_conformant)
593 _cb_wl_tz_policy_conformant_area(void *data, struct tizen_policy *tizen_policy,
594 struct wl_surface *surface, uint32_t conformant_part,
595 uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
600 _cb_wl_tz_policy_notification_done(void *data,
601 struct tizen_policy *tizen_policy,
602 struct wl_surface *surface,
606 Efl_Util_Wl_Surface_Lv_Info *lv_info;
607 Efl_Util_Callback_Info *cb_info;
609 lv_info = eina_hash_find(_eflutil.wl.policy.hash_noti_lv, &surface);
612 lv_info->level = level;
613 lv_info->wait_for_done = EINA_FALSE;
614 lv_info->state = state;
617 if (state != TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) return;
619 cb_info = _cb_info_find_by_wlsurf((void *)surface, CBH_NOTI_LEV);
620 if (!cb_info) return;
621 if (!cb_info->cb) return;
623 cb_info->cb(cb_info->win,
624 EFL_UTIL_ERROR_PERMISSION_DENIED,
629 _cb_wl_tz_policy_transient_for_done(void *data, struct tizen_policy *tizen_policy, uint32_t child_id)
634 _cb_wl_tz_policy_scr_mode_done(void *data,
635 struct tizen_policy *tizen_policy,
636 struct wl_surface *surface,
641 Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
642 Efl_Util_Callback_Info *cb_info;
644 scr_mode_info = eina_hash_find(_eflutil.wl.policy.hash_scr_mode, &surface);
647 scr_mode_info->mode = mode;
648 scr_mode_info->wait_for_done = EINA_FALSE;
649 scr_mode_info->state = state;
652 if (state != TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) return;
654 cb_info = _cb_info_find_by_wlsurf((void *)surface, CBH_SCR_MODE);
655 if (!cb_info) return;
656 if (!cb_info->cb) return;
658 cb_info->cb(cb_info->win,
659 EFL_UTIL_ERROR_PERMISSION_DENIED,
663 static void _cb_wl_tz_policy_iconify_state_changed(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, uint32_t iconified, uint32_t force)
667 static void _cb_wl_tz_policy_supported_aux_hints(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints)
671 static void _cb_wl_tz_policy_allowed_aux_hint(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, int id)
676 _cb_wl_tz_display_policy_brightness_done(void *data,
677 struct tizen_display_policy *tizen_display_policy,
678 struct wl_surface *surface,
682 Efl_Util_Wl_Surface_Brightness_Info *brightness_info;
684 brightness_info = eina_hash_find(_eflutil.wl.display_policy.hash_brightness, &surface);
687 brightness_info->brightness = brightness;
688 brightness_info->wait_for_done = EINA_FALSE;
689 brightness_info->state = state;
694 _cb_window_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
696 Efl_Util_Wl_Surface_Lv_Info *lv_info;
699 if (EINA_UNLIKELY(!lv_info))
702 eina_hash_del(_eflutil.wl.policy.hash_noti_lv, &lv_info->surface, lv_info);
704 #endif /* end of WAYLAND */
707 efl_util_set_notification_window_level(Evas_Object *window,
708 efl_util_notification_level_e level)
712 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
713 EINA_SAFETY_ON_FALSE_RETURN_VAL((level >= EFL_UTIL_NOTIFICATION_LEVEL_NONE) &&
714 (level <= EFL_UTIL_NOTIFICATION_LEVEL_TOP),
715 EFL_UTIL_ERROR_INVALID_PARAMETER);
718 Ecore_X_Window_Type window_type;
722 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
724 xwin = elm_win_xwindow_get(window);
727 if (ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE)
729 // success to get window type
730 if (window_type != ECORE_X_WINDOW_TYPE_NOTIFICATION)
732 // given EFL window's type is not notification type.
733 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
737 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
739 utilx_set_system_notification_level(_eflutil.x11.dpy,
742 return EFL_UTIL_ERROR_NONE;
745 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
746 #endif /* end of X11 */
750 Ecore_Wl_Window *wlwin;
751 struct wl_surface *surface;
752 Efl_Util_Wl_Surface_Lv_Info *lv_info;
753 Ecore_Wl_Window_Type wl_type;
756 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
758 wlwin = elm_win_wl_window_get(window);
759 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
761 type = elm_win_type_get(window);
762 if (type != ELM_WIN_NOTIFICATION)
764 wl_type = ecore_wl_window_type_get(wlwin);
765 EINA_SAFETY_ON_FALSE_RETURN_VAL((wl_type == ECORE_WL_WINDOW_TYPE_NOTIFICATION),
766 EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
769 while (!_eflutil.wl.policy.proto)
770 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
772 surface = ecore_wl_window_surface_get(wlwin);
773 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
774 EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
776 lv_info = eina_hash_find(_eflutil.wl.policy.hash_noti_lv, &surface);
779 lv_info = calloc(1, sizeof(Efl_Util_Wl_Surface_Lv_Info));
780 EINA_SAFETY_ON_NULL_RETURN_VAL(lv_info, EFL_UTIL_ERROR_OUT_OF_MEMORY);
782 lv_info->surface = surface;
783 lv_info->level = (int)level;
784 lv_info->wait_for_done = EINA_TRUE;
785 lv_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
786 eina_hash_add(_eflutil.wl.policy.hash_noti_lv,
790 evas_object_event_callback_add(window, EVAS_CALLBACK_DEL,
791 _cb_window_del, lv_info);
795 lv_info->level = (int)level;
796 lv_info->wait_for_done = EINA_TRUE;
797 lv_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
801 tizen_policy_set_notification_level(_eflutil.wl.policy.proto,
802 surface, (int)level);
804 if (lv_info->wait_for_done)
807 while (lv_info->wait_for_done && (count < 3))
810 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
814 if (lv_info->wait_for_done)
816 return EFL_UTIL_ERROR_INVALID_PARAMETER;
820 if (lv_info->state == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
822 return EFL_UTIL_ERROR_PERMISSION_DENIED;
827 return EFL_UTIL_ERROR_NONE;
828 #endif /* end of WAYLAND */
832 efl_util_get_notification_window_level(Evas_Object *window,
833 efl_util_notification_level_e *level)
837 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
838 EINA_SAFETY_ON_NULL_RETURN_VAL(level, EFL_UTIL_ERROR_INVALID_PARAMETER);
841 Ecore_X_Window_Type window_type;
842 Utilx_Notification_Level utilx_level;
846 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
848 xwin = elm_win_xwindow_get(window);
851 if (ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE)
853 // success to get window type
854 if (window_type != ECORE_X_WINDOW_TYPE_NOTIFICATION)
856 // given EFL window's type is not notification type.
857 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
860 utilx_level = utilx_get_system_notification_level(_eflutil.x11.dpy, xwin);
861 if (utilx_level == UTILX_NOTIFICATION_LEVEL_LOW)
862 *level = EFL_UTIL_NOTIFICATION_LEVEL_1;
863 else if(utilx_level == UTILX_NOTIFICATION_LEVEL_NORMAL)
864 *level = EFL_UTIL_NOTIFICATION_LEVEL_2;
865 else if(utilx_level == UTILX_NOTIFICATION_LEVEL_HIGH)
866 *level = EFL_UTIL_NOTIFICATION_LEVEL_3;
868 return EFL_UTIL_ERROR_INVALID_PARAMETER;
871 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
873 return EFL_UTIL_ERROR_NONE;
876 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
877 #endif /* end of X11 */
881 Ecore_Wl_Window *wlwin;
882 struct wl_surface *surface;
883 Efl_Util_Wl_Surface_Lv_Info *lv_info;
884 Ecore_Wl_Window_Type wl_type;
887 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
889 wlwin = elm_win_wl_window_get(window);
890 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
892 type = elm_win_type_get(window);
893 if (type != ELM_WIN_NOTIFICATION)
895 wl_type = ecore_wl_window_type_get(wlwin);
896 EINA_SAFETY_ON_FALSE_RETURN_VAL((wl_type == ECORE_WL_WINDOW_TYPE_NOTIFICATION),
897 EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
900 while (!_eflutil.wl.policy.proto)
901 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
903 surface = ecore_wl_window_surface_get(wlwin);
904 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
905 EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
907 lv_info = eina_hash_find(_eflutil.wl.policy.hash_noti_lv, &surface);
910 if (lv_info->wait_for_done)
913 while ((lv_info->wait_for_done) && (count < 3))
916 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
920 if (lv_info->wait_for_done)
922 *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
923 return EFL_UTIL_ERROR_INVALID_PARAMETER;
927 switch (lv_info->level)
929 case TIZEN_POLICY_LEVEL_1: *level = EFL_UTIL_NOTIFICATION_LEVEL_1; break;
930 case TIZEN_POLICY_LEVEL_2: *level = EFL_UTIL_NOTIFICATION_LEVEL_2; break;
931 case TIZEN_POLICY_LEVEL_3: *level = EFL_UTIL_NOTIFICATION_LEVEL_3; break;
932 case TIZEN_POLICY_LEVEL_NONE: *level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; break;
933 case TIZEN_POLICY_LEVEL_DEFAULT: *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT; break;
934 case TIZEN_POLICY_LEVEL_MEDIUM: *level = EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM; break;
935 case TIZEN_POLICY_LEVEL_HIGH: *level = EFL_UTIL_NOTIFICATION_LEVEL_HIGH; break;
936 case TIZEN_POLICY_LEVEL_TOP: *level = EFL_UTIL_NOTIFICATION_LEVEL_TOP; break;
937 default: *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
938 return EFL_UTIL_ERROR_INVALID_PARAMETER;
940 return EFL_UTIL_ERROR_NONE;
943 *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
945 return EFL_UTIL_ERROR_NONE;
946 #endif /* end of WAYLAND */
950 efl_util_set_notification_window_level_error_cb(Evas_Object *window,
951 efl_util_notification_window_level_error_cb callback,
954 Eina_Bool ret = EINA_FALSE;
956 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
957 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EFL_UTIL_ERROR_INVALID_PARAMETER);
959 ret = _cb_info_add(window,
960 (Efl_Util_Cb)callback,
963 if (!ret) return EFL_UTIL_ERROR_OUT_OF_MEMORY;
966 if (!_eflutil.cb_handler[CBH_NOTI_LEV].atom)
967 _eflutil.cb_handler[CBH_NOTI_LEV].atom = ecore_x_atom_get("_E_NOTIFICATION_LEVEL_ACCESS_RESULT");
968 #endif /* end of X11 */
970 return EFL_UTIL_ERROR_NONE;
974 efl_util_unset_notification_window_level_error_cb(Evas_Object *window)
976 Eina_Bool ret = EINA_FALSE;
978 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
980 ret = _cb_info_del_by_win(window, CBH_NOTI_LEV);
981 if (!ret) return EFL_UTIL_ERROR_INVALID_PARAMETER;
983 return EFL_UTIL_ERROR_NONE;
987 efl_util_set_window_opaque_state(Evas_Object *window,
992 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
993 EINA_SAFETY_ON_FALSE_RETURN_VAL(((opaque >= 0) && (opaque <= 1)),
994 EFL_UTIL_ERROR_INVALID_PARAMETER);
998 Utilx_Opaque_State state;
1002 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1004 xwin = elm_win_xwindow_get(window);
1005 EINA_SAFETY_ON_FALSE_RETURN_VAL(xwin > 0, EFL_UTIL_ERROR_INVALID_PARAMETER);
1008 state = UTILX_OPAQUE_STATE_ON;
1010 state = UTILX_OPAQUE_STATE_OFF;
1012 ret = utilx_set_window_opaque_state(_eflutil.x11.dpy,
1017 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1019 return EFL_UTIL_ERROR_NONE;
1020 #endif /* end of X11 */
1023 Ecore_Wl_Window *wlwin;
1024 struct wl_surface *surface;
1026 if (!_eflutil.wl.policy.proto)
1031 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1033 while (!_eflutil.wl.policy.proto && ret != -1)
1034 ret = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1036 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.policy.proto, EFL_UTIL_ERROR_INVALID_PARAMETER);
1039 wlwin = elm_win_wl_window_get(window);
1041 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
1043 surface = ecore_wl_window_surface_get(wlwin);
1045 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
1047 tizen_policy_set_opaque_state(_eflutil.wl.policy.proto, surface, opaque);
1049 return EFL_UTIL_ERROR_NONE;
1050 #endif /* end of WAYLAND */
1054 efl_util_set_window_screen_mode(Evas_Object *window,
1055 efl_util_screen_mode_e mode)
1057 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
1058 EINA_SAFETY_ON_FALSE_RETURN_VAL(((mode >= EFL_UTIL_SCREEN_MODE_DEFAULT) &&
1059 (mode <= EFL_UTIL_SCREEN_MODE_ALWAYS_ON)),
1060 EFL_UTIL_ERROR_INVALID_PARAMETER);
1067 e = evas_object_evas_get(window);
1068 EINA_SAFETY_ON_NULL_RETURN_VAL(e, EFL_UTIL_ERROR_INVALID_PARAMETER);
1070 ee = ecore_evas_ecore_evas_get(e);
1071 EINA_SAFETY_ON_NULL_RETURN_VAL(ee, EFL_UTIL_ERROR_INVALID_PARAMETER);
1073 id = ecore_evas_aux_hint_id_get(ee, "wm.policy.win.lcd.lock");
1074 if (mode == EFL_UTIL_SCREEN_MODE_ALWAYS_ON)
1077 ecore_evas_aux_hint_add(ee, "wm.policy.win.lcd.lock", "1");
1079 ecore_evas_aux_hint_val_set(ee, id, "1");
1081 else if (mode == EFL_UTIL_SCREEN_MODE_DEFAULT)
1084 ecore_evas_aux_hint_add(ee, "wm.policy.win.lcd.lock", "0");
1086 ecore_evas_aux_hint_val_set(ee, id, "0");
1089 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1091 return EFL_UTIL_ERROR_NONE;
1092 #endif /* end of X11 */
1095 Ecore_Wl_Window *wlwin;
1096 struct wl_surface *surface;
1097 Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
1101 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1103 wlwin = elm_win_wl_window_get(window);
1106 while (!_eflutil.wl.policy.proto)
1107 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1109 surface = ecore_wl_window_surface_get(wlwin);
1110 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
1111 EFL_UTIL_ERROR_INVALID_PARAMETER);
1113 scr_mode_info = eina_hash_find(_eflutil.wl.policy.hash_scr_mode, &surface);
1116 scr_mode_info = calloc(1, sizeof(Efl_Util_Wl_Surface_Scr_Mode_Info));
1117 EINA_SAFETY_ON_NULL_RETURN_VAL(scr_mode_info, EFL_UTIL_ERROR_OUT_OF_MEMORY);
1119 scr_mode_info->surface = surface;
1120 scr_mode_info->mode = (unsigned int)mode;
1121 scr_mode_info->wait_for_done = EINA_TRUE;
1122 scr_mode_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
1124 eina_hash_add(_eflutil.wl.policy.hash_scr_mode,
1130 scr_mode_info->mode = (unsigned int)mode;
1131 scr_mode_info->wait_for_done = EINA_TRUE;
1132 scr_mode_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
1135 tizen_policy_set_window_screen_mode(_eflutil.wl.policy.proto,
1136 surface, (unsigned int)mode);
1137 if (scr_mode_info->wait_for_done)
1140 while (scr_mode_info->wait_for_done && (count < 3))
1143 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1147 if (scr_mode_info->wait_for_done)
1149 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1153 if (scr_mode_info->state == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
1155 return EFL_UTIL_ERROR_PERMISSION_DENIED;
1160 return EFL_UTIL_ERROR_NONE;
1163 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1164 #endif /* end of WAYLAND */
1168 efl_util_get_window_screen_mode(Evas_Object *window,
1169 efl_util_screen_mode_e *mode)
1171 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
1172 EINA_SAFETY_ON_NULL_RETURN_VAL(mode, EFL_UTIL_ERROR_INVALID_PARAMETER);
1180 e = evas_object_evas_get(window);
1181 EINA_SAFETY_ON_NULL_RETURN_VAL(e, EFL_UTIL_ERROR_INVALID_PARAMETER);
1183 ee = ecore_evas_ecore_evas_get(e);
1184 EINA_SAFETY_ON_NULL_RETURN_VAL(ee, EFL_UTIL_ERROR_INVALID_PARAMETER);
1186 id = ecore_evas_aux_hint_id_get(ee, "wm.policy.win.lcd.lock");
1187 EINA_SAFETY_ON_TRUE_RETURN_VAL((id == -1), EFL_UTIL_ERROR_INVALID_PARAMETER);
1189 str = ecore_evas_aux_hint_val_get(ee, id);
1190 EINA_SAFETY_ON_NULL_RETURN_VAL(str, EFL_UTIL_ERROR_INVALID_PARAMETER);
1192 if (strncmp(str, "1", strlen("1")) == 0)
1193 *mode = EFL_UTIL_SCREEN_MODE_ALWAYS_ON;
1195 *mode = EFL_UTIL_SCREEN_MODE_DEFAULT;
1197 return EFL_UTIL_ERROR_NONE;
1198 #endif /* end of X11 */
1201 Ecore_Wl_Window *wlwin;
1202 struct wl_surface *surface;
1203 Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
1207 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1209 wlwin = elm_win_wl_window_get(window);
1212 while (!_eflutil.wl.policy.proto)
1213 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1215 surface = ecore_wl_window_surface_get(wlwin);
1216 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
1217 EFL_UTIL_ERROR_INVALID_PARAMETER);
1219 scr_mode_info = eina_hash_find(_eflutil.wl.policy.hash_scr_mode, &surface);
1222 if (scr_mode_info->wait_for_done)
1224 while (scr_mode_info->wait_for_done)
1227 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1231 switch (scr_mode_info->mode)
1233 case TIZEN_POLICY_MODE_DEFAULT: *mode = EFL_UTIL_SCREEN_MODE_DEFAULT; break;
1234 case TIZEN_POLICY_MODE_ALWAYS_ON: *mode = EFL_UTIL_SCREEN_MODE_ALWAYS_ON; break;
1235 default: *mode = EFL_UTIL_SCREEN_MODE_DEFAULT;
1236 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1238 return EFL_UTIL_ERROR_NONE;
1242 *mode = EFL_UTIL_SCREEN_MODE_DEFAULT;
1243 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1247 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1248 #endif /* end of WAYLAND */
1251 #ifndef TIZEN_WEARABLE
1253 efl_util_set_window_screen_mode_error_cb(Evas_Object *window,
1254 efl_util_window_screen_mode_error_cb callback,
1257 Eina_Bool ret = EINA_FALSE;
1259 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
1260 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EFL_UTIL_ERROR_INVALID_PARAMETER);
1262 ret = _cb_info_add(window,
1263 (Efl_Util_Cb)callback,
1266 if (!ret) return EFL_UTIL_ERROR_OUT_OF_MEMORY;
1269 if (!_eflutil.cb_handler[CBH_SCR_MODE].atom)
1270 _eflutil.cb_handler[CBH_SCR_MODE].atom = ecore_x_atom_get("_E_SCREEN_MODE_ACCESS_RESULT");
1271 #endif /* end of X11 */
1273 return EFL_UTIL_ERROR_NONE;
1277 efl_util_unset_window_screen_mode_error_cb(Evas_Object *window)
1279 Eina_Bool ret = EINA_FALSE;
1281 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
1283 ret = _cb_info_del_by_win(window, CBH_SCR_MODE);
1284 if (!ret) return EFL_UTIL_ERROR_INVALID_PARAMETER;
1286 return EFL_UTIL_ERROR_NONE;
1291 efl_util_set_window_brightness(Evas_Object *window, int brightness)
1293 Ecore_Wl_Window *wlwin;
1294 struct wl_surface *surface;
1295 Efl_Util_Wl_Surface_Brightness_Info *brightness_info;
1298 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
1299 EINA_SAFETY_ON_FALSE_RETURN_VAL(brightness <= 100, EFL_UTIL_ERROR_INVALID_PARAMETER);
1302 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1304 wlwin = elm_win_wl_window_get(window);
1307 while (!_eflutil.wl.display_policy.proto)
1308 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1310 surface = ecore_wl_window_surface_get(wlwin);
1311 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
1312 EFL_UTIL_ERROR_INVALID_PARAMETER);
1314 brightness_info = eina_hash_find(_eflutil.wl.display_policy.hash_brightness, &surface);
1315 if (!brightness_info)
1317 brightness_info = calloc(1, sizeof(Efl_Util_Wl_Surface_Brightness_Info));
1318 EINA_SAFETY_ON_NULL_RETURN_VAL(brightness_info, EFL_UTIL_ERROR_OUT_OF_MEMORY);
1320 brightness_info->surface = surface;
1321 brightness_info->brightness = brightness;
1322 brightness_info->wait_for_done = EINA_TRUE;
1323 brightness_info->state = TIZEN_DISPLAY_POLICY_ERROR_STATE_NONE;
1325 eina_hash_add(_eflutil.wl.display_policy.hash_brightness,
1331 brightness_info->brightness = brightness;
1332 brightness_info->wait_for_done = EINA_TRUE;
1333 brightness_info->state = TIZEN_DISPLAY_POLICY_ERROR_STATE_NONE;
1336 tizen_display_policy_set_window_brightness(_eflutil.wl.display_policy.proto,
1337 surface, brightness);
1338 if (brightness_info->wait_for_done)
1341 while (brightness_info->wait_for_done && (count < 3))
1344 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1348 if (brightness_info->wait_for_done)
1350 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1354 if (brightness_info->state == TIZEN_DISPLAY_POLICY_ERROR_STATE_PERMISSION_DENIED)
1356 return EFL_UTIL_ERROR_PERMISSION_DENIED;
1360 return EFL_UTIL_ERROR_NONE;
1363 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1367 efl_util_get_window_brightness(Evas_Object *window, int *brightness)
1369 Ecore_Wl_Window *wlwin;
1370 struct wl_surface *surface;
1371 Efl_Util_Wl_Surface_Brightness_Info *brightness_info;
1374 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
1375 EINA_SAFETY_ON_NULL_RETURN_VAL(brightness, EFL_UTIL_ERROR_INVALID_PARAMETER);
1378 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1380 wlwin = elm_win_wl_window_get(window);
1381 if (!wlwin) return EFL_UTIL_ERROR_INVALID_PARAMETER;
1383 while (!_eflutil.wl.display_policy.proto)
1384 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1386 surface = ecore_wl_window_surface_get(wlwin);
1387 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
1388 EFL_UTIL_ERROR_INVALID_PARAMETER);
1390 brightness_info = eina_hash_find(_eflutil.wl.display_policy.hash_brightness, &surface);
1391 if (brightness_info)
1393 if (brightness_info->wait_for_done)
1395 while (brightness_info->wait_for_done)
1398 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1401 *brightness = brightness_info->brightness;
1406 return EFL_UTIL_ERROR_NONE;
1410 struct _efl_util_inputgen_h
1412 unsigned int init_type;
1417 _cb_device_add(void *data EINA_UNUSED,
1418 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED,
1419 uint32_t serial EINA_UNUSED,
1420 const char *identifier EINA_UNUSED,
1421 struct tizen_input_device *device EINA_UNUSED,
1422 struct wl_seat *seat EINA_UNUSED)
1428 _cb_device_remove(void *data EINA_UNUSED,
1429 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED,
1430 uint32_t serial EINA_UNUSED,
1431 const char *identifier EINA_UNUSED,
1432 struct tizen_input_device *device EINA_UNUSED,
1433 struct wl_seat *seat EINA_UNUSED)
1439 _cb_error(void *data EINA_UNUSED,
1440 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED,
1443 _eflutil.wl.devmgr.request_notified = errorcode;
1447 _cb_block_expired(void *data EINA_UNUSED,
1448 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED)
1452 #endif /* end of WAYLAND */
1454 static efl_util_error_e
1455 _efl_util_input_convert_input_generator_error(int ret)
1459 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE:
1460 return EFL_UTIL_ERROR_NONE;
1461 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_PERMISSION:
1462 return EFL_UTIL_ERROR_PERMISSION_DENIED;
1463 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_SYSTEM_RESOURCES:
1464 return EFL_UTIL_ERROR_OUT_OF_MEMORY;
1465 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER:
1466 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1468 return EFL_UTIL_ERROR_NONE;
1472 API efl_util_inputgen_h
1473 efl_util_input_initialize_generator(efl_util_input_device_type_e dev_type)
1475 int ret = EFL_UTIL_ERROR_NONE;
1476 efl_util_inputgen_h inputgen_h = NULL;
1478 if ((dev_type <= EFL_UTIL_INPUT_DEVTYPE_NONE) ||
1479 (dev_type >= EFL_UTIL_INPUT_DEVTYPE_MAX))
1481 set_last_result(EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1485 inputgen_h = (efl_util_inputgen_h)calloc(1, sizeof(struct _efl_util_inputgen_h));
1488 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
1492 inputgen_h->init_type |= dev_type;
1495 if (ret == (int)EINA_FALSE)
1497 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
1501 while (!_eflutil.wl.devmgr.devicemgr)
1502 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1504 tizen_input_device_manager_init_generator(_eflutil.wl.devmgr.devicemgr);
1506 while (_eflutil.wl.devmgr.request_notified == -1)
1507 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1509 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1510 _eflutil.wl.devmgr.request_notified = -1;
1512 set_last_result(ret);
1513 if (ret != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE)
1529 efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h)
1531 int ret = EFL_UTIL_ERROR_NONE;
1532 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1538 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1540 tizen_input_device_manager_deinit_generator(_eflutil.wl.devmgr.devicemgr);
1542 while (_eflutil.wl.devmgr.request_notified == -1)
1543 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1545 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1546 _eflutil.wl.devmgr.request_notified = -1;
1553 efl_util_input_generate_key(efl_util_inputgen_h inputgen_h, const char *key_name, int pressed)
1555 int ret = EFL_UTIL_ERROR_NONE;
1557 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1558 EINA_SAFETY_ON_NULL_RETURN_VAL(key_name, EFL_UTIL_ERROR_INVALID_PARAMETER);
1559 EINA_SAFETY_ON_FALSE_RETURN_VAL(pressed == 0 || pressed == 1, EFL_UTIL_ERROR_INVALID_PARAMETER);
1560 EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_KEYBOARD, EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1563 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1565 tizen_input_device_manager_generate_key(_eflutil.wl.devmgr.devicemgr, key_name, pressed);
1567 while (_eflutil.wl.devmgr.request_notified == -1)
1568 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1570 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1571 _eflutil.wl.devmgr.request_notified = -1;
1578 efl_util_input_generate_touch(efl_util_inputgen_h inputgen_h, int idx,
1579 efl_util_input_touch_type_e touch_type, int x, int y)
1583 enum tizen_input_device_manager_pointer_event_type type;
1586 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1587 EINA_SAFETY_ON_FALSE_RETURN_VAL(idx >= 0, EFL_UTIL_ERROR_INVALID_PARAMETER);
1588 EINA_SAFETY_ON_FALSE_RETURN_VAL((x > 0 && y > 0), EFL_UTIL_ERROR_INVALID_PARAMETER);
1589 EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1592 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1596 case EFL_UTIL_INPUT_TOUCH_BEGIN:
1597 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN;
1599 case EFL_UTIL_INPUT_TOUCH_UPDATE:
1600 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE;
1602 case EFL_UTIL_INPUT_TOUCH_END:
1603 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END;
1606 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1609 tizen_input_device_manager_generate_touch(_eflutil.wl.devmgr.devicemgr, type, x, y, idx);
1611 while (_eflutil.wl.devmgr.request_notified == -1)
1612 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1614 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1615 _eflutil.wl.devmgr.request_notified = -1;
1621 struct _efl_util_screenshot_h
1627 Ecore_X_Display *dpy;
1628 int internal_display;
1643 int eventBase, errorBase;
1644 int dri2Major, dri2Minor;
1645 char *driver_name, *device_name;
1652 Eina_Bool shot_done;
1658 /* scrrenshot handle */
1659 static efl_util_screenshot_h g_screenshot;
1662 #define FOURCC(a,b,c,d) (((unsigned)d&0xff)<<24 | ((unsigned)c&0xff)<<16 | ((unsigned)b&0xff)<<8 | ((unsigned)a&0xff))
1663 #define FOURCC_RGB32 FOURCC('R','G','B','4')
1664 #define TIMEOUT_CAPTURE 3
1666 /* x error handling */
1667 static Bool g_efl_util_x_error_caught;
1670 _efl_util_screenshot_x_error_handle(Display *dpy, XErrorEvent *ev)
1672 if (!g_screenshot || (dpy != g_screenshot->dpy))
1675 g_efl_util_x_error_caught = True;
1681 _efl_util_screenshot_get_port(Display *dpy, unsigned int id, Window win)
1683 unsigned int ver, rev, req_base, evt_base, err_base;
1684 unsigned int adaptors;
1685 XvAdaptorInfo *ai = NULL;
1686 XvImageFormatValues *fo = NULL;
1690 if (XvQueryExtension(dpy, &ver, &rev, &req_base, &evt_base, &err_base) != Success)
1692 fprintf(stderr, "[screenshot] fail: no XV extension. \n");
1696 if (XvQueryAdaptors(dpy, win, &adaptors, &ai) != Success)
1698 fprintf(stderr, "[screenshot] fail: query adaptors. \n");
1702 EINA_SAFETY_ON_NULL_RETURN_VAL(ai, -1);
1704 for (i = 0; i < adaptors; i++)
1706 int support_format = False;
1708 if (!(ai[i].type & XvInputMask) ||
1709 !(ai[i].type & XvStillMask))
1714 fo = XvListImageFormats(dpy, p, &formats);
1715 for (j = 0; j < formats; j++)
1716 if (fo[j].id == (int)id)
1717 support_format = True;
1722 if (!support_format)
1725 for (; p < ai[i].base_id + ai[i].num_ports; p++)
1727 if (XvGrabPort(dpy, p, 0) == Success)
1729 XvFreeAdaptorInfo(ai);
1735 XvFreeAdaptorInfo(ai);
1743 _efl_util_screenshot_get_best_size(Display *dpy, int port, int width, int height, unsigned int *best_width, unsigned int *best_height)
1745 XErrorHandler old_handler = NULL;
1747 Atom atom_capture = XInternAtom(dpy, "_USER_WM_PORT_ATTRIBUTE_CAPTURE", False);
1749 g_efl_util_x_error_caught = False;
1750 old_handler = XSetErrorHandler(_efl_util_screenshot_x_error_handle);
1752 XvSetPortAttribute(dpy, port, atom_capture, 1);
1755 g_efl_util_x_error_caught = False;
1756 XSetErrorHandler(old_handler);
1758 XvQueryBestSize(dpy, port, 0, 0, 0, width, height, best_width, best_height);
1759 if (best_width <= 0 || best_height <= 0)
1766 API efl_util_screenshot_h
1767 efl_util_screenshot_initialize(int width, int height)
1770 efl_util_screenshot_h screenshot = NULL;
1772 int damage_err_base = 0;
1773 unsigned int best_width = 0;
1774 unsigned int best_height = 0;
1776 EINA_SAFETY_ON_FALSE_GOTO(width > 0, fail_param);
1777 EINA_SAFETY_ON_FALSE_GOTO(height > 0, fail_param);
1779 if (g_screenshot != NULL)
1781 if (g_screenshot->width != width || g_screenshot->height != height)
1783 // TODO: recreate pixmap and update information
1784 if (!_efl_util_screenshot_get_best_size(screenshot->dpy, screenshot->port, width, height, &best_width, &best_height))
1786 set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL);
1790 g_screenshot->width = width;
1791 g_screenshot->height = height;
1794 return g_screenshot;
1797 screenshot = calloc(1, sizeof(struct _efl_util_screenshot_h));
1798 EINA_SAFETY_ON_NULL_GOTO(screenshot, fail_memory);
1801 screenshot->dpy = ecore_x_display_get();
1802 if (!screenshot->dpy)
1804 screenshot->dpy = XOpenDisplay(0);
1805 EINA_SAFETY_ON_NULL_GOTO(screenshot, fail_init);
1807 /* for XCloseDisplay at denitialization */
1808 screenshot->internal_display = 1;
1812 screenshot->screen = DefaultScreen(screenshot->dpy);
1814 /* set root window */
1815 screenshot->root = DefaultRootWindow(screenshot->dpy);
1817 /* initialize capture adaptor */
1818 screenshot->port = _efl_util_screenshot_get_port(screenshot->dpy, FOURCC_RGB32, screenshot->root);
1819 EINA_SAFETY_ON_FALSE_GOTO(screenshot->port > 0, fail_init);
1821 /* get the best size */
1822 _efl_util_screenshot_get_best_size(screenshot->dpy, screenshot->port, width, height, &best_width, &best_height);
1823 EINA_SAFETY_ON_FALSE_GOTO(best_width > 0, fail_init);
1824 EINA_SAFETY_ON_FALSE_GOTO(best_height > 0, fail_init);
1826 /* set the width and the height */
1827 screenshot->width = best_width;
1828 screenshot->height = best_height;
1830 /* create a pixmap */
1831 depth = DefaultDepth(screenshot->dpy, screenshot->screen);
1832 screenshot->pixmap = XCreatePixmap(screenshot->dpy, screenshot->root, screenshot->width, screenshot->height, depth);
1833 EINA_SAFETY_ON_FALSE_GOTO(screenshot->pixmap > 0, fail_init);
1835 screenshot->gc = XCreateGC(screenshot->dpy, screenshot->pixmap, 0, 0);
1836 EINA_SAFETY_ON_NULL_GOTO(screenshot->gc, fail_init);
1838 XSetForeground(screenshot->dpy, screenshot->gc, 0xFF000000);
1839 XFillRectangle(screenshot->dpy, screenshot->pixmap, screenshot->gc, 0, 0, width, height);
1841 /* initialize damage */
1842 if (!XDamageQueryExtension(screenshot->dpy, &screenshot->damage_base, &damage_err_base))
1845 screenshot->damage = XDamageCreate(screenshot->dpy, screenshot->pixmap, XDamageReportNonEmpty);
1846 EINA_SAFETY_ON_FALSE_GOTO(screenshot->damage > 0, fail_init);
1848 /* initialize dri3 and dri2 */
1849 if (!DRI2QueryExtension(screenshot->dpy, &screenshot->eventBase, &screenshot->errorBase))
1851 fprintf(stderr, "[screenshot] fail: DRI2QueryExtention\n");
1855 if (!DRI2QueryVersion(screenshot->dpy, &screenshot->dri2Major, &screenshot->dri2Minor))
1857 fprintf(stderr, "[screenshot] fail: DRI2QueryVersion\n");
1861 if (!DRI2Connect(screenshot->dpy, screenshot->root, &screenshot->driver_name, &screenshot->device_name))
1863 fprintf(stderr, "[screenshot] fail: DRI2Connect\n");
1867 screenshot->drm_fd = open(screenshot->device_name, O_RDWR);
1868 EINA_SAFETY_ON_FALSE_GOTO(screenshot->drm_fd >= 0, fail_init);
1870 if (drmGetMagic(screenshot->drm_fd, &screenshot->magic))
1872 fprintf(stderr, "[screenshot] fail: drmGetMagic\n");
1876 if (!DRI2Authenticate(screenshot->dpy, screenshot->root, screenshot->magic))
1878 fprintf(stderr, "[screenshot] fail: DRI2Authenticate\n");
1882 if (!drmAuthMagic(screenshot->drm_fd, screenshot->magic))
1884 fprintf(stderr, "[screenshot] fail: drmAuthMagic\n");
1888 DRI2CreateDrawable(screenshot->dpy, screenshot->pixmap);
1891 screenshot->bufmgr = tbm_bufmgr_init(screenshot->drm_fd);
1892 EINA_SAFETY_ON_NULL_GOTO(screenshot->bufmgr, fail_init);
1894 XFlush(screenshot->dpy);
1896 g_screenshot = screenshot;
1897 set_last_result(EFL_UTIL_ERROR_NONE);
1899 return g_screenshot;
1903 efl_util_screenshot_h screenshot = NULL;
1905 if (!_eflutil.wl.shot.screenshooter)
1909 while (!_eflutil.wl.shot.screenshooter && ret != -1)
1910 ret = wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1911 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.screenshooter, fail_init);
1913 _eflutil.wl.shot.tbm_client = wayland_tbm_client_init(_eflutil.wl.dpy);
1914 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.tbm_client, fail_init);
1917 EINA_SAFETY_ON_FALSE_GOTO(width > 0, fail_param);
1918 EINA_SAFETY_ON_FALSE_GOTO(height > 0, fail_param);
1922 if (g_screenshot->width != width || g_screenshot->height != height)
1924 g_screenshot->width = width;
1925 g_screenshot->height = height;
1928 return g_screenshot;
1931 screenshot = calloc(1, sizeof(struct _efl_util_screenshot_h));
1932 EINA_SAFETY_ON_NULL_GOTO(screenshot, fail_memory);
1934 screenshot->width = width;
1935 screenshot->height = height;
1937 screenshot->bufmgr = wayland_tbm_client_get_bufmgr(_eflutil.wl.shot.tbm_client);
1938 EINA_SAFETY_ON_NULL_GOTO(screenshot->bufmgr, fail_init);
1940 g_screenshot = screenshot;
1941 set_last_result(EFL_UTIL_ERROR_NONE);
1943 screenshooter_set_user_data(_eflutil.wl.shot.screenshooter, &screenshot->shot_done);
1945 return g_screenshot;
1949 efl_util_screenshot_deinitialize(screenshot);
1950 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
1954 efl_util_screenshot_deinitialize(screenshot);
1955 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
1959 efl_util_screenshot_deinitialize(screenshot);
1960 set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL);
1965 efl_util_screenshot_deinitialize(efl_util_screenshot_h screenshot)
1969 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1972 if (screenshot->bufmgr)
1973 tbm_bufmgr_deinit(screenshot->bufmgr);
1975 DRI2DestroyDrawable(screenshot->dpy, screenshot->pixmap);
1978 if (screenshot->drm_fd)
1979 close(screenshot->drm_fd);
1980 if (screenshot->driver_name)
1981 free(screenshot->driver_name);
1982 if (screenshot->device_name)
1983 free(screenshot->device_name);
1986 if (screenshot->port > 0 && screenshot->pixmap > 0)
1987 XvStopVideo(screenshot->dpy, screenshot->port, screenshot->pixmap);
1990 if (screenshot->damage)
1991 XDamageDestroy(screenshot->dpy, screenshot->damage);
1995 XFreeGC(screenshot->dpy, screenshot->gc);
1998 if (screenshot->pixmap > 0)
1999 XFreePixmap(screenshot->dpy, screenshot->pixmap);
2002 if (screenshot->port > 0)
2003 XvUngrabPort(screenshot->dpy, screenshot->port, 0);
2005 XSync(screenshot->dpy, False);
2008 if (screenshot->internal_display ==1 && screenshot->dpy)
2009 XCloseDisplay(screenshot->dpy);
2012 g_screenshot = NULL;
2014 return EFL_UTIL_ERROR_NONE;
2018 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2021 g_screenshot = NULL;
2023 if (_eflutil.wl.shot.screenshooter)
2024 screenshooter_set_user_data(_eflutil.wl.shot.screenshooter, NULL);
2026 return EFL_UTIL_ERROR_NONE;
2032 efl_util_screenshot_take_tbm_surface(efl_util_screenshot_h screenshot)
2036 XErrorHandler old_handler = NULL;
2037 unsigned int attachment = DRI2BufferFrontLeft;
2039 DRI2Buffer *bufs = NULL;
2041 tbm_surface_h t_surface = NULL;
2044 tbm_surface_info_s surf_info;
2047 if (screenshot != g_screenshot)
2049 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
2053 /* for flush other pending requests and pending events */
2054 XSync(screenshot->dpy, 0);
2056 g_efl_util_x_error_caught = False;
2057 old_handler = XSetErrorHandler(_efl_util_screenshot_x_error_handle);
2060 XvPutStill(screenshot->dpy, screenshot->port, screenshot->pixmap, screenshot->gc,
2061 0, 0, screenshot->width, screenshot->height,
2062 0, 0, screenshot->width, screenshot->height);
2064 XSync(screenshot->dpy, 0);
2066 if (g_efl_util_x_error_caught)
2068 g_efl_util_x_error_caught = False;
2069 XSetErrorHandler(old_handler);
2073 g_efl_util_x_error_caught = False;
2074 XSetErrorHandler(old_handler);
2076 if (XPending(screenshot->dpy))
2077 XNextEvent(screenshot->dpy, &ev);
2080 int fd = ConnectionNumber(screenshot->dpy);
2089 tv.tv_sec = TIMEOUT_CAPTURE;
2091 ret = select(fd + 1, &mask, 0, 0, &tv);
2093 fprintf(stderr, "[screenshot] fail: select.\n");
2095 fprintf(stderr, "[screenshot] fail: timeout(%d sec)!\n", TIMEOUT_CAPTURE);
2096 else if (XPending(screenshot->dpy))
2097 XNextEvent(screenshot->dpy, &ev);
2099 fprintf(stderr, "[screenshot] fail: not passed a event!\n");
2102 /* check if the capture is done by xserver and pixmap has got the captured image */
2103 if (ev.type == (screenshot->damage_base + XDamageNotify))
2105 XDamageNotifyEvent *damage_ev = (XDamageNotifyEvent *)&ev;
2106 if (damage_ev->drawable == screenshot->pixmap)
2108 /* Get DRI2 FrontLeft buffer of the pixmap */
2109 bufs = DRI2GetBuffers(screenshot->dpy, screenshot->pixmap, &buf_width, &buf_height, &attachment, 1, &nbufs);
2112 fprintf(stderr, "[screenshot] fail: DRI2GetBuffers\n");
2116 t_bo = tbm_bo_import(screenshot->bufmgr, bufs[0].name);
2119 fprintf(stderr, "[screenshot] fail: import tbm_bo!\n");
2123 surf_info.width = buf_width;
2124 surf_info.height = buf_height;
2125 surf_info.format = TBM_FORMAT_XRGB8888;
2127 surf_info.size = bufs->pitch * surf_info.height;
2128 surf_info.num_planes = 1;
2129 for (i = 0; i < surf_info.num_planes; i++)
2131 surf_info.planes[i].size = bufs->pitch * surf_info.height;
2132 surf_info.planes[i].stride = bufs->pitch;
2133 surf_info.planes[i].offset = 0;
2135 t_surface = tbm_surface_internal_create_with_bos(&surf_info, &t_bo, 1);
2138 fprintf(stderr, "[screenshot] fail: get tbm_surface!\n");
2145 XDamageSubtract(screenshot->dpy, screenshot->damage, None, None );
2147 set_last_result(EFL_UTIL_ERROR_NONE);
2152 XDamageSubtract(screenshot->dpy, screenshot->damage, None, None );
2162 set_last_result(EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL);
2168 tbm_surface_h t_surface = NULL;
2169 struct wl_buffer *buffer = NULL;
2170 Efl_Util_Wl_Output_Info *output;
2173 if (screenshot != g_screenshot)
2175 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
2179 output = eina_list_nth(_eflutil.wl.shot.output_list, 0);
2182 fprintf(stderr, "[screenshot] fail: no output for screenshot\n");
2186 t_surface = tbm_surface_create(screenshot->width, screenshot->height, TBM_FORMAT_XRGB8888);
2189 fprintf(stderr, "[screenshot] fail: tbm_surface_create\n");
2193 buffer = wayland_tbm_client_create_buffer(_eflutil.wl.shot.tbm_client, t_surface);
2196 fprintf(stderr, "[screenshot] fail: create wl_buffer for screenshot\n");
2200 screenshooter_shoot(_eflutil.wl.shot.screenshooter, output->output, buffer);
2202 screenshot->shot_done = EINA_FALSE;
2203 while (!screenshot->shot_done && ret != -1)
2204 ret = wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
2208 fprintf(stderr, "[screenshot] fail: screenshooter_shoot\n");
2212 wl_buffer_destroy(buffer);
2214 /* reset shot_done for next screenshot */
2215 screenshot->shot_done = EINA_FALSE;
2221 tbm_surface_destroy(t_surface);
2223 wl_buffer_destroy(buffer);
2225 set_last_result(EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL);