From 4ea865623df83b78830dc253bcddd7e64a7810ca Mon Sep 17 00:00:00 2001 From: Woochanlee Date: Wed, 8 Jan 2020 07:59:11 -0500 Subject: [PATCH 01/15] tests/ecore_wl2: Add test for ecore_wl2_window_xxx functions Summary: Add below APIs. ecore_wl2_window_commit ecore_wl2_window_frame_callback_add, del ecore_wl2_window_free ecore_wl2_window_hide ecore_wl2_window_shell_surface_exists ecore_wl2_window_show ecore_wl2_window_update_begin + Fix ecore_wl2_activated_get() ref T8016 Reviewers: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8016 Differential Revision: https://phab.enlightenment.org/D11007 --- src/tests/ecore_wl2/ecore_wl2_test_window.c | 510 +++++++++++++++++++- src/tests/ecore_wl2/meson.build | 10 +- 2 files changed, 502 insertions(+), 18 deletions(-) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c index bb329195ef..66b76a3eb9 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_window.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c @@ -7,27 +7,93 @@ #include #include #include +#include + +#ifdef GL_GLES +#include +#include +#endif #include "ecore_wl2_suite.h" +#define WIDTH 480 +#define HEIGHT 360 + +typedef struct _Test_Data { + Ecore_Wl2_Display *display; + Ecore_Wl2_Window *win; + Ecore_Wl2_Frame_Cb_Handle *frame_callback_handler; + Ecore_Event_Handler *handler; + + struct wl_surface *surface; + struct wl_egl_window *egl_window; + + int width; + int height; + int frame_callback_count; + +#ifdef GL_GLES + EGLDisplay egl_display; + EGLConfig egl_conf; + EGLSurface egl_surface; + EGLContext egl_context; +#endif +} Test_Data; + static Ecore_Wl2_Display * _display_connect(void) { - Ecore_Wl2_Display *disp; - - disp = ecore_wl2_display_connect(NULL); - return disp; + return ecore_wl2_display_connect(NULL); } static Ecore_Wl2_Window * _window_create(Ecore_Wl2_Display *disp) { - Ecore_Wl2_Window *win; - - win = ecore_wl2_window_new(disp, NULL, 100, 100, 500, 500); - return win; + return ecore_wl2_window_new(disp, NULL, 100, 100, WIDTH, HEIGHT); } +static struct wl_surface * +_surface_get(Ecore_Wl2_Window *win) +{ + return ecore_wl2_window_surface_get(win); +} + +#ifdef GL_GLES +static void +_init_egl(Test_Data *td) +{ + eglBindAPI(EGL_OPENGL_API); + EGLint num_config; + + EGLint attributes[] = { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_NONE + }; + + td->egl_display = eglGetDisplay((EGLNativeDisplayType)ecore_wl2_display_get(td->display)); + eglInitialize(td->egl_display, NULL, NULL); + eglChooseConfig(td->egl_display, attributes, &td->egl_conf, 1, &num_config); + td->egl_context = eglCreateContext(td->egl_display, td->egl_conf, EGL_NO_CONTEXT, NULL); + + td->egl_window = wl_egl_window_create(td->surface, td->width, td->height); + td->egl_surface = eglCreateWindowSurface(td->egl_display, + td->egl_conf, td->egl_window, NULL); + + eglMakeCurrent(td->egl_display, td->egl_surface, td->egl_surface, td->egl_context); +} + +static void +_term_egl(Test_Data *td) +{ + eglDestroySurface(td->egl_display, td->egl_surface); + wl_egl_window_destroy(td->egl_window); + eglDestroyContext(td->egl_display, td->egl_context); + eglTerminate(td->egl_display); +} +#endif + EFL_START_TEST(wl2_window_new) { Ecore_Wl2_Display *disp; @@ -329,23 +395,93 @@ EFL_START_TEST(wl2_window_type) } EFL_END_TEST +#ifdef GL_GLES +static void +_test_activated_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data) +{ + Test_Data *td = data; + + td->frame_callback_count++; + if (td->frame_callback_count % 4 == 0) + glClearColor(0.0, 1.0, 0.0, 0.0); + else if (td->frame_callback_count % 4 == 1) + glClearColor(0.0, 0.0, 1.0, 0.0); + else if (td->frame_callback_count % 4 == 2) + glClearColor(0.0, 0.0, 0.0, 1.0); + else + glClearColor(1.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + glFlush(); + + eglSwapBuffers(td->egl_display, td->egl_surface); + + ecore_wl2_window_commit(td->win, EINA_TRUE); +} + +static Eina_Bool +_test_activated_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + Test_Data *td = data; + + td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_activated_frame_cb, td); + ecore_wl2_window_commit(td->win, EINA_TRUE); + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_test_activated_window_activate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + //TC Pass + ecore_main_loop_quit(); + + return ECORE_CALLBACK_PASS_ON; +} + EFL_START_TEST(wl2_window_activated) { - Ecore_Wl2_Display *disp; - Ecore_Wl2_Window *win; - Eina_Bool ret; + Test_Data *td; - disp = _display_connect(); - ck_assert(disp != NULL); + ecore_wl2_init(); - win = _window_create(disp); - ck_assert(win != NULL); + td = calloc(1, sizeof(Test_Data)); + td->width = WIDTH; + td->height = HEIGHT; + td->frame_callback_count = 0; - ret = ecore_wl2_window_activated_get(win); + td->display = _display_connect(); + ck_assert(td->display != NULL); - fail_if(ret != EINA_TRUE); + td->win = _window_create(td->display); + ck_assert(td->win != NULL); + + ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + + td->surface = _surface_get(td->win); + ck_assert(td->surface != NULL); + + ecore_wl2_window_show(td->win); + + _init_egl(td); + td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, + _test_activated_configure_complete, td); + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ACTIVATE, + _test_activated_window_activate, NULL); + + ecore_main_loop_begin(); + + _term_egl(td); + ecore_wl2_shutdown(); + free(td); } EFL_END_TEST +#else +EFL_START_TEST(wl2_window_activated) +{ + fail_if("No GL enabled GL should be enabled for API test"); +} +EFL_END_TEST +#endif EFL_START_TEST(wl2_window_aspect) { @@ -454,6 +590,339 @@ EFL_START_TEST(wl2_window_role) } EFL_END_TEST +static void +_test_commit_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data) +{ + Test_Data *td = data; + td->frame_callback_count++; + ecore_main_loop_quit(); +} + +static Eina_Bool +_test_commit_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + Test_Data *td = data; + + td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_commit_frame_cb, td); + ecore_wl2_window_commit(td->win, EINA_TRUE); + + return ECORE_CALLBACK_PASS_ON; +} + +EFL_START_TEST(wl2_window_commit) +{ + Test_Data *td; + + ecore_wl2_init(); + + td = calloc(1, sizeof(Test_Data)); + td->width = WIDTH; + td->height = HEIGHT; + td->frame_callback_count = 0; + + td->display = _display_connect(); + ck_assert(td->display != NULL); + + td->win = _window_create(td->display); + ck_assert(td->win != NULL); + + ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + + td->surface = _surface_get(td->win); + ck_assert(td->surface != NULL); + + ecore_wl2_window_show(td->win); + + td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, + _test_commit_configure_complete, td); + + ecore_main_loop_begin(); + + //Check if the frame callback was called properly by ecore_wl2_window_commit(). + fail_if(td->frame_callback_count == 0); + + ecore_wl2_shutdown(); + free(td); +} +EFL_END_TEST + +static void +_test_frame_callback_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data) +{ + Test_Data *td = data; + td->frame_callback_count++; + if (td->frame_callback_count == 1) + { + ecore_wl2_window_frame_callback_del(td->frame_callback_handler); + td->frame_callback_handler = NULL; + ecore_main_loop_quit(); + } +} + +static Eina_Bool +_test_frame_callback_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + Test_Data *td = data; + + td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_frame_callback_frame_cb, td); + ecore_wl2_window_commit(td->win, EINA_TRUE); + + return ECORE_CALLBACK_PASS_ON; +} + +EFL_START_TEST(wl2_window_frame_callback) +{ + Test_Data *td; + + ecore_wl2_init(); + + td = calloc(1, sizeof(Test_Data)); + td->width = WIDTH; + td->height = HEIGHT; + td->frame_callback_count = 0; + + td->display = _display_connect(); + ck_assert(td->display != NULL); + + td->win = _window_create(td->display); + ck_assert(td->win != NULL); + + ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + + td->surface = _surface_get(td->win); + ck_assert(td->surface != NULL); + + ecore_wl2_window_show(td->win); + + td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, + _test_frame_callback_configure_complete, td); + + ecore_main_loop_begin(); + + //Check if the frame callback called after then it sets NULL or not. + fail_if(td->frame_callback_count != 1); + fail_if(td->frame_callback_handler != NULL); + + ecore_wl2_shutdown(); + free(td); +} +EFL_END_TEST + +EFL_START_TEST(wl2_window_free) +{ + Ecore_Wl2_Window *t_win; + Test_Data *td; + + ecore_wl2_init(); + + td = calloc(1, sizeof(Test_Data)); + + td->display = _display_connect(); + ck_assert(td->display != NULL); + + td->win = _window_create(td->display); + ck_assert(td->win != NULL); + + ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + + td->surface = _surface_get(td->win); + ck_assert(td->surface != NULL); + + ecore_wl2_window_show(td->win); + + t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface); + + fail_if(td->win != t_win); + + ecore_wl2_window_free(td->win); + t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface); + + //Check the returned window with freed window. + fail_if(td->win == t_win); + + ecore_wl2_shutdown(); + free(td); +} +EFL_END_TEST + +static Eina_Bool +_test_hide_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + //TC pass + ecore_main_loop_quit(); + + return ECORE_CALLBACK_PASS_ON; +} + +EFL_START_TEST(wl2_window_hide) +{ + Test_Data *td; + + ecore_wl2_init(); + + td = calloc(1, sizeof(Test_Data)); + td->width = WIDTH; + td->height = HEIGHT; + td->frame_callback_count = 0; + + td->display = _display_connect(); + ck_assert(td->display != NULL); + + td->win = _window_create(td->display); + ck_assert(td->win != NULL); + + ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + + td->surface = _surface_get(td->win); + ck_assert(td->surface != NULL); + + ecore_wl2_window_show(td->win); + + ecore_wl2_window_hide(td->win); + td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_HIDE, + _test_hide_window_hide, NULL); + + ecore_main_loop_begin(); + + ecore_wl2_shutdown(); + free(td); +} +EFL_END_TEST + +EFL_START_TEST(wl2_window_shell_surface_exists) +{ + Test_Data *td; + + ecore_wl2_init(); + + td = calloc(1, sizeof(Test_Data)); + td->width = WIDTH; + td->height = HEIGHT; + td->frame_callback_count = 0; + + td->display = _display_connect(); + ck_assert(td->display != NULL); + + td->win = _window_create(td->display); + ck_assert(td->win != NULL); + + ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + + td->surface = _surface_get(td->win); + ck_assert(td->surface != NULL); + + ecore_wl2_window_show(td->win); + + //window_show function will create shell surface. then checks it. + fail_if(ecore_wl2_window_shell_surface_exists(td->win) == EINA_FALSE); + + ecore_wl2_shutdown(); + free(td); +} +EFL_END_TEST + +static Eina_Bool +_test_show_window_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + //TC pass + ecore_main_loop_quit(); + + return ECORE_CALLBACK_PASS_ON; +} + +EFL_START_TEST(wl2_window_show) +{ + Test_Data *td; + + ecore_wl2_init(); + + td = calloc(1, sizeof(Test_Data)); + td->width = WIDTH; + td->height = HEIGHT; + td->frame_callback_count = 0; + + td->display = _display_connect(); + ck_assert(td->display != NULL); + + td->win = _window_create(td->display); + ck_assert(td->win != NULL); + + ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + + td->surface = _surface_get(td->win); + ck_assert(td->surface != NULL); + + ecore_wl2_window_show(td->win); + + td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW, + _test_show_window_show, NULL); + + ecore_main_loop_begin(); + + ecore_wl2_shutdown(); + free(td); +} +EFL_END_TEST + +static Eina_Bool _window_configure_event_called = EINA_FALSE; + +static Eina_Bool +_test_update_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + _window_configure_event_called = EINA_TRUE; + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_test_update_window_configure_complete(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + //Checks if the configure_complete calling before configure calling + //when ecore_wl2_window_update_begin() called. + fail_if(_window_configure_event_called == EINA_TRUE); + + ecore_main_loop_quit(); + + return ECORE_CALLBACK_PASS_ON; +} + +EFL_START_TEST(wl2_window_update_begin) +{ + Test_Data *td; + + ecore_wl2_init(); + + td = calloc(1, sizeof(Test_Data)); + td->width = WIDTH; + td->height = HEIGHT; + td->frame_callback_count = 0; + + td->display = _display_connect(); + ck_assert(td->display != NULL); + + td->win = _window_create(td->display); + ck_assert(td->win != NULL); + + ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + + td->surface = _surface_get(td->win); + ck_assert(td->surface != NULL); + + ecore_wl2_window_show(td->win); + + ecore_wl2_window_update_begin(td->win); + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, + _test_update_window_configure, NULL); + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, + _test_update_window_configure_complete, NULL); + + ecore_main_loop_begin(); + + ecore_wl2_shutdown(); + free(td); +} +EFL_END_TEST + void ecore_wl2_test_window(TCase *tc) { @@ -483,5 +952,12 @@ ecore_wl2_test_window(TCase *tc) tcase_add_test(tc, wl2_window_class); tcase_add_test(tc, wl2_window_title); tcase_add_test(tc, wl2_window_role); + tcase_add_test(tc, wl2_window_commit); + tcase_add_test(tc, wl2_window_frame_callback); + tcase_add_test(tc, wl2_window_free); + tcase_add_test(tc, wl2_window_hide); + tcase_add_test(tc, wl2_window_shell_surface_exists); + tcase_add_test(tc, wl2_window_show); + tcase_add_test(tc, wl2_window_update_begin); } } diff --git a/src/tests/ecore_wl2/meson.build b/src/tests/ecore_wl2/meson.build index eb1a13db6a..2491b6d631 100644 --- a/src/tests/ecore_wl2/meson.build +++ b/src/tests/ecore_wl2/meson.build @@ -8,9 +8,17 @@ ecore_wl2_suite_src = [ 'ecore_wl2_test_input.c' ] +wl2_test_gl_deps = [] + +if get_option('opengl') == 'es-egl' + wl2_test_gl_deps += dependency('egl') + wl2_test_gl_deps += dependency('gl') +endif + ecore_wl2_suite = executable('ecore_wl2_suite', ecore_wl2_suite_src, - dependencies: [ecore_wl2, ecore, check, wayland_protocol], + dependencies: [ecore_wl2, ecore, ecore_input, check, wayland_protocol, wayland_client, dependency('wayland-egl'), wl2_test_gl_deps], + c_args : [ '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"', '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"'] From 926cbb98af4757af991e55f7d4f4cd35195a5ff4 Mon Sep 17 00:00:00 2001 From: Woochanlee Date: Wed, 8 Jan 2020 07:59:53 -0500 Subject: [PATCH 02/15] ecore_wl2: Add APIs to get window property. Summary: Creates APIs to get property. +ecore_wl2_window_popup_input_get +ecore_wl2_window_input_region_get +ecore_wl2_window_opaque_region_get ref T8016 Reviewers: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8016 Differential Revision: https://phab.enlightenment.org/D11038 --- src/lib/ecore_wl2/Ecore_Wl2.h | 40 ++++++++++++++++++++++++++++ src/lib/ecore_wl2/ecore_wl2_window.c | 30 +++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 0631a5fe6d..d6dfaf1d28 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -917,6 +917,20 @@ EAPI void ecore_wl2_window_alpha_set(Ecore_Wl2_Window *window, Eina_Bool alpha); */ EAPI void ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h); +/** + * Get the opaque region of the Ecore_Wl2_Window + * + * @param win The window + * @param x The left point of the region. + * @param y The top point of the region. + * @param w The width of the region. + * @param h The height of the region. + * + * @ingroup Ecore_Wl2_Window_Group + * @since 1.24 + */ +EAPI void ecore_wl2_window_opaque_region_get(Ecore_Wl2_Window *window, int *x, int *y, int *w, int *h); + /** * Set the input region of the Ecore_Wl2_Window. * @@ -935,6 +949,20 @@ EAPI void ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, in */ EAPI void ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h); +/** + * Get the input region of the Ecore_Wl2_Window. + * + * @param window The window to set the input region of + * @param x The left point of the region. + * @param y The top point of the region. + * @param w The width of the region. + * @param h The height of the region. + * + * @ingroup Ecore_Wl2_Window_Group + * @since 1.24 + */ +EAPI void ecore_wl2_window_input_region_get(Ecore_Wl2_Window *window, int *x, int *y, int *w, int *h); + /** * Get if a given window is maximized * @@ -1300,6 +1328,18 @@ EAPI Eina_Bool ecore_wl2_window_activated_get(const Ecore_Wl2_Window *window); */ EAPI void ecore_wl2_window_popup_input_set(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input); +/** + * @brief Get the seat for a popup window to be used with grab + * + * @param window The window + * + * @return Returns Ecore_Wl2_Input if the window has an input. + * + * @ingroup Ecore_Wl2_Window_Group + * @since 1.24 + */ +EAPI Ecore_Wl2_Input *ecore_wl2_window_popup_input_get(Ecore_Wl2_Window *window); + /** * Check if a window has a shell surface - without one it can't be visible. * diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 0085354d11..21c01c5a70 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -844,6 +844,17 @@ ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w window->pending.opaque = EINA_TRUE; } +EAPI void +ecore_wl2_window_opaque_region_get(Ecore_Wl2_Window *window, int *x, int *y, int *w, int *h) +{ + EINA_SAFETY_ON_NULL_RETURN(window); + + if (x) *x = window->opaque.x; + if (y) *y = window->opaque.y; + if (w) *w = window->opaque.w; + if (h) *h = window->opaque.h; +} + EAPI void ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h) { @@ -893,6 +904,17 @@ ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, window->pending.input = EINA_TRUE; } +EAPI void +ecore_wl2_window_input_region_get(Ecore_Wl2_Window *window, int *x, int *y, int *w, int *h) +{ + EINA_SAFETY_ON_NULL_RETURN(window); + + if (x) *x = window->input_rect.x; + if (y) *y = window->input_rect.y; + if (w) *w = window->input_rect.w; + if (h) *h = window->input_rect.h; +} + EAPI Eina_Bool ecore_wl2_window_maximized_get(Ecore_Wl2_Window *window) { @@ -1117,6 +1139,14 @@ ecore_wl2_window_popup_input_set(Ecore_Wl2_Window *window, Ecore_Wl2_Input *inpu window->grab = input; } +EAPI Ecore_Wl2_Input * +ecore_wl2_window_popup_input_get(Ecore_Wl2_Window *window) +{ + EINA_SAFETY_ON_NULL_RETURN(window); + + return window->grab; +} + EAPI Ecore_Wl2_Display * ecore_wl2_window_display_get(const Ecore_Wl2_Window *window) { From 52fa6aa1b5cacebab9d7db2fd4c532bcddddd7f1 Mon Sep 17 00:00:00 2001 From: Woochanlee Date: Wed, 8 Jan 2020 08:00:25 -0500 Subject: [PATCH 03/15] ecore_wl2: Move ecore_wl2_window_iconified, ecore_wl2_window_pending_get functions to be internal Summary: This iconified state doesn't match the compositor's. pending is only works for user manual buffer render case. So, no need for it to be a public. ref T8016 Reviewers: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8016 Differential Revision: https://phab.enlightenment.org/D11039 --- src/lib/ecore_wl2/Ecore_Wl2.h | 25 ------------------------- src/lib/ecore_wl2/ecore_wl2_internal.h | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index d6dfaf1d28..c7105500b1 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -1115,17 +1115,6 @@ EAPI void ecore_wl2_window_geometry_get(Ecore_Wl2_Window *window, int *x, int *y */ EAPI void ecore_wl2_window_geometry_set(Ecore_Wl2_Window *window, int x, int y, int w, int h); -/** - * Iconify a window - * - * @param win The window to iconifiy - * @param iconified The new iconified state to set - * - * @ingroup Ecore_Wl2_Window_Group - * @since 1.17 - */ -EAPI void ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified); - /** * Set the type of a given window * @@ -2043,20 +2032,6 @@ EAPI void ecore_wl2_session_recovery_disable(void); */ EAPI void ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush); -/** - * Check if a wayland window's surface is in the pending state. - * - * A surface is pending if it's been commit but we haven't received a - * frame callback for it yet. This mean's we're not ready to draw yet. - * - * @param window The window whose surface we want to check - * - * @return whether the window's surface is pending or not. - * - * @since 1.21 - */ -EAPI Eina_Bool ecore_wl2_window_pending_get(Ecore_Wl2_Window *window); - /** * Add a callback that fires when the window's surface_frame callback fires * diff --git a/src/lib/ecore_wl2/ecore_wl2_internal.h b/src/lib/ecore_wl2/ecore_wl2_internal.h index 2b6a965b10..cda98d6459 100644 --- a/src/lib/ecore_wl2/ecore_wl2_internal.h +++ b/src/lib/ecore_wl2/ecore_wl2_internal.h @@ -100,6 +100,31 @@ EAPI void ecore_wl2_window_buffer_attach(Ecore_Wl2_Window *win, void *buffer, in */ EAPI void ecore_wl2_window_buffer_transform_set(Ecore_Wl2_Window *window, int transform); +/** + * Iconify a window + * + * @param win The window to iconifiy + * @param iconified The new iconified state to set + * + * @ingroup Ecore_Wl2_Window_Group + * @since 1.17 + */ +EAPI void ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified); + +/** + * Check if a wayland window's surface is in the pending state. + * + * A surface is pending if it's been commit but we haven't received a + * frame callback for it yet. This mean's we're not ready to draw yet. + * + * @param window The window whose surface we want to check + * + * @return whether the window's surface is pending or not. + * + * @since 1.21 + */ +EAPI Eina_Bool ecore_wl2_window_pending_get(Ecore_Wl2_Window *window); + # undef EAPI # define EAPI From 8d9f032db609ea1ad8c6f058c7293b0d138e4860 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Wed, 8 Jan 2020 10:50:32 +0100 Subject: [PATCH 04/15] ci: travis: enable ptrace capabilities to our docker runs ASAN leak sanitizer needs ptrace capabilities to run. It seems the removal sudo true brings up this issue for us. https://github.com/google/sanitizers/issues/764 https://github.com/travis-ci/travis-ci/issues/9033 It fixes the recent breaks in our ASAN enabled job durign our cron builds. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11041 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1af79309c3..9da669513d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,7 +95,7 @@ before_script: if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$DISTRO" != "" ]]; then docker pull stefanschmidt1/ci-support-files:$DISTRO docker version - docker run --cidfile $HOME/cid -t -d -v `pwd`:/src -v $HOME/.ccache:/root/.ccache -w /src stefanschmidt1/ci-support-files:$DISTRO bash + docker run --cap-add SYS_PTRACE --cidfile $HOME/cid -t -d -v `pwd`:/src -v $HOME/.ccache:/root/.ccache -w /src stefanschmidt1/ci-support-files:$DISTRO bash fi - | if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$DISTRO" == "" ]]; then From 73195a34de15efa91dd7863a63ac99762b6bd7da Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 09:10:43 -0500 Subject: [PATCH 05/15] ecore-wl2: Fix return with no value in function returning non-void --- src/lib/ecore_wl2/ecore_wl2_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 21c01c5a70..f596a7a9de 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -1142,7 +1142,7 @@ ecore_wl2_window_popup_input_set(Ecore_Wl2_Window *window, Ecore_Wl2_Input *inpu EAPI Ecore_Wl2_Input * ecore_wl2_window_popup_input_get(Ecore_Wl2_Window *window) { - EINA_SAFETY_ON_NULL_RETURN(window); + EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); return window->grab; } From 5140c43960c9fc29dce279e73035bc7d2fd9146f Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 09:21:43 -0500 Subject: [PATCH 06/15] tests/ecore_wl2: Fix formatting NB: No functional changes --- src/tests/ecore_wl2/ecore_wl2_test_window.c | 68 ++++++++++++--------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c index 66b76a3eb9..c69f8eb342 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_window.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c @@ -19,24 +19,25 @@ #define WIDTH 480 #define HEIGHT 360 -typedef struct _Test_Data { - Ecore_Wl2_Display *display; - Ecore_Wl2_Window *win; - Ecore_Wl2_Frame_Cb_Handle *frame_callback_handler; - Ecore_Event_Handler *handler; +typedef struct _Test_Data +{ + Ecore_Wl2_Display *display; + Ecore_Wl2_Window *win; + Ecore_Wl2_Frame_Cb_Handle *frame_callback_handler; + Ecore_Event_Handler *handler; - struct wl_surface *surface; - struct wl_egl_window *egl_window; + struct wl_surface *surface; + struct wl_egl_window *egl_window; - int width; - int height; - int frame_callback_count; + int width; + int height; + int frame_callback_count; #ifdef GL_GLES - EGLDisplay egl_display; - EGLConfig egl_conf; - EGLSurface egl_surface; - EGLContext egl_context; + EGLDisplay egl_display; + EGLConfig egl_conf; + EGLSurface egl_surface; + EGLContext egl_context; #endif } Test_Data; @@ -72,16 +73,19 @@ _init_egl(Test_Data *td) EGL_NONE }; - td->egl_display = eglGetDisplay((EGLNativeDisplayType)ecore_wl2_display_get(td->display)); + td->egl_display = + eglGetDisplay((EGLNativeDisplayType)ecore_wl2_display_get(td->display)); eglInitialize(td->egl_display, NULL, NULL); eglChooseConfig(td->egl_display, attributes, &td->egl_conf, 1, &num_config); - td->egl_context = eglCreateContext(td->egl_display, td->egl_conf, EGL_NO_CONTEXT, NULL); + td->egl_context = + eglCreateContext(td->egl_display, td->egl_conf, EGL_NO_CONTEXT, NULL); td->egl_window = wl_egl_window_create(td->surface, td->width, td->height); - td->egl_surface = eglCreateWindowSurface(td->egl_display, - td->egl_conf, td->egl_window, NULL); + td->egl_surface = + eglCreateWindowSurface(td->egl_display, td->egl_conf, td->egl_window, NULL); - eglMakeCurrent(td->egl_display, td->egl_surface, td->egl_surface, td->egl_context); + eglMakeCurrent(td->egl_display, td->egl_surface, td->egl_surface, + td->egl_context); } static void @@ -423,7 +427,9 @@ _test_activated_configure_complete(void *data, int type EINA_UNUSED, void *event { Test_Data *td = data; - td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_activated_frame_cb, td); + td->frame_callback_handler = + ecore_wl2_window_frame_callback_add(td->win, + _test_activated_frame_cb, td); ecore_wl2_window_commit(td->win, EINA_TRUE); return ECORE_CALLBACK_PASS_ON; @@ -463,8 +469,9 @@ EFL_START_TEST(wl2_window_activated) ecore_wl2_window_show(td->win); _init_egl(td); - td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, - _test_activated_configure_complete, td); + td->handler = + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, + _test_activated_configure_complete, td); ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ACTIVATE, _test_activated_window_activate, NULL); @@ -603,7 +610,8 @@ _test_commit_configure_complete(void *data, int type EINA_UNUSED, void *event EI { Test_Data *td = data; - td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_commit_frame_cb, td); + td->frame_callback_handler = + ecore_wl2_window_frame_callback_add(td->win, _test_commit_frame_cb, td); ecore_wl2_window_commit(td->win, EINA_TRUE); return ECORE_CALLBACK_PASS_ON; @@ -633,8 +641,9 @@ EFL_START_TEST(wl2_window_commit) ecore_wl2_window_show(td->win); - td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, - _test_commit_configure_complete, td); + td->handler = + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, + _test_commit_configure_complete, td); ecore_main_loop_begin(); @@ -664,7 +673,9 @@ _test_frame_callback_configure_complete(void *data, int type EINA_UNUSED, void * { Test_Data *td = data; - td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_frame_callback_frame_cb, td); + td->frame_callback_handler = + ecore_wl2_window_frame_callback_add(td->win, + _test_frame_callback_frame_cb, td); ecore_wl2_window_commit(td->win, EINA_TRUE); return ECORE_CALLBACK_PASS_ON; @@ -694,8 +705,9 @@ EFL_START_TEST(wl2_window_frame_callback) ecore_wl2_window_show(td->win); - td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, - _test_frame_callback_configure_complete, td); + td->handler = + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, + _test_frame_callback_configure_complete, td); ecore_main_loop_begin(); From 43ad91ee406cbcc5715486813324a2eecbd5ece4 Mon Sep 17 00:00:00 2001 From: Ali Alzyod Date: Fri, 3 Jan 2020 12:06:25 +0100 Subject: [PATCH 07/15] Text_Format_Horizontal_Alignment_Auto_Type: rename enums, and Doc details Summary: Text_Format_Horizontal_Alignment_Auto_Type: rename enums, and Doc details Reviewers: woohyun, ali.alzyod Reviewed By: ali.alzyod Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7939 Differential Revision: https://phab.enlightenment.org/D10993 --- src/lib/efl/interfaces/efl_text_format.eo | 17 +++++++++++------ src/lib/evas/canvas/evas_object_textblock.c | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/lib/efl/interfaces/efl_text_format.eo b/src/lib/efl/interfaces/efl_text_format.eo index 5c974a675e..03a44295a5 100644 --- a/src/lib/efl/interfaces/efl_text_format.eo +++ b/src/lib/efl/interfaces/efl_text_format.eo @@ -9,10 +9,10 @@ enum @beta Efl.Text_Format_Wrap { } enum @beta Efl.Text_Format_Horizontal_Alignment_Auto_Type { - [[Auto-horizontal alignment of the text.]] - none, [[No auto-alignment rule.]] - normal, [[Respects LTR/RTL (bidirectional) settings.]] - locale, [[Respects locale's language settings.]] + [[Auto-horizontal alignment setting for the text (Left-To-Right or Right-To-Left).]] + none, [[No auto-alignment rule: Horizontal Alignment is decided by @Efl.Text_Format.text_horizontal_align]] + auto, [[Respects LTR/RTL (bidirectional) characters found inside the text content.]] + locale, [[Respects the system's language settings.]] end [[Text is placed at opposite side of LTR/RTL (bidirectional) settings.]] } @@ -55,7 +55,7 @@ interface @beta Efl.Text_Format { } @property text_horizontal_align_auto_type { - [[Horizontal alignment of text.]] + [[Specifies when the text's horizontal alignment should be set automatically.]] values { value: Efl.Text_Format_Horizontal_Alignment_Auto_Type; [[Alignment type.]] } @@ -63,7 +63,12 @@ interface @beta Efl.Text_Format { @property text_horizontal_align { [[Horizontal alignment of text. $[0.0] means "left" - and $[1.0] means "right".]] + and $[1.0] means "right". + Setting this value also sets @.text_horizontal_align_auto_type to + @Efl.Text_Format_Horizontal_Alignment_Auto_Type.none. + This value is ignored when @.text_horizontal_align_auto_type is set to anything other than + @Efl.Text_Format_Horizontal_Alignment_Auto_Type.none. + ]] values { value: double; [[Alignment value between $[0.0] and $[1.0].]] } diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 1dcad334c6..93c7a4b5d5 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -16773,7 +16773,7 @@ _efl_canvas_textblock_efl_text_format_text_horizontal_align_auto_type_set(Eo *ob { _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_NONE); } - else if (type == EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_NORMAL) + else if (type == EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_AUTO) { _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL); } @@ -16795,7 +16795,7 @@ _efl_canvas_textblock_efl_text_format_text_horizontal_align_auto_type_get(const if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL) { - ret = EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_NORMAL; + ret = EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_AUTO; } else if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_END) { From 594ed747a74e181256f4d095b7f0cc841127a921 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 10:19:16 -0500 Subject: [PATCH 08/15] Revert "tests/ecore_wl2: Add test for ecore_wl2_window_xxx functions" This commit reverts some additional tests which were added. The reason for the revert is that these tests can occasionally cause the ecore_wl2 test suite to timeout/stall. This reverts commit 4ea865623df83b78830dc253bcddd7e64a7810ca. --- src/tests/ecore_wl2/ecore_wl2_test_window.c | 509 +------------------- src/tests/ecore_wl2/meson.build | 10 +- 2 files changed, 5 insertions(+), 514 deletions(-) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c index c69f8eb342..d47f314b61 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_window.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c @@ -7,44 +7,19 @@ #include #include #include -#include - -#ifdef GL_GLES -#include -#include -#endif #include "ecore_wl2_suite.h" #define WIDTH 480 #define HEIGHT 360 -typedef struct _Test_Data -{ - Ecore_Wl2_Display *display; - Ecore_Wl2_Window *win; - Ecore_Wl2_Frame_Cb_Handle *frame_callback_handler; - Ecore_Event_Handler *handler; - - struct wl_surface *surface; - struct wl_egl_window *egl_window; - - int width; - int height; - int frame_callback_count; - -#ifdef GL_GLES - EGLDisplay egl_display; - EGLConfig egl_conf; - EGLSurface egl_surface; - EGLContext egl_context; -#endif -} Test_Data; - static Ecore_Wl2_Display * _display_connect(void) { - return ecore_wl2_display_connect(NULL); + Ecore_Wl2_Display *disp; + + disp = ecore_wl2_display_connect(NULL); + return disp; } static Ecore_Wl2_Window * @@ -59,45 +34,6 @@ _surface_get(Ecore_Wl2_Window *win) return ecore_wl2_window_surface_get(win); } -#ifdef GL_GLES -static void -_init_egl(Test_Data *td) -{ - eglBindAPI(EGL_OPENGL_API); - EGLint num_config; - - EGLint attributes[] = { - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_NONE - }; - - td->egl_display = - eglGetDisplay((EGLNativeDisplayType)ecore_wl2_display_get(td->display)); - eglInitialize(td->egl_display, NULL, NULL); - eglChooseConfig(td->egl_display, attributes, &td->egl_conf, 1, &num_config); - td->egl_context = - eglCreateContext(td->egl_display, td->egl_conf, EGL_NO_CONTEXT, NULL); - - td->egl_window = wl_egl_window_create(td->surface, td->width, td->height); - td->egl_surface = - eglCreateWindowSurface(td->egl_display, td->egl_conf, td->egl_window, NULL); - - eglMakeCurrent(td->egl_display, td->egl_surface, td->egl_surface, - td->egl_context); -} - -static void -_term_egl(Test_Data *td) -{ - eglDestroySurface(td->egl_display, td->egl_surface); - wl_egl_window_destroy(td->egl_window); - eglDestroyContext(td->egl_display, td->egl_context); - eglTerminate(td->egl_display); -} -#endif - EFL_START_TEST(wl2_window_new) { Ecore_Wl2_Display *disp; @@ -399,97 +335,6 @@ EFL_START_TEST(wl2_window_type) } EFL_END_TEST -#ifdef GL_GLES -static void -_test_activated_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data) -{ - Test_Data *td = data; - - td->frame_callback_count++; - if (td->frame_callback_count % 4 == 0) - glClearColor(0.0, 1.0, 0.0, 0.0); - else if (td->frame_callback_count % 4 == 1) - glClearColor(0.0, 0.0, 1.0, 0.0); - else if (td->frame_callback_count % 4 == 2) - glClearColor(0.0, 0.0, 0.0, 1.0); - else - glClearColor(1.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - glFlush(); - - eglSwapBuffers(td->egl_display, td->egl_surface); - - ecore_wl2_window_commit(td->win, EINA_TRUE); -} - -static Eina_Bool -_test_activated_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) -{ - Test_Data *td = data; - - td->frame_callback_handler = - ecore_wl2_window_frame_callback_add(td->win, - _test_activated_frame_cb, td); - ecore_wl2_window_commit(td->win, EINA_TRUE); - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_test_activated_window_activate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) -{ - //TC Pass - ecore_main_loop_quit(); - - return ECORE_CALLBACK_PASS_ON; -} - -EFL_START_TEST(wl2_window_activated) -{ - Test_Data *td; - - ecore_wl2_init(); - - td = calloc(1, sizeof(Test_Data)); - td->width = WIDTH; - td->height = HEIGHT; - td->frame_callback_count = 0; - - td->display = _display_connect(); - ck_assert(td->display != NULL); - - td->win = _window_create(td->display); - ck_assert(td->win != NULL); - - ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - td->surface = _surface_get(td->win); - ck_assert(td->surface != NULL); - - ecore_wl2_window_show(td->win); - - _init_egl(td); - td->handler = - ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, - _test_activated_configure_complete, td); - ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ACTIVATE, - _test_activated_window_activate, NULL); - - ecore_main_loop_begin(); - - _term_egl(td); - ecore_wl2_shutdown(); - free(td); -} -EFL_END_TEST -#else -EFL_START_TEST(wl2_window_activated) -{ - fail_if("No GL enabled GL should be enabled for API test"); -} -EFL_END_TEST -#endif - EFL_START_TEST(wl2_window_aspect) { Ecore_Wl2_Display *disp; @@ -597,344 +442,6 @@ EFL_START_TEST(wl2_window_role) } EFL_END_TEST -static void -_test_commit_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data) -{ - Test_Data *td = data; - td->frame_callback_count++; - ecore_main_loop_quit(); -} - -static Eina_Bool -_test_commit_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) -{ - Test_Data *td = data; - - td->frame_callback_handler = - ecore_wl2_window_frame_callback_add(td->win, _test_commit_frame_cb, td); - ecore_wl2_window_commit(td->win, EINA_TRUE); - - return ECORE_CALLBACK_PASS_ON; -} - -EFL_START_TEST(wl2_window_commit) -{ - Test_Data *td; - - ecore_wl2_init(); - - td = calloc(1, sizeof(Test_Data)); - td->width = WIDTH; - td->height = HEIGHT; - td->frame_callback_count = 0; - - td->display = _display_connect(); - ck_assert(td->display != NULL); - - td->win = _window_create(td->display); - ck_assert(td->win != NULL); - - ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - td->surface = _surface_get(td->win); - ck_assert(td->surface != NULL); - - ecore_wl2_window_show(td->win); - - td->handler = - ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, - _test_commit_configure_complete, td); - - ecore_main_loop_begin(); - - //Check if the frame callback was called properly by ecore_wl2_window_commit(). - fail_if(td->frame_callback_count == 0); - - ecore_wl2_shutdown(); - free(td); -} -EFL_END_TEST - -static void -_test_frame_callback_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data) -{ - Test_Data *td = data; - td->frame_callback_count++; - if (td->frame_callback_count == 1) - { - ecore_wl2_window_frame_callback_del(td->frame_callback_handler); - td->frame_callback_handler = NULL; - ecore_main_loop_quit(); - } -} - -static Eina_Bool -_test_frame_callback_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) -{ - Test_Data *td = data; - - td->frame_callback_handler = - ecore_wl2_window_frame_callback_add(td->win, - _test_frame_callback_frame_cb, td); - ecore_wl2_window_commit(td->win, EINA_TRUE); - - return ECORE_CALLBACK_PASS_ON; -} - -EFL_START_TEST(wl2_window_frame_callback) -{ - Test_Data *td; - - ecore_wl2_init(); - - td = calloc(1, sizeof(Test_Data)); - td->width = WIDTH; - td->height = HEIGHT; - td->frame_callback_count = 0; - - td->display = _display_connect(); - ck_assert(td->display != NULL); - - td->win = _window_create(td->display); - ck_assert(td->win != NULL); - - ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - td->surface = _surface_get(td->win); - ck_assert(td->surface != NULL); - - ecore_wl2_window_show(td->win); - - td->handler = - ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, - _test_frame_callback_configure_complete, td); - - ecore_main_loop_begin(); - - //Check if the frame callback called after then it sets NULL or not. - fail_if(td->frame_callback_count != 1); - fail_if(td->frame_callback_handler != NULL); - - ecore_wl2_shutdown(); - free(td); -} -EFL_END_TEST - -EFL_START_TEST(wl2_window_free) -{ - Ecore_Wl2_Window *t_win; - Test_Data *td; - - ecore_wl2_init(); - - td = calloc(1, sizeof(Test_Data)); - - td->display = _display_connect(); - ck_assert(td->display != NULL); - - td->win = _window_create(td->display); - ck_assert(td->win != NULL); - - ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - td->surface = _surface_get(td->win); - ck_assert(td->surface != NULL); - - ecore_wl2_window_show(td->win); - - t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface); - - fail_if(td->win != t_win); - - ecore_wl2_window_free(td->win); - t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface); - - //Check the returned window with freed window. - fail_if(td->win == t_win); - - ecore_wl2_shutdown(); - free(td); -} -EFL_END_TEST - -static Eina_Bool -_test_hide_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) -{ - //TC pass - ecore_main_loop_quit(); - - return ECORE_CALLBACK_PASS_ON; -} - -EFL_START_TEST(wl2_window_hide) -{ - Test_Data *td; - - ecore_wl2_init(); - - td = calloc(1, sizeof(Test_Data)); - td->width = WIDTH; - td->height = HEIGHT; - td->frame_callback_count = 0; - - td->display = _display_connect(); - ck_assert(td->display != NULL); - - td->win = _window_create(td->display); - ck_assert(td->win != NULL); - - ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - td->surface = _surface_get(td->win); - ck_assert(td->surface != NULL); - - ecore_wl2_window_show(td->win); - - ecore_wl2_window_hide(td->win); - td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_HIDE, - _test_hide_window_hide, NULL); - - ecore_main_loop_begin(); - - ecore_wl2_shutdown(); - free(td); -} -EFL_END_TEST - -EFL_START_TEST(wl2_window_shell_surface_exists) -{ - Test_Data *td; - - ecore_wl2_init(); - - td = calloc(1, sizeof(Test_Data)); - td->width = WIDTH; - td->height = HEIGHT; - td->frame_callback_count = 0; - - td->display = _display_connect(); - ck_assert(td->display != NULL); - - td->win = _window_create(td->display); - ck_assert(td->win != NULL); - - ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - td->surface = _surface_get(td->win); - ck_assert(td->surface != NULL); - - ecore_wl2_window_show(td->win); - - //window_show function will create shell surface. then checks it. - fail_if(ecore_wl2_window_shell_surface_exists(td->win) == EINA_FALSE); - - ecore_wl2_shutdown(); - free(td); -} -EFL_END_TEST - -static Eina_Bool -_test_show_window_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) -{ - //TC pass - ecore_main_loop_quit(); - - return ECORE_CALLBACK_PASS_ON; -} - -EFL_START_TEST(wl2_window_show) -{ - Test_Data *td; - - ecore_wl2_init(); - - td = calloc(1, sizeof(Test_Data)); - td->width = WIDTH; - td->height = HEIGHT; - td->frame_callback_count = 0; - - td->display = _display_connect(); - ck_assert(td->display != NULL); - - td->win = _window_create(td->display); - ck_assert(td->win != NULL); - - ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - td->surface = _surface_get(td->win); - ck_assert(td->surface != NULL); - - ecore_wl2_window_show(td->win); - - td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW, - _test_show_window_show, NULL); - - ecore_main_loop_begin(); - - ecore_wl2_shutdown(); - free(td); -} -EFL_END_TEST - -static Eina_Bool _window_configure_event_called = EINA_FALSE; - -static Eina_Bool -_test_update_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) -{ - _window_configure_event_called = EINA_TRUE; - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_test_update_window_configure_complete(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) -{ - //Checks if the configure_complete calling before configure calling - //when ecore_wl2_window_update_begin() called. - fail_if(_window_configure_event_called == EINA_TRUE); - - ecore_main_loop_quit(); - - return ECORE_CALLBACK_PASS_ON; -} - -EFL_START_TEST(wl2_window_update_begin) -{ - Test_Data *td; - - ecore_wl2_init(); - - td = calloc(1, sizeof(Test_Data)); - td->width = WIDTH; - td->height = HEIGHT; - td->frame_callback_count = 0; - - td->display = _display_connect(); - ck_assert(td->display != NULL); - - td->win = _window_create(td->display); - ck_assert(td->win != NULL); - - ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - td->surface = _surface_get(td->win); - ck_assert(td->surface != NULL); - - ecore_wl2_window_show(td->win); - - ecore_wl2_window_update_begin(td->win); - ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, - _test_update_window_configure, NULL); - ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, - _test_update_window_configure_complete, NULL); - - ecore_main_loop_begin(); - - ecore_wl2_shutdown(); - free(td); -} -EFL_END_TEST - void ecore_wl2_test_window(TCase *tc) { @@ -958,18 +465,10 @@ ecore_wl2_test_window(TCase *tc) tcase_add_test(tc, wl2_wm_window_rotation_app); tcase_add_test(tc, wl2_window_geometry); tcase_add_test(tc, wl2_window_type); - tcase_add_test(tc, wl2_window_activated); tcase_add_test(tc, wl2_window_available_rotation); tcase_add_test(tc, wl2_window_aspect); tcase_add_test(tc, wl2_window_class); tcase_add_test(tc, wl2_window_title); tcase_add_test(tc, wl2_window_role); - tcase_add_test(tc, wl2_window_commit); - tcase_add_test(tc, wl2_window_frame_callback); - tcase_add_test(tc, wl2_window_free); - tcase_add_test(tc, wl2_window_hide); - tcase_add_test(tc, wl2_window_shell_surface_exists); - tcase_add_test(tc, wl2_window_show); - tcase_add_test(tc, wl2_window_update_begin); } } diff --git a/src/tests/ecore_wl2/meson.build b/src/tests/ecore_wl2/meson.build index 2491b6d631..eb1a13db6a 100644 --- a/src/tests/ecore_wl2/meson.build +++ b/src/tests/ecore_wl2/meson.build @@ -8,17 +8,9 @@ ecore_wl2_suite_src = [ 'ecore_wl2_test_input.c' ] -wl2_test_gl_deps = [] - -if get_option('opengl') == 'es-egl' - wl2_test_gl_deps += dependency('egl') - wl2_test_gl_deps += dependency('gl') -endif - ecore_wl2_suite = executable('ecore_wl2_suite', ecore_wl2_suite_src, - dependencies: [ecore_wl2, ecore, ecore_input, check, wayland_protocol, wayland_client, dependency('wayland-egl'), wl2_test_gl_deps], - + dependencies: [ecore_wl2, ecore, check, wayland_protocol], c_args : [ '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"', '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"'] From 59ec4ea1b349a86339b1efade3ef19b76920898d Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 10:33:53 -0500 Subject: [PATCH 09/15] tests/ecore_wl2: Add test for ecore_wl2_window_input_region functions ref T8016 --- src/tests/ecore_wl2/ecore_wl2_test_window.c | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c index d47f314b61..c5604802a4 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_window.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c @@ -442,6 +442,28 @@ EFL_START_TEST(wl2_window_role) } EFL_END_TEST +EFL_START_TEST(wl2_window_input_region) +{ + Ecore_Wl2_Display *disp; + Ecore_Wl2_Window *win; + int x, y, w, h; + + disp = _display_connect(); + ck_assert(disp != NULL); + + win = _window_create(disp); + ck_assert(win != NULL); + + ecore_wl2_window_input_region_set(win, 10, 10, 100, 100); + + ecore_wl2_window_input_region_get(win, &x, &y, &w, &h); + fail_if(x != 10); + fail_if(y != 10); + fail_if(w != 100); + fail_if(h != 100); +} +EFL_END_TEST + void ecore_wl2_test_window(TCase *tc) { @@ -470,5 +492,6 @@ ecore_wl2_test_window(TCase *tc) tcase_add_test(tc, wl2_window_class); tcase_add_test(tc, wl2_window_title); tcase_add_test(tc, wl2_window_role); + tcase_add_test(tc, wl2_window_input_region); } } From 0bb0d862cebdfbb6b1f7f96f3ed3a62b102e55fb Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 10:36:16 -0500 Subject: [PATCH 10/15] tests/ecore_wl2: Add test for ecore_wl2_window_opaque_region functions ref T8016 --- src/tests/ecore_wl2/ecore_wl2_test_window.c | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c index c5604802a4..54d7f8bfd9 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_window.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c @@ -464,6 +464,28 @@ EFL_START_TEST(wl2_window_input_region) } EFL_END_TEST +EFL_START_TEST(wl2_window_opaque_region) +{ + Ecore_Wl2_Display *disp; + Ecore_Wl2_Window *win; + int x, y, w, h; + + disp = _display_connect(); + ck_assert(disp != NULL); + + win = _window_create(disp); + ck_assert(win != NULL); + + ecore_wl2_window_opaque_region_set(win, 10, 10, 100, 100); + + ecore_wl2_window_opaque_region_get(win, &x, &y, &w, &h); + fail_if(x != 10); + fail_if(y != 10); + fail_if(w != 100); + fail_if(h != 100); +} +EFL_END_TEST + void ecore_wl2_test_window(TCase *tc) { @@ -493,5 +515,6 @@ ecore_wl2_test_window(TCase *tc) tcase_add_test(tc, wl2_window_title); tcase_add_test(tc, wl2_window_role); tcase_add_test(tc, wl2_window_input_region); + tcase_add_test(tc, wl2_window_opaque_region); } } From a9ded0ab5c0d463208c5305856107fb27bb73271 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 10:42:11 -0500 Subject: [PATCH 11/15] tests/ecore_wl2: Fix input_keymap test The test for ecore_wl2_input_keymap_get was causing failues in the suite because we need to verify that the input device is a keyboard before we can check for a keymap. ref T8016 --- src/tests/ecore_wl2/ecore_wl2_test_input.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_input.c b/src/tests/ecore_wl2/ecore_wl2_test_input.c index 73056a77fa..696a6c7c9f 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_input.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_input.c @@ -102,7 +102,9 @@ EFL_START_TEST(wl2_input_keymap_get) EINA_ITERATOR_FOREACH(itr, input) { - ck_assert(ecore_wl2_input_keymap_get(input) != NULL); + if (ecore_wl2_input_seat_capabilities_get(input) == + ECORE_WL2_SEAT_CAPABILITIES_KEYBOARD) + ck_assert(ecore_wl2_input_keymap_get(input) != NULL); } eina_iterator_free(itr); From 9df48a5a3c47471ad25146888b413f088d5bcf9c Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 10:58:29 -0500 Subject: [PATCH 12/15] tests/ecore_wl2: Add test for ecore_wl2_window_popup_input functions ref T8016 --- src/tests/ecore_wl2/ecore_wl2_test_window.c | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c index 54d7f8bfd9..611b36768c 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_window.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c @@ -486,6 +486,39 @@ EFL_START_TEST(wl2_window_opaque_region) } EFL_END_TEST +EFL_START_TEST(wl2_window_popup_input) +{ + Ecore_Wl2_Display *disp; + Ecore_Wl2_Window *win; + Ecore_Wl2_Input *input; + Eina_Iterator *itr; + + disp = _display_connect(); + ck_assert(disp != NULL); + + win = _window_create(disp); + ck_assert(win != NULL); + + ecore_wl2_window_type_set(win, ECORE_WL2_WINDOW_TYPE_MENU); + + itr = ecore_wl2_display_inputs_get(disp); + ck_assert(itr != NULL); + + EINA_ITERATOR_FOREACH(itr, input) + { + if (ecore_wl2_input_seat_capabilities_get(input) != + ECORE_WL2_SEAT_CAPABILITIES_POINTER) + continue; + + ecore_wl2_window_popup_input_set(win, input); + fail_if(ecore_wl2_window_popup_input_get(win) != input); + break; + } + + eina_iterator_free(itr); +} +EFL_END_TEST + void ecore_wl2_test_window(TCase *tc) { @@ -516,5 +549,6 @@ ecore_wl2_test_window(TCase *tc) tcase_add_test(tc, wl2_window_role); tcase_add_test(tc, wl2_window_input_region); tcase_add_test(tc, wl2_window_opaque_region); + tcase_add_test(tc, wl2_window_popup_input); } } From 60672bdc5aafa54d9e8e1d8c4fac3df3af2fe322 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 11:02:11 -0500 Subject: [PATCH 13/15] tests/ecore_wl2: Add test for ecore_wl2_display_input_find_by_name ref T8016 --- src/tests/ecore_wl2/ecore_wl2_test_display.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_display.c b/src/tests/ecore_wl2/ecore_wl2_test_display.c index 99b441b433..2f77d2705f 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_display.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_display.c @@ -177,6 +177,19 @@ EFL_START_TEST(wl2_display_compositor_version_get) } EFL_END_TEST +EFL_START_TEST(wl2_display_input_find_by_name) +{ + Ecore_Wl2_Display *disp; + Ecore_Wl2_Input *input; + + disp = _display_connect(); + ck_assert(disp != NULL); + + input = ecore_wl2_display_input_find_by_name(disp, "default"); + ck_assert(input != NULL); +} +EFL_END_TEST + void ecore_wl2_test_display(TCase *tc) { @@ -202,5 +215,6 @@ ecore_wl2_test_display(TCase *tc) tcase_add_test(tc, wl2_display_screen_size_get); tcase_add_test(tc, wl2_display_inputs_get); tcase_add_test(tc, wl2_display_compositor_version_get); + tcase_add_test(tc, wl2_display_input_find_by_name); } } From d8c0080dba592668869f83134be51766eaf6b3d2 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 11:06:15 -0500 Subject: [PATCH 14/15] tests/ecore_wl2: Add test for ecore_wl2_input_seat_capabilities_get ref T8016 --- src/tests/ecore_wl2/ecore_wl2_test_input.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/tests/ecore_wl2/ecore_wl2_test_input.c b/src/tests/ecore_wl2/ecore_wl2_test_input.c index 696a6c7c9f..98b9e9758e 100644 --- a/src/tests/ecore_wl2/ecore_wl2_test_input.c +++ b/src/tests/ecore_wl2/ecore_wl2_test_input.c @@ -132,6 +132,30 @@ EFL_START_TEST(wl2_input_name_get) } EFL_END_TEST +EFL_START_TEST(wl2_input_seat_capabilities) +{ + Ecore_Wl2_Display *disp; + Ecore_Wl2_Input *input; + Eina_Iterator *itr; + + disp = _display_connect(); + ck_assert(disp != NULL); + + itr = ecore_wl2_display_inputs_get(disp); + ck_assert(itr != NULL); + + EINA_ITERATOR_FOREACH(itr, input) + { + Ecore_Wl2_Seat_Capabilities cap = ECORE_WL2_SEAT_CAPABILITIES_NONE; + + cap = ecore_wl2_input_seat_capabilities_get(input); + ck_assert(cap != ECORE_WL2_SEAT_CAPABILITIES_NONE); + } + + eina_iterator_free(itr); +} +EFL_END_TEST + void ecore_wl2_test_input(TCase *tc) { @@ -142,5 +166,6 @@ ecore_wl2_test_input(TCase *tc) tcase_add_test(tc, wl2_input_display_get); tcase_add_test(tc, wl2_input_keymap_get); tcase_add_test(tc, wl2_input_name_get); + tcase_add_test(tc, wl2_input_seat_capabilities); } } From ad3e3bba3bf8bb6080f0ad49992df81b05eb4187 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 8 Jan 2020 11:13:11 -0500 Subject: [PATCH 15/15] ecore-wl2: Remove unused API This API is not used Anywhere inside EFL, Enlightenment, Or Tizen so there is really no need for it to exist....one less unused API to worry about. --- src/lib/ecore_wl2/Ecore_Wl2.h | 13 ------------- src/lib/ecore_wl2/ecore_wl2_input.c | 11 ----------- 2 files changed, 24 deletions(-) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index c7105500b1..484708287c 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -1524,19 +1524,6 @@ EAPI Eina_Stringshare *ecore_wl2_input_name_get(Ecore_Wl2_Input *input); */ EAPI Eina_Bool ecore_wl2_input_keyboard_repeat_get(const Ecore_Wl2_Input *input, double *rate, double *delay); -/** - * Get the Evas_Device for the seat belonging to a window from an input - * - * @param input The input - * @param window The window - * - * @return The device object - * - * @ingroup Ecore_Wl2_Input_Group - * @since 1.20 - */ -EAPI Eo *ecore_wl2_input_seat_device_get(const Ecore_Wl2_Input *input, const Ecore_Wl2_Window *window); - /** * Retrieves the mouse position of the seat * diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c index 67a2dcba80..6694f3687d 100644 --- a/src/lib/ecore_wl2/ecore_wl2_input.c +++ b/src/lib/ecore_wl2/ecore_wl2_input.c @@ -1824,17 +1824,6 @@ ecore_wl2_input_keyboard_repeat_get(const Ecore_Wl2_Input *input, double *rate, return input->repeat.enabled; } -EAPI Eo * -ecore_wl2_input_seat_device_get(const Ecore_Wl2_Input *input, const Ecore_Wl2_Window *window) -{ - Ecore_Wl2_Input_Devices *devices; - EINA_SAFETY_ON_NULL_RETURN_VAL(input, NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); - - devices = _ecore_wl2_devices_get(input, window); - return devices ? devices->seat_dev : NULL; -} - EAPI void ecore_wl2_input_pointer_set(Ecore_Wl2_Input *input, struct wl_surface *surface, int hot_x, int hot_y) {