diff options
author | jeon <jhyuni.kang@samsung.com> | 2019-05-09 21:47:35 +0900 |
---|---|---|
committer | jeon <jhyuni.kang@samsung.com> | 2019-05-10 13:28:11 +0900 |
commit | 37e5270ae65b1a5ff41c5582066f61b55aa28e55 (patch) | |
tree | 2c01bf7f1c8c2d6cab845af6906047d983ef494a | |
parent | 5d7db9117747d440b5b9752db68c9ab5294e7825 (diff) | |
download | efl-util-tizen_4.0.tar.gz efl-util-tizen_4.0.tar.bz2 efl-util-tizen_4.0.zip |
gesture: use default wl_queue to get gesture eventstizen_4.0
Change-Id: Ia4e52bf4a204c6ec21166a0c457491a4a7ced473
-rw-r--r-- | src/efl_util.c | 311 |
1 files changed, 183 insertions, 128 deletions
diff --git a/src/efl_util.c b/src/efl_util.c index a94b481..a71df5d 100644 --- a/src/efl_util.c +++ b/src/efl_util.c @@ -187,8 +187,6 @@ typedef struct _Efl_Util_Data Eina_Bool init; struct wl_display *dpy; struct wl_event_queue *queue; - int dpy_fd; - Ecore_Fd_Handler *fd_hdl; struct { @@ -217,12 +215,6 @@ typedef struct _Efl_Util_Data struct tizen_display_policy *proto; Eina_Hash *hash_brightness; } display_policy; - struct - { - struct tizen_gesture *proto; - int request_notified; - int event_init; - } gesture; } wl; struct @@ -237,12 +229,10 @@ static Efl_Util_Data _eflutil = { EINA_FALSE, 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 */ }, { { NULL, 0 }, /* handler for notification level */ @@ -250,13 +240,44 @@ static Efl_Util_Data _eflutil = }, }; +typedef struct _Efl_Util_Data_Default_Queue +{ + /* wayland related stuffs */ + struct + { + Eina_Bool init; + struct wl_display *dpy; + + struct + { + unsigned int id; + struct tizen_gesture *proto; + int request_notified; + int event_init; + } gesture; + } wl; +} Efl_Util_Data_Default_Queue; + +static Efl_Util_Data_Default_Queue _eflutil_defaultqueue = +{ + { + EINA_FALSE, + NULL, + { 0, NULL, -1, EINA_FALSE } /* tizen_gesture protocol */ + }, +}; + + static Eina_Bool _cb_info_add(Evas_Object *win, Efl_Util_Cb cb, void *data, int idx); static Eina_Bool _cb_info_del_by_win(Evas_Object *win, int idx); static Eina_List *_cb_info_list_get(int idx); static Efl_Util_Callback_Info *_cb_info_find_by_win(Evas_Object *win, int idx); 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 Efl_Util_Callback_Info *_cb_info_find_by_wlsurf(void *wlsurf, int idx); @@ -295,6 +316,12 @@ static const struct wl_registry_listener _wl_reg_listener = _cb_wl_reg_global_remove }; +static const struct wl_registry_listener _wl_default_queue_reg_listener = +{ + _cb_wl_default_queue_reg_global, + _cb_wl_default_queue_reg_global_remove +}; + static const struct wl_registry_listener _wl_reg_screenshooter_listener = { _cb_wl_reg_screenshooter_global, @@ -456,6 +483,38 @@ 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; + + ecore_wl_init(NULL); + + _eflutil_defaultqueue.wl.dpy = ecore_wl_display_get(); + 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_wl_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, @@ -581,11 +640,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 @@ -613,6 +667,38 @@ _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) +{ + /* unset each global id number to 0 since global id is started + * from number 1 on server side display structure + */ + 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, @@ -2021,7 +2107,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 @@ -2045,7 +2131,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 @@ -2069,7 +2155,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 @@ -2092,7 +2178,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 */ @@ -2119,7 +2205,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 @@ -2159,7 +2245,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); @@ -2172,13 +2258,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; } @@ -2197,7 +2283,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); @@ -2210,13 +2296,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; } @@ -2235,7 +2321,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); @@ -2248,13 +2334,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; } @@ -2273,7 +2359,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); @@ -2286,18 +2372,17 @@ _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; } - static int _efl_util_gesture_grab_tap(efl_util_gesture_data data) { @@ -2309,7 +2394,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); @@ -2319,13 +2404,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; } @@ -2341,7 +2426,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); @@ -2351,13 +2436,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; } @@ -2370,18 +2455,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; } @@ -2394,42 +2479,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) @@ -2438,16 +2508,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) { @@ -2458,16 +2528,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); @@ -2493,23 +2555,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; @@ -2848,13 +2903,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; } @@ -2884,13 +2939,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; } @@ -2905,13 +2960,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; } @@ -2936,13 +2991,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; } |