X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fefl_util.c;h=902b0db1c6daca7cc306c9b7964bec13fb4bab6c;hb=5c722ad18d2d3333d81c04201b08e5c80968df00;hp=b5032bf7cd1d955af764ddfdb91e772b801d1616;hpb=1c2cadbfa459c50c4d6787bbf2ad7c6d834f874c;p=platform%2Fcore%2Fapi%2Fefl-util.git diff --git a/src/efl_util.c b/src/efl_util.c index b5032bf..902b0db 100644 --- a/src/efl_util.c +++ b/src/efl_util.c @@ -95,6 +95,7 @@ static inline tizen_profile_t get_tizen_profile() #define LOG_TAG "TIZEN_N_EFL_UTIL" #define EFL_UTIL_INPUT_GENERATOR_DEFAULT_TIME_OUT 1000 #define EFL_UTIL_INPUT_GENERATOR_DEFAULT_DISPATCH_TIME_OUT 10 +#define EFL_UTIL_INPUT_GENERATOR_TOUCH_MAX_FINGER 10 typedef struct _Efl_Util_Wl_Surface_Lv_Info { @@ -173,6 +174,15 @@ typedef struct _Efl_Util_Device_Info Eina_Stringshare *name; } Efl_Util_Device_Info; +typedef struct _E_Devicemgr_Inputgen_Touch_Axis +{ + double radius_x; + double radius_y; + double pressure; + double angle; + double palm; +} E_Devicemgr_Inputgen_Touch_Axis; + typedef struct _Efl_Util_Data { /* wayland related stuffs */ @@ -182,8 +192,6 @@ typedef struct _Efl_Util_Data Ecore_Wl2_Display *wl2_display; struct wl_display *dpy; struct wl_event_queue *queue; - int dpy_fd; - Ecore_Fd_Handler *fd_hdl; struct { @@ -208,39 +216,68 @@ typedef struct _Efl_Util_Data Eina_List *devices; Eina_List *wait_devices; struct wl_event_source *wait_timer; + int max_touch_count; + int request_touch_count; } devmgr; + struct wl_seat *seat; struct { unsigned int id; struct tizen_display_policy *proto; Eina_Hash *hash_brightness; } display_policy; + } wl; +} Efl_Util_Data; + +typedef struct _Efl_Util_Data_Default_Queue +{ + /* wayland related stuffs */ + struct + { + Eina_Bool init; + Ecore_Wl2_Display *wl2_display; + struct wl_display *dpy; + struct { + unsigned int id; struct tizen_gesture *proto; int request_notified; int event_init; } gesture; } wl; -} Efl_Util_Data; +} Efl_Util_Data_Default_Queue; + static Efl_Util_Data _eflutil = { { EINA_FALSE, NULL, NULL, NULL, - -1, NULL, { 0, NULL, NULL, NULL }, /* tizen_policy protocol */ { NULL, NULL, NULL, NULL, NULL, 0 }, /* screenshooter protocol */ - { NULL, -1 }, /* tizen_input_device_manager protocol */ - { 0, NULL, NULL }, /* display_policy protocol */ - { NULL, -1, EINA_FALSE } /* tizen_gesture protocol */ + { NULL, -1, NULL, NULL, NULL, 0, 0 }, /* tizen_input_device_manager protocol */ + NULL, /* wl_seat protocol */ + { 0, NULL, NULL } /* display_policy protocol */ + }, +}; + +static Efl_Util_Data_Default_Queue _eflutil_defaultqueue = +{ + { + EINA_FALSE, + NULL, NULL, + { 0, NULL, -1, 0 } /* gesture protocol */ }, }; + static Eina_Bool _wl_init(void); +static Eina_Bool _wl_init_default_queue(void); static void _cb_wl_reg_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version); static void _cb_wl_reg_global_remove(void *data, struct wl_registry *reg, unsigned int name); +static void _cb_wl_default_queue_reg_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version); +static void _cb_wl_default_queue_reg_global_remove(void *data, struct wl_registry *reg, unsigned int name); static void _cb_wl_reg_screenshooter_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version); static void _cb_wl_reg_screenshooter_global_remove(void *data, struct wl_registry *reg, unsigned int name); static void _cb_wl_tz_policy_conformant(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t is_conformant); @@ -264,6 +301,7 @@ static void _cb_device_add(void *data EINA_UNUSED, struct tiz 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); static void _cb_error(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, uint32_t errorcode); static void _cb_block_expired(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED); +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); 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); 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); @@ -314,7 +352,8 @@ struct tizen_input_device_manager_listener _wl_tz_devmgr_listener = _cb_device_add, _cb_device_remove, _cb_error, - _cb_block_expired + _cb_block_expired, + _cb_max_touch_count }; struct tizen_display_policy_listener _wl_tz_display_policy_listener = @@ -322,6 +361,12 @@ struct tizen_display_policy_listener _wl_tz_display_policy_listener = _cb_wl_tz_display_policy_brightness_done, }; +static const struct wl_registry_listener _wl_default_queue_reg_listener = +{ + _cb_wl_default_queue_reg_global, + _cb_wl_default_queue_reg_global_remove +}; + struct tizen_gesture_listener _wl_tz_gesture_listener = { _cb_gesture_edge_swipe_notify, @@ -382,6 +427,40 @@ fail: return EINA_FALSE; } +static Eina_Bool +_wl_init_default_queue(void) +{ + struct wl_display *display_wrapper = NULL; + struct wl_registry *reg = NULL; + + if (_eflutil_defaultqueue.wl.init) return EINA_TRUE; + + if (ecore_wl2_init() <= 0) return EINA_FALSE; + + _eflutil_defaultqueue.wl.wl2_display = ecore_wl2_connected_display_get(NULL); + EINA_SAFETY_ON_NULL_GOTO(_eflutil_defaultqueue.wl.wl2_display, fail); + _eflutil_defaultqueue.wl.dpy = ecore_wl2_display_get(_eflutil_defaultqueue.wl.wl2_display); + EINA_SAFETY_ON_NULL_GOTO(_eflutil_defaultqueue.wl.dpy, fail); + + display_wrapper = wl_proxy_create_wrapper(_eflutil_defaultqueue.wl.dpy); + EINA_SAFETY_ON_NULL_GOTO(display_wrapper, fail); + + reg = wl_display_get_registry(display_wrapper); + wl_proxy_wrapper_destroy(display_wrapper); + display_wrapper = NULL; + EINA_SAFETY_ON_NULL_GOTO(reg, fail); + + wl_registry_add_listener(reg, &_wl_default_queue_reg_listener, NULL); + + _eflutil_defaultqueue.wl.init = EINA_TRUE; + + return EINA_TRUE; +fail: + + ecore_wl2_shutdown(); + return EINA_FALSE; +} + static void _cb_wl_output_geometry(void *data, struct wl_output *wl_output, int x, int y, int physical_width, int physical_height, int subpixel, @@ -456,6 +535,22 @@ static const struct tizen_screenshooter_listener tz_screenshooter_listener = }; static void +_cb_seat_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) +{ +} + +static void +_cb_seat_name(void *data, struct wl_seat *seat EINA_UNUSED, const char *name) +{ +} + +static const struct wl_seat_listener _seat_listener = +{ + _cb_seat_capabilities, + _cb_seat_name, +}; + +static void _cb_wl_reg_global(void *data, struct wl_registry *reg, unsigned int id, @@ -490,6 +585,11 @@ _cb_wl_reg_global(void *data, output->output = wl_registry_bind(reg, id, &wl_output_interface, version); wl_output_add_listener(output->output, &output_listener, output); } + else if(strcmp(interface, "wl_seat") == 0) + { + _eflutil.wl.seat = wl_registry_bind(reg, id, &wl_seat_interface, version); + wl_seat_add_listener(_eflutil.wl.seat, &_seat_listener, NULL); + } else if (strcmp(interface, "tizen_input_device_manager") == 0) { _eflutil.wl.devmgr.devicemgr = wl_registry_bind(reg, id, &tizen_input_device_manager_interface, version); @@ -507,11 +607,6 @@ _cb_wl_reg_global(void *data, _eflutil.wl.display_policy.hash_brightness = eina_hash_pointer_new(free); _eflutil.wl.display_policy.id = id; } - else if (strcmp(interface, "tizen_gesture") == 0) - { - _eflutil.wl.gesture.proto = wl_registry_bind(reg, id, &tizen_gesture_interface, version); - tizen_gesture_add_listener(_eflutil.wl.gesture.proto, &_wl_tz_gesture_listener, NULL); - } } /* LCOV_EXCL_START */ static void @@ -539,6 +634,35 @@ _cb_wl_reg_global_remove(void *data, /* LCOV_EXCL_STOP */ static void +_cb_wl_default_queue_reg_global(void *data, + struct wl_registry *reg, + unsigned int id, + const char *interface, + unsigned int version) +{ + if (strcmp(interface, "tizen_gesture") == 0) + { + _eflutil_defaultqueue.wl.gesture.id = id; + _eflutil_defaultqueue.wl.gesture.proto = wl_registry_bind(reg, id, &tizen_gesture_interface, version); + tizen_gesture_add_listener(_eflutil_defaultqueue.wl.gesture.proto, &_wl_tz_gesture_listener, NULL); + } +} +/* LCOV_EXCL_START */ +static void +_cb_wl_default_queue_reg_global_remove(void *data, + struct wl_registry *reg, + unsigned int id) +{ + if (id == _eflutil_defaultqueue.wl.gesture.id) + { + _eflutil_defaultqueue.wl.gesture.id = 0; + _eflutil_defaultqueue.wl.gesture.proto = NULL; + } +} +/* LCOV_EXCL_STOP */ + + +static void _cb_wl_reg_screenshooter_global(void *data, struct wl_registry *reg, unsigned int name, @@ -1140,6 +1264,7 @@ struct _efl_util_inputgen_h { unsigned int init_type; char name[32]; + E_Devicemgr_Inputgen_Touch_Axis *axis_info; }; static Eina_Bool @@ -1298,6 +1423,16 @@ _cb_block_expired(void *data EINA_UNUSED, } /* LCOV_EXCL_STOP */ +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, + struct wl_seat *seat EINA_UNUSED) +{ + _eflutil.wl.devmgr.max_touch_count = max_count; +} + static efl_util_error_e _efl_util_input_convert_input_generator_error(int ret) { @@ -1311,6 +1446,8 @@ _efl_util_input_convert_input_generator_error(int ret) return EFL_UTIL_ERROR_OUT_OF_MEMORY; case TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER: return EFL_UTIL_ERROR_INVALID_PARAMETER; + case TIZEN_INPUT_DEVICE_MANAGER_ERROR_NOT_ALLOWED: + return EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE; default : return EFL_UTIL_ERROR_NONE; } @@ -1354,8 +1491,11 @@ _efl_util_input_initialize_wait_device(void) { ret = wl_event_source_timer_update(_eflutil.wl.devmgr.wait_timer, EFL_UTIL_INPUT_GENERATOR_DEFAULT_TIME_OUT); - if (ret != 0) _timer_wait(NULL); - return; + if (ret != 0) + { + _timer_wait(NULL); + return; + } } while (_eflutil.wl.devmgr.wait_timer) @@ -1605,6 +1745,39 @@ out: } API int +efl_util_input_set_touch_count(int max_count) +{ + int ret = EFL_UTIL_ERROR_NONE; + + ret = _wl_init(); + if (ret == (int)EINA_FALSE) + { + return EFL_UTIL_ERROR_INVALID_PARAMETER; + } + + while (!_eflutil.wl.devmgr.devicemgr) + wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + + if (_eflutil.wl.devmgr.max_touch_count >= max_count) + return EFL_UTIL_ERROR_NONE; + + tizen_input_device_manager_set_touch_count(_eflutil.wl.devmgr.devicemgr, max_count); + + while (_eflutil.wl.devmgr.request_notified == -1) + wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + + ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified); + _eflutil.wl.devmgr.request_notified = -1; + + if (ret == EFL_UTIL_ERROR_NONE) + { + _eflutil.wl.devmgr.request_touch_count = max_count; + } + + return ret; +} + +API int efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h) { int ret = EFL_UTIL_ERROR_NONE; @@ -1618,6 +1791,9 @@ efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h) if (inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_POINTER) clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE; + if (inputgen_h->axis_info) + free(inputgen_h->axis_info); + free(inputgen_h); inputgen_h = NULL; @@ -1669,6 +1845,9 @@ efl_util_input_generate_touch(efl_util_inputgen_h inputgen_h, int idx, EINA_SAFETY_ON_FALSE_RETURN_VAL((x > 0 && y > 0), EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, EFL_UTIL_ERROR_NO_SUCH_DEVICE); + if (idx >= _eflutil.wl.devmgr.max_touch_count) + return EFL_UTIL_ERROR_INVALID_PARAMETER; + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER); switch(touch_type) @@ -1697,6 +1876,146 @@ efl_util_input_generate_touch(efl_util_inputgen_h inputgen_h, int idx, return ret; } +static int +_efl_util_input_generate_touch_axis_send(unsigned int type, double value) +{ + int ret; + + tizen_input_device_manager_generate_axis(_eflutil.wl.devmgr.devicemgr, type, wl_fixed_from_double(value)); + + while (_eflutil.wl.devmgr.request_notified == -1) + wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + + ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified); + _eflutil.wl.devmgr.request_notified = -1; + + return ret; +} + +static void +_efl_util_input_generate_touch_axis_cleanup(efl_util_inputgen_h inputgen_h, int idx) +{ + int i; + if (idx >= 0) + { + inputgen_h->axis_info[idx].radius_x = 1.0; + inputgen_h->axis_info[idx].radius_y = 1.0; + inputgen_h->axis_info[idx].pressure = 1.0; + inputgen_h->axis_info[idx].angle = 0.0; + inputgen_h->axis_info[idx].palm = 0.0; + } + else + { + for (i = 0; i < EFL_UTIL_INPUT_GENERATOR_TOUCH_MAX_FINGER; i++) + { + inputgen_h->axis_info[i].radius_x = 1.0; + inputgen_h->axis_info[i].radius_y = 1.0; + inputgen_h->axis_info[i].pressure = 1.0; + inputgen_h->axis_info[i].angle = 0.0; + inputgen_h->axis_info[i].palm = 0.0; + } + } +} + +static int +_efl_util_input_generate_touch_axis_process(efl_util_inputgen_h inputgen_h, int idx, double radius_x, + double radius_y, double pressure, double angle, double palm) +{ + int ret = EFL_UTIL_ERROR_NONE; + + if (!inputgen_h->axis_info) + { + inputgen_h->axis_info = calloc(EFL_UTIL_INPUT_GENERATOR_TOUCH_MAX_FINGER, + sizeof(E_Devicemgr_Inputgen_Touch_Axis)); + _efl_util_input_generate_touch_axis_cleanup(inputgen_h, -1); + } + + if (inputgen_h->axis_info[idx].radius_x != radius_x) + { + ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_RADIUS_X, radius_x); + if (ret != EFL_UTIL_ERROR_NONE) return ret; + inputgen_h->axis_info[idx].radius_x = radius_x; + } + if (inputgen_h->axis_info[idx].radius_y != radius_y) + { + ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_RADIUS_Y, radius_y); + if (ret != EFL_UTIL_ERROR_NONE) return ret; + inputgen_h->axis_info[idx].radius_y = radius_y; + } + if (inputgen_h->axis_info[idx].pressure != pressure) + { + ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_PRESSURE, pressure); + if (ret != EFL_UTIL_ERROR_NONE) return ret; + inputgen_h->axis_info[idx].pressure = pressure; + } + if (inputgen_h->axis_info[idx].angle != angle) + { + ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_ANGLE, angle); + if (ret != EFL_UTIL_ERROR_NONE) return ret; + inputgen_h->axis_info[idx].angle = angle; + } + if (inputgen_h->axis_info[idx].palm != palm) + { + ret = _efl_util_input_generate_touch_axis_send(TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_PALM, palm); + if (ret != EFL_UTIL_ERROR_NONE) return ret; + inputgen_h->axis_info[idx].palm = palm; + } + + return ret; +} + +API int +efl_util_input_generate_touch_axis(efl_util_inputgen_h inputgen_h, int idx, + efl_util_input_touch_type_e touch_type, int x, int y, + double radius_x, double radius_y, + double pressure, double angle, double palm) +{ + int ret, version; + enum tizen_input_device_manager_pointer_event_type type; + + EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_FALSE_RETURN_VAL(idx >= 0, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_FALSE_RETURN_VAL((x >= 0 && y >= 0), EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, EFL_UTIL_ERROR_NO_SUCH_DEVICE); + EINA_SAFETY_ON_FALSE_RETURN_VAL((radius_x >= 0.0 && radius_y >= 0.0), EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_FALSE_RETURN_VAL((pressure >= 0.0 && palm >= 0.0), EFL_UTIL_ERROR_INVALID_PARAMETER); + + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER); + version = tizen_input_device_manager_get_version(_eflutil.wl.devmgr.devicemgr); + EINA_SAFETY_ON_FALSE_RETURN_VAL((version >= 3), EFL_UTIL_ERROR_NOT_SUPPORTED); + + switch(touch_type) + { + case EFL_UTIL_INPUT_TOUCH_BEGIN: + type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_BEGIN; + break; + case EFL_UTIL_INPUT_TOUCH_UPDATE: + type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_UPDATE; + break; + case EFL_UTIL_INPUT_TOUCH_END: + type = TIZEN_INPUT_DEVICE_MANAGER_POINTER_EVENT_TYPE_END; + break; + default: + return EFL_UTIL_ERROR_INVALID_PARAMETER; + } + + if (touch_type != EFL_UTIL_INPUT_TOUCH_END) + _efl_util_input_generate_touch_axis_process(inputgen_h, idx, radius_x, radius_y, pressure, angle, palm); + else + _efl_util_input_generate_touch_axis_cleanup(inputgen_h, idx); + + tizen_input_device_manager_generate_touch(_eflutil.wl.devmgr.devicemgr, type, x, y, idx); + + while (_eflutil.wl.devmgr.request_notified == -1) + wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + + ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified); + _eflutil.wl.devmgr.request_notified = -1; + + return ret; +} + + API int 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) { @@ -1736,6 +2055,43 @@ efl_util_input_generate_pointer(efl_util_inputgen_h inputgen_h, int buttons, efl return ret; } +API int +efl_util_input_generate_wheel(efl_util_inputgen_h inputgen_h, efl_util_input_pointer_wheel_type_e wheel_type, int value) +{ + int ret, version; + enum tizen_input_device_manager_pointer_event_type type; + + EINA_SAFETY_ON_NULL_RETURN_VAL(inputgen_h, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_FALSE_RETURN_VAL(inputgen_h->init_type & EFL_UTIL_INPUT_DEVTYPE_POINTER, EFL_UTIL_ERROR_NO_SUCH_DEVICE); + + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.devmgr.devicemgr, EFL_UTIL_ERROR_INVALID_PARAMETER); + version = tizen_input_device_manager_get_version(_eflutil.wl.devmgr.devicemgr); + EINA_SAFETY_ON_FALSE_RETURN_VAL((version >= 3), EFL_UTIL_ERROR_NOT_SUPPORTED); + + switch(wheel_type) + { + case EFL_UTIL_INPUT_POINTER_WHEEL_VERT: + type = TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_WHEEL; + break; + case EFL_UTIL_INPUT_POINTER_WHEEL_HORZ: + type = TIZEN_INPUT_DEVICE_MANAGER_AXIS_TYPE_HWHEEL; + break; + default: + return EFL_UTIL_ERROR_INVALID_PARAMETER; + } + + tizen_input_device_manager_generate_axis(_eflutil.wl.devmgr.devicemgr, type, wl_fixed_from_int(value)); + + while (_eflutil.wl.devmgr.request_notified == -1) + wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + + ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified); + _eflutil.wl.devmgr.request_notified = -1; + + return ret; +} + + struct _efl_util_screenshot_h { @@ -1812,11 +2168,20 @@ efl_util_screenshot_initialize(int width, int height) struct wl_registry *reg = NULL; int ret = 0; - EINA_SAFETY_ON_FALSE_GOTO(width > 0, fail_param); - EINA_SAFETY_ON_FALSE_GOTO(height > 0, fail_param); + if (width <= 0 || height <= 0) + { + set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER); + return NULL; + } _screenshot_mutex_lock(); + if (!g_screenshot) + { + screenshot = calloc(1, sizeof(struct _efl_util_screenshot_h)); + EINA_SAFETY_ON_NULL_GOTO(screenshot, fail_memory); + } + if (!_eflutil.wl.shot.screenshooter) { ret = _wl_init(); @@ -1824,6 +2189,8 @@ efl_util_screenshot_initialize(int width, int height) { set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER); _screenshot_mutex_unlock(); + if (screenshot) + free(screenshot); return NULL; } wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.queue); @@ -1868,15 +2235,13 @@ efl_util_screenshot_initialize(int width, int height) g_screenshot->width = width; g_screenshot->height = height; } + set_last_result(EFL_UTIL_ERROR_NONE); _screenshot_mutex_unlock(); return g_screenshot; } - screenshot = calloc(1, sizeof(struct _efl_util_screenshot_h)); - EINA_SAFETY_ON_NULL_GOTO(screenshot, fail_memory); - screenshot->width = width; screenshot->height = height; screenshot->auto_rotation = EINA_TRUE; @@ -1893,22 +2258,28 @@ efl_util_screenshot_initialize(int width, int height) return g_screenshot; -fail_param: - set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER); - return NULL; -fail_memory: /* LCOV_EXCL_START */ +fail_memory: if (display_wrapper) wl_proxy_wrapper_destroy(display_wrapper); set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY); + if (screenshot) + free(screenshot); + _screenshot_mutex_unlock(); return NULL; + fail_init: if (reg) wl_registry_destroy(reg); if (screenshot) - efl_util_screenshot_deinitialize(screenshot); - _screenshot_mutex_unlock(); - set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL); + { + _screenshot_mutex_unlock(); + efl_util_screenshot_deinitialize(screenshot); + } + if (_eflutil.wl.shot.noti == 0) + set_last_result(EFL_UTIL_ERROR_PERMISSION_DENIED); + else + set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL); return NULL; /* LCOV_EXCL_STOP */ } @@ -1928,6 +2299,12 @@ efl_util_screenshot_deinitialize(efl_util_screenshot_h screenshot) free(screenshot); g_screenshot = NULL; + if (_eflutil.wl.shot.tbm_client) + { + wayland_tbm_client_deinit(_eflutil.wl.shot.tbm_client); + _eflutil.wl.shot.tbm_client = NULL; + } + if (_eflutil.wl.shot.screenshooter) { screenshooter_destroy(_eflutil.wl.shot.screenshooter); @@ -2002,7 +2379,7 @@ efl_util_screenshot_take_tbm_surface(efl_util_screenshot_h screenshot) goto fail; } - wl_buffer_destroy(buffer); + wayland_tbm_client_destroy_buffer(_eflutil.wl.shot.tbm_client, buffer); /* reset shot_done for next screenshot */ screenshot->shot_done = EINA_FALSE; @@ -2017,7 +2394,7 @@ fail: if (t_surface) tbm_surface_destroy(t_surface); if (buffer) - wl_buffer_destroy(buffer); + wayland_tbm_client_destroy_buffer(_eflutil.wl.shot.tbm_client, buffer); set_last_result(EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL); @@ -2026,7 +2403,6 @@ fail: return NULL; } -/* LCOV_EXCL_START */ API int efl_util_screenshot_set_auto_rotation(efl_util_screenshot_h screenshot, int set) { @@ -2056,7 +2432,6 @@ efl_util_screenshot_get_auto_rotation(efl_util_screenshot_h screenshot, int *set return EFL_UTIL_ERROR_NONE; } -/* LCOV_EXCL_STOP */ struct _efl_util_gesture_h { @@ -2072,7 +2447,7 @@ API int EFL_UTIL_EVENT_GESTURE_PALM_COVER = 0; 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) { - _eflutil.wl.gesture.request_notified = error; + _eflutil_defaultqueue.wl.gesture.request_notified = error; } static void @@ -2096,7 +2471,7 @@ _cb_gesture_edge_swipe(void *data EINA_UNUSED, struct tizen_gesture *tizen_gestu 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) { - _eflutil.wl.gesture.request_notified = error; + _eflutil_defaultqueue.wl.gesture.request_notified = error; } static void @@ -2120,7 +2495,7 @@ _cb_gesture_edge_drag(void *data EINA_UNUSED, struct tizen_gesture *tizen_gestur static void _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) { - _eflutil.wl.gesture.request_notified = error; + _eflutil_defaultqueue.wl.gesture.request_notified = error; } static void @@ -2143,7 +2518,7 @@ _cb_gesture_tap(void *data EINA_UNUSED, struct tizen_gesture *tizen_gesture EINA 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) { - _eflutil.wl.gesture.request_notified = error; + _eflutil_defaultqueue.wl.gesture.request_notified = error; } /* LCOV_EXCL_START */ @@ -2170,7 +2545,7 @@ _cb_gesture_palm_cover(void *data EINA_UNUSED, struct tizen_gesture *tizen_gestu 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) { - _eflutil.wl.gesture.request_notified = error; + _eflutil_defaultqueue.wl.gesture.request_notified = error; } static efl_util_error_e @@ -2210,7 +2585,7 @@ _efl_util_gesture_grab_edge_swipe(efl_util_gesture_data data) base_data = (Efl_Util_Gesture_Common_Grab_Data *)data; - EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_EDGE_SWIPE, EFL_UTIL_ERROR_INVALID_PARAMETER); @@ -2223,13 +2598,13 @@ _efl_util_gesture_grab_edge_swipe(efl_util_gesture_data data) start_point = edge_swipe_data->start_point; end_point = edge_swipe_data->end_point; - tizen_gesture_grab_edge_swipe(_eflutil.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point); + tizen_gesture_grab_edge_swipe(_eflutil_defaultqueue.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2248,7 +2623,7 @@ _efl_util_gesture_ungrab_edge_swipe(efl_util_gesture_data data) base_data = (Efl_Util_Gesture_Common_Grab_Data *)data; - EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_EDGE_SWIPE, EFL_UTIL_ERROR_INVALID_PARAMETER); @@ -2261,13 +2636,13 @@ _efl_util_gesture_ungrab_edge_swipe(efl_util_gesture_data data) start_point = edge_swipe_data->start_point; end_point = edge_swipe_data->end_point; - tizen_gesture_ungrab_edge_swipe(_eflutil.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point); + tizen_gesture_ungrab_edge_swipe(_eflutil_defaultqueue.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2286,7 +2661,7 @@ _efl_util_gesture_grab_edge_drag(efl_util_gesture_data data) base_data = (Efl_Util_Gesture_Common_Grab_Data *)data; - EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_EDGE_DRAG, EFL_UTIL_ERROR_INVALID_PARAMETER); @@ -2299,13 +2674,13 @@ _efl_util_gesture_grab_edge_drag(efl_util_gesture_data data) start_point = edge_drag_data->start_point; end_point = edge_drag_data->end_point; - tizen_gesture_grab_edge_drag(_eflutil.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point); + tizen_gesture_grab_edge_drag(_eflutil_defaultqueue.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2324,7 +2699,7 @@ _efl_util_gesture_ungrab_edge_drag(efl_util_gesture_data data) base_data = (Efl_Util_Gesture_Common_Grab_Data *)data; - EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_EDGE_DRAG, EFL_UTIL_ERROR_INVALID_PARAMETER); @@ -2337,13 +2712,13 @@ _efl_util_gesture_ungrab_edge_drag(efl_util_gesture_data data) start_point = edge_drag_data->start_point; end_point = edge_drag_data->end_point; - tizen_gesture_ungrab_edge_drag(_eflutil.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point); + tizen_gesture_ungrab_edge_drag(_eflutil_defaultqueue.wl.gesture.proto, fingers, edge, edge_size, start_point, end_point); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2360,7 +2735,7 @@ _efl_util_gesture_grab_tap(efl_util_gesture_data data) base_data = (Efl_Util_Gesture_Common_Grab_Data *)data; - EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_TAP, EFL_UTIL_ERROR_INVALID_PARAMETER); @@ -2370,13 +2745,13 @@ _efl_util_gesture_grab_tap(efl_util_gesture_data data) fingers = tap_data->fingers; repeats = tap_data->repeats; - tizen_gesture_grab_tap(_eflutil.wl.gesture.proto, fingers, repeats); + tizen_gesture_grab_tap(_eflutil_defaultqueue.wl.gesture.proto, fingers, repeats); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2392,7 +2767,7 @@ _efl_util_gesture_ungrab_tap(efl_util_gesture_data data) base_data = (Efl_Util_Gesture_Common_Grab_Data *)data; - EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_TAP, EFL_UTIL_ERROR_INVALID_PARAMETER); @@ -2402,13 +2777,13 @@ _efl_util_gesture_ungrab_tap(efl_util_gesture_data data) fingers = tap_data->fingers; repeats = tap_data->repeats; - tizen_gesture_ungrab_tap(_eflutil.wl.gesture.proto, fingers, repeats); + tizen_gesture_ungrab_tap(_eflutil_defaultqueue.wl.gesture.proto, fingers, repeats); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2421,18 +2796,18 @@ _efl_util_gesture_grab_palm_cover(efl_util_gesture_data data) base_data = (Efl_Util_Gesture_Common_Grab_Data *)data; - EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_PALM_COVER, EFL_UTIL_ERROR_INVALID_PARAMETER); - tizen_gesture_grab_palm_cover(_eflutil.wl.gesture.proto); + tizen_gesture_grab_palm_cover(_eflutil_defaultqueue.wl.gesture.proto); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2445,42 +2820,27 @@ _efl_util_gesture_ungrab_palm_cover(efl_util_gesture_data data) base_data = (Efl_Util_Gesture_Common_Grab_Data *)data; - EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); + EINA_SAFETY_ON_NULL_RETURN_VAL(_eflutil_defaultqueue.wl.gesture.proto, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_NULL_RETURN_VAL(base_data, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_FALSE_RETURN_VAL(base_data->type == TIZEN_GESTURE_TYPE_PALM_COVER, EFL_UTIL_ERROR_INVALID_PARAMETER); - tizen_gesture_ungrab_palm_cover(_eflutil.wl.gesture.proto); + tizen_gesture_ungrab_palm_cover(_eflutil_defaultqueue.wl.gesture.proto); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } - -static Eina_Bool -_efl_util_fd_cb(void *data, Ecore_Fd_Handler *hdl) -{ - if (_eflutil.wl.dpy && _eflutil.wl.queue) - { - wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.queue); - return ECORE_CALLBACK_RENEW; - } - else - { - return ECORE_CALLBACK_CANCEL; - } -} /* LCOV_EXCL_STOP */ API efl_util_gesture_h efl_util_gesture_initialize(void) { efl_util_gesture_h gesture_h = NULL; - int dpy_fd = -1; gesture_h = (efl_util_gesture_h)calloc(1, sizeof(struct _efl_util_gesture_h)); if (!gesture_h) @@ -2489,16 +2849,16 @@ efl_util_gesture_initialize(void) goto out; /* LCOV_EXCL_LINE */ } - if (_wl_init() == (int)EINA_FALSE) + if (_wl_init_default_queue() == (int)EINA_FALSE) { set_last_result(EFL_UTIL_ERROR_NOT_SUPPORTED); /* LCOV_EXCL_LINE */ goto out; /* LCOV_EXCL_LINE */ } - while (!_eflutil.wl.gesture.proto) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); /* LCOV_EXCL_LINE */ + while (!_eflutil_defaultqueue.wl.gesture.proto) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); /* LCOV_EXCL_LINE */ - if (_eflutil.wl.gesture.event_init <= 0) + if (_eflutil_defaultqueue.wl.gesture.event_init <= 0) { if (ecore_event_init() <= 0) { @@ -2509,16 +2869,8 @@ efl_util_gesture_initialize(void) EFL_UTIL_EVENT_GESTURE_EDGE_DRAG = ecore_event_type_new(); EFL_UTIL_EVENT_GESTURE_TAP = ecore_event_type_new(); EFL_UTIL_EVENT_GESTURE_PALM_COVER = ecore_event_type_new(); - - dpy_fd = wl_display_get_fd(_eflutil.wl.dpy); - _eflutil.wl.dpy_fd = fcntl(dpy_fd, F_DUPFD_CLOEXEC, 0); - if (_eflutil.wl.dpy_fd >= 0) - _eflutil.wl.fd_hdl = ecore_main_fd_handler_add(_eflutil.wl.dpy_fd, - ECORE_FD_READ | ECORE_FD_WRITE | ECORE_FD_ERROR, - _efl_util_fd_cb, NULL, - NULL, NULL); } - _eflutil.wl.gesture.event_init++; + _eflutil_defaultqueue.wl.gesture.event_init++; gesture_h->init = EINA_TRUE; set_last_result(EFL_UTIL_ERROR_NONE); @@ -2544,23 +2896,16 @@ efl_util_gesture_deinitialize(efl_util_gesture_h gesture_h) free(gesture_h); gesture_h = NULL; - _eflutil.wl.gesture.event_init--; + _eflutil_defaultqueue.wl.gesture.event_init--; - if (_eflutil.wl.gesture.event_init <= 0) + if (_eflutil_defaultqueue.wl.gesture.event_init <= 0) { - _eflutil.wl.gesture.event_init = 0; + _eflutil_defaultqueue.wl.gesture.event_init = 0; ecore_event_shutdown(); EFL_UTIL_EVENT_GESTURE_EDGE_SWIPE = 0; EFL_UTIL_EVENT_GESTURE_EDGE_DRAG = 0; EFL_UTIL_EVENT_GESTURE_TAP = 0; EFL_UTIL_EVENT_GESTURE_PALM_COVER = 0; - if (_eflutil.wl.dpy_fd >= 0) - { - ecore_main_fd_handler_del(_eflutil.wl.fd_hdl); - _eflutil.wl.fd_hdl = NULL; - close(_eflutil.wl.dpy_fd); - _eflutil.wl.dpy_fd = -1; - } } return EFL_UTIL_ERROR_NONE; @@ -2899,13 +3244,13 @@ efl_util_gesture_select(efl_util_gesture_h gesture_h, Evas_Object *window, efl_u EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EFL_UTIL_ERROR_INVALID_PARAMETER); - tizen_gesture_select_palm_cover(_eflutil.wl.gesture.proto, surface); + tizen_gesture_select_palm_cover(_eflutil_defaultqueue.wl.gesture.proto, surface); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2935,13 +3280,13 @@ efl_util_gesture_deselect(efl_util_gesture_h gesture_h, Evas_Object *window, efl EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EFL_UTIL_ERROR_INVALID_PARAMETER); - tizen_gesture_deselect_palm_cover(_eflutil.wl.gesture.proto, surface); + tizen_gesture_deselect_palm_cover(_eflutil_defaultqueue.wl.gesture.proto, surface); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2956,13 +3301,13 @@ efl_util_gesture_activate_set(efl_util_gesture_h gesture_h, unsigned int type, E EINA_SAFETY_ON_FALSE_RETURN_VAL(gesture_h->init, EFL_UTIL_ERROR_INVALID_PARAMETER); EINA_SAFETY_ON_TRUE_RETURN_VAL(type == EFL_UTIL_GESTURE_TYPE_NONE, EFL_UTIL_ERROR_INVALID_PARAMETER); - tizen_gesture_activate_set(_eflutil.wl.gesture.proto, NULL, type, active); + tizen_gesture_activate_set(_eflutil_defaultqueue.wl.gesture.proto, NULL, type, active); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; } @@ -2987,13 +3332,13 @@ efl_util_gesture_activate_set_on_window(efl_util_gesture_h gesture_h, Evas_Objec EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EFL_UTIL_ERROR_INVALID_PARAMETER); - tizen_gesture_activate_set(_eflutil.wl.gesture.proto, surface, type, active); + tizen_gesture_activate_set(_eflutil_defaultqueue.wl.gesture.proto, surface, type, active); - while (_eflutil.wl.gesture.request_notified == -1) - wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue); + while (_eflutil_defaultqueue.wl.gesture.request_notified == -1) + wl_display_dispatch(_eflutil_defaultqueue.wl.dpy); - ret = _efl_util_gesture_convert_error(_eflutil.wl.gesture.request_notified); - _eflutil.wl.gesture.request_notified = -1; + ret = _efl_util_gesture_convert_error(_eflutil_defaultqueue.wl.gesture.request_notified); + _eflutil_defaultqueue.wl.gesture.request_notified = -1; return ret; }