2 * Copyright (c) 2011-2017 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.
19 #define LOG_TAG "TIZEN_N_EFL_UTIL"
26 #include <sys/types.h>
30 #include <tbm_bufmgr.h>
31 #include <tbm_surface.h>
32 #include <tbm_surface_internal.h>
33 #include <Elementary.h>
34 #include <Ecore_Evas.h>
37 #include <Ecore_Wl2.h>
38 #include <wayland-client.h>
39 #include <wayland-tbm-client.h>
40 #include <tizen-extension-client-protocol.h>
42 #include <efl_util_screenshot_extension.h>
49 #define LOG_TAG "TIZEN_N_EFL_UTIL"
50 #define EFL_UTIL_INPUT_GENERATOR_TOUCH_MAX_FINGER 10
52 #define NUM_EVENT_WAIT_DONE_COUNT 5
54 typedef struct _Efl_Util_Wl_Surface_Lv_Info
56 void *surface; /* wl_surface */
58 Eina_Bool wait_for_done;
60 } Efl_Util_Wl_Surface_Lv_Info;
62 typedef struct _Efl_Util_Wl_Surface_Scr_Mode_Info
64 void *surface; /* wl_surface */
66 Eina_Bool wait_for_done;
68 } Efl_Util_Wl_Surface_Scr_Mode_Info;
70 typedef struct _Efl_Util_Wl_Surface_Brightness_Info
72 void *surface; /* wl_surface */
74 Eina_Bool wait_for_done;
76 } Efl_Util_Wl_Surface_Brightness_Info;
78 typedef struct _Efl_Util_Wl_Output_Info
80 struct wl_output *output;
81 int offset_x, offset_y, width, height;
82 } Efl_Util_Wl_Output_Info;
84 typedef struct _Efl_Util_Gesture_Common_Grab_Data
87 } Efl_Util_Gesture_Common_Grab_Data;
89 typedef struct _Efl_Util_Gesture_Edge_Swipe_Grab_Data
91 Efl_Util_Gesture_Common_Grab_Data base;
94 efl_util_gesture_edge_e edge;
95 efl_util_gesture_edge_size_e edge_size;
96 unsigned int start_point;
97 unsigned int end_point;
98 } Efl_Util_Gesture_Edge_Swipe_Grab_Data;
100 typedef struct _Efl_Util_Gesture_Edge_Drag_Grab_Data
102 Efl_Util_Gesture_Common_Grab_Data base;
104 unsigned int fingers;
105 efl_util_gesture_edge_e edge;
106 efl_util_gesture_edge_size_e edge_size;
107 unsigned int start_point;
108 unsigned int end_point;
109 } Efl_Util_Gesture_Edge_Drag_Grab_Data;
111 typedef struct _Efl_Util_Gesture_Tap_Grab_Data
113 Efl_Util_Gesture_Common_Grab_Data base;
115 unsigned int fingers;
116 unsigned int repeats;
117 } Efl_Util_Gesture_Tap_Grab_Data;
119 typedef struct _Efl_Util_Gesture_Palm_Cover_Grab_Data
121 Efl_Util_Gesture_Common_Grab_Data base;
122 } Efl_Util_Gesture_Palm_Cover_Grab_Data;
124 typedef struct _E_Devicemgr_Inputgen_Touch_Axis
131 } E_Devicemgr_Inputgen_Touch_Axis;
133 typedef struct _Efl_Util_Data
135 /* wayland related stuffs */
139 Ecore_Wl2_Display *wl2_display;
140 struct wl_display *dpy;
141 struct wl_event_queue *queue;
146 struct tizen_policy *proto;
147 Eina_Hash *hash_noti_lv;
148 Eina_Hash *hash_scr_mode;
152 struct wl_event_queue *queue;
153 struct tizen_screenshooter *tz_screenshooter;
154 struct wayland_tbm_client *tbm_client;
155 Eina_List *output_list;
160 struct tizen_input_device_manager *devicemgr;
161 int request_notified;
163 Eina_List *wait_devices;
164 struct wl_event_source *wait_timer;
166 int request_touch_count;
171 struct tizen_display_policy *proto;
172 Eina_Hash *hash_brightness;
177 typedef struct _Efl_Util_Data_Default_Queue
179 /* wayland related stuffs */
183 Ecore_Wl2_Display *wl2_display;
184 struct wl_display *dpy;
189 struct tizen_gesture *proto;
190 int request_notified;
194 } Efl_Util_Data_Default_Queue;
197 static Efl_Util_Data _eflutil =
202 { 0, NULL, NULL, NULL }, /* tizen_policy protocol */
203 { NULL, NULL, NULL, NULL, 0 }, /* screenshooter protocol */
204 { NULL, -1, NULL, NULL, NULL, 0, 0 }, /* tizen_input_device_manager protocol */
205 { 0, NULL, NULL } /* display_policy protocol */
209 static Efl_Util_Data_Default_Queue _eflutil_defaultqueue =
214 { 0, NULL, -1, 0 } /* gesture protocol */
219 static Eina_Bool _wl_init(void);
220 static Eina_Bool _wl_init_default_queue(void);
221 static void _cb_wl_reg_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version);
222 static void _cb_wl_reg_global_remove(void *data, struct wl_registry *reg, unsigned int name);
223 static void _cb_wl_default_queue_reg_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version);
224 static void _cb_wl_default_queue_reg_global_remove(void *data, struct wl_registry *reg, unsigned int name);
225 static void _cb_wl_reg_screenshooter_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version);
226 static void _cb_wl_reg_screenshooter_global_remove(void *data, struct wl_registry *reg, unsigned int name);
227 static void _cb_wl_tz_policy_conformant(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t is_conformant);
228 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);
229 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);
230 static void _cb_wl_tz_policy_transient_for_done(void *data, struct tizen_policy *tizen_policy, uint32_t child_id);
231 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);
232 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);
233 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);
234 static void _cb_wl_tz_policy_allowed_aux_hint(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, int id);
235 static void _cb_wl_tz_policy_aux_message(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, const char *key, const char *val, struct wl_array *options);
236 static void _cb_wl_conformant_region(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, uint32_t serial);
238 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);
240 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);
241 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);
242 static void _cb_error(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, uint32_t errorcode);
243 static void _cb_block_expired(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED);
244 static void _cb_max_touch_count(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, uint32_t serial EINA_UNUSED, int32_t max_count EINA_UNUSED, struct wl_seat *seat EINA_UNUSED);
246 static void _cb_gesture_edge_swipe_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t fingers EINA_UNUSED, uint32_t edge EINA_UNUSED, uint32_t edge_size EINA_UNUSED, uint32_t start_point EINA_UNUSED, uint32_t end_point EINA_UNUSED, uint32_t error);
247 static void _cb_gesture_edge_swipe(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t mode, uint32_t fingers, int sx, int sy, uint32_t edge);
248 static void _cb_gesture_edge_drag_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t fingers EINA_UNUSED, uint32_t edge EINA_UNUSED, uint32_t edge_size EINA_UNUSED, uint32_t start_point EINA_UNUSED, uint32_t end_point EINA_UNUSED, uint32_t error);
249 static void _cb_gesture_edge_drag(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t mode, uint32_t fingers, int cx, int cy, uint32_t edge);
250 static void _cb_gesture_tap_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t fingers EINA_UNUSED, uint32_t repeats EINA_UNUSED, uint32_t error);
251 static void _cb_gesture_tap(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t mode, uint32_t fingers, uint32_t repeats);
252 static void _cb_gesture_palm_cover_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, struct wl_surface *surface EINA_UNUSED, uint32_t error);
253 static void _cb_gesture_palm_cover(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, struct wl_surface *surface EINA_UNUSED, uint32_t mode, uint32_t duration, int cx, int cy, uint32_t size, wl_fixed_t pressure);
254 static void _cb_gesture_activate_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, struct wl_surface *surface EINA_UNUSED, uint32_t type EINA_UNUSED, uint32_t active EINA_UNUSED, uint32_t error);
257 static const struct wl_registry_listener _wl_reg_listener =
260 _cb_wl_reg_global_remove
263 static const struct wl_registry_listener _wl_reg_screenshooter_listener =
265 _cb_wl_reg_screenshooter_global,
266 _cb_wl_reg_screenshooter_global_remove
269 struct tizen_policy_listener _wl_tz_policy_listener =
271 _cb_wl_tz_policy_conformant,
272 _cb_wl_tz_policy_conformant_area,
273 _cb_wl_tz_policy_notification_done,
274 _cb_wl_tz_policy_transient_for_done,
275 _cb_wl_tz_policy_scr_mode_done,
276 _cb_wl_tz_policy_iconify_state_changed,
277 _cb_wl_tz_policy_supported_aux_hints,
278 _cb_wl_tz_policy_allowed_aux_hint,
279 _cb_wl_tz_policy_aux_message,
280 _cb_wl_conformant_region,
283 struct tizen_input_device_manager_listener _wl_tz_devmgr_listener =
292 struct tizen_display_policy_listener _wl_tz_display_policy_listener =
294 _cb_wl_tz_display_policy_brightness_done,
297 static const struct wl_registry_listener _wl_default_queue_reg_listener =
299 _cb_wl_default_queue_reg_global,
300 _cb_wl_default_queue_reg_global_remove
303 struct tizen_gesture_listener _wl_tz_gesture_listener =
305 _cb_gesture_edge_swipe_notify,
306 _cb_gesture_edge_swipe,
307 _cb_gesture_edge_drag_notify,
308 _cb_gesture_edge_drag,
309 _cb_gesture_tap_notify,
311 _cb_gesture_palm_cover_notify,
312 _cb_gesture_palm_cover,
313 _cb_gesture_activate_notify
319 struct wl_display *display_wrapper = NULL;
320 struct wl_registry *reg = NULL;
322 if (_eflutil.wl.init) return EINA_TRUE;
326 _eflutil.wl.wl2_display = ecore_wl2_display_connect(NULL);
327 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.wl2_display, fail);
328 _eflutil.wl.dpy = ecore_wl2_display_get(_eflutil.wl.wl2_display);
329 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.dpy, fail);
331 display_wrapper = wl_proxy_create_wrapper(_eflutil.wl.dpy);
332 EINA_SAFETY_ON_NULL_GOTO(display_wrapper, fail);
334 _eflutil.wl.queue = wl_display_create_queue(_eflutil.wl.dpy);
335 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.queue, fail);
337 wl_proxy_set_queue((struct wl_proxy *)display_wrapper, _eflutil.wl.queue);
339 reg = wl_display_get_registry(display_wrapper);
340 wl_proxy_wrapper_destroy(display_wrapper);
341 display_wrapper = NULL;
342 EINA_SAFETY_ON_NULL_GOTO(reg, fail);
344 wl_registry_add_listener(reg, &_wl_reg_listener, NULL);
346 _eflutil.wl.init = EINA_TRUE;
351 wl_proxy_wrapper_destroy(display_wrapper);
353 if (_eflutil.wl.queue)
355 wl_event_queue_destroy(_eflutil.wl.queue);
356 _eflutil.wl.queue = NULL;
359 ecore_wl2_shutdown();
364 _wl_init_default_queue(void)
366 struct wl_display *display_wrapper = NULL;
367 struct wl_registry *reg = NULL;
369 if (_eflutil_defaultqueue.wl.init) return EINA_TRUE;
371 if (ecore_wl2_init() <= 0) return EINA_FALSE;
373 _eflutil_defaultqueue.wl.wl2_display = ecore_wl2_connected_display_get(NULL);
374 EINA_SAFETY_ON_NULL_GOTO(_eflutil_defaultqueue.wl.wl2_display, fail);
375 _eflutil_defaultqueue.wl.dpy = ecore_wl2_display_get(_eflutil_defaultqueue.wl.wl2_display);
376 EINA_SAFETY_ON_NULL_GOTO(_eflutil_defaultqueue.wl.dpy, fail);
378 display_wrapper = wl_proxy_create_wrapper(_eflutil_defaultqueue.wl.dpy);
379 EINA_SAFETY_ON_NULL_GOTO(display_wrapper, fail);
381 reg = wl_display_get_registry(display_wrapper);
382 wl_proxy_wrapper_destroy(display_wrapper);
383 display_wrapper = NULL;
384 EINA_SAFETY_ON_NULL_GOTO(reg, fail);
386 wl_registry_add_listener(reg, &_wl_default_queue_reg_listener, NULL);
388 _eflutil_defaultqueue.wl.init = EINA_TRUE;
393 ecore_wl2_shutdown();
398 _cb_wl_output_geometry(void *data, struct wl_output *wl_output, int x, int y,
399 int physical_width, int physical_height, int subpixel,
400 const char *make, const char *model, int transform)
402 Efl_Util_Wl_Output_Info *output = wl_output_get_user_data(wl_output);
403 if (wl_output == output->output)
405 output->offset_x = x;
406 output->offset_y = y;
411 _cb_wl_output_mode(void *data, struct wl_output *wl_output, uint32_t flags,
412 int width, int height, int refresh)
414 Efl_Util_Wl_Output_Info *output = wl_output_get_user_data(wl_output);
415 if (wl_output == output->output && (flags & WL_OUTPUT_MODE_CURRENT))
417 output->width = width;
418 output->height = height;
423 _cb_wl_output_done(void *data, struct wl_output *wl_output)
428 _cb_wl_output_scale(void *data, struct wl_output *wl_output, int32_t factor)
432 static const struct wl_output_listener output_listener =
434 _cb_wl_output_geometry,
441 _cb_tz_screenshot_format(void *data, struct tizen_screenshooter *tz_screenshooter, uint32_t format)
446 _cb_tz_screenshot_noti(void *data, struct tizen_screenshooter *tz_screenshooter, uint32_t noti)
448 _eflutil.wl.shot.noti = noti;
452 _cb_tz_screenshot_done(void *data, struct tizen_screenshooter *tz_screenshooter)
454 Eina_Bool *shot_done = (Eina_Bool*)data;
456 *shot_done = EINA_TRUE;
459 static const struct tizen_screenshooter_listener tz_screenshooter_listener =
461 _cb_tz_screenshot_format,
462 _cb_tz_screenshot_noti,
463 _cb_tz_screenshot_done,
467 _cb_wl_reg_global(void *data,
468 struct wl_registry *reg,
470 const char *interface,
471 unsigned int version)
473 if (!strcmp(interface, "tizen_policy"))
475 struct tizen_policy *proto;
476 proto = wl_registry_bind(reg,
478 &tizen_policy_interface,
482 tizen_policy_add_listener(proto,
483 &_wl_tz_policy_listener,
486 _eflutil.wl.policy.hash_noti_lv = eina_hash_pointer_new(free);
487 _eflutil.wl.policy.hash_scr_mode = eina_hash_pointer_new(free);
488 _eflutil.wl.policy.proto = proto;
489 _eflutil.wl.policy.id = id;
491 else if (strcmp(interface, "wl_output") == 0)
493 Efl_Util_Wl_Output_Info *output = calloc(1, sizeof(Efl_Util_Wl_Output_Info));
494 EINA_SAFETY_ON_NULL_RETURN(output);
496 _eflutil.wl.shot.output_list = eina_list_append(_eflutil.wl.shot.output_list, output);
498 output->output = wl_registry_bind(reg, id, &wl_output_interface, version);
499 wl_output_add_listener(output->output, &output_listener, output);
501 else if (strcmp(interface, "tizen_input_device_manager") == 0)
503 _eflutil.wl.devmgr.devicemgr = wl_registry_bind(reg, id, &tizen_input_device_manager_interface, version);
504 tizen_input_device_manager_add_listener(_eflutil.wl.devmgr.devicemgr, &_wl_tz_devmgr_listener, NULL);
506 else if (!strcmp(interface, "tizen_display_policy"))
508 _eflutil.wl.display_policy.proto = wl_registry_bind(reg, id, &tizen_display_policy_interface, version);
509 if (!_eflutil.wl.display_policy.proto) return;
511 tizen_display_policy_add_listener(_eflutil.wl.display_policy.proto,
512 &_wl_tz_display_policy_listener,
515 _eflutil.wl.display_policy.hash_brightness = eina_hash_pointer_new(free);
516 _eflutil.wl.display_policy.id = id;
519 /* LCOV_EXCL_START */
521 _cb_wl_reg_global_remove(void *data,
522 struct wl_registry *reg,
525 /* unset each global id number to 0 since global id is started
526 * from number 1 on server side display structure
528 if (id == _eflutil.wl.policy.id)
530 _eflutil.wl.policy.id = 0;
531 _eflutil.wl.policy.proto = NULL;
532 eina_hash_free(_eflutil.wl.policy.hash_noti_lv);
533 eina_hash_free(_eflutil.wl.policy.hash_scr_mode);
535 else if (id == _eflutil.wl.display_policy.id)
537 _eflutil.wl.display_policy.id = 0;
538 _eflutil.wl.display_policy.proto = NULL;
539 eina_hash_free(_eflutil.wl.display_policy.hash_brightness);
545 _cb_wl_default_queue_reg_global(void *data,
546 struct wl_registry *reg,
548 const char *interface,
549 unsigned int version)
551 if (strcmp(interface, "tizen_gesture") == 0)
553 _eflutil_defaultqueue.wl.gesture.id = id;
554 _eflutil_defaultqueue.wl.gesture.proto = wl_registry_bind(reg, id, &tizen_gesture_interface, version);
555 tizen_gesture_add_listener(_eflutil_defaultqueue.wl.gesture.proto, &_wl_tz_gesture_listener, NULL);
558 /* LCOV_EXCL_START */
560 _cb_wl_default_queue_reg_global_remove(void *data,
561 struct wl_registry *reg,
564 if (id == _eflutil_defaultqueue.wl.gesture.id)
566 _eflutil_defaultqueue.wl.gesture.id = 0;
567 _eflutil_defaultqueue.wl.gesture.proto = NULL;
574 _cb_wl_reg_screenshooter_global(void *data,
575 struct wl_registry *reg,
577 const char *interface,
578 unsigned int version)
580 if (strcmp(interface, "tizen_screenshooter") == 0)
582 _eflutil.wl.shot.tz_screenshooter = wl_registry_bind(reg, name, &tizen_screenshooter_interface, version);
583 tizen_screenshooter_add_listener(_eflutil.wl.shot.tz_screenshooter, &tz_screenshooter_listener, NULL);
585 wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
589 /* LCOV_EXCL_START */
591 _cb_wl_reg_screenshooter_global_remove(void *data,
592 struct wl_registry *reg,
598 _cb_wl_tz_policy_conformant(void *data, struct tizen_policy *tizen_policy,
599 struct wl_surface *surface, uint32_t is_conformant)
604 _cb_wl_tz_policy_conformant_area(void *data, struct tizen_policy *tizen_policy,
605 struct wl_surface *surface, uint32_t conformant_part,
606 uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
612 _cb_wl_tz_policy_notification_done(void *data,
613 struct tizen_policy *tizen_policy,
614 struct wl_surface *surface,
618 Efl_Util_Wl_Surface_Lv_Info *lv_info;
620 lv_info = eina_hash_find(_eflutil.wl.policy.hash_noti_lv, &surface);
623 lv_info->level = level;
624 lv_info->wait_for_done = EINA_FALSE;
625 lv_info->state = state;
629 /* LCOV_EXCL_START */
631 _cb_wl_tz_policy_transient_for_done(void *data, struct tizen_policy *tizen_policy, uint32_t child_id)
637 _cb_wl_tz_policy_scr_mode_done(void *data,
638 struct tizen_policy *tizen_policy,
639 struct wl_surface *surface,
643 Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
645 scr_mode_info = eina_hash_find(_eflutil.wl.policy.hash_scr_mode, &surface);
648 scr_mode_info->mode = mode;
649 scr_mode_info->wait_for_done = EINA_FALSE;
650 scr_mode_info->state = state;
654 /* LCOV_EXCL_START */
655 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)
659 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)
663 static void _cb_wl_tz_policy_allowed_aux_hint(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, int id)
667 static void _cb_wl_tz_policy_aux_message(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface_resource, const char *key, const char *val, struct wl_array *options)
670 static void _cb_wl_conformant_region(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, uint32_t serial)
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);
706 efl_util_set_notification_window_level(Evas_Object *window,
707 efl_util_notification_level_e level)
711 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
712 EINA_SAFETY_ON_FALSE_RETURN_VAL((level >= EFL_UTIL_NOTIFICATION_LEVEL_NONE) &&
713 (level <= EFL_UTIL_NOTIFICATION_LEVEL_TOP),
714 EFL_UTIL_ERROR_INVALID_PARAMETER);
717 Ecore_Wl2_Window *wlwin;
718 struct wl_surface *surface;
719 Efl_Util_Wl_Surface_Lv_Info *lv_info;
720 Ecore_Wl2_Window_Type wl_type;
723 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
725 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
726 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
728 type = elm_win_type_get(window);
729 if (type != ELM_WIN_NOTIFICATION)
731 wl_type = ecore_wl2_window_type_get(wlwin);
732 EINA_SAFETY_ON_FALSE_RETURN_VAL((wl_type == ECORE_WL2_WINDOW_TYPE_NOTIFICATION),
733 EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
736 while (!_eflutil.wl.policy.proto)
737 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
739 surface = ecore_wl2_window_surface_get(wlwin);
740 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
741 EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
743 lv_info = eina_hash_find(_eflutil.wl.policy.hash_noti_lv, &surface);
746 lv_info = calloc(1, sizeof(Efl_Util_Wl_Surface_Lv_Info));
747 EINA_SAFETY_ON_NULL_RETURN_VAL(lv_info, EFL_UTIL_ERROR_OUT_OF_MEMORY);
749 lv_info->surface = surface;
750 lv_info->level = (int)level;
751 lv_info->wait_for_done = EINA_TRUE;
752 lv_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
753 eina_hash_add(_eflutil.wl.policy.hash_noti_lv,
757 evas_object_event_callback_add(window, EVAS_CALLBACK_DEL,
758 _cb_window_del, lv_info);
762 lv_info->level = (int)level;
763 lv_info->wait_for_done = EINA_TRUE;
764 lv_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
768 tizen_policy_set_notification_level(_eflutil.wl.policy.proto,
769 surface, (int)level);
771 if (lv_info->wait_for_done)
774 while (lv_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT))
776 ecore_wl2_display_flush(_eflutil.wl.wl2_display);
777 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
781 if (lv_info->wait_for_done)
783 return EFL_UTIL_ERROR_INVALID_PARAMETER;
787 if (lv_info->state == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
789 return EFL_UTIL_ERROR_PERMISSION_DENIED;
794 return EFL_UTIL_ERROR_NONE;
798 efl_util_get_notification_window_level(Evas_Object *window,
799 efl_util_notification_level_e *level)
803 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
804 EINA_SAFETY_ON_NULL_RETURN_VAL(level, EFL_UTIL_ERROR_INVALID_PARAMETER);
807 Ecore_Wl2_Window *wlwin;
808 struct wl_surface *surface;
809 Efl_Util_Wl_Surface_Lv_Info *lv_info;
810 Ecore_Wl2_Window_Type wl_type;
813 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
815 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
816 EINA_SAFETY_ON_NULL_RETURN_VAL(wlwin, EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
818 type = elm_win_type_get(window);
819 if (type != ELM_WIN_NOTIFICATION)
821 wl_type = ecore_wl2_window_type_get(wlwin);
822 EINA_SAFETY_ON_FALSE_RETURN_VAL((wl_type == ECORE_WL2_WINDOW_TYPE_NOTIFICATION),
823 EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
826 while (!_eflutil.wl.policy.proto)
827 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
829 surface = ecore_wl2_window_surface_get(wlwin);
830 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
831 EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE);
833 lv_info = eina_hash_find(_eflutil.wl.policy.hash_noti_lv, &surface);
836 if (lv_info->wait_for_done)
839 while ((lv_info->wait_for_done) && (count < NUM_EVENT_WAIT_DONE_COUNT))
841 ecore_wl2_display_flush(_eflutil.wl.wl2_display);
842 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
846 if (lv_info->wait_for_done)
848 *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
849 return EFL_UTIL_ERROR_INVALID_PARAMETER;
853 switch (lv_info->level)
855 case TIZEN_POLICY_LEVEL_NONE: *level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; break;
856 case TIZEN_POLICY_LEVEL_DEFAULT: *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT; break;
857 case TIZEN_POLICY_LEVEL_MEDIUM: *level = EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM; break;
858 case TIZEN_POLICY_LEVEL_HIGH: *level = EFL_UTIL_NOTIFICATION_LEVEL_HIGH; break;
859 case TIZEN_POLICY_LEVEL_TOP: *level = EFL_UTIL_NOTIFICATION_LEVEL_TOP; break;
860 default: *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
861 return EFL_UTIL_ERROR_INVALID_PARAMETER;
863 return EFL_UTIL_ERROR_NONE;
866 *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
868 return EFL_UTIL_ERROR_NONE;
872 efl_util_set_window_opaque_state(Evas_Object *window,
877 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
878 EINA_SAFETY_ON_FALSE_RETURN_VAL(((opaque >= 0) && (opaque <= 1)),
879 EFL_UTIL_ERROR_INVALID_PARAMETER);
881 Ecore_Wl2_Window *wlwin;
882 struct wl_surface *surface;
884 if (!_eflutil.wl.policy.proto)
889 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
891 while (!_eflutil.wl.policy.proto && ret != -1)
892 ret = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
894 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.policy.proto, EFL_UTIL_ERROR_INVALID_PARAMETER);
897 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
899 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
901 surface = ecore_wl2_window_surface_get(wlwin);
903 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
905 tizen_policy_set_opaque_state(_eflutil.wl.policy.proto, surface, opaque);
907 return EFL_UTIL_ERROR_NONE;
911 efl_util_set_window_screen_mode(Evas_Object *window,
912 efl_util_screen_mode_e mode)
914 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
915 EINA_SAFETY_ON_FALSE_RETURN_VAL(((mode >= EFL_UTIL_SCREEN_MODE_DEFAULT) &&
916 (mode <= EFL_UTIL_SCREEN_MODE_ALWAYS_ON)),
917 EFL_UTIL_ERROR_INVALID_PARAMETER);
919 Ecore_Wl2_Window *wlwin;
920 struct wl_surface *surface;
921 Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
925 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
927 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
930 while (!_eflutil.wl.policy.proto)
931 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
933 surface = ecore_wl2_window_surface_get(wlwin);
934 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
935 EFL_UTIL_ERROR_INVALID_PARAMETER);
937 scr_mode_info = eina_hash_find(_eflutil.wl.policy.hash_scr_mode, &surface);
940 scr_mode_info = calloc(1, sizeof(Efl_Util_Wl_Surface_Scr_Mode_Info));
941 EINA_SAFETY_ON_NULL_RETURN_VAL(scr_mode_info, EFL_UTIL_ERROR_OUT_OF_MEMORY);
943 scr_mode_info->surface = surface;
944 scr_mode_info->mode = (unsigned int)mode;
945 scr_mode_info->wait_for_done = EINA_TRUE;
946 scr_mode_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
948 eina_hash_add(_eflutil.wl.policy.hash_scr_mode,
954 scr_mode_info->mode = (unsigned int)mode;
955 scr_mode_info->wait_for_done = EINA_TRUE;
956 scr_mode_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
959 tizen_policy_set_window_screen_mode(_eflutil.wl.policy.proto,
960 surface, (unsigned int)mode);
961 if (scr_mode_info->wait_for_done)
964 while (scr_mode_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT))
966 ecore_wl2_display_flush(_eflutil.wl.wl2_display);
967 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
971 if (scr_mode_info->wait_for_done)
973 return EFL_UTIL_ERROR_INVALID_PARAMETER;
977 if (scr_mode_info->state == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
979 return EFL_UTIL_ERROR_PERMISSION_DENIED;
984 return EFL_UTIL_ERROR_NONE;
987 return EFL_UTIL_ERROR_INVALID_PARAMETER;
991 efl_util_get_window_screen_mode(Evas_Object *window,
992 efl_util_screen_mode_e *mode)
994 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
995 EINA_SAFETY_ON_NULL_RETURN_VAL(mode, EFL_UTIL_ERROR_INVALID_PARAMETER);
997 Ecore_Wl2_Window *wlwin;
998 struct wl_surface *surface;
999 Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
1003 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1005 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
1008 while (!_eflutil.wl.policy.proto)
1009 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1011 surface = ecore_wl2_window_surface_get(wlwin);
1012 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
1013 EFL_UTIL_ERROR_INVALID_PARAMETER);
1015 scr_mode_info = eina_hash_find(_eflutil.wl.policy.hash_scr_mode, &surface);
1018 if (scr_mode_info->wait_for_done)
1020 while (scr_mode_info->wait_for_done)
1022 ecore_wl2_display_flush(_eflutil.wl.wl2_display);
1023 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1027 switch (scr_mode_info->mode)
1029 case TIZEN_POLICY_MODE_DEFAULT: *mode = EFL_UTIL_SCREEN_MODE_DEFAULT; break;
1030 case TIZEN_POLICY_MODE_ALWAYS_ON: *mode = EFL_UTIL_SCREEN_MODE_ALWAYS_ON; break;
1031 default: *mode = EFL_UTIL_SCREEN_MODE_DEFAULT;
1032 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1034 return EFL_UTIL_ERROR_NONE;
1038 *mode = EFL_UTIL_SCREEN_MODE_DEFAULT;
1039 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1043 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1047 efl_util_set_window_brightness(Evas_Object *window, int brightness)
1049 Ecore_Wl2_Window *wlwin;
1050 struct wl_surface *surface;
1051 Efl_Util_Wl_Surface_Brightness_Info *brightness_info;
1054 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
1055 EINA_SAFETY_ON_FALSE_RETURN_VAL(brightness <= 100, EFL_UTIL_ERROR_INVALID_PARAMETER);
1058 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1060 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
1063 while (!_eflutil.wl.display_policy.proto)
1064 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1066 surface = ecore_wl2_window_surface_get(wlwin);
1067 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
1068 EFL_UTIL_ERROR_INVALID_PARAMETER);
1070 brightness_info = eina_hash_find(_eflutil.wl.display_policy.hash_brightness, &surface);
1071 if (!brightness_info)
1073 brightness_info = calloc(1, sizeof(Efl_Util_Wl_Surface_Brightness_Info));
1074 EINA_SAFETY_ON_NULL_RETURN_VAL(brightness_info, EFL_UTIL_ERROR_OUT_OF_MEMORY);
1076 brightness_info->surface = surface;
1077 brightness_info->brightness = brightness;
1078 brightness_info->wait_for_done = EINA_TRUE;
1079 brightness_info->state = TIZEN_DISPLAY_POLICY_ERROR_STATE_NONE;
1081 eina_hash_add(_eflutil.wl.display_policy.hash_brightness,
1087 brightness_info->brightness = brightness;
1088 brightness_info->wait_for_done = EINA_TRUE;
1089 brightness_info->state = TIZEN_DISPLAY_POLICY_ERROR_STATE_NONE;
1092 tizen_display_policy_set_window_brightness(_eflutil.wl.display_policy.proto,
1093 surface, brightness);
1094 if (brightness_info->wait_for_done)
1097 while (brightness_info->wait_for_done && (count < NUM_EVENT_WAIT_DONE_COUNT))
1099 ecore_wl2_display_flush(_eflutil.wl.wl2_display);
1100 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1104 if (brightness_info->wait_for_done)
1106 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1110 if (brightness_info->state == TIZEN_DISPLAY_POLICY_ERROR_STATE_PERMISSION_DENIED)
1112 return EFL_UTIL_ERROR_PERMISSION_DENIED;
1116 return EFL_UTIL_ERROR_NONE;
1119 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1123 efl_util_get_window_brightness(Evas_Object *window, int *brightness)
1125 Ecore_Wl2_Window *wlwin;
1126 struct wl_surface *surface;
1127 Efl_Util_Wl_Surface_Brightness_Info *brightness_info;
1130 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
1131 EINA_SAFETY_ON_NULL_RETURN_VAL(brightness, EFL_UTIL_ERROR_INVALID_PARAMETER);
1134 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EFL_UTIL_ERROR_INVALID_PARAMETER);
1136 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
1137 if (!wlwin) return EFL_UTIL_ERROR_INVALID_PARAMETER;
1139 while (!_eflutil.wl.display_policy.proto)
1140 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1142 surface = ecore_wl2_window_surface_get(wlwin);
1143 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
1144 EFL_UTIL_ERROR_INVALID_PARAMETER);
1146 brightness_info = eina_hash_find(_eflutil.wl.display_policy.hash_brightness, &surface);
1147 if (brightness_info)
1149 if (brightness_info->wait_for_done)
1151 while (brightness_info->wait_for_done)
1153 ecore_wl2_display_flush(_eflutil.wl.wl2_display);
1154 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1157 *brightness = brightness_info->brightness;
1162 return EFL_UTIL_ERROR_NONE;
1166 struct _efl_util_inputgen_h
1168 unsigned int init_type;
1170 E_Devicemgr_Inputgen_Touch_Axis *axis_info;
1173 /* LCOV_EXCL_STOP */
1176 _cb_device_add(void *data EINA_UNUSED,
1177 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED,
1178 uint32_t serial EINA_UNUSED,
1179 const char *identifier EINA_UNUSED,
1180 struct tizen_input_device *device,
1181 struct wl_seat *seat EINA_UNUSED)
1187 _cb_device_remove(void *data EINA_UNUSED,
1188 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED,
1189 uint32_t serial EINA_UNUSED,
1190 const char *identifier EINA_UNUSED,
1191 struct tizen_input_device *device,
1192 struct wl_seat *seat EINA_UNUSED)
1198 _cb_error(void *data EINA_UNUSED,
1199 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED,
1202 _eflutil.wl.devmgr.request_notified = errorcode;
1205 /* LCOV_EXCL_START */
1207 _cb_block_expired(void *data EINA_UNUSED,
1208 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED)
1212 /* LCOV_EXCL_STOP */
1215 _cb_max_touch_count(void *data EINA_UNUSED,
1216 struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED,
1217 uint32_t serial EINA_UNUSED,
1219 struct wl_seat *seat EINA_UNUSED)
1221 _eflutil.wl.devmgr.max_touch_count = max_count;
1224 static efl_util_error_e
1225 _efl_util_input_convert_input_generator_error(int ret)
1229 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE:
1230 return EFL_UTIL_ERROR_NONE;
1231 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_PERMISSION:
1232 return EFL_UTIL_ERROR_PERMISSION_DENIED;
1233 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_NO_SYSTEM_RESOURCES:
1234 return EFL_UTIL_ERROR_OUT_OF_MEMORY;
1235 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER:
1236 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1237 case TIZEN_INPUT_DEVICE_MANAGER_ERROR_NOT_ALLOWED:
1238 return EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE;
1240 return EFL_UTIL_ERROR_NONE;
1244 static efl_util_inputgen_h
1245 _efl_util_input_create_inputgen(unsigned int dev_type, const char *name, int *ret, int with_name)
1247 efl_util_inputgen_h inputgen_h = NULL;
1248 unsigned int clas = 0x0;
1251 dev_type & ~(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN
1252 | EFL_UTIL_INPUT_DEVTYPE_KEYBOARD
1253 | EFL_UTIL_INPUT_DEVTYPE_POINTER))
1255 set_last_result(EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1259 inputgen_h = (efl_util_inputgen_h)calloc(1, sizeof(struct _efl_util_inputgen_h));
1262 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
1266 inputgen_h->init_type |= dev_type;
1269 if (name) strncpy(inputgen_h->name, name, 31);
1270 else strncpy(inputgen_h->name, "Input Generator", 31);
1274 if (*ret == (int)EINA_FALSE)
1276 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
1280 if (dev_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
1281 clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN;
1282 if (dev_type & EFL_UTIL_INPUT_DEVTYPE_KEYBOARD)
1283 clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD;
1284 if (dev_type & EFL_UTIL_INPUT_DEVTYPE_POINTER)
1285 clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE;
1287 while (!_eflutil.wl.devmgr.devicemgr)
1288 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1291 tizen_input_device_manager_init_generator_with_sync(_eflutil.wl.devmgr.devicemgr, clas, inputgen_h->name);
1292 else if (with_name == 1)
1293 tizen_input_device_manager_init_generator_with_name(_eflutil.wl.devmgr.devicemgr, clas, inputgen_h->name);
1295 tizen_input_device_manager_init_generator(_eflutil.wl.devmgr.devicemgr, clas);
1298 while (_eflutil.wl.devmgr.request_notified == -1)
1299 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1301 *ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1302 _eflutil.wl.devmgr.request_notified = -1;
1304 set_last_result(*ret);
1305 if (*ret != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE)
1319 API efl_util_inputgen_h
1320 efl_util_input_initialize_generator(unsigned int dev_type)
1322 int ret = EFL_UTIL_ERROR_NONE;
1323 efl_util_inputgen_h inputgen_h = NULL;
1325 inputgen_h = _efl_util_input_create_inputgen(dev_type, NULL, &ret, 0);
1332 API efl_util_inputgen_h
1333 efl_util_input_initialize_generator_with_name(unsigned int dev_type, const char *name)
1335 int ret = EFL_UTIL_ERROR_NONE;
1336 efl_util_inputgen_h inputgen_h = NULL;
1338 inputgen_h = _efl_util_input_create_inputgen(dev_type, name, &ret, 1);
1345 API efl_util_inputgen_h
1346 efl_util_input_initialize_generator_with_sync(unsigned int dev_type, const char *name)
1348 int ret = EFL_UTIL_ERROR_NONE;
1349 efl_util_inputgen_h inputgen_h = NULL;
1351 inputgen_h = _efl_util_input_create_inputgen(dev_type, name, &ret, 2);
1359 efl_util_input_set_touch_count(int max_count)
1361 int ret = EFL_UTIL_ERROR_NONE;
1364 if (ret == (int)EINA_FALSE)
1366 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1369 while (!_eflutil.wl.devmgr.devicemgr)
1370 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1372 if (_eflutil.wl.devmgr.max_touch_count >= max_count)
1373 return EFL_UTIL_ERROR_NONE;
1375 tizen_input_device_manager_set_touch_count(_eflutil.wl.devmgr.devicemgr, max_count);
1377 while (_eflutil.wl.devmgr.request_notified == -1)
1378 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1380 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1381 _eflutil.wl.devmgr.request_notified = -1;
1383 if (ret == EFL_UTIL_ERROR_NONE)
1385 _eflutil.wl.devmgr.request_touch_count = max_count;
1392 efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h)
1394 int ret = EFL_UTIL_ERROR_NONE;
1395 unsigned int clas = 0x0;
1396 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1398 if (inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
1399 clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN;
1400 if (inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_KEYBOARD)
1401 clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD;
1402 if (inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_POINTER)
1403 clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE;
1405 if (inputgen_h->axis_info)
1406 free(inputgen_h->axis_info);
1411 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1413 tizen_input_device_manager_deinit_generator(_eflutil.wl.devmgr.devicemgr, clas);
1415 while (_eflutil.wl.devmgr.request_notified == -1)
1416 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1418 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1419 _eflutil.wl.devmgr.request_notified = -1;
1425 efl_util_input_generate_key(efl_util_inputgen_h inputgen_h, const char *key_name, int pressed)
1427 int ret = EFL_UTIL_ERROR_NONE;
1429 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1430 EINA_SAFETY_ON_NULL_RETURN_VAL(key_name, EFL_UTIL_ERROR_INVALID_PARAMETER);
1431 EINA_SAFETY_ON_FALSE_RETURN_VAL(pressed == 0 || pressed == 1, EFL_UTIL_ERROR_INVALID_PARAMETER);
1432 EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_KEYBOARD, EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1434 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1436 tizen_input_device_manager_generate_key(_eflutil.wl.devmgr.devicemgr, key_name, pressed);
1438 while (_eflutil.wl.devmgr.request_notified == -1)
1439 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1441 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1442 _eflutil.wl.devmgr.request_notified = -1;
1448 efl_util_input_generate_touch(efl_util_inputgen_h inputgen_h, int idx,
1449 efl_util_input_touch_type_e touch_type, int x, int y)
1452 enum tizen_input_device_manager_pointer_event_type type;
1454 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1455 EINA_SAFETY_ON_FALSE_RETURN_VAL(idx >= 0, EFL_UTIL_ERROR_INVALID_PARAMETER);
1456 EINA_SAFETY_ON_FALSE_RETURN_VAL((x > 0 && y > 0), EFL_UTIL_ERROR_INVALID_PARAMETER);
1457 EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1459 if (idx >= _eflutil.wl.devmgr.max_touch_count)
1460 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1462 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1466 case EFL_UTIL_INPUT_TOUCH_BEGIN:
1467 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN;
1469 case EFL_UTIL_INPUT_TOUCH_UPDATE:
1470 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE;
1472 case EFL_UTIL_INPUT_TOUCH_END:
1473 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END;
1476 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1479 tizen_input_device_manager_generate_touch(_eflutil.wl.devmgr.devicemgr, type, x, y, idx);
1481 while (_eflutil.wl.devmgr.request_notified == -1)
1482 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1484 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1485 _eflutil.wl.devmgr.request_notified = -1;
1491 _efl_util_input_generate_touch_axis_send(unsigned int type, double value)
1495 tizen_input_device_manager_generate_axis(_eflutil.wl.devmgr.devicemgr, type, wl_fixed_from_double(value));
1497 while (_eflutil.wl.devmgr.request_notified == -1)
1498 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1500 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1501 _eflutil.wl.devmgr.request_notified = -1;
1507 _efl_util_input_generate_touch_axis_cleanup(efl_util_inputgen_h inputgen_h, int idx)
1512 inputgen_h->axis_info[idx].radius_x = 1.0;
1513 inputgen_h->axis_info[idx].radius_y = 1.0;
1514 inputgen_h->axis_info[idx].pressure = 1.0;
1515 inputgen_h->axis_info[idx].angle = 0.0;
1516 inputgen_h->axis_info[idx].palm = 0.0;
1520 for (i = 0; i < EFL_UTIL_INPUT_GENERATOR_TOUCH_MAX_FINGER; i++)
1522 inputgen_h->axis_info[i].radius_x = 1.0;
1523 inputgen_h->axis_info[i].radius_y = 1.0;
1524 inputgen_h->axis_info[i].pressure = 1.0;
1525 inputgen_h->axis_info[i].angle = 0.0;
1526 inputgen_h->axis_info[i].palm = 0.0;
1532 _efl_util_input_generate_touch_axis_process(efl_util_inputgen_h inputgen_h, int idx, double radius_x,
1533 double radius_y, double pressure, double angle, double palm)
1535 int ret = EFL_UTIL_ERROR_NONE;
1537 if (!inputgen_h->axis_info)
1539 inputgen_h->axis_info = calloc(EFL_UTIL_INPUT_GENERATOR_TOUCH_MAX_FINGER,
1540 sizeof(E_Devicemgr_Inputgen_Touch_Axis));
1541 _efl_util_input_generate_touch_axis_cleanup(inputgen_h, -1);
1544 if (inputgen_h->axis_info[idx].radius_x != radius_x)
1546 ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_RADIUS_X, radius_x);
1547 if (ret != EFL_UTIL_ERROR_NONE) return ret;
1548 inputgen_h->axis_info[idx].radius_x = radius_x;
1550 if (inputgen_h->axis_info[idx].radius_y != radius_y)
1552 ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_RADIUS_Y, radius_y);
1553 if (ret != EFL_UTIL_ERROR_NONE) return ret;
1554 inputgen_h->axis_info[idx].radius_y = radius_y;
1556 if (inputgen_h->axis_info[idx].pressure != pressure)
1558 ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_PRESSURE, pressure);
1559 if (ret != EFL_UTIL_ERROR_NONE) return ret;
1560 inputgen_h->axis_info[idx].pressure = pressure;
1562 if (inputgen_h->axis_info[idx].angle != angle)
1564 ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_ANGLE, angle);
1565 if (ret != EFL_UTIL_ERROR_NONE) return ret;
1566 inputgen_h->axis_info[idx].angle = angle;
1568 if (inputgen_h->axis_info[idx].palm != palm)
1570 ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_PALM, palm);
1571 if (ret != EFL_UTIL_ERROR_NONE) return ret;
1572 inputgen_h->axis_info[idx].palm = palm;
1579 efl_util_input_generate_touch_axis(efl_util_inputgen_h inputgen_h, int idx,
1580 efl_util_input_touch_type_e touch_type, int x, int y,
1581 double radius_x, double radius_y,
1582 double pressure, double angle, double palm)
1585 enum tizen_input_device_manager_pointer_event_type type;
1587 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1588 EINA_SAFETY_ON_FALSE_RETURN_VAL(idx >= 0, EFL_UTIL_ERROR_INVALID_PARAMETER);
1589 EINA_SAFETY_ON_FALSE_RETURN_VAL((x >= 0 && y >= 0), EFL_UTIL_ERROR_INVALID_PARAMETER);
1590 EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1591 EINA_SAFETY_ON_FALSE_RETURN_VAL((radius_x >= 0.0 && radius_y >= 0.0), EFL_UTIL_ERROR_INVALID_PARAMETER);
1592 EINA_SAFETY_ON_FALSE_RETURN_VAL((pressure >= 0.0 && palm >= 0.0), EFL_UTIL_ERROR_INVALID_PARAMETER);
1594 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1595 version = tizen_input_device_manager_get_version(_eflutil.wl.devmgr.devicemgr);
1596 EINA_SAFETY_ON_FALSE_RETURN_VAL((version >= 3), EFL_UTIL_ERROR_NOT_SUPPORTED);
1600 case EFL_UTIL_INPUT_TOUCH_BEGIN:
1601 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN;
1603 case EFL_UTIL_INPUT_TOUCH_UPDATE:
1604 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE;
1606 case EFL_UTIL_INPUT_TOUCH_END:
1607 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END;
1610 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1613 if (touch_type != EFL_UTIL_INPUT_TOUCH_END)
1614 _efl_util_input_generate_touch_axis_process(inputgen_h, idx, radius_x, radius_y, pressure, angle, palm);
1616 _efl_util_input_generate_touch_axis_cleanup(inputgen_h, idx);
1618 tizen_input_device_manager_generate_touch(_eflutil.wl.devmgr.devicemgr, type, x, y, idx);
1620 while (_eflutil.wl.devmgr.request_notified == -1)
1621 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1623 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1624 _eflutil.wl.devmgr.request_notified = -1;
1631 efl_util_input_generate_pointer(efl_util_inputgen_h inputgen_h, int buttons, efl_util_input_pointer_type_e pointer_type, int x, int y)
1634 enum tizen_input_device_manager_pointer_event_type type;
1636 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1637 EINA_SAFETY_ON_FALSE_RETURN_VAL(buttons > 0, EFL_UTIL_ERROR_INVALID_PARAMETER);
1638 EINA_SAFETY_ON_FALSE_RETURN_VAL((x >= 0 && y >= 0), EFL_UTIL_ERROR_INVALID_PARAMETER);
1639 EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_POINTER, EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1641 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1643 switch(pointer_type)
1645 case EFL_UTIL_INPUT_POINTER_BUTTON_DOWN:
1646 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN;
1648 case EFL_UTIL_INPUT_POINTER_MOVE:
1649 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE;
1651 case EFL_UTIL_INPUT_POINTER_BUTTON_UP:
1652 type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END;
1655 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1658 tizen_input_device_manager_generate_pointer(_eflutil.wl.devmgr.devicemgr, type, x, y, buttons);
1660 while (_eflutil.wl.devmgr.request_notified == -1)
1661 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1663 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1664 _eflutil.wl.devmgr.request_notified = -1;
1670 efl_util_input_generate_wheel(efl_util_inputgen_h inputgen_h, efl_util_input_pointer_wheel_type_e wheel_type, int value)
1673 enum tizen_input_device_manager_pointer_event_type type;
1675 EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
1676 EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_POINTER, EFL_UTIL_ERROR_NO_SUCH_DEVICE);
1678 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER);
1679 version = tizen_input_device_manager_get_version(_eflutil.wl.devmgr.devicemgr);
1680 EINA_SAFETY_ON_FALSE_RETURN_VAL((version >= 3), EFL_UTIL_ERROR_NOT_SUPPORTED);
1684 case EFL_UTIL_INPUT_POINTER_WHEEL_VERT:
1685 type = TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_WHEEL;
1687 case EFL_UTIL_INPUT_POINTER_WHEEL_HORZ:
1688 type = TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_HWHEEL;
1691 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1694 tizen_input_device_manager_generate_axis(_eflutil.wl.devmgr.devicemgr, type, wl_fixed_from_int(value));
1696 while (_eflutil.wl.devmgr.request_notified == -1)
1697 wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1699 ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
1700 _eflutil.wl.devmgr.request_notified = -1;
1707 struct _efl_util_screenshot_h
1712 Eina_Bool shot_done;
1717 Eina_Bool auto_rotation;
1720 /* scrrenshot handle */
1721 static efl_util_screenshot_h g_screenshot;
1722 static Eina_Bool shot_mutex_init;
1723 static pthread_mutex_t shot_lock;
1726 _screenshot_mutex_init(void)
1728 if (shot_mutex_init)
1731 if (pthread_mutex_init(&shot_lock, NULL))
1733 fprintf(stderr, "[screenshot] fail: mutex init"); /*LCOV_EXCL_LINE*/
1734 return EINA_FALSE; /*LCOV_EXCL_LINE*/
1737 shot_mutex_init = EINA_TRUE;
1743 _screenshot_mutex_destory(void)
1745 if (!shot_mutex_init)
1748 if (pthread_mutex_destroy(&shot_lock))
1750 fprintf(stderr, "[screenshot] fail: mutex destory"); /*LCOV_EXCL_LINE*/
1751 return EINA_FALSE; /*LCOV_EXCL_LINE*/
1754 shot_mutex_init = EINA_FALSE;
1760 _screenshot_mutex_lock(void)
1762 if (!_screenshot_mutex_init())
1765 pthread_mutex_lock(&shot_lock);
1769 _screenshot_mutex_unlock(void)
1771 pthread_mutex_unlock(&shot_lock);
1775 _efl_util_wl_screenshooter_init()
1777 struct wl_display *display_wrapper = NULL;
1778 struct wl_registry *registry = NULL;
1781 if (_wl_init() == EINA_FALSE)
1784 wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
1786 display_wrapper = wl_proxy_create_wrapper(_eflutil.wl.dpy);
1787 EINA_SAFETY_ON_NULL_RETURN_VAL(display_wrapper, EINA_FALSE);
1789 _eflutil.wl.shot.queue = wl_display_create_queue(_eflutil.wl.dpy);
1790 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.queue, fail_create_queue);
1792 wl_proxy_set_queue((struct wl_proxy *)display_wrapper, _eflutil.wl.shot.queue);
1794 registry = wl_display_get_registry(display_wrapper);
1795 EINA_SAFETY_ON_NULL_GOTO(registry, fail_get_registry);
1797 wl_registry_add_listener(registry, &_wl_reg_screenshooter_listener, NULL);
1799 ret = wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
1800 EINA_SAFETY_ON_TRUE_GOTO(ret == -1, fail_roundtrip);
1801 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.tz_screenshooter, fail_roundtrip);
1803 _eflutil.wl.shot.tbm_client = wayland_tbm_client_init(_eflutil.wl.dpy);
1804 EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.tbm_client, fail_tbm_client_init);
1806 wl_registry_destroy(registry);
1807 wl_proxy_wrapper_destroy(display_wrapper);
1809 if (_eflutil.wl.shot.noti == 0)
1811 fprintf(stderr, "[screenshot] fail: privilege error\n"); /* LCOV_EXCL_LINE */
1817 fail_tbm_client_init:
1818 tizen_screenshooter_destroy(_eflutil.wl.shot.tz_screenshooter);
1819 _eflutil.wl.shot.tz_screenshooter = NULL;
1821 wl_registry_destroy(registry);
1823 wl_event_queue_destroy(_eflutil.wl.shot.queue);
1824 _eflutil.wl.shot.queue = NULL;
1826 wl_proxy_wrapper_destroy(display_wrapper);
1832 _efl_util_wl_screenshooter_deinit()
1834 if (_eflutil.wl.shot.tbm_client)
1836 wayland_tbm_client_deinit(_eflutil.wl.shot.tbm_client);
1837 _eflutil.wl.shot.tbm_client = NULL;
1840 if (_eflutil.wl.shot.tz_screenshooter)
1842 tizen_screenshooter_destroy(_eflutil.wl.shot.tz_screenshooter);
1843 _eflutil.wl.shot.tz_screenshooter = NULL;
1846 if (_eflutil.wl.shot.queue)
1848 wl_event_queue_destroy(_eflutil.wl.shot.queue);
1849 _eflutil.wl.shot.queue = NULL;
1853 API efl_util_screenshot_h
1854 efl_util_screenshot_initialize(int width, int height)
1856 efl_util_screenshot_h screenshot = NULL;
1858 if (width <= 0 || height <= 0)
1860 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
1864 _screenshot_mutex_lock();
1868 if (g_screenshot->width != width || g_screenshot->height != height)
1870 g_screenshot->width = width;
1871 g_screenshot->height = height;
1873 set_last_result(EFL_UTIL_ERROR_NONE);
1875 _screenshot_mutex_unlock();
1877 return g_screenshot;
1880 screenshot = calloc(1, sizeof(struct _efl_util_screenshot_h));
1881 if (screenshot == NULL)
1883 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
1885 _screenshot_mutex_unlock();
1890 if (!_eflutil.wl.shot.tz_screenshooter)
1892 if (_efl_util_wl_screenshooter_init() == EINA_FALSE)
1894 if (_eflutil.wl.shot.noti == 0)
1895 set_last_result(EFL_UTIL_ERROR_PERMISSION_DENIED);
1897 set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL);
1901 _screenshot_mutex_unlock();
1907 screenshot->width = width;
1908 screenshot->height = height;
1909 screenshot->auto_rotation = EINA_TRUE;
1911 screenshot->bufmgr = wayland_tbm_client_get_bufmgr(_eflutil.wl.shot.tbm_client);
1912 EINA_SAFETY_ON_NULL_GOTO(screenshot->bufmgr, fail_get_bufmgr);
1914 g_screenshot = screenshot;
1915 set_last_result(EFL_UTIL_ERROR_NONE);
1917 tizen_screenshooter_set_user_data(_eflutil.wl.shot.tz_screenshooter, &screenshot->shot_done);
1919 _screenshot_mutex_unlock();
1921 return g_screenshot;
1923 /* LCOV_EXCL_START */
1925 set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL);
1926 _screenshot_mutex_unlock();
1927 efl_util_screenshot_deinitialize(screenshot);
1930 /* LCOV_EXCL_STOP */
1934 efl_util_screenshot_deinitialize(efl_util_screenshot_h screenshot)
1936 _screenshot_mutex_lock();
1940 _screenshot_mutex_unlock();
1941 _screenshot_mutex_destory();
1942 return EFL_UTIL_ERROR_INVALID_PARAMETER;
1946 g_screenshot = NULL;
1948 _efl_util_wl_screenshooter_deinit();
1950 _screenshot_mutex_unlock();
1951 _screenshot_mutex_destory();
1953 return EFL_UTIL_ERROR_NONE;
1958 efl_util_screenshot_take_tbm_surface(efl_util_screenshot_h screenshot)
1960 tbm_surface_h t_surface = NULL;
1961 struct wl_buffer *buffer = NULL;
1962 Efl_Util_Wl_Output_Info *output;
1965 _screenshot_mutex_lock();
1967 if (!screenshot || (screenshot != g_screenshot))
1969 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
1970 _screenshot_mutex_unlock();
1974 output = eina_list_nth(_eflutil.wl.shot.output_list, 0);
1977 fprintf(stderr, "[screenshot] fail: no output for screenshot\n"); /* LCOV_EXCL_LINE */
1981 t_surface = tbm_surface_create(screenshot->width, screenshot->height, TBM_FORMAT_XRGB8888);
1984 fprintf(stderr, "[screenshot] fail: tbm_surface_create\n"); /* LCOV_EXCL_LINE */
1988 buffer = wayland_tbm_client_create_buffer(_eflutil.wl.shot.tbm_client, t_surface);
1991 fprintf(stderr, "[screenshot] fail: create wl_buffer for screenshot\n"); /* LCOV_EXCL_LINE */
1995 tizen_screenshooter_shoot(_eflutil.wl.shot.tz_screenshooter, output->output, buffer);
1997 screenshot->shot_done = EINA_FALSE;
1999 while (!screenshot->shot_done && ret != -1)
2000 ret = wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
2004 fprintf(stderr, "[screenshot] fail: tizen_screenshooter_shoot\n"); /* LCOV_EXCL_LINE */
2008 wayland_tbm_client_destroy_buffer(_eflutil.wl.shot.tbm_client, buffer);
2010 /* reset shot_done for next screenshot */
2011 screenshot->shot_done = EINA_FALSE;
2013 set_last_result(EFL_UTIL_ERROR_NONE);
2015 _screenshot_mutex_unlock();
2021 tbm_surface_destroy(t_surface);
2023 wayland_tbm_client_destroy_buffer(_eflutil.wl.shot.tbm_client, buffer);
2025 set_last_result(EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL);
2027 _screenshot_mutex_unlock();
2033 efl_util_screenshot_set_auto_rotation(efl_util_screenshot_h screenshot, int set)
2035 if (!screenshot || (screenshot != g_screenshot))
2036 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2038 if (!(set == 0 || set == 1))
2039 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2042 g_screenshot->auto_rotation = EINA_TRUE;
2044 g_screenshot->auto_rotation = EINA_FALSE;
2046 tizen_screenshooter_set_oneshot_auto_rotation(_eflutil.wl.shot.tz_screenshooter, g_screenshot->auto_rotation);
2048 return EFL_UTIL_ERROR_NONE;
2052 efl_util_screenshot_get_auto_rotation(efl_util_screenshot_h screenshot, int *set)
2054 if (!screenshot || (screenshot != g_screenshot) || !set)
2055 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2057 *set = g_screenshot->auto_rotation;
2059 return EFL_UTIL_ERROR_NONE;
2062 /* LCOV_EXCL_START */
2063 struct _efl_util_screenmirror_h
2065 struct tizen_screenmirror *tz_screenmirror;
2071 Eina_List *buffer_list;
2073 Eina_Bool mirror_working;
2076 Eina_Bool cb_content;
2077 efl_util_screenmirror_handler user_func;
2081 typedef struct _efl_util_mirror_buffer efl_util_mirror_buffer;
2082 struct _efl_util_mirror_buffer
2084 struct wl_buffer *buffer;
2086 tbm_surface_h t_surface;
2089 static efl_util_screenmirror_h g_screenmirror;
2092 _efl_util_screenmirror_loop(void *data)
2094 efl_util_screenmirror_h screenmirror;
2097 screenmirror = (efl_util_screenmirror_h)data;
2101 if (!screenmirror->mirror_working)
2104 ret = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
2107 fprintf(stderr, "[screenmirror] fail: dispatch_queue\n");
2115 static efl_util_mirror_buffer *
2116 _efl_util_create_mirror_buffer(efl_util_screenmirror_h screenmirror)
2118 efl_util_mirror_buffer *mbuffer;
2120 mbuffer = calloc(1, sizeof(struct _efl_util_mirror_buffer));
2121 EINA_SAFETY_ON_NULL_RETURN_VAL(mbuffer, NULL);
2123 mbuffer->w = screenmirror->width;
2124 mbuffer->h = screenmirror->height;
2126 mbuffer->t_surface = tbm_surface_internal_create_with_flags(mbuffer->w,
2127 mbuffer->h, TBM_FORMAT_ARGB8888, TBM_BO_SCANOUT);
2128 EINA_SAFETY_ON_NULL_GOTO(mbuffer->t_surface, fail_create_surface);
2130 mbuffer->buffer = wayland_tbm_client_create_buffer(_eflutil.wl.shot.tbm_client, mbuffer->t_surface);
2131 EINA_SAFETY_ON_NULL_GOTO(mbuffer->buffer, fail_create_buffer);
2136 tbm_surface_destroy(mbuffer->t_surface);
2137 fail_create_surface:
2144 _efl_util_destroy_mirror_buffer(efl_util_mirror_buffer *mbuffer)
2146 EINA_SAFETY_ON_NULL_RETURN(mbuffer);
2148 if (mbuffer->buffer)
2149 wl_buffer_destroy(mbuffer->buffer);
2155 _efl_util_screenmirror_handle_dequeued(void *data,
2156 struct tizen_screenmirror *tz_screenmirror, struct wl_buffer *buffer)
2158 efl_util_screenmirror_h screenmirror;
2159 efl_util_mirror_buffer *mbuffer;
2162 screenmirror = (efl_util_screenmirror_h)data;
2163 screenmirror->cb_start = EINA_TRUE;
2165 EINA_LIST_FOREACH_SAFE(screenmirror->buffer_list, l, ll, mbuffer)
2167 if (mbuffer->buffer == buffer)
2169 if (mbuffer->w != screenmirror->width || mbuffer->h != screenmirror->height ||
2170 !screenmirror->mirror_working)
2171 tbm_surface_destroy(mbuffer->t_surface);
2173 screenmirror->user_func(screenmirror, mbuffer->t_surface, screenmirror->user_data);
2175 screenmirror->buffer_list = eina_list_remove_list(screenmirror->buffer_list, l);
2176 _efl_util_destroy_mirror_buffer(mbuffer);
2182 mbuffer = _efl_util_create_mirror_buffer(screenmirror);
2183 if (mbuffer == NULL)
2185 fprintf(stderr, "[screenmirror] fail: buffer create\n");
2188 screenmirror->buffer_list = eina_list_append(screenmirror->buffer_list, mbuffer);
2189 tizen_screenmirror_queue(screenmirror->tz_screenmirror, mbuffer->buffer);
2193 _efl_util_screenmirror_handle_content(void *data,
2194 struct tizen_screenmirror *tz_screenmirror, uint32_t content)
2196 efl_util_screenmirror_h screenmirror = NULL;
2198 screenmirror = (efl_util_screenmirror_h)data;
2199 screenmirror->cb_content = EINA_TRUE;
2203 _efl_util_screenmirror_handle_stop(void *data, struct tizen_screenmirror *tz_screenmirror)
2205 efl_util_screenmirror_h screenmirror = NULL;
2207 screenmirror = (efl_util_screenmirror_h)data;
2208 screenmirror->cb_stop = EINA_TRUE;
2211 static const struct tizen_screenmirror_listener efl_util_screenmirror_listener = {
2212 _efl_util_screenmirror_handle_dequeued,
2213 _efl_util_screenmirror_handle_content,
2214 _efl_util_screenmirror_handle_stop
2217 API efl_util_screenmirror_h
2218 efl_util_screenmirror_initialize(int width, int height)
2220 efl_util_screenmirror_h screenmirror = NULL;
2221 efl_util_mirror_buffer *mbuffer;
2222 Efl_Util_Wl_Output_Info *output;
2225 if (width <= 0 || height <= 0)
2227 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
2231 _screenshot_mutex_lock();
2235 if (g_screenmirror->mirror_working)
2237 set_last_result(EFL_UTIL_ERROR_INVALID_OPERATION);
2238 _screenshot_mutex_unlock();
2243 g_screenmirror->width = width;
2244 g_screenmirror->height = height;
2245 set_last_result(EFL_UTIL_ERROR_NONE);
2246 _screenshot_mutex_unlock();
2247 return g_screenmirror;
2251 screenmirror = calloc(1, sizeof(struct _efl_util_screenmirror_h));
2252 if (screenmirror == NULL)
2254 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
2255 _screenshot_mutex_unlock();
2259 if (!_eflutil.wl.shot.tz_screenshooter)
2261 if (_efl_util_wl_screenshooter_init() == EINA_FALSE)
2263 if (_eflutil.wl.shot.noti == 0)
2264 set_last_result(EFL_UTIL_ERROR_PERMISSION_DENIED);
2266 set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL);
2272 output = eina_list_nth(_eflutil.wl.shot.output_list, 0);
2275 set_last_result(EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE);
2276 fprintf(stderr, "[screenmirror] fail: no output for screenmirror\n");
2277 goto fail_get_output;
2280 screenmirror->tz_screenmirror = tizen_screenshooter_get_screenmirror(_eflutil.wl.shot.tz_screenshooter, output->output);
2281 wl_proxy_set_queue((struct wl_proxy *)screenmirror->tz_screenmirror, _eflutil.wl.shot.queue);
2282 tizen_screenmirror_add_listener(screenmirror->tz_screenmirror, &efl_util_screenmirror_listener, screenmirror);
2283 tizen_screenmirror_set_stretch(screenmirror->tz_screenmirror, TIZEN_SCREENMIRROR_STRETCH_KEEP_RATIO);
2284 screenmirror->width = width;
2285 screenmirror->height = height;
2287 g_screenmirror = screenmirror;
2289 for (i = 0; i < 1; i++)
2291 mbuffer = _efl_util_create_mirror_buffer(screenmirror);
2294 screenmirror->buffer_list = eina_list_append(screenmirror->buffer_list, mbuffer);
2295 tizen_screenmirror_queue(screenmirror->tz_screenmirror, mbuffer->buffer);
2298 fprintf(stderr, "[screenmirror] fail: buffer create %d\n", i);
2300 while (!screenmirror->cb_content && ret != -1)
2301 ret = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
2303 _screenshot_mutex_unlock();
2305 return screenmirror;
2310 _screenshot_mutex_unlock();
2315 efl_util_screenmirror_deinitialize(efl_util_screenmirror_h screenmirror)
2317 efl_util_mirror_buffer *mbuffer;
2320 _screenshot_mutex_lock();
2322 if (!screenmirror || (screenmirror != g_screenmirror))
2324 _screenshot_mutex_unlock();
2325 _screenshot_mutex_destory();
2326 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2329 if (screenmirror->mirror_working)
2331 fprintf(stderr, "[screenmirror] fail: execute stop before deinit\n");
2332 _screenshot_mutex_unlock();
2333 _screenshot_mutex_destory();
2334 return EFL_UTIL_ERROR_INVALID_OPERATION;
2337 EINA_LIST_FOREACH(screenmirror->buffer_list, l, mbuffer)
2339 tbm_surface_destroy(mbuffer->t_surface);
2340 _efl_util_destroy_mirror_buffer(mbuffer);
2342 eina_list_free(screenmirror->buffer_list);
2344 tizen_screenmirror_destroy(screenmirror->tz_screenmirror);
2346 g_screenmirror = NULL;
2348 _efl_util_wl_screenshooter_deinit();
2350 _screenshot_mutex_unlock();
2351 _screenshot_mutex_destory();
2353 return EFL_UTIL_ERROR_NONE;
2357 efl_util_screenmirror_set_handler(efl_util_screenmirror_h screenmirror,
2358 efl_util_screenmirror_handler func, void *data)
2360 _screenshot_mutex_lock();
2362 if (!screenmirror || (screenmirror != g_screenmirror) || !func)
2364 _screenshot_mutex_unlock();
2365 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2367 screenmirror->user_func = func;
2368 screenmirror->user_data = data;
2370 _screenshot_mutex_unlock();
2372 return EFL_UTIL_ERROR_NONE;
2376 efl_util_screenmirror_start(efl_util_screenmirror_h screenmirror)
2380 _screenshot_mutex_lock();
2382 if (!screenmirror || (screenmirror != g_screenmirror))
2384 _screenshot_mutex_unlock();
2385 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2387 else if (!screenmirror->user_func)
2389 _screenshot_mutex_unlock();
2390 return EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL;
2392 else if (screenmirror->mirror_working)
2394 _screenshot_mutex_unlock();
2395 return EFL_UTIL_ERROR_NONE;
2398 screenmirror->cb_start = EINA_FALSE;
2399 screenmirror->mirror_working = EINA_TRUE;
2400 tizen_screenmirror_start(screenmirror->tz_screenmirror);
2401 while (!screenmirror->cb_start && ret != -1)
2402 ret = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
2405 fprintf(stderr, "[screenmirror] fail: tizen_screenmirror_start\n");
2406 _screenshot_mutex_unlock();
2407 return EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL;
2410 ret = pthread_create(&screenmirror->thread, NULL, _efl_util_screenmirror_loop, screenmirror);
2413 fprintf(stderr, "[screenmirror] fail: thread create fail\n");
2414 _screenshot_mutex_unlock();
2415 return EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL;
2418 pthread_setname_np(screenmirror->thread, "e_util_mirror");
2420 _screenshot_mutex_unlock();
2422 return EFL_UTIL_ERROR_NONE;
2426 efl_util_screenmirror_stop(efl_util_screenmirror_h screenmirror)
2430 _screenshot_mutex_lock();
2432 if (!screenmirror || (screenmirror != g_screenmirror))
2434 _screenshot_mutex_unlock();
2435 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2437 else if (!screenmirror->mirror_working)
2439 _screenshot_mutex_unlock();
2440 return EFL_UTIL_ERROR_NONE;
2442 screenmirror->mirror_working = EINA_FALSE;
2443 pthread_join(screenmirror->thread, NULL);
2444 tizen_screenmirror_stop(screenmirror->tz_screenmirror);
2445 screenmirror->cb_stop = EINA_FALSE;
2447 while (!screenmirror->cb_stop && ret != -1)
2448 ret = wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);
2451 fprintf(stderr, "[screenmirror] fail: tizen_screenmirror_stop\n");
2452 _screenshot_mutex_unlock();
2453 return EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL;
2456 _screenshot_mutex_unlock();
2458 return EFL_UTIL_ERROR_NONE;
2460 /* LCOV_EXCL_STOP */
2462 struct _efl_util_gesture_h
2467 API int EFL_UTIL_EVENT_GESTURE_EDGE_SWIPE = 0;
2468 API int EFL_UTIL_EVENT_GESTURE_EDGE_DRAG = 0;
2469 API int EFL_UTIL_EVENT_GESTURE_TAP = 0;
2470 API int EFL_UTIL_EVENT_GESTURE_PALM_COVER = 0;
2472 /* LCOV_EXCL_START */
2474 _cb_gesture_edge_swipe_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t fingers EINA_UNUSED, uint32_t edge EINA_UNUSED, uint32_t edge_size EINA_UNUSED, uint32_t start_point EINA_UNUSED, uint32_t end_point EINA_UNUSED, uint32_t error)
2476 _eflutil_defaultqueue.wl.gesture.request_notified = error;
2480 _cb_gesture_edge_swipe(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t mode, uint32_t fingers, int sx, int sy, uint32_t edge)
2482 efl_util_event_gesture_edge_swipe_s *ev = NULL;
2484 ev = (efl_util_event_gesture_edge_swipe_s *)calloc(1, sizeof(*ev));
2489 ev->fingers = fingers;
2494 ecore_event_add(EFL_UTIL_EVENT_GESTURE_EDGE_SWIPE, ev, NULL, NULL);
2498 _cb_gesture_edge_drag_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t fingers EINA_UNUSED, uint32_t edge EINA_UNUSED, uint32_t edge_size EINA_UNUSED, uint32_t start_point EINA_UNUSED, uint32_t end_point EINA_UNUSED, uint32_t error)
2500 _eflutil_defaultqueue.wl.gesture.request_notified = error;
2504 _cb_gesture_edge_drag(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t mode, uint32_t fingers, int cx, int cy, uint32_t edge)
2506 efl_util_event_gesture_edge_drag_s *ev = NULL;
2508 ev = (efl_util_event_gesture_edge_drag_s *)calloc(1, sizeof(*ev));
2513 ev->fingers = fingers;
2518 ecore_event_add(EFL_UTIL_EVENT_GESTURE_EDGE_DRAG, ev, NULL, NULL);
2522 _cb_gesture_tap_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t fingers EINA_UNUSED, uint32_t repeat EINA_UNUSED, uint32_t error)
2524 _eflutil_defaultqueue.wl.gesture.request_notified = error;
2528 _cb_gesture_tap(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, uint32_t mode, uint32_t fingers, uint32_t repeats)
2530 efl_util_event_gesture_tap_s *ev = NULL;
2532 ev = (efl_util_event_gesture_tap_s *)calloc(1, sizeof(*ev));
2537 ev->fingers = fingers;
2538 ev->repeats = repeats;
2540 ecore_event_add(EFL_UTIL_EVENT_GESTURE_TAP, ev, NULL, NULL);
2542 /* LCOV_EXCL_STOP */
2545 _cb_gesture_palm_cover_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, struct wl_surface *surface EINA_UNUSED, uint32_t error)
2547 _eflutil_defaultqueue.wl.gesture.request_notified = error;
2550 /* LCOV_EXCL_START */
2552 _cb_gesture_palm_cover(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, struct wl_surface *surface, uint32_t mode, uint32_t duration, int cx, int cy, uint32_t size, wl_fixed_t pressure)
2554 efl_util_event_gesture_palm_cover_s *ev = NULL;
2556 ev = (efl_util_event_gesture_palm_cover_s *)calloc(1, sizeof(*ev));
2561 ev->duration = duration;
2565 ev->pressure = wl_fixed_to_int(pressure);
2567 ecore_event_add(EFL_UTIL_EVENT_GESTURE_PALM_COVER, ev, NULL, NULL);
2569 /* LCOV_EXCL_STOP */
2572 _cb_gesture_activate_notify(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA_UNUSED, struct wl_surface *surface EINA_UNUSED, uint32_t type EINA_UNUSED, uint32_t active EINA_UNUSED, uint32_t error)
2574 _eflutil_defaultqueue.wl.gesture.request_notified = error;
2577 static efl_util_error_e
2578 _efl_util_gesture_convert_error(int ret)
2582 case TIZEN_GESTURE_ERROR_NONE:
2583 return EFL_UTIL_ERROR_NONE;
2584 case TIZEN_GESTURE_ERROR_INVALID_DATA:
2585 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2586 case TIZEN_GESTURE_ERROR_NO_PERMISSION:
2587 return EFL_UTIL_ERROR_PERMISSION_DENIED;
2588 case TIZEN_GESTURE_ERROR_NO_SYSTEM_RESOURCES:
2589 return EFL_UTIL_ERROR_OUT_OF_MEMORY;
2590 case TIZEN_GESTURE_ERROR_GRABBED_ALREADY:
2591 return EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE;
2592 case TIZEN_GESTURE_ERROR_NOT_SUPPORTED:
2593 return EFL_UTIL_ERROR_NOT_SUPPORTED;
2595 return EFL_UTIL_ERROR_NONE;
2599 /* LCOV_EXCL_START */
2600 static efl_util_error_e
2601 _efl_util_gesture_verify_request_notified()
2603 int ret = EFL_UTIL_ERROR_NONE;
2605 while (_eflutil_defaultqueue.wl.gesture.request_notified == -1)
2606 wl_display_dispatch(_eflutil_defaultqueue.wl.dpy);
2608 ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified);
2609 _eflutil_defaultqueue.wl.gesture.request_notified = -1;
2615 _efl_util_gesture_grab_edge_swipe(efl_util_gesture_data data, Eina_Bool grabbed)
2617 int ret = EFL_UTIL_ERROR_NONE;
2618 Efl_Util_Gesture_Common_Grab_Data *base_data = NULL;
2619 Efl_Util_Gesture_Edge_Swipe_Grab_Data *edge_swipe_data = NULL;
2620 unsigned int fingers = 0;
2621 unsigned int edge = 0;
2622 unsigned int edge_size = 0;
2623 unsigned int start_point = 0;
2624 unsigned int end_point = 0;
2626 base_data = (Efl_Util_Gesture_Common_Grab_Data *)data;
2628 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER);
2629 EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
2630 EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_EDGE_SWIPE,
2631 EFL_UTIL_ERROR_INVALID_PARAMETER);
2633 edge_swipe_data = (Efl_Util_Gesture_Edge_Swipe_Grab_Data *)data;
2635 fingers = edge_swipe_data->fingers;
2636 edge = edge_swipe_data->edge;
2637 edge_size = edge_swipe_data->edge_size;
2638 start_point = edge_swipe_data->start_point;
2639 end_point = edge_swipe_data->end_point;
2642 tizen_gesture_grab_edge_swipe(_eflutil_defaultqueue.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point);
2644 tizen_gesture_ungrab_edge_swipe(_eflutil_defaultqueue.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point);
2646 ret = _efl_util_gesture_verify_request_notified();
2652 _efl_util_gesture_grab_edge_drag(efl_util_gesture_data data, Eina_Bool grabbed)
2654 int ret = EFL_UTIL_ERROR_NONE;
2655 Efl_Util_Gesture_Common_Grab_Data *base_data = NULL;
2656 Efl_Util_Gesture_Edge_Drag_Grab_Data *edge_drag_data = NULL;
2657 unsigned int fingers = 0;
2658 unsigned int edge = 0;
2659 unsigned int edge_size = 0;
2660 unsigned int start_point = 0;
2661 unsigned int end_point = 0;
2663 base_data = (Efl_Util_Gesture_Common_Grab_Data *)data;
2665 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER);
2666 EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
2667 EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_EDGE_DRAG,
2668 EFL_UTIL_ERROR_INVALID_PARAMETER);
2670 edge_drag_data = (Efl_Util_Gesture_Edge_Drag_Grab_Data *)data;
2672 fingers = edge_drag_data->fingers;
2673 edge = edge_drag_data->edge;
2674 edge_size = edge_drag_data->edge_size;
2675 start_point = edge_drag_data->start_point;
2676 end_point = edge_drag_data->end_point;
2679 tizen_gesture_grab_edge_drag(_eflutil_defaultqueue.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point);
2681 tizen_gesture_ungrab_edge_drag(_eflutil_defaultqueue.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point);
2683 ret = _efl_util_gesture_verify_request_notified();
2689 _efl_util_gesture_grab_tap(efl_util_gesture_data data, Eina_Bool grabbed)
2691 int ret = EFL_UTIL_ERROR_NONE;
2692 Efl_Util_Gesture_Common_Grab_Data *base_data = NULL;
2693 Efl_Util_Gesture_Tap_Grab_Data *tap_data = NULL;
2694 unsigned int fingers = 0;
2695 unsigned int repeats = 0;
2697 base_data = (Efl_Util_Gesture_Common_Grab_Data *)data;
2699 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER);
2700 EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
2701 EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_TAP,
2702 EFL_UTIL_ERROR_INVALID_PARAMETER);
2704 tap_data = (Efl_Util_Gesture_Tap_Grab_Data *)data;
2706 fingers = tap_data->fingers;
2707 repeats = tap_data->repeats;
2710 tizen_gesture_grab_tap(_eflutil_defaultqueue.wl.gesture.proto, fingers, repeats);
2712 tizen_gesture_ungrab_tap(_eflutil_defaultqueue.wl.gesture.proto, fingers, repeats);
2714 ret = _efl_util_gesture_verify_request_notified();
2720 _efl_util_gesture_grab_palm_cover(efl_util_gesture_data data, Eina_Bool grabbed)
2722 int ret = EFL_UTIL_ERROR_NONE;
2723 Efl_Util_Gesture_Common_Grab_Data *base_data = NULL;
2725 base_data = (Efl_Util_Gesture_Common_Grab_Data *)data;
2727 EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER);
2728 EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
2729 EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_PALM_COVER,
2730 EFL_UTIL_ERROR_INVALID_PARAMETER);
2733 tizen_gesture_grab_palm_cover(_eflutil_defaultqueue.wl.gesture.proto);
2735 tizen_gesture_ungrab_palm_cover(_eflutil_defaultqueue.wl.gesture.proto);
2737 ret = _efl_util_gesture_verify_request_notified();
2741 /* LCOV_EXCL_STOP */
2743 API efl_util_gesture_h
2744 efl_util_gesture_initialize(void)
2746 efl_util_gesture_h gesture_h = NULL;
2748 gesture_h = (efl_util_gesture_h)calloc(1, sizeof(struct _efl_util_gesture_h));
2751 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */
2752 goto out; /* LCOV_EXCL_LINE */
2755 if (_wl_init_default_queue() == (int)EINA_FALSE)
2757 set_last_result(EFL_UTIL_ERROR_NOT_SUPPORTED); /* LCOV_EXCL_LINE */
2758 goto out; /* LCOV_EXCL_LINE */
2761 while (!_eflutil_defaultqueue.wl.gesture.proto)
2762 wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); /* LCOV_EXCL_LINE */
2764 if (_eflutil_defaultqueue.wl.gesture.event_init <= 0)
2766 if (ecore_event_init() <= 0)
2768 set_last_result(EFL_UTIL_ERROR_NOT_SUPPORTED); /* LCOV_EXCL_LINE */
2769 goto out; /* LCOV_EXCL_LINE */
2771 EFL_UTIL_EVENT_GESTURE_EDGE_SWIPE = ecore_event_type_new();
2772 EFL_UTIL_EVENT_GESTURE_EDGE_DRAG = ecore_event_type_new();
2773 EFL_UTIL_EVENT_GESTURE_TAP = ecore_event_type_new();
2774 EFL_UTIL_EVENT_GESTURE_PALM_COVER = ecore_event_type_new();
2776 _eflutil_defaultqueue.wl.gesture.event_init++;
2777 gesture_h->init = EINA_TRUE;
2779 set_last_result(EFL_UTIL_ERROR_NONE);
2783 /* LCOV_EXCL_START */
2790 /* LCOV_EXCL_STOP */
2794 efl_util_gesture_deinitialize(efl_util_gesture_h gesture_h)
2796 EINA_SAFETY_ON_NULL_RETURN_VAL(gesture_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
2797 EINA_SAFETY_ON_FALSE_RETURN_VAL(gesture_h->init, EFL_UTIL_ERROR_INVALID_PARAMETER);
2802 _eflutil_defaultqueue.wl.gesture.event_init--;
2804 if (_eflutil_defaultqueue.wl.gesture.event_init <= 0)
2806 _eflutil_defaultqueue.wl.gesture.event_init = 0;
2807 ecore_event_shutdown();
2808 EFL_UTIL_EVENT_GESTURE_EDGE_SWIPE = 0;
2809 EFL_UTIL_EVENT_GESTURE_EDGE_DRAG = 0;
2810 EFL_UTIL_EVENT_GESTURE_TAP = 0;
2811 EFL_UTIL_EVENT_GESTURE_PALM_COVER = 0;
2814 return EFL_UTIL_ERROR_NONE;
2817 API efl_util_gesture_data
2818 efl_util_gesture_edge_swipe_new(efl_util_gesture_h gesture_h, unsigned int fingers, efl_util_gesture_edge_e edge)
2820 Efl_Util_Gesture_Edge_Swipe_Grab_Data *data;
2822 if (!gesture_h || gesture_h->init == EINA_FALSE)
2824 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
2828 if (edge <= EFL_UTIL_GESTURE_EDGE_NONE || edge > EFL_UTIL_GESTURE_EDGE_LEFT)
2830 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
2834 data = (Efl_Util_Gesture_Edge_Swipe_Grab_Data *)calloc(1, sizeof(Efl_Util_Gesture_Edge_Swipe_Grab_Data));
2837 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */
2838 return NULL; /* LCOV_EXCL_LINE */
2841 data->base.type = TIZEN_GESTURE_TYPE_EDGE_SWIPE;
2842 data->fingers = fingers;
2844 data->edge_size = EFL_UTIL_GESTURE_EDGE_SIZE_FULL;
2846 set_last_result(EFL_UTIL_ERROR_NONE);
2848 return (void *)data;
2852 efl_util_gesture_edge_swipe_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data)
2854 if (!gesture_h || gesture_h->init == EINA_FALSE)
2856 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2861 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2867 return EFL_UTIL_ERROR_NONE;
2871 efl_util_gesture_edge_swipe_size_set(efl_util_gesture_data data, efl_util_gesture_edge_size_e edge_size, unsigned int start_point, unsigned int end_point)
2873 Efl_Util_Gesture_Edge_Swipe_Grab_Data *edge_swipe_data = data;
2875 EINA_SAFETY_ON_NULL_RETURN_VAL(edge_swipe_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
2876 EINA_SAFETY_ON_FALSE_RETURN_VAL(edge_swipe_data->base.type == TIZEN_GESTURE_TYPE_EDGE_SWIPE,
2877 EFL_UTIL_ERROR_INVALID_PARAMETER);
2878 EINA_SAFETY_ON_FALSE_RETURN_VAL(edge_size == EFL_UTIL_GESTURE_EDGE_SIZE_PARTIAL,
2879 EFL_UTIL_ERROR_INVALID_PARAMETER);
2880 EINA_SAFETY_ON_FALSE_RETURN_VAL(end_point > start_point, EFL_UTIL_ERROR_INVALID_PARAMETER);
2882 edge_swipe_data->edge_size = edge_size;
2883 edge_swipe_data->start_point = start_point;
2884 edge_swipe_data->end_point = end_point;
2886 return EFL_UTIL_ERROR_NONE;
2889 API efl_util_gesture_data
2890 efl_util_gesture_edge_drag_new(efl_util_gesture_h gesture_h, unsigned int fingers, efl_util_gesture_edge_e edge)
2892 Efl_Util_Gesture_Edge_Drag_Grab_Data *data;
2894 if (!gesture_h || gesture_h->init == EINA_FALSE)
2896 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
2900 if (edge <= EFL_UTIL_GESTURE_EDGE_NONE || edge > EFL_UTIL_GESTURE_EDGE_LEFT)
2902 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
2906 data = (Efl_Util_Gesture_Edge_Drag_Grab_Data *)calloc(1, sizeof(Efl_Util_Gesture_Edge_Drag_Grab_Data));
2909 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */
2910 return NULL; /* LCOV_EXCL_LINE */
2913 data->base.type = TIZEN_GESTURE_TYPE_EDGE_DRAG;
2914 data->fingers = fingers;
2916 data->edge_size = EFL_UTIL_GESTURE_EDGE_SIZE_FULL;
2918 set_last_result(EFL_UTIL_ERROR_NONE);
2920 return (void *)data;
2924 efl_util_gesture_edge_drag_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data)
2926 if (!gesture_h || gesture_h->init == EINA_FALSE)
2928 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2933 return EFL_UTIL_ERROR_INVALID_PARAMETER;
2939 return EFL_UTIL_ERROR_NONE;
2943 efl_util_gesture_edge_drag_size_set(efl_util_gesture_data data, efl_util_gesture_edge_size_e edge_size, unsigned int start_point, unsigned int end_point)
2945 Efl_Util_Gesture_Edge_Drag_Grab_Data *edge_drag_data = data;
2947 EINA_SAFETY_ON_NULL_RETURN_VAL(edge_drag_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
2948 EINA_SAFETY_ON_FALSE_RETURN_VAL(edge_drag_data->base.type == TIZEN_GESTURE_TYPE_EDGE_DRAG,
2949 EFL_UTIL_ERROR_INVALID_PARAMETER);
2950 EINA_SAFETY_ON_FALSE_RETURN_VAL(edge_size == EFL_UTIL_GESTURE_EDGE_SIZE_PARTIAL,
2951 EFL_UTIL_ERROR_INVALID_PARAMETER);
2952 EINA_SAFETY_ON_FALSE_RETURN_VAL(end_point > start_point, EFL_UTIL_ERROR_INVALID_PARAMETER);
2954 edge_drag_data->edge_size = edge_size;
2955 edge_drag_data->start_point = start_point;
2956 edge_drag_data->end_point = end_point;
2958 return EFL_UTIL_ERROR_NONE;
2961 API efl_util_gesture_data
2962 efl_util_gesture_tap_new(efl_util_gesture_h gesture_h, unsigned int fingers, unsigned int repeats)
2964 Efl_Util_Gesture_Tap_Grab_Data *data;
2966 if (!gesture_h || gesture_h->init == EINA_FALSE)
2968 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
2972 if (fingers <= 1 || repeats <= 1)
2974 set_last_result(EFL_UTIL_ERROR_NOT_SUPPORTED);
2978 data = (Efl_Util_Gesture_Tap_Grab_Data *)calloc(1, sizeof(Efl_Util_Gesture_Tap_Grab_Data));
2981 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */
2982 return NULL; /* LCOV_EXCL_LINE */
2985 data->base.type = TIZEN_GESTURE_TYPE_TAP;
2986 data->fingers = fingers;
2987 data->repeats = repeats;
2989 set_last_result(EFL_UTIL_ERROR_NONE);
2991 return (void *)data;
2995 efl_util_gesture_tap_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data)
2997 if (!gesture_h || gesture_h->init == EINA_FALSE)
2999 return EFL_UTIL_ERROR_INVALID_PARAMETER;
3004 return EFL_UTIL_ERROR_INVALID_PARAMETER;
3010 return EFL_UTIL_ERROR_NONE;
3013 API efl_util_gesture_data
3014 efl_util_gesture_palm_cover_new(efl_util_gesture_h gesture_h)
3016 Efl_Util_Gesture_Palm_Cover_Grab_Data *data;
3018 if (!gesture_h || gesture_h->init == EINA_FALSE)
3020 set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
3024 data = (Efl_Util_Gesture_Palm_Cover_Grab_Data *)calloc(1, sizeof(Efl_Util_Gesture_Palm_Cover_Grab_Data));
3027 set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */
3028 return NULL; /* LCOV_EXCL_LINE */
3031 data->base.type = TIZEN_GESTURE_TYPE_PALM_COVER;
3033 set_last_result(EFL_UTIL_ERROR_NONE);
3035 return (void *)data;
3039 efl_util_gesture_palm_cover_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data)
3041 if (!gesture_h || gesture_h->init == EINA_FALSE)
3043 return EFL_UTIL_ERROR_INVALID_PARAMETER;
3048 return EFL_UTIL_ERROR_INVALID_PARAMETER;
3054 return EFL_UTIL_ERROR_NONE;
3057 /* LCOV_EXCL_START */
3059 efl_util_gesture_grab(efl_util_gesture_h gesture_h, efl_util_gesture_data data)
3061 int ret = EFL_UTIL_ERROR_NONE;
3062 Efl_Util_Gesture_Common_Grab_Data *base_data = NULL;
3064 base_data = (Efl_Util_Gesture_Common_Grab_Data *)data;
3066 EINA_SAFETY_ON_NULL_RETURN_VAL(gesture_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
3067 EINA_SAFETY_ON_FALSE_RETURN_VAL(gesture_h->init, EFL_UTIL_ERROR_INVALID_PARAMETER);
3068 EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
3070 switch (base_data->type)
3072 case TIZEN_GESTURE_TYPE_EDGE_SWIPE:
3073 ret = _efl_util_gesture_grab_edge_swipe(data, EINA_TRUE);
3075 case TIZEN_GESTURE_TYPE_EDGE_DRAG:
3076 ret = _efl_util_gesture_grab_edge_drag(data, EINA_TRUE);
3078 case TIZEN_GESTURE_TYPE_TAP:
3079 ret = _efl_util_gesture_grab_tap(data, EINA_TRUE);
3081 case TIZEN_GESTURE_TYPE_PALM_COVER:
3082 ret = _efl_util_gesture_grab_palm_cover(data, EINA_TRUE);
3085 return EFL_UTIL_ERROR_INVALID_PARAMETER;
3092 efl_util_gesture_ungrab(efl_util_gesture_h gesture_h, efl_util_gesture_data data)
3094 int ret = EFL_UTIL_ERROR_NONE;
3095 Efl_Util_Gesture_Common_Grab_Data *base_data = NULL;
3097 base_data = (Efl_Util_Gesture_Common_Grab_Data *)data;
3099 EINA_SAFETY_ON_NULL_RETURN_VAL(gesture_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
3100 EINA_SAFETY_ON_FALSE_RETURN_VAL(gesture_h->init, EFL_UTIL_ERROR_INVALID_PARAMETER);
3101 EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
3103 switch (base_data->type)
3105 case TIZEN_GESTURE_TYPE_EDGE_SWIPE:
3106 ret = _efl_util_gesture_grab_edge_swipe(data, EINA_FALSE);
3108 case TIZEN_GESTURE_TYPE_EDGE_DRAG:
3109 ret = _efl_util_gesture_grab_edge_drag(data, EINA_FALSE);
3111 case TIZEN_GESTURE_TYPE_TAP:
3112 ret = _efl_util_gesture_grab_tap(data, EINA_FALSE);
3114 case TIZEN_GESTURE_TYPE_PALM_COVER:
3115 ret = _efl_util_gesture_grab_palm_cover(data, EINA_FALSE);
3118 return EFL_UTIL_ERROR_INVALID_PARAMETER;
3123 /* LCOV_EXCL_STOP */
3126 efl_util_gesture_select(efl_util_gesture_h gesture_h, Evas_Object *window, efl_util_gesture_data data)
3128 Efl_Util_Gesture_Common_Grab_Data *base_data = NULL;
3129 Ecore_Wl2_Window *wlwin;
3130 struct wl_surface *surface;
3133 base_data = (Efl_Util_Gesture_Common_Grab_Data *)data;
3135 EINA_SAFETY_ON_NULL_RETURN_VAL(gesture_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
3136 EINA_SAFETY_ON_FALSE_RETURN_VAL(gesture_h->init, EFL_UTIL_ERROR_INVALID_PARAMETER);
3137 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
3138 EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
3140 if (base_data->type != TIZEN_GESTURE_TYPE_PALM_COVER)
3141 return EFL_UTIL_ERROR_NOT_SUPPORTED;
3143 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
3144 if (!wlwin) return EFL_UTIL_ERROR_INVALID_PARAMETER;
3146 surface = ecore_wl2_window_surface_get(wlwin);
3147 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
3148 EFL_UTIL_ERROR_INVALID_PARAMETER);
3150 tizen_gesture_select_palm_cover(_eflutil_defaultqueue.wl.gesture.proto, surface);
3152 ret = _efl_util_gesture_verify_request_notified();
3158 efl_util_gesture_deselect(efl_util_gesture_h gesture_h, Evas_Object *window, efl_util_gesture_data data)
3160 Efl_Util_Gesture_Common_Grab_Data *base_data = NULL;
3161 Ecore_Wl2_Window *wlwin;
3162 struct wl_surface *surface;
3165 base_data = (Efl_Util_Gesture_Common_Grab_Data *)data;
3167 EINA_SAFETY_ON_NULL_RETURN_VAL(gesture_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
3168 EINA_SAFETY_ON_FALSE_RETURN_VAL(gesture_h->init, EFL_UTIL_ERROR_INVALID_PARAMETER);
3169 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
3170 EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER);
3172 if (base_data->type != TIZEN_GESTURE_TYPE_PALM_COVER)
3173 return EFL_UTIL_ERROR_NOT_SUPPORTED;
3175 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
3176 if (!wlwin) return EFL_UTIL_ERROR_INVALID_PARAMETER;
3178 surface = ecore_wl2_window_surface_get(wlwin);
3179 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
3180 EFL_UTIL_ERROR_INVALID_PARAMETER);
3182 tizen_gesture_deselect_palm_cover(_eflutil_defaultqueue.wl.gesture.proto, surface);
3184 ret = _efl_util_gesture_verify_request_notified();
3189 /* LCOV_EXCL_START */
3191 efl_util_gesture_activate_set(efl_util_gesture_h gesture_h, unsigned int type, Eina_Bool active)
3195 EINA_SAFETY_ON_NULL_RETURN_VAL(gesture_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
3196 EINA_SAFETY_ON_FALSE_RETURN_VAL(gesture_h->init, EFL_UTIL_ERROR_INVALID_PARAMETER);
3197 EINA_SAFETY_ON_TRUE_RETURN_VAL(type == EFL_UTIL_GESTURE_TYPE_NONE, EFL_UTIL_ERROR_INVALID_PARAMETER);
3199 tizen_gesture_activate_set(_eflutil_defaultqueue.wl.gesture.proto, NULL, type, active);
3201 ret = _efl_util_gesture_verify_request_notified();
3205 /* LCOV_EXCL_STOP */
3208 efl_util_gesture_activate_set_on_window(efl_util_gesture_h gesture_h, Evas_Object *window, unsigned int type, Eina_Bool active)
3210 Ecore_Wl2_Window *wlwin;
3211 struct wl_surface *surface;
3214 EINA_SAFETY_ON_NULL_RETURN_VAL(gesture_h, EFL_UTIL_ERROR_INVALID_PARAMETER);
3215 EINA_SAFETY_ON_FALSE_RETURN_VAL(gesture_h->init, EFL_UTIL_ERROR_INVALID_PARAMETER);
3216 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
3217 EINA_SAFETY_ON_TRUE_RETURN_VAL(type == EFL_UTIL_GESTURE_TYPE_NONE, EFL_UTIL_ERROR_INVALID_PARAMETER);
3219 wlwin = (Ecore_Wl2_Window *)elm_win_wl_window_get(window);
3220 if (!wlwin) return EFL_UTIL_ERROR_INVALID_PARAMETER;
3222 surface = ecore_wl2_window_surface_get(wlwin);
3223 EINA_SAFETY_ON_NULL_RETURN_VAL(surface,
3224 EFL_UTIL_ERROR_INVALID_PARAMETER);
3226 tizen_gesture_activate_set(_eflutil_defaultqueue.wl.gesture.proto, surface, type, active);
3228 ret = _efl_util_gesture_verify_request_notified();