From: Hwankyu Jhun Date: Tue, 12 Nov 2019 05:15:34 +0000 (+0900) Subject: Modify Seamless Launching Effect API X-Git-Tag: submit/tizen/20191114.041920~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F217475%2F6;p=platform%2Fcore%2Fappfw%2Fwidget-viewer.git Modify Seamless Launching Effect API To support dali application, the functions are changed. Modifies: - frame_type_e - frame_broker_create() - frame_provider_create() Adds: - frame_get_native_buffer() - frame_get_image_file() - frame_get_file_path() - frame_get_file_group() - frame_native_buffer_get_raw() - frame_native_buffer_get_width() - frame_native_buffer_get_height() - frame_native_buffer_get_bpp() Removes: - frame_get_raw() Change-Id: Ie43cb401a006ddceb82a16ab710873a2c681bc7c Signed-off-by: Hwankyu Jhun --- diff --git a/frame-broker/CMakeLists.txt b/frame-broker/CMakeLists.txt index 949be48..f925b71 100644 --- a/frame-broker/CMakeLists.txt +++ b/frame-broker/CMakeLists.txt @@ -13,9 +13,9 @@ pkg_check_modules(frame-broker REQUIRED aul capi-appfw-app-control dlog - elementary + ecore-wl2 glib-2.0 - screen_connector_launcher_service_evas + screen_connector_launcher_service uuid bundle ) diff --git a/frame-broker/frame-broker.pc.in b/frame-broker/frame-broker.pc.in index 51e4a2d..f198881 100644 --- a/frame-broker/frame-broker.pc.in +++ b/frame-broker/frame-broker.pc.in @@ -6,7 +6,7 @@ includedir=@INCLUDEDIR@ Name: launcher-service Description: Support development of the launcher Version: @VERSION@ -Requires: screen_connector_launcher_service_evas elementary capi-appfw-app-control +Requires: screen_connector_launcher_service ecore-wl2 capi-appfw-app-control Libs: -L${libdir} -lframe-broker Cflags: -I${includedir} cppflags: -I${includedir} diff --git a/frame-broker/include/frame.h b/frame-broker/include/frame.h index a6bd21d..771a5f5 100644 --- a/frame-broker/include/frame.h +++ b/frame-broker/include/frame.h @@ -19,7 +19,6 @@ #include -#include #include #include @@ -34,12 +33,20 @@ extern "C" { typedef struct frame_s *frame_h; /** + * @brief The native buffer handle. + * @since_tizen 5.5 + */ +typedef void *frame_native_buffer_h; + +/** * @brief Enumeration for the frame type. * @since_tizen 5.5 */ typedef enum { - FRAME_TYPE_REMOTE_SURFACE, /**< The remote surface */ - FRAME_TYPE_SPLASH_SCREEN, /**< The splash screen */ + FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER, /**< The remote surface: The native buffer */ + FRAME_TYPE_REMOTE_SURFACE_IMAGE_FILE, /**< The remote surface: The image file */ + FRAME_TYPE_SPLASH_SCREEN_IMAGE, /**< The splash screen: The image */ + FRAME_TYPE_SPLASH_SCREEN_EDJE, /**< The splash screen: The EDJE */ } frame_type_e; /** @@ -52,19 +59,83 @@ typedef enum { } frame_direction_e; /** - * @brief Gets the raw handle of the frame. + * @brief Gets the native buffer. + * @since_tizen 5.5 + * @detils If the type of the frame is not FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER, + * this function returns a negative error value that is FRAME_BROKER_ERROR_INVALID_PARAMETER. + * @remarks The @a buffer should not be released. + * + * @param[in] handle The frame handle + * @param[out] buffer The native buffer + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #FRAME_BROKER_ERROR_NONE Successful + * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see frame_native_buffer_get_raw() + * @see frame_native_buffer_get_width() + * @see frame_native_buffer_get_height() + * @see frame_native_buffer_get_bbp() + */ +int frame_get_native_buffer(frame_h handle, frame_native_buffer_h *buffer); + +/** + * @brief Gets the image file information. * @since_tizen 5.5 - * @remarks Ths @a raw should not be released. + * @detils If the type of the frame is not FRAME_TYPE_REMOTE_SURFACE_IMAGE_FILE, + * this function returns a negative error value that is FRAME_BROKER_ERROR_INVALID_PARAMETER. + * @remarks The @a fd should not be released using close(). * * @param[in] handle The frame handle - * @param[out] raw The evas object + * @param[out] fd The file descriptor + * @param[out] size The size of the frame buffer * @return @c 0 on success, * otherwise a negative error value * * @retval #FRAME_BROKER_ERROR_NONE Successful * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter */ -int frame_get_raw(frame_h handle, Evas_Object **raw); +int frame_get_image_file(frame_h handle, + int32_t *fd, uint32_t* size); + +/** + * @brief Gets the file path of the splash screen. + * @since_tizen 5.5 + * @detils To use this function, the type of the frame has to be FRAME_TYPE_SPLASH_SCREEN_IMAGE or FRAME_TYPE_SPLASH_SCREEN_EDJE. + * If it's not, this function returns a negative error value that is FRAME_BROKER_ERROR_INVALID_PARAMETER. + * @remarks The @a file_path should be released using free() + * + * @param[in] handle The frame handle + * @param[out] file_path The file path + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #FRAME_BROKER_ERROR_NONE Successful + * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #FRAME_BROKER_ERROR_OUT_OF_MEMORY Out of memory + */ +int frame_get_file_path(frame_h handle, + char **file_path); + +/** + * @brief Gets the file group of the splash screen. + * @since_tizen 5.5 + * @detils To use this function, the type of the frame has to be FRAME_TYPE_SPLASH_SCREEN_EDJE. + * If it's not, this function returns a negative error value that is FRAME_BROKER_ERROR_INVALID_PARAMETER. + * @remarks The @a file_group should be released using free() + * + * @param[in] handle The frame handle + * @param[out] file_group The file group + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #FRAME_BROKER_ERROR_NONE Successful + * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #FRAME_BROKER_ERROR_OUT_OF_MEMORY Out of memory + */ +int frame_get_file_group(frame_h handle, + char **file_group); /** * @brief Gets the type of the frame. @@ -141,6 +212,64 @@ int frame_get_position_y(frame_h handle, int32_t *y); */ int frame_get_extra_data(frame_h handle, bundle **extra_data); +/** + * @brief Gets the raw data of the native buffer. + * @since_tizen 5.5 + * + * @param[in] handle The native buffer handle + * @param[out] raw The raw data + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #FRAME_BROKER_ERROR_NONE Successful + * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter + */ +int frame_native_buffer_get_raw(frame_native_buffer_h handle, void **raw); + +/** + * @brief Gets the width of the native buffer. + * @since_tizen 5.5 + * + * @param[in] handle The native buffer handle + * @param[out] width The width of the native buffer + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #FRAME_BROKER_ERROR_NONE Successful + * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter + */ +int frame_native_buffer_get_width(frame_native_buffer_h handle, + uint32_t *width); + +/** + * @brief Gets the height of the native buffer. + * @since_tizen 5.5 + * + * @param[in] handle The native buffer handle + * @param[out] height The height of the native buffer + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #FRAME_BROKER_ERROR_NONE Successful + * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter + */ +int frame_native_buffer_get_height(frame_native_buffer_h handle, + uint32_t *height); +/** + * @brief Gets the bpp of the native buffer. + * @since_tizen 5.5 + * + * @param[in] handle The native buffer handle + * @param[out] bpp The bpp of the native buffer + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #FRAME_BROKER_ERROR_NONE Successful + * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter + */ +int frame_native_buffer_get_bbp(frame_native_buffer_h handle, + uint32_t *bpp); + #ifdef __cplusplus } #endif diff --git a/frame-broker/include/frame_broker.h b/frame-broker/include/frame_broker.h index 43020e7..217fede 100644 --- a/frame-broker/include/frame_broker.h +++ b/frame-broker/include/frame_broker.h @@ -17,7 +17,7 @@ #ifndef __FRAME_BROKER_H__ #define __FRAME_BROKER_H__ -#include +#include #include #include #include @@ -39,7 +39,7 @@ typedef struct frame_broker_s *frame_broker_h; * @since_tizen 5.5 * @remarks The @a handle should be release using frame_broker_destroy() function. * - * @param[in] win The evas object + * @param[in] wl2_win The Ecore Wl2 Window * @param[in] callback The set of callback functions to handle frame context lifecycle events * @param[in] user_data The user data to be passed to the callback functions * @param[out] handle The frame broker handle @@ -55,7 +55,7 @@ typedef struct frame_broker_s *frame_broker_h; * * @see frame_broker_destroy() */ -int frame_broker_create(Evas_Object *win, +int frame_broker_create(Ecore_Wl2_Window *wl2_win, frame_context_lifecycle_callback_s *callback, void *user_data, frame_broker_h *handle); diff --git a/frame-broker/src/frame.c b/frame-broker/src/frame.c index e13e796..a504a02 100644 --- a/frame-broker/src/frame.c +++ b/frame-broker/src/frame.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include "frame.h" #include "frame_private.h" @@ -25,44 +25,39 @@ #include "private.h" struct frame_s { - Evas_Object *raw; - frame_type_e type; - frame_direction_e direction; - int32_t x; - int32_t y; + screen_connector_launcher_service_image_h image; bundle *extra_data; }; static frame_type_e __convert_type( - screen_connector_launcher_service_evas_image_type_e type) + screen_connector_launcher_service_image_type_e type) { switch (type) { - case SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_REMOTE_SURFACE_TBM: - case SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_IMAGE_TYPE_REMOTE_SURFACE_IMAGE_FILE: - return FRAME_TYPE_REMOTE_SURFACE; + case SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_REMOTE_SURFACE_TBM: + return FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER; + case SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_REMOTE_SURFACE_IMAGE_FILE: + return FRAME_TYPE_REMOTE_SURFACE_IMAGE_FILE; + case SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_SPLASH_SCREEN_IMAGE: + return FRAME_TYPE_SPLASH_SCREEN_IMAGE; default: - return FRAME_TYPE_SPLASH_SCREEN; + return FRAME_TYPE_SPLASH_SCREEN_EDJE; } } static frame_direction_e __convert_direction( - screen_connector_launcher_service_evas_direction_e direction) + screen_connector_launcher_service_direction_e direction) { - if (direction == SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_DIRECTION_FORWARD) + if (direction == SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_FORWARD) return FRAME_DIRECTION_FORWARD; return FRAME_DIRECTION_BACKWARD; } -int frame_create(Evas_Object *image, - screen_connector_launcher_service_evas_image_type_e type, - screen_connector_launcher_service_evas_direction_e direction, - int32_t x, - int32_t y, - const char *shared_widget_info, +int frame_create(screen_connector_launcher_service_image_h image, frame_h *handle) { struct frame_s *frame; + char *shared_widget_info = NULL; if (!image || !handle) { _E("Invalid parameter"); @@ -75,6 +70,8 @@ int frame_create(Evas_Object *image, return FRAME_BROKER_ERROR_OUT_OF_MEMORY; } + screen_connector_launcher_service_image_get_shared_widget_info(image, + &shared_widget_info); _D("shared_widget_info(%s)", shared_widget_info); if (shared_widget_info && shared_widget_info[0] != '\0' && strcmp(shared_widget_info, "None") != 0) { @@ -84,6 +81,7 @@ int frame_create(Evas_Object *image, } else { frame->extra_data = bundle_create(); } + free(shared_widget_info); if (!frame->extra_data) { _E("Failed to create extra data"); @@ -91,11 +89,7 @@ int frame_create(Evas_Object *image, return FRAME_BROKER_ERROR_OUT_OF_MEMORY; } - frame->raw = image; - frame->type = __convert_type(type); - frame->direction = __convert_direction(direction); - frame->x = x; - frame->y = y; + frame->image = image; *handle = frame; @@ -115,62 +109,170 @@ int frame_destroy(frame_h handle) return FRAME_BROKER_ERROR_NONE; } -API int frame_get_raw(frame_h handle, Evas_Object **raw) +API int frame_get_native_buffer(frame_h handle, frame_native_buffer_h *buffer) { - if (!handle || !raw) { + tbm_surface_info_s *surface_info = NULL; + frame_type_e type; + int ret; + + if (!handle || !buffer) { _E("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - *raw = handle->raw; + frame_get_type(handle, &type); + if (type != FRAME_TYPE_REMOTE_SURFACE_NATIVE_BUFFER) { + _E("Invalid parameter. type(%d)", type); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } - return FRAME_BROKER_ERROR_NONE; + ret = screen_connector_launcher_service_image_get_tbm_surface_info( + handle->image, &surface_info); + if (ret != 0) { + _E("Failed to get tbm surface info. error(%d)", ret); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + *buffer = (frame_native_buffer_h)surface_info; + + return ret; +} + +API int frame_get_image_file(frame_h handle, + int32_t *fd, uint32_t *size) +{ + frame_type_e type; + int ret; + + if (!handle || !fd || !size) { + _E("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + frame_get_type(handle, &type); + if (type != FRAME_TYPE_REMOTE_SURFACE_IMAGE_FILE) { + _E("Invalid parameter. type(%d)", type); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + ret = screen_connector_launcher_service_image_get_image_file( + handle->image, fd, size); + return ret; +} + +API int frame_get_file_path(frame_h handle, char **file_path) +{ + frame_type_e type; + int ret; + + if (!handle || !file_path) { + _E("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + frame_get_type(handle, &type); + if (type != FRAME_TYPE_SPLASH_SCREEN_IMAGE && + type != FRAME_TYPE_SPLASH_SCREEN_EDJE) { + _E("Invalid parameter. type(%d)", type); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + ret = screen_connector_launcher_service_image_get_file_path( + handle->image, file_path); + return ret; +} + +API int frame_get_file_group(frame_h handle, char **file_group) +{ + frame_type_e type; + int ret; + + if (!handle || !file_group) { + _E("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + frame_get_type(handle, &type); + if (type != FRAME_TYPE_SPLASH_SCREEN_EDJE) { + _E("Invalid parameter. type(%d)", type); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + ret = screen_connector_launcher_service_image_get_file_group( + handle->image, file_group); + return ret; } API int frame_get_type(frame_h handle, frame_type_e *type) { + screen_connector_launcher_service_image_type_e image_type; + int ret; + if (!handle || !type) { _E("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - *type = handle->type; + ret = screen_connector_launcher_service_image_get_type(handle->image, + &image_type); + if (ret != 0) + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + + *type = __convert_type(image_type); return FRAME_BROKER_ERROR_NONE; } API int frame_get_direction(frame_h handle, frame_direction_e *direction) { + screen_connector_launcher_service_direction_e scls_direction; + int ret; + if (!handle || !direction) { _E("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - *direction = handle->direction; + ret = screen_connector_launcher_service_image_get_direction( + handle->image, &scls_direction); + if (ret != 0) + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + + *direction = __convert_direction(scls_direction); return FRAME_BROKER_ERROR_NONE; } API int frame_get_position_x(frame_h handle, int32_t *x) { + int ret; + if (!handle || !x) { _E("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - *x = handle->x; + ret = screen_connector_launcher_service_image_get_position_x( + handle->image, x); + if (ret != 0) + return FRAME_BROKER_ERROR_INVALID_PARAMETER; return FRAME_BROKER_ERROR_NONE; } API int frame_get_position_y(frame_h handle, int32_t *y) { + int ret; + if (!handle || !y) { _E("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - *y = handle->y; + ret = screen_connector_launcher_service_image_get_position_y( + handle->image, y); + if (ret != 0) + return FRAME_BROKER_ERROR_INVALID_PARAMETER; return FRAME_BROKER_ERROR_NONE; } @@ -186,3 +288,67 @@ API int frame_get_extra_data(frame_h handle, bundle **extra_data) return FRAME_BROKER_ERROR_NONE; } + +API int frame_native_buffer_get_raw(frame_native_buffer_h handle, + void **raw) +{ + tbm_surface_info_s *info; + + if (!handle || !raw) { + _E("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + info = (tbm_surface_info_s *)handle; + *raw = info->planes[0].ptr; + + return FRAME_BROKER_ERROR_NONE; +} + +API int frame_native_buffer_get_width(frame_native_buffer_h handle, + uint32_t *width) +{ + tbm_surface_info_s *info; + + if (!handle || !width) { + _E("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + info = (tbm_surface_info_s *)handle; + *width = info->width; + + return FRAME_BROKER_ERROR_NONE; +} + +API int frame_native_buffer_get_height(frame_native_buffer_h handle, + uint32_t *height) +{ + tbm_surface_info_s *info; + + if (!handle || !height) { + _E("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + info = (tbm_surface_info_s *)handle; + *height = info->height; + + return FRAME_BROKER_ERROR_NONE; +} + +API int frame_native_buffer_get_bbp(frame_native_buffer_h handle, + uint32_t *bpp) +{ + tbm_surface_info_s *info; + + if (!handle || !bpp) { + _E("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + info = (tbm_surface_info_s *)handle; + *bpp = info->bpp; + + return FRAME_BROKER_ERROR_NONE; +} diff --git a/frame-broker/src/frame_broker.c b/frame-broker/src/frame_broker.c index 545fb01..5159600 100644 --- a/frame-broker/src/frame_broker.c +++ b/frame-broker/src/frame_broker.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include "frame_broker.h" @@ -34,11 +34,11 @@ struct frame_broker_s { char *name; - Evas_Object *win; + Ecore_Wl2_Window *wl2_win; frame_context_lifecycle_callback_s callback; void *user_data; aul_launcher_service_h als; - screen_connector_launcher_service_evas_h scls_evas; + screen_connector_launcher_service_h scls; frame_context_h context; frame_context_h pre_context; }; @@ -47,13 +47,13 @@ static GList *__win_list; static gint __compare_win(gconstpointer a, gconstpointer b) { - Evas_Object *win_a = (Evas_Object *)a; - Evas_Object *win_b = (Evas_Object *)b; + Ecore_Wl2_Window *win_a = (Ecore_Wl2_Window *)a; + Ecore_Wl2_Window *win_b = (Ecore_Wl2_Window *)b; return win_a != win_b; } -static bool __exist_win(Evas_Object *win) +static bool __exist_win(Ecore_Wl2_Window *win) { GList *found; @@ -64,12 +64,12 @@ static bool __exist_win(Evas_Object *win) return false; } -static void __add_win(Evas_Object *win) +static void __add_win(Ecore_Wl2_Window *win) { __win_list = g_list_append(__win_list, win); } -static void __remove_win(Evas_Object *win) +static void __remove_win(Ecore_Wl2_Window *win) { __win_list = g_list_remove(__win_list, win); } @@ -152,12 +152,7 @@ static void __aul_launcher_service_cb(const char *app_id, frame_context_on_create(context); } -static void __scls_evas_prepare_cb(Evas_Object *image, - screen_connector_launcher_service_evas_image_type_e type, - screen_connector_launcher_service_evas_direction_e direction, - int32_t x, - int32_t y, - const char *shared_widget_info, +static void __scls_prepare_cb(screen_connector_launcher_service_image_h image, uint32_t serial, void *user_data) { @@ -166,7 +161,7 @@ static void __scls_evas_prepare_cb(Evas_Object *image, frame_h frame; int ret; - _D("[__SCLS_EVAS__] Prepare"); + _D("[__SCLS__] Prepare"); if (context == NULL) { if (broker->pre_context) { __check_pre_context(broker); @@ -178,8 +173,7 @@ static void __scls_evas_prepare_cb(Evas_Object *image, frame_context_set_serial(context, serial); - ret = frame_create(image, type, direction, x, y, - shared_widget_info, &frame); + ret = frame_create(image, &frame); if (ret != FRAME_BROKER_ERROR_NONE) { _E("Failed to create frame. error(%d)", ret); frame_context_on_error(context, @@ -190,12 +184,12 @@ static void __scls_evas_prepare_cb(Evas_Object *image, frame_context_on_resume(context, frame); } -static void __scls_evas_stop_cb(uint32_t serial, void *user_data) +static void __scls_stop_cb(uint32_t serial, void *user_data) { frame_broker_h broker = user_data; frame_context_h context = broker->context; - _D("[__SCLS_EVAS__] Stop"); + _D("[__SCLS__] Stop"); if (context == NULL) { if (broker->pre_context) { __check_pre_context(broker); @@ -210,27 +204,26 @@ static void __scls_evas_stop_cb(uint32_t serial, void *user_data) } static frame_context_error_e __convert_error( - screen_connector_launcher_service_evas_error_e error) + screen_connector_launcher_service_error_e error) { switch (error) { - case SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_ERROR_DISQUALIFIED: + case SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_DISQUALIFIED: return FRAME_CONTEXT_ERROR_DISQUALIFIED; - case SCREEN_CONNECTOR_LAUNCHER_SERVICE_EVAS_ERROR_WRONG_REQUEST: + case SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_WRONG_REQUEST: return FRAME_CONTEXT_ERROR_WRONG_REQUEST; default: return FRAME_CONTEXT_ERROR_NONE; } } -static void __scls_evas_error_cb( - screen_connector_launcher_service_evas_error_e error, +static void __scls_error_cb(screen_connector_launcher_service_error_e error, uint32_t serial, void *user_data) { frame_broker_h broker = user_data; frame_context_h context = broker->context; - _D("[__SCLS_EVAS__] Error"); + _D("[__SCLS__] Error"); if (context == NULL) { if (broker->pre_context) { __check_pre_context(broker); @@ -243,7 +236,7 @@ static void __scls_evas_error_cb( frame_context_on_error(context, __convert_error(error)); } -static void __scls_evas_cleanup_cb(uint32_t serial, void *user_data) +static void __scls_cleanup_cb(uint32_t serial, void *user_data) { frame_broker_h broker = user_data; frame_context_h context = broker->context; @@ -251,7 +244,7 @@ static void __scls_evas_cleanup_cb(uint32_t serial, void *user_data) frame_h frame; int ret; - _D("[__SCLS_EVAS__] Clean up"); + _D("[__SCLS__] Clean up"); if (context == NULL) { _E("Invalid context"); return; @@ -274,22 +267,32 @@ static void __scls_evas_cleanup_cb(uint32_t serial, void *user_data) } } -API int frame_broker_create(Evas_Object *win, +static void __scls_reset_cb(uint32_t serial, void *user_data) +{ + frame_broker_h broker = user_data; + frame_context_h context = broker->context; + + _W("[__SCLS__] Reset"); + frame_context_set_frame(context, NULL); +} + +API int frame_broker_create(Ecore_Wl2_Window *wl2_win, frame_context_lifecycle_callback_s *callback, void *user_data, frame_broker_h *handle) { - screen_connector_launcher_service_evas_h scls_evas; - screen_connector_launcher_service_evas_ops ops = { - .prepare = __scls_evas_prepare_cb, - .stop = __scls_evas_stop_cb, - .error = __scls_evas_error_cb, - .cleanup = __scls_evas_cleanup_cb + screen_connector_launcher_service_h scls; + screen_connector_launcher_service_ops ops = { + .prepare = __scls_prepare_cb, + .stop = __scls_stop_cb, + .error = __scls_error_cb, + .cleanup = __scls_cleanup_cb, + .reset = __scls_reset_cb }; struct frame_broker_s *broker; int ret; - if (!win || !callback || !handle) { + if (!wl2_win || !callback || !handle) { _E("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -301,8 +304,8 @@ API int frame_broker_create(Evas_Object *win, return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - if (__exist_win(win)) { - _E("Already exists. win(%p)", win); + if (__exist_win(wl2_win)) { + _E("Already exists. wl2_win(%p)", wl2_win); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -335,22 +338,21 @@ API int frame_broker_create(Evas_Object *win, return FRAME_BROKER_ERROR_IO_ERROR; } - ret = screen_connector_launcher_service_evas_create(win, &scls_evas); + ret = screen_connector_launcher_service_create(wl2_win, &scls); if (ret != 0) { _E("Failed to create scls evas. error(%d)", ret); frame_broker_destroy(broker); return FRAME_BROKER_ERROR_IO_ERROR; } - screen_connector_launcher_service_evas_set_ops(scls_evas, &ops, - broker); + screen_connector_launcher_service_set_ops(scls, &ops, broker); - broker->scls_evas = scls_evas; - broker->win = win; + broker->scls = scls; + broker->wl2_win = wl2_win; broker->callback = *callback; broker->user_data = user_data; - __add_win(win); + __add_win(wl2_win); *handle = broker; @@ -364,12 +366,12 @@ API int frame_broker_destroy(frame_broker_h handle) return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - __remove_win(handle->win); + __remove_win(handle->wl2_win); if (handle->context) frame_context_destroy(handle->context); - screen_connector_launcher_service_evas_destroy(handle->scls_evas); + screen_connector_launcher_service_destroy(handle->scls); aul_launcher_service_destroy(handle->als); free(handle->name); free(handle); @@ -517,7 +519,7 @@ int frame_broker_launch(frame_broker_h handle, const char *app_id, } *serial = __generate_serial(); - ret = screen_connector_launcher_service_evas_launch(handle->scls_evas, + ret = screen_connector_launcher_service_launch(handle->scls, app_id, inst_id ? inst_id : "", pid, *serial); if (ret != 0) { _E("Failed to launch scls evas. error(%d)", ret); @@ -539,8 +541,8 @@ int frame_broker_launch_with_shared_widget(frame_broker_h handle, } *serial = __generate_serial(); - ret = screen_connector_launcher_service_evas_launch_with_shared_widget( - handle->scls_evas, app_id, + ret = screen_connector_launcher_service_launch_with_shared_widget( + handle->scls, app_id, inst_id ? inst_id : "", pid, *serial); if (ret != 0) { _E("Failed to launch scls evas with shared widget. error(%d)", @@ -560,8 +562,8 @@ int frame_broker_launching(frame_broker_h handle, uint32_t serial) return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - ret = screen_connector_launcher_service_evas_launching( - handle->scls_evas, serial); + ret = screen_connector_launcher_service_launching( + handle->scls, serial); if (ret != 0) { _E("Failed to notify that the animation has been started"); return FRAME_BROKER_ERROR_IO_ERROR; @@ -579,8 +581,8 @@ int frame_broker_launch_cancel(frame_broker_h handle, uint32_t serial) return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - ret = screen_connector_launcher_service_evas_launch_cancel( - handle->scls_evas, serial); + ret = screen_connector_launcher_service_launch_cancel( + handle->scls, serial); if (ret != 0) { _E("Failed to notify that the animation has been canceled."); return FRAME_BROKER_ERROR_IO_ERROR; @@ -598,8 +600,8 @@ int frame_broker_launch_done(frame_broker_h handle, uint32_t serial) return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - ret = screen_connector_launcher_service_evas_launch_done( - handle->scls_evas, serial); + ret = screen_connector_launcher_service_launch_done( + handle->scls, serial); if (ret != 0) { _E("Failed to notify that the animation has been finished."); return FRAME_BROKER_ERROR_IO_ERROR; diff --git a/frame-broker/src/frame_context.c b/frame-broker/src/frame_context.c index b7e5c64..dc79814 100644 --- a/frame-broker/src/frame_context.c +++ b/frame-broker/src/frame_context.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "frame_broker.h" #include "frame_broker_private.h" @@ -40,8 +39,7 @@ struct frame_context_s { int pid; bool started; uint32_t serial; - frame_h prev_frame; - frame_h curr_frame; + frame_h frame; }; int frame_context_create(frame_broker_h broker, @@ -107,11 +105,8 @@ int frame_context_destroy(frame_context_h handle) frame_context_on_pause(handle); frame_context_on_destroy(handle); - if (handle->prev_frame) - frame_destroy(handle->prev_frame); - - if (handle->curr_frame) - frame_destroy(handle->curr_frame); + if (handle->frame) + frame_destroy(handle->frame); free(handle->inst_id); free(handle->app_id); @@ -164,7 +159,8 @@ static gboolean __context_pause_cb(gpointer data) context->idle_tag = 0; frame_context_on_pause(context); - frame_get_direction(context->curr_frame, &direction); + _W("frame(%p)", context->frame); + frame_get_direction(context->frame, &direction); if (direction == FRAME_DIRECTION_BACKWARD) { _D("frame_context_destroy()"); frame_context_destroy(context); @@ -246,16 +242,17 @@ int frame_context_get_serial(frame_context_h handle, uint32_t *serial) int frame_context_set_frame(frame_context_h handle, frame_h frame) { - if (!handle || !frame) { + if (!handle) { _E("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - if (handle->prev_frame) - frame_destroy(handle->prev_frame); + if (handle->frame) + frame_destroy(handle->frame); + + _W("prev frame(%p), new frame(%p)", handle->frame, frame); - handle->prev_frame = handle->curr_frame; - handle->curr_frame = frame; + handle->frame = frame; return FRAME_BROKER_ERROR_NONE; } @@ -267,7 +264,7 @@ int frame_context_get_frame(frame_context_h handle, frame_h *frame) return FRAME_BROKER_ERROR_INVALID_PARAMETER; } - *frame = handle->curr_frame; + *frame = handle->frame; return FRAME_BROKER_ERROR_NONE; } diff --git a/frame-broker/src/frame_private.h b/frame-broker/src/frame_private.h index c36570d..a360d1a 100644 --- a/frame-broker/src/frame_private.h +++ b/frame-broker/src/frame_private.h @@ -17,16 +17,11 @@ #ifndef __FRAME_PRIVATE_H__ #define __FRAME_PRIVATE_H__ -#include +#include #include "frame.h" -int frame_create(Evas_Object *image, - screen_connector_launcher_service_evas_image_type_e type, - screen_connector_launcher_service_evas_direction_e direction, - int32_t x, - int32_t y, - const char *shared_widget_info, +int frame_create(screen_connector_launcher_service_image_h image, frame_h *handle); int frame_destroy(frame_h handle); diff --git a/frame-provider/include/frame_provider.h b/frame-provider/include/frame_provider.h index 7e7ead4..cb72068 100644 --- a/frame-provider/include/frame_provider.h +++ b/frame-provider/include/frame_provider.h @@ -19,7 +19,7 @@ #include -#include +#include #include #include @@ -83,7 +83,7 @@ typedef struct { * @since_tizen 5.5 * @remarks The @a handle should be released using frame_provider_destroy(). * - * @param[in] win The evas object + * @param[in] wl2_win The Ecore Wl2 Window * @param[in] callback The set of callback functions to handle frame provider events * @param[in] user_data The user data to be passed to the callback functions * @param[out] handle The frame provider handle @@ -97,7 +97,7 @@ typedef struct { * @see frame_provider_destroy() * @see frame_provider_event_callback_s */ -int frame_provider_create(Evas_Object *win, +int frame_provider_create(Ecore_Wl2_Window *wl2_win, frame_provider_event_callback_s *callback, void *user_data, frame_provider_h *handle); diff --git a/frame-provider/src/frame_provider.c b/frame-provider/src/frame_provider.c index 20e47cd..f2e60b5 100644 --- a/frame-provider/src/frame_provider.c +++ b/frame-provider/src/frame_provider.c @@ -28,7 +28,7 @@ #include "private.h" struct frame_provider_s { - Evas_Object *win; + Ecore_Wl2_Window *wl2_win; screen_connector_shared_widget_launch_h scswl; screen_connector_shared_widget_launch_prepare_state_e state; uint32_t serial; @@ -40,13 +40,13 @@ static GList *__win_list; static gint __compare_win(gconstpointer a, gconstpointer b) { - Evas_Object *win_a = (Evas_Object *)a; - Evas_Object *win_b = (Evas_Object *)b; + Ecore_Wl2_Window *win_a = (Ecore_Wl2_Window *)a; + Ecore_Wl2_Window *win_b = (Ecore_Wl2_Window *)b; return win_a != win_b; } -static bool __exist_win(Evas_Object *win) +static bool __exist_win(Ecore_Wl2_Window *win) { GList *found; @@ -57,12 +57,12 @@ static bool __exist_win(Evas_Object *win) return false; } -static void __add_win(Evas_Object *win) +static void __add_win(Ecore_Wl2_Window *win) { __win_list = g_list_append(__win_list, win); } -static void __remove_win(Evas_Object *win) +static void __remove_win(Ecore_Wl2_Window *win) { __win_list = g_list_remove(__win_list, win); } @@ -83,22 +83,21 @@ static void __scswl_prepare_cb( provider->callback.hide(provider, provider->user_data); } -API int frame_provider_create(Evas_Object *win, +API int frame_provider_create(Ecore_Wl2_Window *wl2_win, frame_provider_event_callback_s *callback, void *user_data, frame_provider_h *handle) { struct frame_provider_s *provider; - Ecore_Wl2_Window *wl2_win; int ret; - if (!win || !callback || !handle) { + if (!wl2_win || !callback || !handle) { _E("Invalid parameter"); return FRAME_PROVIDER_ERROR_INVALID_PARAMETER; } - if (__exist_win(win)) { - _E("Already exists. win(%p)", win); + if (__exist_win(wl2_win)) { + _E("Already exists. wl2_win(%p)", wl2_win); return FRAME_PROVIDER_ERROR_INVALID_PARAMETER; } @@ -108,7 +107,6 @@ API int frame_provider_create(Evas_Object *win, return FRAME_PROVIDER_ERROR_OUT_OF_MEMORY; } - wl2_win = (Ecore_Wl2_Window *)elm_win_wl_window_get(win); ret = screen_connector_shared_widget_launch_create(wl2_win, &provider->scswl); if (ret != 0) { @@ -120,11 +118,11 @@ API int frame_provider_create(Evas_Object *win, screen_connector_shared_widget_launch_prepare_cb_set(provider->scswl, __scswl_prepare_cb, provider); - provider->win = win; + provider->wl2_win = wl2_win; provider->callback = *callback; provider->user_data = user_data; - __add_win(win); + __add_win(wl2_win); *handle = provider; @@ -138,7 +136,7 @@ API int frame_provider_destroy(frame_provider_h handle) return FRAME_PROVIDER_ERROR_NONE; } - __remove_win(handle->win); + __remove_win(handle->wl2_win); screen_connector_shared_widget_launch_destroy(handle->scswl); free(handle); diff --git a/packaging/libwidget_viewer.spec b/packaging/libwidget_viewer.spec index 2cbba7c..f5437e1 100644 --- a/packaging/libwidget_viewer.spec +++ b/packaging/libwidget_viewer.spec @@ -37,7 +37,7 @@ BuildRequires: pkgconfig(wayland-tbm-client) BuildRequires: pkgconfig(screen_connector_watcher_evas) BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(gmock) -BuildRequires: pkgconfig(screen_connector_launcher_service_evas) +BuildRequires: pkgconfig(screen_connector_launcher_service) BuildRequires: pkgconfig(screen_connector_shared_widget_launch) %if 0%{?gcov:1} BuildRequires: lcov