From: jeon Date: Mon, 3 Dec 2018 07:16:02 +0000 (+0900) Subject: gesture: use default wl_queue to get gesture events X-Git-Tag: submit/tizen/20190603.081230~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd8db293009d6dfef373e9f0f26bc76a910ca543;p=platform%2Fcore%2Fapi%2Fefl-util.git gesture: use default wl_queue to get gesture events Change-Id: Id03df5c3fe0f6405d3577f8a352ad4e64e124e8a --- diff --git a/src/efl_util.c b/src/efl_util.c index cc0d75c..c1a2f38 100644 --- a/src/efl_util.c +++ b/src/efl_util.c @@ -182,8 +182,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 { @@ -215,32 +213,57 @@ typedef struct _Efl_Util_Data 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 */ + { 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); @@ -322,6 +345,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 +411,42 @@ 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: + if (display_wrapper) + wl_proxy_wrapper_destroy(display_wrapper); + + 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, @@ -507,11 +572,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 @@ -538,6 +598,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, @@ -2084,7 +2173,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 @@ -2108,7 +2197,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 @@ -2132,7 +2221,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 @@ -2155,7 +2244,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 */ @@ -2182,7 +2271,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 @@ -2222,7 +2311,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); @@ -2235,13 +2324,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; } @@ -2260,7 +2349,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); @@ -2273,13 +2362,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; } @@ -2298,7 +2387,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); @@ -2311,13 +2400,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; } @@ -2336,7 +2425,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); @@ -2349,13 +2438,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; } @@ -2372,7 +2461,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); @@ -2382,13 +2471,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; } @@ -2404,7 +2493,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); @@ -2414,13 +2503,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; } @@ -2433,18 +2522,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; } @@ -2457,42 +2546,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) @@ -2501,16 +2575,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) { @@ -2521,16 +2595,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); @@ -2556,23 +2622,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; @@ -2911,13 +2970,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; } @@ -2947,13 +3006,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; } @@ -2968,13 +3027,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; } @@ -2999,13 +3058,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; }