From: Sung-jae Park Date: Tue, 25 Nov 2014 08:49:56 +0000 (+0900) Subject: Creating old package too X-Git-Tag: accepted/tizen/mobile/20150530.065423^2~18^2~8^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=886dbb27be30ff5d9cd196dc82bfc08fcdf5a6d1;p=apps%2Fnative%2Fwidget%2Fwidget.git Creating old package too [model] Redwood,Kiran,B3(Wearable) [binary_type] AP [customer] Docomo/Orange/ATT/Open [issue#] N/A [problem] [cause] [solution] [team] HomeTF [request] [horizontal_expansion] Change-Id: I0479dc906783764ca32787c117fc3e55717c3388 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 882af1f..6ee6fe4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,88 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(dynamicbox C) -SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -SET(EXEC_PREFIX "\${prefix}") -SET(PROJECT_NAME "${PROJECT_NAME}") -SET(LIBDIR "\${exec_prefix}/lib") -SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") -SET(VERSION_MAJOR 0) -SET(VERSION "${VERSION_MAJOR}.0.1") +ADD_SUBDIRECTORY(dynamicbox) +ADD_SUBDIRECTORY(livebox) -set(CMAKE_SKIP_BUILD_RPATH true) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED - dlog - dynamicbox_service - dynamicbox_provider - evas - ecore - elementary -) - -IF (X11_SUPPORT) -pkg_check_modules(pkgs_extra REQUIRED - x11 -) -ADD_DEFINITIONS("-DHAVE_X11") -SET(BUILD_SOURCE - src/virtual_window.c -) -ENDIF (X11_SUPPORT) - -IF (WAYLAND_SUPPORT) -ADD_DEFINITIONS("-DHAVE_WAYLAND") -SET(BUILD_SOURCE - src/virtual_window_wayland.c -) -ENDIF (WAYLAND_SUPPORT) - -FOREACH(flag ${pkgs_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -FOREACH(flag ${pkgs_extra_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g") - -ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") -ADD_DEFINITIONS("-DLOG_TAG=\"DYNAMICBOX\"") -ADD_DEFINITIONS("-DNDEBUG") -ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET") -ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"") -ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"com.samsung.data-provider-slave\"") -#ADD_DEFINITIONS("-D_ENABLE_PERF") - -SET (BUILD_SOURCE - ${BUILD_SOURCE} - src/dlist.c - src/util.c - src/dynamicbox.c - src/snapshot_window.c -) - -ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${pkgs_extra_LDFLAGS} "-lpthread") - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib) - -CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) -SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc") - -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/dynamicbox.h DESTINATION include/${PROJECT_NAME}) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/internal/dynamicbox.h DESTINATION include/${PROJECT_NAME}/internal) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}") - -ADD_SUBDIRECTORY(data) +ADD_DEPENDENCIES(livebox dynamicbox) diff --git a/TC/_export_env.sh b/TC/_export_env.sh deleted file mode 100644 index 7a317f8..0000000 --- a/TC/_export_env.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -source ./config - -export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path -#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware target path -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh deleted file mode 100644 index 3fd8e3f..0000000 --- a/TC/_export_target_env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -. ./config - -export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path -#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh deleted file mode 100755 index 72aad6c..0000000 --- a/TC/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -c -p ./ -tcc -b -j $JOURNAL_RESULT -p ./ -grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh deleted file mode 100644 index 29743e0..0000000 --- a/TC/clean.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -RESULT_DIR=results - -tcc -c -p ./ # executing tcc, with clean option (-c) -rm -r $RESULT_DIR -rm -r tet_tmp_dir -rm testcase/tet_captured diff --git a/TC/config b/TC/config deleted file mode 100644 index 099cbb3..0000000 --- a/TC/config +++ /dev/null @@ -1,3 +0,0 @@ -PKG_NAME=livebox -TET_INSTALL_HOST_PATH=/home/developer/private/$PKG_NAME/TC/TETware -TET_INSTALL_TARGET_PATH=/home/developer/private/$PKG_NAME/TC/TETware diff --git a/TC/push.sh b/TC/push.sh deleted file mode 100755 index 5eb9510..0000000 --- a/TC/push.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -. ./config - -TC_PATH=/opt/home/$PKG_NAME - -echo $TC_PATH - -sdb shell "mkdir -p $TC_PATH" - -sdb push . $TC_PATH - - diff --git a/TC/run.sh b/TC/run.sh deleted file mode 100755 index cec5778..0000000 --- a/TC/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -source ./_export_target_env.sh - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -e -j $JOURNAL_RESULT -p ./ -grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile deleted file mode 100644 index df6033d..0000000 --- a/TC/testcase/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -include ../config - -CC ?= gcc - -C_FILES = $(shell ls *.c) - -PKGS = $(PKG_NAME) -PKGS += glib-2.0 -PKGS += livebox-service -PKGS += evas -PKGS += ecore -PKGS += elementary -PKGS += dlog -#PKGS += provider -LDFLAGS = `pkg-config --libs $(PKGS)` -LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s - -CFLAGS = -I. `pkg-config --cflags $(PKGS)` -CFLAGS += -DTIZEN_ENGINEER_MODE -CFLAGS += -DTIZEN_DEBUG_ENABLE -CFLAGS += -I$(TET_ROOT)/inc/tet3 -CFLAGS += -Wall - -TCS := $(shell ls -1 *.c | cut -d. -f1) - -all: $(TCS) - -%: %.c - $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) - -clean: - rm -f $(TCS) diff --git a/TC/testcase/tslist b/TC/testcase/tslist deleted file mode 100644 index 2fc5b2e..0000000 --- a/TC/testcase/tslist +++ /dev/null @@ -1,2 +0,0 @@ -/testcase/utc_livebox - diff --git a/TC/testcase/utc_livebox.c b/TC/testcase/utc_livebox.c deleted file mode 100644 index ddca292..0000000 --- a/TC/testcase/utc_livebox.c +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include -#include - -#define LOG_TAG "LIVEBOX_TC" - -#include -#include -#include -#include - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -static void startup(void) -{ - /* start of TC */ - tet_printf("\n TC start"); -} - - -static void cleanup(void) -{ - /* end of TC */ - tet_printf("\n TC end"); -} - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -#define DUMMY_ID "/opt/usr/share/live_magazine/com.samsung.dummy.png" -#define DUMMY_INVALID_ID "/usr/share/live_magazine/com.samsung.dummy.png" -#define DUMMY_PKGNAME "com.samsung.dummy" - -static void utc_livebox_desc_open_n(void) -{ - LOGD(""); - struct livebox_desc *handle; - - handle = livebox_desc_open(DUMMY_INVALID_ID, 0); - if (handle) { - (void)livebox_desc_close(handle); - } - dts_check_eq("livebox_desc_open", handle, NULL, "Must return NULL in case of invalid id is used"); -} - -static void utc_livebox_desc_open_p(void) -{ - LOGD(""); - struct livebox_desc *handle; - - handle = livebox_desc_open(DUMMY_ID, 0); - dts_check_ne("livebox_desc_open", handle, NULL, "Must return valid handle"); -} - -static void utc_livebox_desc_close_n(void) -{ - LOGD(""); - int ret; - - ret = livebox_desc_close(NULL); - dts_check_eq("livebox_desc_close", ret, LB_STATUS_ERROR_INVALID, "Must returns LB_STATUS_ERROR_INVALID"); -} - -static void utc_livebox_desc_close_p(void) -{ - LOGD(""); - struct livebox_desc *handle; - int ret; - - handle = livebox_desc_open(DUMMY_ID, 0); - if (!handle) { - dts_check_ne("livebox_desc_close", handle, NULL, "Failed to create a handle"); - return; - } - - ret = livebox_desc_close(handle); - dts_check_eq("livebox_desc_close", ret, LB_STATUS_SUCCESS, "Must returns LB_STATUS_SUCCESS"); -} - -static void utc_livebox_desc_set_category_n(void) -{ - LOGD(""); - int ret; - ret = livebox_desc_set_category(NULL, NULL, NULL); - - dts_check_eq("livebox_desc_set_category", ret, LB_STATUS_ERROR_INVALID, "Invalid parameter used, LB_STATUS_ERROR_INVALID should be returned"); -} - -static void utc_livebox_desc_set_category_p(void) -{ - LOGD(""); - struct livebox_desc *handle; - int ret; - - handle = livebox_desc_open(DUMMY_ID, 0); - if (!handle) { - dts_check_ne("livebox_desc_set_category", handle, NULL, "Failed to create a handle"); - return; - } - - ret = livebox_desc_set_category(handle, NULL, "New Category"); - (void)livebox_desc_close(handle); - dts_check_eq("livebox_desc_set_category", ret, LB_STATUS_SUCCESS, "LB_STATUS_SUCCESS should be returned\n"); -} - -static void utc_livebox_desc_set_id_n(void) -{ - LOGD(""); - struct livebox_desc *handle; - int ret; - - handle = livebox_desc_open(DUMMY_ID, 0); - if (!handle) { - dts_check_ne("livebox_desc_set_id", handle, NULL, "Failed to create a handle"); - return; - } - ret = livebox_desc_set_id(handle, -1, NULL); - (void)livebox_desc_close(handle); - dts_check_eq("livebox_desc_set_id", ret, LB_STATUS_ERROR_NOT_EXIST, "LB_STATUS_ERROR_NOT_EXIST should be returned\n"); -} - -static void utc_livebox_desc_set_id_p(void) -{ - LOGD(""); - struct livebox_desc *handle; - int ret; - int idx; - - handle = livebox_desc_open(DUMMY_ID, 0); - if (!handle) { - dts_check_ne("livebox_desc_set_id", handle, NULL, "Failed to create a handle"); - return; - } - idx = livebox_desc_add_block(handle, NULL, LB_DESC_TYPE_SCRIPT, "swallow,part", "/usr/apps/com.samsung.test-app/res/edje/test.edj", "test,group"); - if (idx < 0) { - dts_check_ge("livebox_desc_set_id", idx, 0, "Failed to add a desc block"); - (void)livebox_desc_close(handle); - return; - } - - ret = livebox_desc_set_id(handle, idx, "new,id"); - (void)livebox_desc_close(handle); - dts_check_eq("livebox_desc_set_id", ret, LB_STATUS_SUCCESS, "LB_STATUS_SUCCESS should be returned\n"); -} - -static void utc_livebox_desc_add_block_n(void) -{ - LOGD(""); - int idx; - - idx = livebox_desc_add_block(NULL, NULL, LB_DESC_TYPE_SCRIPT, "swallow,part", "/usr/apps/com.samsung.test-app/res/edje/test.edj", "test,group"); - dts_check_eq("livebox_desc_add_block", idx, LB_STATUS_ERROR_INVALID, "LB_STATUS_ERROR_INVALID should be returned\n"); -} - -static void utc_livebox_desc_add_block_p(void) -{ - LOGD(""); - struct livebox_desc *handle; - int idx; - - handle = livebox_desc_open(DUMMY_ID, 0); - if (!handle) { - dts_check_ne("livebox_desc_add_block", handle, NULL, "Failed to create a handle"); - return; - } - - idx = livebox_desc_add_block(handle, NULL, LB_DESC_TYPE_SCRIPT, "swallow,part", "/usr/apps/com.samsung.test-app/res/edje/test.edj", "test,group"); - dts_check_ge("livebox_desc_add_block", idx, 0, "idx should not be less than 0\n"); - (void)livebox_desc_close(handle); -} - -static void utc_livebox_desc_del_block_n(void) -{ - LOGD(""); - struct livebox_desc *handle; - int ret; - - handle = livebox_desc_open(DUMMY_ID, 0); - if (!handle) { - dts_check_ne("livebox_desc_del_block", handle, NULL, "Failed to create a handle"); - return; - } - - ret = livebox_desc_del_block(handle, 0); - dts_check_eq("livebox_desc_del_block", ret, LB_STATUS_ERROR_NOT_EXIST, "Block is not found, LB_STATUS_ERROR_NOT_EXIST should be returned\n"); -} - -static void utc_livebox_desc_del_block_p(void) -{ - LOGD(""); - struct livebox_desc *handle; - int idx; - int ret; - - handle = livebox_desc_open(DUMMY_ID, 0); - if (handle == NULL) { - dts_check_ne("livebox_desc_del_block", handle, NULL, "Failed to create desc handle"); - return; - } - idx = livebox_desc_add_block(handle, NULL, LB_DESC_TYPE_SCRIPT, "swallow,part", "/usr/apps/com.samsung.test-app/res/edje/test.edj", "test,group"); - if (idx < 0) { - dts_check_ge("livebox_desc_del_block", idx, 0, "Failed to add a desc block"); - (void)livebox_desc_close(handle); - return; - } - ret = livebox_desc_del_block(handle, idx); - (void)livebox_desc_close(handle); - dts_check_eq("livebox_desc_del_block", ret, LB_STATUS_SUCCESS, "del_block should returns LB_STATUS_SUCCESS\n"); -} - -int livebox_trigger_update_monitor(const char *id, int is_pd) -{ - if (!id) { - return LB_STATUS_ERROR_INVALID; - } - - return LB_STATUS_SUCCESS; -} - -static void utc_livebox_content_is_updated_n(void) -{ - LOGD(""); - int ret; - - ret = livebox_content_is_updated(NULL, 0); - dts_check_eq("livebox_content_is_updated", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_content_is_updated_p(void) -{ - LOGD(""); - int ret; - ret = livebox_content_is_updated(DUMMY_ID, 0); - dts_check_eq("livebox_content_is_updated", ret, LB_STATUS_SUCCESS, "should returns LB_STATUS_SUCCESS\n"); -} - -static void utc_livebox_request_close_pd_n(void) -{ - LOGD(""); - int ret; - - ret = livebox_request_close_pd(DUMMY_PKGNAME, DUMMY_ID, LB_STATUS_SUCCESS); - dts_check_eq("livebox_request_close_pd", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_request_close_pd_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_request_close_pd", "pass negative test"); -} - -static void utc_livebox_request_update_n(void) -{ - LOGD(""); - int ret; - ret = livebox_request_update(NULL); - dts_check_eq("livebox_request_update", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID"); -} - -static void utc_livebox_request_update_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_request_update", "pass negative test"); -} - -static void utc_livebox_util_nl2br_n(void) -{ - LOGD(""); - char *nl2br; - - nl2br = livebox_util_nl2br(NULL); - dts_check_eq("livebox_util_nl2br", nl2br, NULL, "should returns NULL\n"); -} - -static void utc_livebox_util_nl2br_p(void) -{ - LOGD(""); - char *nl2br; - nl2br = livebox_util_nl2br("hello\nworld"); - LOGD("[%s]", nl2br); - dts_check_str_eq("livebox_util_nl2br", nl2br, "hello
world", "should returns \"hello
world\""); - LOGD(""); -} - -static void utc_livebox_acquire_buffer_n(void) -{ - LOGD(""); - struct livebox_buffer *handle; - - handle = livebox_acquire_buffer(NULL, 0, 720, 200, NULL, NULL); - dts_check_eq("livebox_acquire_buffer", handle, NULL, "should returns NULL\n"); -} - -static void utc_livebox_acquire_buffer_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_acquire_buffer", "pass positive test"); -} - -static void utc_livebox_acquire_buffer_NEW_n(void) -{ - LOGD(""); - struct livebox_buffer *handle; - - handle = livebox_acquire_buffer_NEW(NULL, 0, 720, 200, sizeof(int), NULL, NULL); - dts_check_eq("livebox_acquire_buffer_NEW", handle, NULL, "should returns NULL\n"); -} - -static void utc_livebox_acquire_buffer_NEW_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_acquire_buffer_NEW", "pass positive test"); -} - - -static void utc_livebox_pixmap_id_n(void) -{ - LOGD(""); - unsigned long pixmap; - - pixmap = livebox_pixmap_id(NULL); - dts_check_eq("livebox_pixmap_id", pixmap, 0, "should returns 0\n"); -} - -static void utc_livebox_pixmap_id_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_pixmap_id", "pass positive test"); -} - -static void utc_livebox_ref_buffer_n(void) -{ - LOGD(""); - void *ret; - ret = livebox_ref_buffer(NULL); - dts_check_eq("livebox_ref_buffer", ret, NULL, "should returns NULL\n"); -} - -static void utc_livebox_ref_buffer_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_ref_buffer", "pass positive test"); -} - -static void utc_livebox_sync_buffer_n(void) -{ - LOGD(""); - int ret; - ret = livebox_sync_buffer(NULL); - dts_check_eq("livebox_sync_buffer", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_sync_buffer_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_sync_buffer", "pass positive test"); -} - -static void utc_livebox_support_hw_buffer_n(void) -{ - LOGD(""); - int ret; - ret = livebox_support_hw_buffer(NULL); - dts_check_eq("livebox_support_hw_buffer", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_support_hw_buffer_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_support_hw_buffer", "pass positive test"); -} - -static void utc_livebox_create_hw_buffer_n(void) -{ - LOGD(""); - int ret; - ret = livebox_create_hw_buffer(NULL); - dts_check_eq("livebox_create_hw_buffer", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_create_hw_buffer_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_create_hw_buffer", "pass positive test"); -} - -static void utc_livebox_destroy_hw_buffer_n(void) -{ - LOGD(""); - int ret; - ret = livebox_destroy_hw_buffer(NULL); - dts_check_eq("livebox_destroy_hw_buffer", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_destroy_hw_buffer_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_destroy_hw_buffer", "pass positive test"); -} - -static void utc_livebox_buffer_hw_buffer_n(void) -{ - LOGD(""); - void *ret; - ret = livebox_buffer_hw_buffer(NULL); - dts_check_eq("livebox_buffer_hw_buffer", ret, NULL, "should returns LB_STATUS_ERROR_INVALID"); -} - -static void utc_livebox_buffer_hw_buffer_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_buffer_hw_buffer", "pass positive test"); -} - -static void utc_livebox_buffer_pre_render_n(void) -{ - LOGD(""); - int ret; - ret = livebox_buffer_pre_render(NULL); - dts_check_eq("livebox_buffer_pre_render", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_buffer_pre_render_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_buffer_pre_render", "pass positive test"); -} - -static void utc_livebox_buffer_post_render_n(void) -{ - LOGD(""); - int ret; - ret = livebox_buffer_post_render(NULL); - dts_check_eq("livebox_buffer_post_render", ret, LB_STATUS_ERROR_INVALID, "should returns LB_STATUS_ERROR_INVALID\n"); -} - -static void utc_livebox_buffer_post_render_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_buffer_post_render", "pass positive test"); -} - -static void utc_livebox_get_evas_object_n(void) -{ - LOGD(""); - Evas_Object *obj; - - obj = livebox_get_evas_object(NULL, 1); - dts_check_eq("livebox_get_evas_object", obj, NULL, "should returns NULL\n"); -} - -static void utc_livebox_get_evas_object_p(void) -{ - LOGD(""); - /*! - * \note - * Unable to test the positive case - */ - dts_pass("livebox_get_evas_object", "pass positve test"); -} - -struct tet_testlist tet_testlist[] = { - { utc_livebox_desc_open_n, NEGATIVE_TC_IDX }, - { utc_livebox_desc_open_p, POSITIVE_TC_IDX }, - { utc_livebox_desc_close_n, NEGATIVE_TC_IDX }, - { utc_livebox_desc_close_p, POSITIVE_TC_IDX }, - { utc_livebox_desc_set_category_n, NEGATIVE_TC_IDX }, - { utc_livebox_desc_set_category_p, POSITIVE_TC_IDX }, - { utc_livebox_desc_set_id_n, NEGATIVE_TC_IDX }, - { utc_livebox_desc_set_id_p, POSITIVE_TC_IDX }, - { utc_livebox_desc_add_block_n, NEGATIVE_TC_IDX }, - { utc_livebox_desc_add_block_p, POSITIVE_TC_IDX }, - { utc_livebox_desc_del_block_n, NEGATIVE_TC_IDX }, - { utc_livebox_desc_del_block_p, POSITIVE_TC_IDX }, - { utc_livebox_content_is_updated_n, NEGATIVE_TC_IDX }, - { utc_livebox_content_is_updated_p, POSITIVE_TC_IDX }, - { utc_livebox_request_close_pd_n, NEGATIVE_TC_IDX }, - { utc_livebox_request_close_pd_p, POSITIVE_TC_IDX }, - { utc_livebox_request_update_n, NEGATIVE_TC_IDX }, - { utc_livebox_request_update_p, POSITIVE_TC_IDX }, - { utc_livebox_util_nl2br_n, NEGATIVE_TC_IDX }, - { utc_livebox_util_nl2br_p, POSITIVE_TC_IDX }, - - { utc_livebox_acquire_buffer_n, NEGATIVE_TC_IDX }, - { utc_livebox_acquire_buffer_p, POSITIVE_TC_IDX }, - { utc_livebox_acquire_buffer_NEW_n, NEGATIVE_TC_IDX }, - { utc_livebox_acquire_buffer_NEW_p, POSITIVE_TC_IDX }, - - { utc_livebox_pixmap_id_n, NEGATIVE_TC_IDX }, - { utc_livebox_pixmap_id_p, POSITIVE_TC_IDX }, - - { utc_livebox_ref_buffer_n, NEGATIVE_TC_IDX }, - { utc_livebox_ref_buffer_p, POSITIVE_TC_IDX }, - - { utc_livebox_sync_buffer_n, NEGATIVE_TC_IDX }, - { utc_livebox_sync_buffer_p, POSITIVE_TC_IDX }, - - { utc_livebox_support_hw_buffer_n, NEGATIVE_TC_IDX }, - { utc_livebox_support_hw_buffer_p, POSITIVE_TC_IDX }, - { utc_livebox_create_hw_buffer_n, NEGATIVE_TC_IDX }, - { utc_livebox_create_hw_buffer_p, POSITIVE_TC_IDX }, - { utc_livebox_destroy_hw_buffer_n, NEGATIVE_TC_IDX }, - { utc_livebox_destroy_hw_buffer_p, POSITIVE_TC_IDX }, - { utc_livebox_buffer_hw_buffer_n, NEGATIVE_TC_IDX }, - { utc_livebox_buffer_hw_buffer_p, POSITIVE_TC_IDX }, - { utc_livebox_buffer_pre_render_n, NEGATIVE_TC_IDX }, - { utc_livebox_buffer_pre_render_p, POSITIVE_TC_IDX }, - { utc_livebox_buffer_post_render_n, NEGATIVE_TC_IDX }, - { utc_livebox_buffer_post_render_p, POSITIVE_TC_IDX }, - { utc_livebox_get_evas_object_n, NEGATIVE_TC_IDX }, - { utc_livebox_get_evas_object_p, POSITIVE_TC_IDX }, - - { NULL, 0 }, -}; - diff --git a/TC/tet_scen b/TC/tet_scen deleted file mode 100644 index 03f029a..0000000 --- a/TC/tet_scen +++ /dev/null @@ -1,7 +0,0 @@ -all - ^TEST -##### Scenarios for TEST ##### - -# Test scenario -TEST - :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg deleted file mode 100644 index f7eda55..0000000 --- a/TC/tetbuild.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option for build operation checking -TET_BUILD_TOOL=make # build with using make command -TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build -TET_API_COMPLIANT=True # use TET API in Test Case ? -TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg deleted file mode 100644 index 02d7030..0000000 --- a/TC/tetclean.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option -TET_CLEAN_TOOL= make clean # clean tool -TET_CLEAN_FILE= Makefile # file for clean -TET_API_COMPLIANT=True # TET API useage -TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg deleted file mode 100644 index ef3e452..0000000 --- a/TC/tetexec.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capturing execution or not -TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional -TET_EXEC_FILE= # ex) exectool : execution file/ Optional -TET_API_COMPLIANT=True # Test case or Tool usesTET API? -TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/dynamicbox/CMakeLists.txt b/dynamicbox/CMakeLists.txt new file mode 100644 index 0000000..48b5fb6 --- /dev/null +++ b/dynamicbox/CMakeLists.txt @@ -0,0 +1,88 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(dynamicbox C) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "\${prefix}") +SET(PROJECT_NAME "${PROJECT_NAME}") +SET(LIBDIR "\${exec_prefix}/lib") +SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") +SET(VERSION_MAJOR 1) +SET(VERSION "${VERSION_MAJOR}.0.0") + +set(CMAKE_SKIP_BUILD_RPATH true) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED + dlog + dynamicbox_service + dynamicbox_provider + evas + ecore + elementary +) + +IF (X11_SUPPORT) +pkg_check_modules(pkgs_extra REQUIRED + x11 +) +ADD_DEFINITIONS("-DHAVE_X11") +SET(BUILD_SOURCE + src/virtual_window.c +) +ENDIF (X11_SUPPORT) + +IF (WAYLAND_SUPPORT) +ADD_DEFINITIONS("-DHAVE_WAYLAND") +SET(BUILD_SOURCE + src/virtual_window_wayland.c +) +ENDIF (WAYLAND_SUPPORT) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +FOREACH(flag ${pkgs_extra_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g") + +ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") +ADD_DEFINITIONS("-DLOG_TAG=\"DYNAMICBOX\"") +ADD_DEFINITIONS("-DNDEBUG") +ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET") +ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"") +ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"com.samsung.data-provider-slave\"") +#ADD_DEFINITIONS("-D_ENABLE_PERF") + +SET (BUILD_SOURCE + ${BUILD_SOURCE} + src/dlist.c + src/util.c + src/dynamicbox.c + src/snapshot_window.c +) + +ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${pkgs_extra_LDFLAGS} "-lpthread") + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib) + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc") + +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/dynamicbox.h DESTINATION include/${PROJECT_NAME}) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/internal/dynamicbox.h DESTINATION include/${PROJECT_NAME}/internal) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}") + +ADD_SUBDIRECTORY(data) diff --git a/LICENSE b/dynamicbox/LICENSE similarity index 100% rename from LICENSE rename to dynamicbox/LICENSE diff --git a/data/CMakeLists.txt b/dynamicbox/data/CMakeLists.txt similarity index 100% rename from data/CMakeLists.txt rename to dynamicbox/data/CMakeLists.txt diff --git a/doc/dynamicbox_doc.h b/dynamicbox/doc/dynamicbox_doc.h similarity index 100% rename from doc/dynamicbox_doc.h rename to dynamicbox/doc/dynamicbox_doc.h diff --git a/dynamicbox.pc.in b/dynamicbox/dynamicbox.pc.in similarity index 100% rename from dynamicbox.pc.in rename to dynamicbox/dynamicbox.pc.in diff --git a/include/debug.h b/dynamicbox/include/debug.h similarity index 100% rename from include/debug.h rename to dynamicbox/include/debug.h diff --git a/include/dlist.h b/dynamicbox/include/dlist.h similarity index 100% rename from include/dlist.h rename to dynamicbox/include/dlist.h diff --git a/include/dynamicbox.h b/dynamicbox/include/dynamicbox.h similarity index 100% rename from include/dynamicbox.h rename to dynamicbox/include/dynamicbox.h diff --git a/include/internal/dynamicbox.h b/dynamicbox/include/internal/dynamicbox.h similarity index 100% rename from include/internal/dynamicbox.h rename to dynamicbox/include/internal/dynamicbox.h diff --git a/include/util.h b/dynamicbox/include/util.h similarity index 100% rename from include/util.h rename to dynamicbox/include/util.h diff --git a/dynamicbox/patch/pixmap_ee.patch b/dynamicbox/patch/pixmap_ee.patch new file mode 100644 index 0000000..8996ccb --- /dev/null +++ b/dynamicbox/patch/pixmap_ee.patch @@ -0,0 +1,128 @@ +diff --git a/src/virtual_window.c b/src/virtual_window.c +index 1c42a7c..7a487ff 100644 +--- a/src/virtual_window.c ++++ b/src/virtual_window.c +@@ -40,9 +40,14 @@ + static struct static_info { + Ecore_Evas *(*alloc_canvas)(int w, int h, void *(*a)(void *data, int size), void (*f)(void *data, void *ptr), void *data); + Ecore_Evas *(*alloc_canvas_with_stride)(int w, int h, void *(*a)(void *data, int size, int *stride, int *bpp), void (*f)(void *data, void *ptr), void *data); ++ Ecore_Evas *(*alloc_canvas_with_pixmap)(const char *disp_name, Ecore_X_Window parent, ++ int x, int y, int w, int h, ++ Ecore_X_Pixmap (*alloc_cb)(void *data, Ecore_X_Window parent, int w, int h, int *depth), ++ void (*free_cb)(void *data, Ecore_X_Pixmap pixmap), void *data); + } s_info = { + .alloc_canvas = NULL, + .alloc_canvas_with_stride = NULL, ++ .alloc_canvas_with_pixmap = NULL, + }; + + /*! +@@ -639,12 +644,70 @@ static void ecore_evas_free_cb(Ecore_Evas *ee) + info->ee = NULL; + } + ++/** ++ * @note ++ * This callback can be called twice (or more) to get a several pixmaps ++ * Acquired pixmaps are used for double/tripple buffering for canvas ++ */ ++static Ecore_X_Pixmap alloc_pixmap_cb(void *data, Ecore_X_Window parent, int w, int h, int *depth) ++{ ++ struct info *info = data; ++ ++ if (info->ee) { ++ ecore_evas_geometry_get(info->ee, NULL, NULL, &info->w, &info->h); ++ DbgPrint("Size of ee is updated: %dx%d (info: %p)\n", info->w, info->h, info); ++ } ++ ++ /*! ++ * Acquire a buffer for canvas. ++ */ ++ info->handle = dynamicbox_acquire_buffer(info->id, info->is_gbar, ++ info->w, info->h, sizeof(int), 0, ++ event_handler_cb, info); ++ if (!info->handle) { ++ ErrPrint("Failed to get the buffer\n"); ++ return 0u; ++ } ++ ++ info->is_hw = 0; ++ return (Ecore_X_Pixmap)dynamicbox_resource_id(info->handle); ++} ++ ++static void free_pixmap_cb(void *data, Ecore_X_Pixmap pixmap) ++{ ++ struct info *info = data; ++ ++ if (!info->handle) { ++ return; ++ } ++ ++ if (info->is_hw) { ++ ErrPrint("Impossible\n"); ++ } ++ ++ dynamicbox_release_buffer(info->handle); ++ info->handle = NULL; ++ ++ if (info->deleted) { ++ free(info->id); ++ info->id = NULL; ++ ++ free(info); ++ } ++} ++ + PUBLIC Evas_Object *dynamicbox_get_evas_object(const char *id, int is_pd) + { + struct info *info; + Evas_Object *rect; ++ const char *engine; ++ ++ if (!s_info.alloc_canvas && !s_info.alloc_canvas_with_stride && !s_info.alloc_canvas_with_pixmap) { ++ s_info.alloc_canvas_with_pixmap = dlsym(RTLD_DEFAULT, "ecore_evas_gl_x11_pixmap_allocfunc_new"); ++ if (!s_info.alloc_canvas_with_pixmap) { ++ DbgPrint("pixmap_allocfunc_new is not found\n"); ++ } + +- if (!s_info.alloc_canvas && !s_info.alloc_canvas_with_stride) { + s_info.alloc_canvas_with_stride = dlsym(RTLD_DEFAULT, "ecore_evas_buffer_allocfunc_with_stride_new"); + if (!s_info.alloc_canvas_with_stride) { + DbgPrint("allocfunc_with_stirde_new is not found\n"); +@@ -655,7 +718,7 @@ PUBLIC Evas_Object *dynamicbox_get_evas_object(const char *id, int is_pd) + ErrPrint("allocfunc_new is not found\n"); + } + +- if (!s_info.alloc_canvas_with_stride && !s_info.alloc_canvas) { ++ if (!s_info.alloc_canvas_with_stride && !s_info.alloc_canvas && !s_info.alloc_canvas_with_pixmap) { + ErrPrint("No way to allocate canvas\n"); + return NULL; + } +@@ -687,10 +750,23 @@ PUBLIC Evas_Object *dynamicbox_get_evas_object(const char *id, int is_pd) + info->w = 1; + info->h = 1; + +- if (!dynamicbox_conf_auto_align() && s_info.alloc_canvas_with_stride) { +- info->ee = s_info.alloc_canvas_with_stride(1, 1, alloc_stride_fb, free_fb, info); +- } else { +- info->ee = s_info.alloc_canvas(1, 1, alloc_fb, free_fb, info); ++ engine = elm_config_preferred_engine_get(); ++ DbgPrint("Preferred engine: %s\n", engine); ++ if (engine && !strcmp(engine, "opengl_x11")) { ++ if (s_info.alloc_canvas_with_pixmap) { ++ info->ee = s_info.alloc_canvas_with_pixmap(NULL, 0u, 0, 0, 1, 1, alloc_pixmap_cb, free_pixmap_cb, info); ++ } ++ } ++ ++ if (!info->ee) { ++ /** ++ * Fallback to buffer backend ++ */ ++ if (!dynamicbox_conf_auto_align() && s_info.alloc_canvas_with_stride) { ++ info->ee = s_info.alloc_canvas_with_stride(1, 1, alloc_stride_fb, free_fb, info); ++ } else { ++ info->ee = s_info.alloc_canvas(1, 1, alloc_fb, free_fb, info); ++ } + } + + if (!info->ee) { diff --git a/dynamicbox/patch/pixmap_ee_dbox.patch b/dynamicbox/patch/pixmap_ee_dbox.patch new file mode 100644 index 0000000..93aeacb --- /dev/null +++ b/dynamicbox/patch/pixmap_ee_dbox.patch @@ -0,0 +1,125 @@ +diff --git a/src/virtual_window.c b/src/virtual_window.c +index 4f482ff..0e39eda 100644 +--- a/src/virtual_window.c ++++ b/src/virtual_window.c +@@ -41,9 +41,11 @@ + static struct static_info { + Ecore_Evas *(*alloc_canvas)(int w, int h, void *(*a)(void *data, int size), void (*f)(void *data, void *ptr), void *data); + Ecore_Evas *(*alloc_canvas_with_stride)(int w, int h, void *(*a)(void *data, int size, int *stride, int *bpp), void (*f)(void *data, void *ptr), void *data); ++ Ecore_Evas *(*alloc_canvas_with_pixmap)(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, Ecore_X_Pixmap (*alloc_cb)(void *data, Ecore_X_Window parent, int w, int h, int *depth), void (*free_cb)(void *data, Ecore_X_Pixmap pixmap), void *data); + } s_info = { + .alloc_canvas = NULL, + .alloc_canvas_with_stride = NULL, ++ .alloc_canvas_with_pixmap = NULL, + }; + + /** +@@ -486,6 +488,58 @@ static int event_handler_cb(struct dynamicbox_buffer *handler, struct dynamicbox + return ret; + } + ++/** ++ * @note ++ * This callback can be called twice (or more) to get a several pixmaps ++ * Acquired pixmaps are used for double/tripple buffering for canvas ++ */ ++static Ecore_X_Pixmap alloc_pixmap_cb(void *data, Ecore_X_Window parent, int w, int h, int *depth) ++{ ++ struct info *info = data; ++ ++ if (info->ee) { ++ ecore_evas_geometry_get(info->ee, NULL, NULL, &info->w, &info->h); ++ DbgPrint("Size of ee is updated: %dx%d (info: %p)\n", info->w, info->h, info); ++ } ++ ++ /*! ++ * Acquire a buffer for canvas. ++ */ ++ info->handle = dynamicbox_acquire_buffer(info->id, info->is_gbar, ++ info->w, info->h, sizeof(int), 0, ++ event_handler_cb, info); ++ if (!info->handle) { ++ ErrPrint("Failed to get the buffer\n"); ++ return 0u; ++ } ++ ++ info->is_hw = 0; ++ return (Ecore_X_Pixmap)dynamicbox_resource_id(info->handle); ++} ++ ++static void free_pixmap_cb(void *data, Ecore_X_Pixmap pixmap) ++{ ++ struct info *info = data; ++ ++ if (!info->handle) { ++ return; ++ } ++ ++ if (info->is_hw) { ++ ErrPrint("Impossible\n"); ++ } ++ ++ dynamicbox_release_buffer(info->handle); ++ info->handle = NULL; ++ ++ if (info->deleted) { ++ free(info->id); ++ info->id = NULL; ++ ++ free(info); ++ } ++} ++ + static void *alloc_fb(void *data, int size) + { + struct info *info = data; +@@ -654,8 +708,14 @@ PUBLIC void *dynamicbox_get_evas_object(const char *id, int is_gbar) + { + struct info *info; + Evas_Object *rect; ++ const char *engine; ++ ++ if (!s_info.alloc_canvas && !s_info.alloc_canvas_with_stride && !s_info.alloc_canvas_with_pixmap) { ++ s_info.alloc_canvas_with_pixmap = dlsym(RTLD_DEFAULT, "ecore_evas_gl_x11_pixmap_allocfunc_new"); ++ if (!s_info.alloc_canvas_with_pixmap) { ++ DbgPrint("pixmap_allocfunc_new is not found\n"); ++ } + +- if (!s_info.alloc_canvas && !s_info.alloc_canvas_with_stride) { + s_info.alloc_canvas_with_stride = dlsym(RTLD_DEFAULT, "ecore_evas_buffer_allocfunc_with_stride_new"); + if (!s_info.alloc_canvas_with_stride) { + DbgPrint("allocfunc_with_stirde_new is not found\n"); +@@ -666,7 +726,7 @@ PUBLIC void *dynamicbox_get_evas_object(const char *id, int is_gbar) + ErrPrint("allocfunc_new is not found\n"); + } + +- if (!s_info.alloc_canvas_with_stride && !s_info.alloc_canvas) { ++ if (!s_info.alloc_canvas_with_stride && !s_info.alloc_canvas && !s_info.alloc_canvas_with_pixmap) { + ErrPrint("No way to allocate canvas\n"); + return NULL; + } +@@ -698,10 +758,20 @@ PUBLIC void *dynamicbox_get_evas_object(const char *id, int is_gbar) + info->w = 1; + info->h = 1; + +- if (!dynamicbox_conf_auto_align() && s_info.alloc_canvas_with_stride) { +- info->ee = s_info.alloc_canvas_with_stride(1, 1, alloc_stride_fb, free_fb, info); +- } else if (s_info.alloc_canvas) { +- info->ee = s_info.alloc_canvas(1, 1, alloc_fb, free_fb, info); ++ engine = elm_config_preferred_engine_get(); ++ DbgPrint("Preferred engine: %s\n", engine); ++ if (engine && !strcmp(engine, "opengl_x11")) { ++ if (s_info.alloc_canvas_with_pixmap) { ++ info->ee = s_info.alloc_canvas_with_pixmap(NULL, 0u, 0, 0, 1, 1, alloc_pixmap_cb, free_pixmap_cb, info); ++ } ++ } ++ ++ if (!info->ee) { ++ if (!dynamicbox_conf_auto_align() && s_info.alloc_canvas_with_stride) { ++ info->ee = s_info.alloc_canvas_with_stride(1, 1, alloc_stride_fb, free_fb, info); ++ } else if (s_info.alloc_canvas) { ++ info->ee = s_info.alloc_canvas(1, 1, alloc_fb, free_fb, info); ++ } + } + + if (!info->ee) { diff --git a/src/dlist.c b/dynamicbox/src/dlist.c similarity index 100% rename from src/dlist.c rename to dynamicbox/src/dlist.c diff --git a/src/dynamicbox.c b/dynamicbox/src/dynamicbox.c similarity index 100% rename from src/dynamicbox.c rename to dynamicbox/src/dynamicbox.c diff --git a/src/snapshot_window.c b/dynamicbox/src/snapshot_window.c similarity index 100% rename from src/snapshot_window.c rename to dynamicbox/src/snapshot_window.c diff --git a/src/util.c b/dynamicbox/src/util.c similarity index 100% rename from src/util.c rename to dynamicbox/src/util.c diff --git a/src/virtual_window.c b/dynamicbox/src/virtual_window.c similarity index 100% rename from src/virtual_window.c rename to dynamicbox/src/virtual_window.c diff --git a/dynamicbox/src/virtual_window.c.orig b/dynamicbox/src/virtual_window.c.orig new file mode 100644 index 0000000..bd60bd5 --- /dev/null +++ b/dynamicbox/src/virtual_window.c.orig @@ -0,0 +1,1010 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "dynamicbox.h" +#include "debug.h" + +#define IS_GBAR 1 + +#define PUBLIC __attribute__((visibility("default"))) +#define DBOX_WIN_TAG "dynamic,box,win" + +#define DBOX_DEFAULT_WIDTH 1 +#define DBOX_DEFAULT_HEIGHT 1 +#define GL_ENGINE "opengl_x11" + +static struct static_info { + Ecore_Evas *(*alloc_canvas)(int w, int h, void *(*a)(void *data, int size), void (*f)(void *data, void *ptr), void *data); + Ecore_Evas *(*alloc_canvas_with_stride)(int w, int h, void *(*a)(void *data, int size, int *stride, int *bpp), void (*f)(void *data, void *ptr), void *data); + Ecore_Evas *(*alloc_canvas_with_pixmap)(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, Ecore_X_Pixmap (*alloc_cb)(void *data, Ecore_X_Window parent, int w, int h, int depth), void (*free_cb)(void *data, Ecore_X_Pixmap pixmap), void *data); +} s_info = { + .alloc_canvas = NULL, + .alloc_canvas_with_stride = NULL, + .alloc_canvas_with_pixmap = NULL, +}; + +/** + * @brief + * Abstracted Data Type of Virtual Window + */ +typedef struct virtual_window_info { + char *id; /**< Identification */ + dynamicbox_buffer_h handle; /**< Livebox buffer handle */ + enum win_type { + VWIN_SW_BUF = 0x00, /**< S/W buffer */ + VWIN_GEM = 0x01, /**< GEM buffer */ + VWIN_PIXMAP = 0x02, /**< PIXMAP */ + VWIN_ERROR = 0x03 /**< Unknown */ + } type; + Ecore_Evas *ee; + Evas *e; + int is_gbar; + int deleted; + int w; + int h; + unsigned int *resource_array; + int resource_cnt; + + unsigned int front_resource_id; + + int pressed; +} *vwin_info_t; + +static inline Evas_Object *get_highlighted_object(Evas_Object *obj) +{ + Evas_Object *o, *ho; + + o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); + if (!o) return NULL; + + ho = evas_object_data_get(o, "_elm_access_target"); + return ho; +} + +/** + * @note + * Every user event (mouse) on the buffer will be passed via this event callback + */ +static int event_handler_cb(dynamicbox_buffer_h handler, struct dynamicbox_buffer_event_data *event_info, void *data) +{ + vwin_info_t info = data; + Elm_Access_Action_Info action_info; + Elm_Access_Action_Type action_type; + int ret = 0; + Evas_Object *parent_elm; + KeySym *key_symbol; + unsigned int flags = 0; + double timestamp; + + if (!info->handle) { + /* Just ignore this event */ + return 0; + } + + if (DYNAMICBOX_CONF_USE_GETTIMEOFDAY) { + if (DYNAMICBOX_CONF_EVENT_FILTER > 0.0f && (info->pressed == 0 || event_info->type == DBOX_BUFFER_EVENT_MOVE)) { + struct timeval tv; + + if (gettimeofday(&tv, NULL) < 0) { + ErrPrint("gettimeofday: %s\n", strerror(errno)); + } else { + timestamp = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f; + timestamp -= event_info->timestamp; + + if (timestamp > DYNAMICBOX_CONF_EVENT_FILTER) { + DbgPrint("Dropped %lf\n", timestamp); + return 0; + } + } + } + + /** + * If the device doesn't use the clock monotic time, we have to emulate it for EVAS + * Evas only use the monotic time for animating objects + */ + timestamp = ecore_time_get() * 1000.0f; + } else { + if (DYNAMICBOX_CONF_EVENT_FILTER > 0.0f && (info->pressed == 0 || event_info->type == DBOX_BUFFER_EVENT_MOVE)) { + timestamp = ecore_time_get(); + + timestamp -= event_info->timestamp; + if (timestamp > DYNAMICBOX_CONF_EVENT_FILTER) { + DbgPrint("Dropped %lf\n", timestamp); + return 0; + } + } + + timestamp = event_info->timestamp * 1000.0f; + } + + /** + * @note + * Feed up events + */ + switch (event_info->type) { + case DBOX_BUFFER_EVENT_ON_HOLD: + flags = evas_event_default_flags_get(info->e); + flags |= EVAS_EVENT_FLAG_ON_HOLD; + evas_event_default_flags_set(info->e, flags); + break; + case DBOX_BUFFER_EVENT_OFF_HOLD: + flags = evas_event_default_flags_get(info->e); + flags &= ~EVAS_EVENT_FLAG_ON_HOLD; + evas_event_default_flags_set(info->e, flags); + break; + case DBOX_BUFFER_EVENT_ON_SCROLL: + flags = evas_event_default_flags_get(info->e); + flags |= EVAS_EVENT_FLAG_ON_SCROLL; + evas_event_default_flags_set(info->e, flags); + break; + case DBOX_BUFFER_EVENT_OFF_SCROLL: + flags = evas_event_default_flags_get(info->e); + flags &= ~EVAS_EVENT_FLAG_ON_SCROLL; + evas_event_default_flags_set(info->e, flags); + break; + case DBOX_BUFFER_EVENT_ENTER: + evas_event_feed_mouse_in(info->e, timestamp, NULL); + break; + case DBOX_BUFFER_EVENT_LEAVE: + evas_event_feed_mouse_out(info->e, timestamp, NULL); + break; + case DBOX_BUFFER_EVENT_DOWN: + /** + * @note + * Before processing the DOWN event, + * Reset the evas event flags regarding ON_HOLD option. + * It can be re-enabled while processing down-move-up events. + */ + flags = evas_event_default_flags_get(info->e); + flags &= ~EVAS_EVENT_FLAG_ON_SCROLL; + flags &= ~EVAS_EVENT_FLAG_ON_HOLD; + evas_event_default_flags_set(info->e, flags); + /** + * @note + * Calculate the event occurred X & Y on the buffer + */ + evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL); + evas_event_feed_mouse_down(info->e, 1, EVAS_BUTTON_NONE, timestamp, NULL); /* + 0.2f just for fake event */ + info->pressed = 1; + break; + case DBOX_BUFFER_EVENT_MOVE: + /** + * @note + * Calculate the event occurred X & Y on the buffer + */ + evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL); + break; + case DBOX_BUFFER_EVENT_UP: + evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL); + evas_event_feed_mouse_up(info->e, 1, EVAS_BUTTON_NONE, timestamp, NULL); + info->pressed = 0; + /** + * @note + * We have to keep the event flags, so we should not clear them from here. + * Sometimes, asynchronously callable Callbacks can refer the evas event flags after up event. + * so if we reset them from here, those kind of callbacks will fails to do their job properly. + */ + break; + case DBOX_BUFFER_EVENT_ACCESS_HIGHLIGHT: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_HIGHLIGHT; + /** + * @note + * Calculate the event occurred X & Y on the buffer + */ + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + ret = elm_access_action(parent_elm, action_type, &action_info); + if (ret == EINA_TRUE) { + if (!get_highlighted_object(parent_elm)) { + ErrPrint("Highlighted object is not found\n"); + ret = DBOX_ACCESS_STATUS_ERROR; + } else { + DbgPrint("Highlighted object is found\n"); + ret = DBOX_ACCESS_STATUS_DONE; + } + } else { + ErrPrint("Action error\n"); + ret = DBOX_ACCESS_STATUS_ERROR; + } + break; + case DBOX_BUFFER_EVENT_ACCESS_HIGHLIGHT_NEXT: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT; + action_info.highlight_cycle = EINA_FALSE; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_LAST : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_HIGHLIGHT_PREV: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV; + action_info.highlight_cycle = EINA_FALSE; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_FIRST : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_ACTIVATE: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_ACTIVATE; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_ACTION_UP: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_UP; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_ACTION_DOWN: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_DOWN; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_SCROLL_UP: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_SCROLL; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_SCROLL_MOVE: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_SCROLL; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_SCROLL_DOWN: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_SCROLL; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_UNHIGHLIGHT: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_VALUE_CHANGE: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_VALUE_CHANGE; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_MOUSE: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_MOUSE; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_BACK: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_BACK; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_OVER: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_OVER; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_READ: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_READ; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_ENABLE: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_ENABLE; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_ACCESS_DISABLE: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + memset(&action_info, 0, sizeof(action_info)); + action_type = ELM_ACCESS_ACTION_DISABLE; + action_info.x = event_info->info.access.x; + action_info.y = event_info->info.access.y; + action_info.mouse_type = event_info->info.access.mouse_type; + ret = elm_access_action(parent_elm, action_type, &action_info); + ret = (ret == EINA_FALSE) ? DBOX_ACCESS_STATUS_ERROR : DBOX_ACCESS_STATUS_DONE; + break; + case DBOX_BUFFER_EVENT_KEY_DOWN: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + + key_symbol = XGetKeyboardMapping(ecore_x_display_get(), event_info->info.keycode, 1, &ret); + if (key_symbol) { + char *key_name; + char *key_string; + + key_string = XKeysymToString(*key_symbol); + key_name = XKeysymToString(*key_symbol); + DbgPrint("Key symbol: %s, name: %s\n", key_string, key_name); + XFree(key_symbol); + XFree(key_name); + XFree(key_string); + } + ret = DBOX_KEY_STATUS_ERROR; + break; + case DBOX_BUFFER_EVENT_KEY_UP: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + + key_symbol = XGetKeyboardMapping(ecore_x_display_get(), event_info->info.keycode, 1, &ret); + if (key_symbol) { + char *key_name; + char *key_string; + + key_string = XKeysymToString(*key_symbol); + key_name = XKeysymToString(*key_symbol); + DbgPrint("Key symbol: %s, name: %s\n", key_string, key_name); + XFree(key_symbol); + XFree(key_name); + XFree(key_string); + } + ret = DBOX_KEY_STATUS_ERROR; + break; + case DBOX_BUFFER_EVENT_KEY_FOCUS_IN: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + + key_symbol = XGetKeyboardMapping(ecore_x_display_get(), event_info->info.keycode, 1, &ret); + if (key_symbol) { + char *key_name; + char *key_string; + + key_string = XKeysymToString(*key_symbol); + key_name = XKeysymToString(*key_symbol); + DbgPrint("Key symbol: %s, name: %s\n", key_string, key_name); + XFree(key_symbol); + XFree(key_name); + XFree(key_string); + } + ret = DBOX_KEY_STATUS_ERROR; + break; + case DBOX_BUFFER_EVENT_KEY_FOCUS_OUT: + parent_elm = ecore_evas_data_get(info->ee, DBOX_WIN_TAG); + if (!parent_elm) { + ret = DBOX_ACCESS_STATUS_ERROR; + break; + } + + key_symbol = XGetKeyboardMapping(ecore_x_display_get(), event_info->info.keycode, 1, &ret); + if (key_symbol) { + char *key_name; + char *key_string; + + key_string = XKeysymToString(*key_symbol); + key_name = XKeysymToString(*key_symbol); + DbgPrint("Key symbol: %s, name: %s\n", key_string, key_name); + XFree(key_symbol); + XFree(key_name); + XFree(key_string); + } + ret = DBOX_KEY_STATUS_ERROR; + break; + default: + DbgPrint("Unhandled buffer event (%d)\n", event_info->type); + break; + } + + return ret; +} + +/** + * @note + * This callback can be called twice (or more) to get a several pixmaps + * Acquired pixmaps are used for double/tripple buffering for canvas + */ +static Ecore_X_Pixmap alloc_pixmap_cb(void *data, Ecore_X_Window parent, int w, int h, int depth) +{ + vwin_info_t info = data; + Ecore_X_Pixmap pixmap; + + if (!info->handle) { + ErrPrint("Invalid handle\n"); + return 0u; + } + + info->w = w; + info->h = h; + DbgPrint("Size of ee is updated: %dx%d - %d (info: %p)\n", info->w, info->h, depth, info); + depth >>= 3; + + if (dynamicbox_resource_id(info->handle, DBOX_PRIMARY_BUFFER) == 0u) { + /** + * @note + * Need to allocate a primary buffer + */ + dynamicbox_acquire_buffer(info->handle, DBOX_PRIMARY_BUFFER, info->w, info->h, depth); + if (!info->handle) { + ErrPrint("Failed to get the buffer\n"); + return 0u; + } + + pixmap = (Ecore_X_Pixmap)dynamicbox_resource_id(info->handle, DBOX_PRIMARY_BUFFER); + } else if (DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT > 0) { + int idx; + + if (!info->resource_array) { + info->resource_array = calloc(DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT, sizeof(*info->resource_array)); + if (!info->resource_array) { + ErrPrint("Out of memory: %s\n", strerror(errno)); + return 0u; + } + + idx = 0; + } else { + for (idx = 0; idx < DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT; idx++) { + if (info->resource_array[idx] == 0u) { + break; + } + } + + if (idx == DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT) { + ErrPrint("Out of index: %d\n", idx); + return 0u; + } + } + + if (dynamicbox_acquire_buffer(info->handle, idx, info->w, info->h, depth) < 0) { + ErrPrint("Failed to acquire a buffer for %d\n", idx); + return 0u; + } + + info->resource_array[idx] = dynamicbox_resource_id(info->handle, idx); + if (info->resource_array[idx] == 0u) { + ErrPrint("Failed to allocate pixmap\n"); + } + + DbgPrint("Allocated index: %d/%d - %u\n", idx, DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT, info->resource_array[idx]); + pixmap = info->resource_array[idx]; + } else { + ErrPrint("Unable to allocate pixmap\n"); + pixmap = 0u; + } + + /** + * Acquire a buffer for canvas. + */ + info->type = VWIN_PIXMAP; + info->resource_cnt += !!(unsigned int)pixmap; + return pixmap; +} + +static void free_pixmap_cb(void *data, Ecore_X_Pixmap pixmap) +{ + vwin_info_t info = data; + + if (!info->handle) { + return; + } + + if (info->type != VWIN_PIXMAP) { + ErrPrint("Impossible\n"); + } + + if (dynamicbox_resource_id(info->handle, DBOX_PRIMARY_BUFFER) == pixmap) { + if (dynamicbox_release_buffer(info->handle, DBOX_PRIMARY_BUFFER) < 0) { + DbgPrint("Failed to release buffer\n"); + } + info->resource_cnt--; + } else { + int idx; + + for (idx = 0; idx < DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT; idx++) { + /** + * @note + * Find a index to release it + */ + if (info->resource_array[idx] == pixmap) { + if (dynamicbox_release_buffer(info->handle, idx) < 0) { + DbgPrint("Failed to release buffer\n"); + } + info->resource_array[idx] = 0u; + info->resource_cnt--; + break; + } + } + } + + if (info->deleted && info->resource_cnt == 0) { + DbgPrint("Destroy buffer handle\n"); + + dynamicbox_destroy_buffer(info->handle); + free(info->resource_array); + free(info->id); + free(info); + } +} + +static void *alloc_fb(void *data, int size) +{ + vwin_info_t info = data; + void *buffer; + + if (info->ee) { + ecore_evas_geometry_get(info->ee, NULL, NULL, &info->w, &info->h); + DbgPrint("Size of ee is updated: %dx%d (info: %p)\n", info->w, info->h, info); + } + + if (!info->handle) { + ErrPrint("Failed to create a buffer\n"); + return NULL; + } + + if (dynamicbox_acquire_buffer(info->handle, DBOX_PRIMARY_BUFFER, info->w, info->h, sizeof(int)) < 0) { + ErrPrint("Failed to acquire buffer\n"); + return NULL; + } + + /** + * If it supports the H/W accelerated buffer, + * Use it. + */ + if (dynamicbox_support_hw_buffer(info->handle)) { + if (dynamicbox_create_hw_buffer(info->handle) == 0) { + buffer = dynamicbox_buffer_hw_buffer(info->handle); + if (buffer) { + DbgPrint("HW Accelerated buffer is created %p, (%dx%d)\n", info, info->w, info->h); + info->type = VWIN_GEM; + return buffer; + } + } + + ErrPrint("Failed to allocate HW Accelerated buffer\n"); + } + + /** + * Or use the buffer of a S/W backend. + */ + buffer = dynamicbox_ref_buffer(info->handle); + DbgPrint("SW buffer is created (%dx%d)\n", info->w, info->h); + info->type = VWIN_SW_BUF; + return buffer; +} + +static void *alloc_stride_fb(void *data, int size, int *stride, int *bpp) +{ + void *buffer; + + buffer = alloc_fb(data, size); + if (buffer) { + vwin_info_t info = data; + int _stride; + + *bpp = sizeof(int); + _stride = dynamicbox_buffer_stride(info->handle); + if (_stride < 0) { + _stride = info->w * *bpp; + } + + *stride = _stride; + *bpp <<= 3; + DbgPrint("bpp: %d, stride: %d\n", *bpp, *stride); + } + + return buffer; +} + +static void free_fb(void *data, void *ptr) +{ + vwin_info_t info = data; + + if (!info->handle) { + return; + } + + if (info->type == VWIN_GEM) { + if (dynamicbox_destroy_hw_buffer(info->handle) == 0) { + DbgPrint("HW Accelerated buffer is destroyed\n"); + } + } else if (info->type == VWIN_SW_BUF) { + DbgPrint("SW buffer is destroyed, %p\n", info); + dynamicbox_unref_buffer(ptr); + } else if (info->type == VWIN_PIXMAP) { + ErrPrint("Unable to reach to here\n"); + } + + if (dynamicbox_release_buffer(info->handle, DBOX_PRIMARY_BUFFER) < 0) { + ErrPrint("Failed to release buffer\n"); + } + + if (info->deleted) { + dynamicbox_destroy_buffer(info->handle); + free(info->resource_array); + free(info->id); + free(info); + } +} + +static void pre_render_cb(void *data, Evas *e, void *event_info) +{ + vwin_info_t info = data; + + if (!info->handle) { + return; + } + + if (dynamicbox_conf_premultiplied_alpha()) { + Evas_Coord w; + Evas_Coord h; + + ecore_evas_geometry_get(info->ee, NULL, NULL, &w, &h); + evas_damage_rectangle_add(e, 0, 0, w, h); + } + + if (info->type == VWIN_GEM) { + dynamicbox_buffer_pre_render(info->handle); + } else if (info->type == VWIN_PIXMAP) { + /** + * Only the pixmap type Ecore_Evas uses this variable + */ + info->front_resource_id = ecore_evas_gl_x11_pixmap_get(info->ee); + } else if (info->type == VWIN_SW_BUF) { + /* Do nothing */ + } +} + +static void post_render_cb(void *data, Evas *e, void *event_info) +{ + vwin_info_t info = data; + + if (!info->handle) { + return; + } + + if (dynamicbox_conf_premultiplied_alpha()) { + void *canvas; + int x, y, w, h; + + // Get a pointer of a buffer of the virtual canvas + canvas = (void *)ecore_evas_buffer_pixels_get(info->ee); + if (!canvas) { + ErrPrint("Failed to get pixel canvas\n"); + return; + } + + ecore_evas_geometry_get(info->ee, &x, &y, &w, &h); + evas_data_argb_unpremul(canvas, w * h); + } + + if (info->type == VWIN_GEM) { + dynamicbox_buffer_post_render(info->handle); + } else if (info->type == VWIN_PIXMAP) { + int idx; + + for (idx = 0; idx < DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT; idx++) { + if (info->front_resource_id == info->resource_array[idx]) { + /** + */ + dynamicbox_send_updated_by_idx(info->handle, idx); + break; + } + } + + if (idx == DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT) { + /* Send updated event for PRIMARY BUFFER */ + if (info->front_resource_id == dynamicbox_resource_id(info->handle, DBOX_PRIMARY_BUFFER)) { + dynamicbox_send_updated_by_idx(info->handle, DBOX_PRIMARY_BUFFER); + } else { + DbgPrint("Unable to send updated: %u (%u)\n", info->front_resource_id, dynamicbox_resource_id(info->handle, DBOX_PRIMARY_BUFFER)); + } + } + } else if (info->type == VWIN_SW_BUF) { + dynamicbox_sync_buffer(info->handle); + } +} + +static void ecore_evas_free_cb(Ecore_Evas *ee) +{ + vwin_info_t info; + + info = ecore_evas_data_get(ee, "dynamic,box,info"); + if (!info) { + DbgPrint("Info is not valid\n"); + return; + } + + if (info->e) { + evas_event_callback_del(info->e, EVAS_CALLBACK_RENDER_POST, post_render_cb); + evas_event_callback_del(info->e, EVAS_CALLBACK_RENDER_PRE, pre_render_cb); + } + + info->deleted = 1; + info->ee = NULL; +} + +PUBLIC void *dynamicbox_get_evas_object(const char *id, int is_gbar) +{ + vwin_info_t info; + Evas_Object *rect; + const char *engine; + int gl_is_turned_on = 0; + + if (!s_info.alloc_canvas && !s_info.alloc_canvas_with_stride && !s_info.alloc_canvas_with_pixmap) { + s_info.alloc_canvas_with_pixmap = dlsym(RTLD_DEFAULT, "ecore_evas_gl_x11_pixmap_allocfunc_new"); + if (!s_info.alloc_canvas_with_pixmap) { + DbgPrint("pixmap_allocfunc_new is not found\n"); + } + + s_info.alloc_canvas_with_stride = dlsym(RTLD_DEFAULT, "ecore_evas_buffer_allocfunc_with_stride_new"); + if (!s_info.alloc_canvas_with_stride) { + DbgPrint("allocfunc_with_stirde_new is not found\n"); + } + + s_info.alloc_canvas = dlsym(RTLD_DEFAULT, "ecore_evas_buffer_allocfunc_new"); + if (!s_info.alloc_canvas) { + ErrPrint("allocfunc_new is not found\n"); + } + + if (!s_info.alloc_canvas_with_stride && !s_info.alloc_canvas && !s_info.alloc_canvas_with_pixmap) { + ErrPrint("No way to allocate canvas\n"); + return NULL; + } + } + + if (!id) { + ErrPrint("Invalid parameter\n"); + return NULL; + } + + info = calloc(1, sizeof(*info)); + if (!info) { + ErrPrint("Heap: %s\n", strerror(errno)); + return NULL; + } + + info->id = strdup(id); + if (!info->id) { + ErrPrint("Heap: %s\n", strerror(errno)); + free(info); + return NULL; + } + + info->is_gbar = is_gbar; + + /** + * Acquire a buffer for canvas. + */ + info->handle = dynamicbox_create_buffer(info->id, info->is_gbar, + (dynamicbox_conf_auto_align() || !s_info.alloc_canvas_with_stride), + event_handler_cb, info); + + if (!info->handle) { + ErrPrint("Failed to create a dynamicbox buffer\n"); + free(info->id); + free(info); + return NULL; + } + + /** + * Size information must be initialized before call the ecore_evas_buffer_new. + */ + info->w = DBOX_DEFAULT_WIDTH; + info->h = DBOX_DEFAULT_HEIGHT; + + engine = elm_config_preferred_engine_get(); + DbgPrint("Preferred engine: %s (%s)\n", engine, GL_ENGINE); + if (engine && !strcmp(engine, GL_ENGINE)) { + if (s_info.alloc_canvas_with_pixmap) { + info->ee = s_info.alloc_canvas_with_pixmap(NULL, 0u, 0, 0, info->w, info->h, alloc_pixmap_cb, free_pixmap_cb, info); + if (!info->ee) { + ErrPrint("Unable to create a ee for pixmap\n"); + } else { + gl_is_turned_on = 1; + } + } + } + + if (!info->ee) { + if (!dynamicbox_conf_auto_align() && s_info.alloc_canvas_with_stride) { + info->ee = s_info.alloc_canvas_with_stride(info->w, info->h, alloc_stride_fb, free_fb, info); + } else if (s_info.alloc_canvas) { + info->ee = s_info.alloc_canvas(info->w, info->h, alloc_fb, free_fb, info); + } + } + + if (!info->ee) { + ErrPrint("Failed to create ecore_evas (%dx%d)\n", info->w, info->h); + dynamicbox_destroy_buffer(info->handle); + free(info->id); + free(info); + return NULL; + } + + ecore_evas_data_set(info->ee, "dynamic,box,info", info); + + /** + * @note + * Free callback must be prepared before use the ecore_evas_free() + */ + ecore_evas_callback_pre_free_set(info->ee, ecore_evas_free_cb); + + info->e = ecore_evas_get(info->ee); + if (!info->e) { + ErrPrint("Failed to get evas\n"); + ecore_evas_free(info->ee); + return NULL; + } + + if (!gl_is_turned_on) { + pre_render_cb(info, NULL, NULL); + ecore_evas_alpha_set(info->ee, EINA_TRUE); + post_render_cb(info, NULL, NULL); + } else { + DbgPrint("opengl-x11 engine should not turn on the alpha\n"); + } + + ecore_evas_manual_render_set(info->ee, EINA_FALSE); + ecore_evas_resize(info->ee, info->w, info->h); + + evas_event_callback_add(info->e, EVAS_CALLBACK_RENDER_POST, post_render_cb, info); + evas_event_callback_add(info->e, EVAS_CALLBACK_RENDER_PRE, pre_render_cb, info); + + rect = evas_object_rectangle_add(info->e); + if (!rect) { + ErrPrint("Failed to create evas_object\n"); + ecore_evas_free(info->ee); + return NULL; + } + + evas_object_resize(rect, info->w, info->h); + evas_object_color_set(rect, 0, 0, 0, 0); + return rect; +} + +/* End of a file */ diff --git a/dynamicbox/src/virtual_window.c.rej b/dynamicbox/src/virtual_window.c.rej new file mode 100644 index 0000000..2ef205f --- /dev/null +++ b/dynamicbox/src/virtual_window.c.rej @@ -0,0 +1,29 @@ +--- src/virtual_window.c ++++ src/virtual_window.c +@@ -157,7 +157,7 @@ + flags = evas_event_default_flags_get(info->e); + flags |= EVAS_EVENT_FLAG_ON_HOLD; + evas_event_default_flags_set(info->e, flags); +- DbgPrint("ON_HOLD: %s\n", info->id); ++ DbgPrint("ON_HOLD: %s (%lfx%lf - %lf)\n", info->id, event_info->info.pointer.x, event_info->info.pointer.y, timestamp); + break; + case DBOX_BUFFER_EVENT_OFF_HOLD: + flags = evas_event_default_flags_get(info->e); +@@ -198,7 +198,7 @@ + evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL); + evas_event_feed_mouse_down(info->e, 1, EVAS_BUTTON_NONE, timestamp, NULL); /* + 0.2f just for fake event */ + info->pressed = 1; +- DbgPrint("DOWN: %s\n", info->id); ++ DbgPrint("DOWN: %s (%lfx%lf - %lf)\n", info->id, event_info->info.pointer.x, event_info->info.pointer.y, timestamp); + break; + case DBOX_BUFFER_EVENT_MOVE: + /** +@@ -211,7 +211,7 @@ + evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL); + evas_event_feed_mouse_up(info->e, 1, EVAS_BUTTON_NONE, timestamp, NULL); + info->pressed = 0; +- DbgPrint("UP: %s\n", info->id); ++ DbgPrint("UP: %s (%lfx%lf - %lf)\n", info->id, event_info->info.pointer.x, event_info->info.pointer.y, timestamp); + /** + * @note + * We have to keep the event flags, so we should not clear them from here. diff --git a/src/virtual_window_wayland.c b/dynamicbox/src/virtual_window_wayland.c similarity index 100% rename from src/virtual_window_wayland.c rename to dynamicbox/src/virtual_window_wayland.c diff --git a/livebox/CMakeLists.txt b/livebox/CMakeLists.txt new file mode 100644 index 0000000..373e05a --- /dev/null +++ b/livebox/CMakeLists.txt @@ -0,0 +1,56 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(livebox C) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "\${prefix}") +SET(PROJECT_NAME "${PROJECT_NAME}") +SET(LIBDIR "\${exec_prefix}/lib") +SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") +SET(VERSION_MAJOR 1) +SET(VERSION "${VERSION_MAJOR}.0.0") + +set(CMAKE_SKIP_BUILD_RPATH true) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) + +INCLUDE(FindPkgConfig) +pkg_check_modules(old_pkgs REQUIRED + dlog + evas + ecore + elementary + livebox-service +) + +FOREACH(flag ${old_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g") + +ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") +ADD_DEFINITIONS("-DLOG_TAG=\"LIVEBOX\"") +ADD_DEFINITIONS("-DNDEBUG") +ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET") +ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"") +ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"com.samsung.data-provider-slave\"") + +SET (BUILD_SOURCE + src/livebox.c +) + +ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${old_pkgs_LDFLAGS} "-lpthread") + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib) + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc") +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/livebox.h DESTINATION include/${PROJECT_NAME}) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/livebox_product.h DESTINATION include/${PROJECT_NAME}) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}") diff --git a/livebox/LICENSE b/livebox/LICENSE new file mode 100644 index 0000000..571fe79 --- /dev/null +++ b/livebox/LICENSE @@ -0,0 +1,206 @@ +Flora License + +Version 1.1, April, 2013 + +http://floralicense.org/license/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and +all other entities that control, are controlled by, or are +under common control with that entity. For the purposes of +this definition, "control" means (i) the power, direct or indirect, +to cause the direction or management of such entity, +whether by contract or otherwise, or (ii) ownership of fifty percent (50%) +or more of the outstanding shares, or (iii) beneficial ownership of +such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice +that is included in or attached to the work (an example is provided +in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial +revisions, annotations, elaborations, or other modifications represent, +as a whole, an original work of authorship. For the purposes of this License, +Derivative Works shall not include works that remain separable from, +or merely link (or bind by name) to the interfaces of, the Work and +Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original +version of the Work and any modifications or additions to that Work or +Derivative Works thereof, that is intentionally submitted to Licensor +for inclusion in the Work by the copyright owner or by an individual or +Legal Entity authorized to submit on behalf of the copyright owner. +For the purposes of this definition, "submitted" means any form of +electronic, verbal, or written communication sent to the Licensor or +its representatives, including but not limited to communication on +electronic mailing lists, source code control systems, and issue +tracking systems that are managed by, or on behalf of, the Licensor +for the purpose of discussing and improving the Work, but excluding +communication that is conspicuously marked or otherwise designated +in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +"Tizen Certified Platform" shall mean a software platform that complies +with the standards set forth in the Tizen Compliance Specification +and passes the Tizen Compliance Tests as defined from time to time +by the Tizen Technical Steering Group and certified by the Tizen +Association or its designated agent. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work +solely as incorporated into a Tizen Certified Platform, where such +license applies only to those patent claims licensable by such +Contributor that are necessarily infringed by their Contribution(s) +alone or by combination of their Contribution(s) with the Work solely +as incorporated into a Tizen Certified Platform to which such +Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim +in a lawsuit) alleging that the Work or a Contribution incorporated +within the Work constitutes direct or contributory patent infringement, +then any patent licenses granted to You under this License for that +Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof pursuant to the copyright license +above, in any medium, with or without modifications, and in Source or +Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works + a copy of this License; and + 2. You must cause any modified files to carry prominent notices stating + that You changed the files; and + 3. You must retain, in the Source form of any Derivative Works that + You distribute, all copyright, patent, trademark, and attribution + notices from the Source form of the Work, excluding those notices + that do not pertain to any part of the Derivative Works; and + 4. If the Work includes a "NOTICE" text file as part of its distribution, + then any Derivative Works that You distribute must include a readable + copy of the attribution notices contained within such NOTICE file, + excluding those notices that do not pertain to any part of + the Derivative Works, in at least one of the following places: + within a NOTICE text file distributed as part of the Derivative Works; + within the Source form or documentation, if provided along with the + Derivative Works; or, within a display generated by the Derivative Works, + if and wherever such third-party notices normally appear. + The contents of the NOTICE file are for informational purposes only + and do not modify the License. You may add Your own attribution notices + within Derivative Works that You distribute, alongside or as an addendum + to the NOTICE text from the Work, provided that such additional attribution + notices cannot be construed as modifying the License. You may add Your own + copyright statement to Your modifications and may provide additional or + different license terms and conditions for use, reproduction, or + distribution of Your modifications, or for any such Derivative Works + as a whole, provided Your use, reproduction, and distribution of + the Work otherwise complies with the conditions stated in this License + and your own copyright statement or terms and conditions do not conflict + the conditions stated in the License including section 3. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Flora License to your work + +To apply the Flora License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Flora License, Version 1.1 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://floralicense.org/license/ + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/livebox/include/debug.h b/livebox/include/debug.h new file mode 100644 index 0000000..d278fc4 --- /dev/null +++ b/livebox/include/debug.h @@ -0,0 +1,20 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define DbgPrint(format, arg...) SECURE_LOGD(format, ##arg) +#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg) +#define WarnPrint(format, arg...) SECURE_LOGW(format, ##arg) +/* End of a file */ diff --git a/livebox/include/dlist.h b/livebox/include/dlist.h new file mode 100644 index 0000000..6ce75e0 --- /dev/null +++ b/livebox/include/dlist.h @@ -0,0 +1,43 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define dlist_remove_data(list, data) do { \ + struct dlist *l; \ + l = dlist_find_data(list, data); \ + list = dlist_remove(list, l); \ +} while (0) + +#define dlist_foreach(list, l, data) \ + for ((l) = (list); ((data) = dlist_data(l)); (l) = dlist_next(l)) + +#define dlist_foreach_safe(list, l, n, data) \ + for ((l) = (list), (n) = dlist_next(l); \ + ((data) = dlist_data(l)); \ + (l) = (n), (n) = dlist_next(l)) + +struct dlist; + +extern struct dlist *dlist_append(struct dlist *list, void *data); +extern struct dlist *dlist_prepend(struct dlist *list, void *data); +extern struct dlist *dlist_remove(struct dlist *list, struct dlist *l); +extern struct dlist *dlist_find_data(struct dlist *list, void *data); +extern void *dlist_data(struct dlist *l); +extern struct dlist *dlist_next(struct dlist *l); +extern struct dlist *dlist_prev(struct dlist *l); +extern int dlist_count(struct dlist *l); +extern struct dlist *dlist_nth(struct dlist *l, int nth); + +/* End of a file */ diff --git a/livebox/include/dynamicbox.h b/livebox/include/dynamicbox.h new file mode 100644 index 0000000..768e9c5 --- /dev/null +++ b/livebox/include/dynamicbox.h @@ -0,0 +1,871 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __DYNAMICBOX_UILITY_H +#define __DYNAMICBOX_UILITY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** + * @file dynamicbox.h + * @brief This file declares API of libdynamicbox library + * @since_tizen 2.3 + */ + +/** + * @addtogroup CAPI_DYNAMICBOX_UTILITY_MODULE + * @{ + */ + +/** + * @brief Definition for COLOR BLOCK. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_COLOR "color" + +/** + * @brief Definition for TEXT BLOCK. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_TEXT "text" + +/** + * @brief Definition for IMAGE BLOCK. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_IMAGE "image" + +/** + * @brief Definition for SIGNAL BLOCK. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_SIGNAL "signal" + +/** + * @brief Definition for INFO BLOCK. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_INFO "info" + +/** + * @brief Definition for DRAG BLOCK. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_DRAG "drag" + +/** + * @brief Definition for SCRIPT SCRIPT. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_SCRIPT "script" + +/** + * @brief Definition for ACCESSIBILITY INFORMATION BLOCK. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_ACCESS "access" + +/** + * @brief Definition for accessibility operation. + * @since_tizen 2.3 + */ +#define DBOX_DESC_TYPE_ACCESS_OPERATION "access,operation" + +/** + * @brief Definition for set highlight on specified part. + * @since_tizen 2.3 + */ +#define DBOX_DESC_DATA_ACCESS_OPERATION_HL_SET "set,hl" + +/** + * @brief Definition for remove highlight from specified part. + * @since_tizen 2.3 + */ +#define DBOX_DESC_DATA_ACCESS_OPERATION_HL_UNSET "unset,hl" + +/** + * @brief Definition for move the highlight to next part. + * @since_tizen 2.3 + */ +#define DBOX_DESC_DATA_ACCESS_OPERATION_HL_NEXT "next,hl" + +/** + * @brief Definition for move the highlight to previous part. + * @since_tizen 2.3 + */ +#define DBOX_DESC_DATA_ACCESS_OPERATION_HL_PREV "prev,hl" + +/** + * @brief Definition for reset the chain of accessibility highlight list. + * @since_tizen 2.3 + */ +#define DBOX_DESC_DATA_ACCESS_OPERATION_RESET "reset,focus" + +/** + * @brief Definition for specify the highlight move option. + * @details If the highlight list reaches to the last object, move back to the first object. + * @since_tizen 2.3 + */ +#define DBOX_DESC_OPTION_ACCESS_HL_LOOP "cycle" + +/** + * @brief Definition for specify the highlight move option. + * @details If the highlight list reaches to the last object(or the first object), + * the "prev,hl", "next,hl" will be failed. + * @since_tizen 2.3 + */ +#define DBOX_DESC_OPTION_ACCESS_HL_NOLOOP "no,cycle" + +/** + * @brief Dynamic Box description data handle. + * @since_tizen 2.3 + */ +struct dynamicbox_desc; + +/** + * @brief Updates a description file. + * @since_tizen 2.3 + * @remarks Must be used only by Inhouse Dynamic Box. + * @param[in] id Dynamic Box Instance Id + * @param[in] gbar 1 for Glance Bar or 0 + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return Handle of desc instance + * @pre Should be loaded by data-provider-slave. + * @post Should be destroyed(flushed) using dynamicbox_desc_close() API. + * @see dynamicbox_desc_close() + */ +extern struct dynamicbox_desc *dynamicbox_desc_open(const char *id, int gbar); + +/** + * @brief Completes the description file update. + * @details Only if this API is called, the description data will be applied to the content of Dynamic Box (or GBar). + * @since_tizen 2.3 + * @remarks Must be used only by Inhouse Dynamic Box. + * @param[in] handle Handle which is created by dynamicbox_desc_open() function + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_NONE If the flushing description data is successfully done + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER If the given handle is not valid + * @pre Handle must be created by dynamicbox_desc_open() + * @post Handle must not be used after return from this function. + * @see dynamicbox_desc_open() + */ +extern int dynamicbox_desc_close(struct dynamicbox_desc *handle); + +/** + * @brief Sets the category information of current description data. + * @details Creates a new description block for updating category information of layout object. + * @since_tizen 2.3 + * @param[in] handle Handle which is created by dynamicbox_desc_open() function + * @param[in] id Id string of target object + * @param[in] category Category string that will be used by layout object + * @return int type + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid handle + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Memory is not enough to add this block + * @retval index Index(>=0) of added block, which can be used by dynamicbox_desc_set_id() + * @pre Must be called after create a handle using dynamicbox_desc_open() + * @see dynamicbox_desc_set_id() + */ +extern int dynamicbox_desc_set_category(struct dynamicbox_desc *handle, const char *id, const char *category); + +/** + * @brief Sets the content size. + * @details Sets the content size of layout. + * @since_tizen 2.3 + * @param[in] handle Handle which is created by dynamicbox_desc_open() function + * @param[in] id Id string of target object + * @param[in] w Width in pixel + * @param[in] h Height in pixel + * @return int type + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Not enough memory to add a new block + * @retval index Index(>=0) of added block Successfully added + * @see dynamicbox_desc_open() + * @see dynamicbox_desc_set_id() + */ +extern int dynamicbox_desc_set_size(struct dynamicbox_desc *handle, const char *id, int w, int h); + +/** + * @brief Sets the target id of the given block. + * @details Only available for the script block. + * @since_tizen 2.3 + * @param[in] handle Handle which is created by dynamicbox_desc_open() function + * @param[in] idx Index of target block + * @param[in] id Id String which will be used by other dynamicbox_desc_XXX functions + * @return int type + * @retval #DBOX_STATUS_ERROR_NONE Id is successfully updated for given idx of desc block + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #DBOX_STATUS_ERROR_NOT_EXIST Given index of desc block is not exists + * @pre Desc block should be exists which has given index "idx". + * @post Specified Id string("id") can be used by other dynamicbox_desc_XXXX functions. + * @see dynamicbox_desc_open() + * @see dynamicbox_desc_set_id() + */ +extern int dynamicbox_desc_set_id(struct dynamicbox_desc *handle, int idx, const char *id); + +/** + * @brief Adds a new block. + * @since_tizen 2.3 + * @param[in] handle Handle which is created by the dynamicbox_desc_open() function + * @param[in] id ID of source script object + * @param[in] type Type (image|text|script|signal|.. etc) + * @param[in] part Target part to update with given content(data) + * @param[in] data Content for specified part + * @param[in] option Option for the block. (script: group, image: option, ...) + * @return Index of current description block + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Not enough memory to add a new desc block + * @retval index Index(>=0) of added desc block + * @pre Handle must be created using dynamicbox_desc_open. + * @see dynamicbox_desc_set_id() + * @see dynamicbox_desc_del_block() + */ +extern int dynamicbox_desc_add_block(struct dynamicbox_desc *handle, const char *id, const char *type, const char *part, const char *data, const char *option); + +/** + * @brief Deletes an added block. + * @since_tizen 2.3 + * @details If you discard the added desc block, use this API and the index of the created desc block. + * @param[in] handle Handle which is created by dynamicbox_desc_open() function + * @param[in] idx Index of added block, returned from dynamicbox_desc_add_block(), dynamicbox_desc_set_size(), dynamicbox_desc_set_category(), etc + * @return int type + * @retval #DBOX_STATUS_ERROR_NONE Successfully deleted + * @retval #DBOX_STATUS_ERROR_NOT_EXIST Given index of desc block is not exists + * @pre Index must be exists. + * @see dynamicbox_desc_add_block() + * @see dynamicbox_desc_open() + */ +extern int dynamicbox_desc_del_block(struct dynamicbox_desc *handle, int idx); + +/** + * @brief Creates an Evas_Object to create an elm_win object. + * @details Creating a new Evas_Object using Dynamic Box frame buffer. + * @since_tizen 2.3 + * @param[in] id Instance Id + * @param[in] gbar 1 if this object is created for Glance Bar or 0 (for Dynamic Box) + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return Evas_Object* Evas Object type + * @retval Address Valid evas object + * @retval @c NULL failed to create + */ +extern Evas_Object *dynamicbox_get_evas_object(const char *id, int gbar); + +/** + * @brief Set extra information for updated content. + * @details + * If the provider should give some hints to the viewer, + * such as title, icon and name, this function can set them. + * provider will send those information to the viewer when the + * content is updated. + * @since_tizen 2.3 + * @remarks This function only works with the buffer type inhouse provider. + * @param[in] id Dynamic Box Instance Id + * @param[in] content Content string that will pass to a Dynamic Box via dynamicbox_create interface when it is re-created. + * @param[in] title Human readable text for accessitility, summarized text for representing the content of a box. + * @param[in] icon Path of icon image file - alternative image content + * @param[in] name Name of a box - alternative text content + * @return int type + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid parameters + * @retval #DBOX_STATUS_ERROR_FAULT Unrecoverable error + * @retval #DBOX_STATUS_ERROR_NONE Successfully sent + */ +extern int dynamicbox_set_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name); + + +/** + * @internal + * @brief Structure for a Dynamic Box buffer defined by a provider. + * @since_tizen 2.3 + */ +struct dynamicbox_buffer; + +/** + * @internal + * @brief Return values of dynamicbox programming interfaces: Operation is successfully done. + * @since_tizen 2.3 + */ +extern const int DONE; + +/** + * @internal + * @brief Return values of dynamicbox programming interfaces: Contents are updated. + * @since_tizen 2.3 + */ +extern const int OUTPUT_UPDATED; + +/** + * @internal + * @brief Return values of dynamicbox programming interfaces: Need to call the dynamicbox_need_to_update and dynamicbox_update_content. + * @since_tizen 2.3 + */ +extern const int NEED_TO_SCHEDULE; + +/** + * @internal + * @brief Return values of dynamicbox programming interfaces: Need to do force update. + * @since_tizen 2.3 + */ +extern const int FORCE_TO_SCHEDULE; + +/** + * @internal + * @brief Return values of dynamicbox programming interfaces: Need to create a new instance. + * @since_tizen 2.3 + */ +extern const int NEED_TO_CREATE; + +/** + * @internal + * @brief Return values of dynamicbox programming interfaces: Need to destroy this instance. + * @since_tizen 2.3 + */ +extern const int NEED_TO_DESTROY; + +/** + * @internal + * @brief Return values of dynamicbox programming interfaces: Need to update. + * @since_tizen 2.3 + */ +extern const int NEED_TO_UPDATE; + +/** + * @internal + * @brief Return values of dynamicbox programming interfaces: Using network. + * @since_tizen 2.3 + */ +extern const int USE_NET; + +/** + * @internal + * @brief System event type: System font is changed. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_FONT_CHANGED; + +/** + * @internal + * @brief System event type: System language is changed. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_LANG_CHANGED; + +/** + * @internal + * @brief System event type: System time is changed. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_TIME_CHANGED; + +/** + * @internal + * @brief System event type: Region changed. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_REGION_CHANGED; + +/** + * @internal + * @brief System event type: Accessibility mode changed. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_TTS_CHANGED; + +/** + * @internal + * @brief System event type: Dynamic Box is paused. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_PAUSED; + +/** + * @internal + * @brief System event type: Dynamic Box is resumed. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_RESUMED; + +/** + * @internal + * @brief System event type: MMC Status change event. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_MMC_STATUS_CHANGED; + +/** + * @internal + * @brief System event type: Dynamic Box instance is removed from a viewer. + * @since_tizen 2.3 + */ +extern const int DBOX_SYS_EVENT_DELETED; + +/** + * @internal + * @brief Structure for extra event information for dynamicbox_content_event interface function. + * @since_tizen 2.3 + */ +#if !defined(__SCRIPT_EVENT_INFO) +#define __SCRIPT_EVENT_INFO + +/** + * @internal + * @brief + * Text signal & Content event uses this data structure. + * @since_tizen 2.3 + */ +struct event_info { + struct _pointer { + double x; /**< X value of current mouse(touch) position */ + double y; /**< Y value of current mouse(touch) position */ + int down; /**< Is it pressed(1) or not(0) */ + } pointer; + + struct _part { + double sx; /**< Pressed object's left top X */ + double sy; /**< Pressed object's left top Y */ + double ex; /**< Pressed object's right bottom X */ + double ey; /**< Pressed object's right bottom Y */ + } part; +}; +#endif + +/** + * @internal + * @brief Notifies the updated content to the provider. + * @details Forcedly notifies the updated contents. + * This function can be used from async callback function to notify the updated content. + * @since_tizen 2.3 + * @param[in] id Instance Id which is passed to you via the first parameter of every dynamicbox_XXXX interface functions + * @param[in] gbar 1 for updating content of Glance Bar or 0(for content of Dynamic Box) + * @return int type + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Not enough memory + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #DBOX_STATUS_ERROR_IO_ERROR I/O failed, Cannot access given resource file(id) + * @retval #DBOX_STATUS_ERROR_NONE Successfully notified + * @pre This API only can be used after loaded into the data-provider-slave process. + */ +extern int dynamicbox_content_is_updated(const char *id, int gbar); + +/** + * @internal + * @brief Replaces "\n" (new line character) with <br> tag. + * @details This utility function is used to replace all NEW LINE CHARACTER ("\n") with <br> tag. + * @since_tizen 2.3 + * @param[in] str Source string + * @return char * type + * @retval string Allocted in the heap + * @retval @c NULL If it fails to replace string + * @post Returned string must has to be free'd by user manually. + */ +extern char *dynamicbox_util_nl2br(const char *str); + +/** + * @internal + * @brief Interfaces for direct buffer management (Available only for the GBar area). + * @since_tizen 2.3 + */ +#ifndef __DBOX_PROVIDER_BUFFER_H +/** + * @internal + * @brief Enumeration for value should be sync'd with provider. + * @since_tizen 2.3 + */ +enum dbox_buffer_event { + DBOX_BUFFER_EVENT_ENTER, /**< Mouse cursor enter */ + DBOX_BUFFER_EVENT_LEAVE, /**< Mouse cursor leave */ + DBOX_BUFFER_EVENT_DOWN, /**< Mouse down */ + DBOX_BUFFER_EVENT_MOVE, /**< Mouse move */ + DBOX_BUFFER_EVENT_UP, /**< Mouse up */ + + DBOX_BUFFER_EVENT_KEY_DOWN, /**< Key down */ + DBOX_BUFFER_EVENT_KEY_UP, /**< Key up */ + DBOX_BUFFER_EVENT_KEY_FOCUS_IN, /**< Key focus in */ + DBOX_BUFFER_EVENT_KEY_FOCUS_OUT, /**< Key focus out */ + + DBOX_BUFFER_EVENT_HIGHLIGHT, /**< Accessibility - Highlight */ + DBOX_BUFFER_EVENT_HIGHLIGHT_NEXT, /**< Accessibility - Move highlight to next */ + DBOX_BUFFER_EVENT_HIGHLIGHT_PREV, /**< Accessibility - Move highlight to prev */ + DBOX_BUFFER_EVENT_ACTIVATE, /**< Accessibility - Activate the highlighted object */ + DBOX_BUFFER_EVENT_ACTION_UP, /**< Accessibility - Make UP action */ + DBOX_BUFFER_EVENT_ACTION_DOWN, /**< Accessibility - Make Down action */ + DBOX_BUFFER_EVENT_SCROLL_UP, /**< Accessibility - Scroll up */ + DBOX_BUFFER_EVENT_SCROLL_MOVE, /**< Accessibility - Scroll move */ + DBOX_BUFFER_EVENT_SCROLL_DOWN, /**< Accessibility - Scroll down */ + DBOX_BUFFER_EVENT_UNHIGHLIGHT, /**< Accessibility - Remove highlight */ + + DBOX_BUFFER_EVENT_ON_HOLD, /**< To prevent from generating mouse clicked event */ + DBOX_BUFFER_EVENT_OFF_HOLD, /**< Stopped holding. */ + DBOX_BUFFER_EVENT_ON_SCROLL, /**< On scrolling */ + DBOX_BUFFER_EVENT_OFF_SCROLL, /**< Scrolling stopped */ + + DBOX_BUFFER_EVENT_ACCESS_VALUE_CHANGE, /**< */ + DBOX_BUFFER_EVENT_ACCESS_MOUSE, /**< give mouse event to highlight object */ + DBOX_BUFFER_EVENT_ACCESS_BACK, /**< go back to a previous view ex: pop naviframe item */ + DBOX_BUFFER_EVENT_ACCESS_OVER, /**< mouse over an object */ + DBOX_BUFFER_EVENT_ACCESS_READ, /**< highlight an object */ + DBOX_BUFFER_EVENT_ACCESS_ENABLE, /**< enable highlight and read ability */ + DBOX_BUFFER_EVENT_ACCESS_DISABLE /**< disable highlight and read ability */ +}; + +/** + * @internal + * @brief Event info + * @since_tizen 2.3 + */ +struct dbox_buffer_event_data { + enum dbox_buffer_event type; /**< Mouse, Keyboard, Accessibility event type */ + double timestamp; /**< Timestamp of events */ + + union _input_data { + struct _mouse { + int x; /**< If the event type is for accessibility or mouse, coordinates of X for pointer */ + int y; /**< If the event type is for accessibility or mouse, coordinates of Y for pointer */ + } pointer; + + struct _access { + int x; /**< Accessibility event X coordinate */ + int y; /**< Accessibility event Y coordinate */ + unsigned int mouse_type; /**< 0: down, 1: move, 2: up | 0: cur, 1: next, 2: prev, 3: off */ + unsigned int action_type; /**< reserved for protocol */ + unsigned int action_by; /**< reserved for protocol */ + int cycle; /**< reserved for protocol */ + } access; + + unsigned int keycode; /**< If the event type is for keyboard, the value of keycode */ + } info; +}; +#endif + +/** + * @internal + * @brief Acquires a buffer for GBar or DBox, currently only the GBar is supported. + * @since_tizen 2.3 + * @param[in] id Instance Id which is passed to you via the first parameter of every dynamicbox_XXXX interface functions + * @param[in] gbar 1 for Glance Bar or 0 for Dynamic Box + * @param[in] width Width in pixel + * @param[in] height Height in pixel + * @param[in] pixels Size of a pixel in bytes + * @param[in] handler Event handling callback + * @param[in] data User data for event handling callback + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return Buffer handle + * @retval @c NULL Failed to acquire buffer + * @retval handler Handle object + * @pre Given instance must be specify its type as buffer. or this API will be fail. + * @post Allocated buffer object must be released via dynamicbox_release_buffer(). + * @see dynamicbox_release_buffer() + */ +extern struct dynamicbox_buffer *dynamicbox_acquire_buffer(const char *id, int gbar, int width, int height, int pixels, int auto_align, int (*handler)(struct dynamicbox_buffer *, struct dbox_buffer_event_data *, void *), void *data); + +/** + * @internal + * @brief Acquires the Id of Resource (window system). + * @details Only if the provider uses Resource for providing render buffer. + * @since_tizen 2.3 + * @remarks Pixmap Id can be destroyed if you call the dynamicbox_release_buffer(). Then this Resource Id is not guaranteed to use. + * @param[in] handle Buffer handle + * @return unsigned int Resource Id + * @retval >0 Resource Id + * @retval 0 Failed to get Resource Id + * @pre The system must be set to use the Resource Id method for content sharing. + * @see dynamicbox_acquire_buffer() + */ +extern unsigned int dynamicbox_resource_id(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Releases the buffer of dynamicbox. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #DBOX_STATUS_ERROR_NONE Successfully released + * @pre Handle must be created using dynamicbox_acquire_buffer(). + * @see dynamicbox_acquire_buffer() + */ +extern int dynamicbox_release_buffer(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Gets the address of buffer for S/W rendering. + * @details If you try to use this, after dynamicbox_create_hw_buffer(), you will get @c NULL. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return void* address of the render buffer + * @retval @c NULL If it falis to get buffer address + * @retval address If it succeed to get the buffer address + * @see dynamicbox_unref_buffer() + */ +extern void *dynamicbox_ref_buffer(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Releases the S/W render buffer. + * @since_tizen 2.3 + * @param[in] buffer Address of render buffer + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid handle + * @retval #DBOX_STATUS_ERROR_NONE Successfully unreference + * @pre dynamicbox_ref_buffer() must be called. + * @see dynamicbox_ref_buffer() + */ +extern int dynamicbox_unref_buffer(void *buffer); + +/** + * @internal + * @brief Synchronizes the updated buffer. + * @details This is only needed for non-H/W accelerated buffer. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_NONE Successfully sync'd + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @see dynamicbox_acquire_buffer() + */ +extern int dynamicbox_sync_buffer(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Requests to schedule the update operation to a provider. + * @since_tizen 2.3 + * @param[in] id Instance Id which is passed to you via the first parameter of every dynamicbox_XXXX interface functions + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return If succes returns 0 or return less than 0 + * @retval #DBOX_STATUS_ERROR_NONE Successfully triggered + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Not enough memory + * @retval #DBOX_STATUS_ERROR_NOT_EXIST Given id instance is not exist + */ +extern int dynamicbox_request_update(const char *id); + +/** + * @internal + * @brief Checks whether the dynamicbox supports H/W acceleration or not. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @return int type + * @retval 1 If the buffer handle support the H/W acceleration buffer + * @retval 0 If it doesn not supported + * @see dynamicbox_acquire_buffer() + */ +extern int dynamicbox_support_hw_buffer(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Creates the H/W accelerated buffer. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_ALREADY H/W buffer is already created + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @retval #DBOX_STATUS_ERROR_NONE Successfully created + * @pre Must be checked whether the H/W buffer is supported or not. + * @post Must be destroyed if it is not necessary. + * @see dynamicbox_support_hw_buffer() + */ +extern int dynamicbox_create_hw_buffer(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Destroys the H/W accelerated buffer. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_NONE Successfully destroyed + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @pre Must be created h/w buffer using dynamicbox_create_hw_buffer. + * @see dynamicbox_create_hw_buffer() + */ +extern int dynamicbox_destroy_hw_buffer(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Gets the address of the accelerated H/W buffer. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return void* type + * @retval @c NULL Failed to get H/W accelerated buffer address + * @retval addr H/W accelerated buffer address + * @see dynamicbox_create_hw_buffer() + */ +extern void *dynamicbox_buffer_hw_buffer(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Get the stride information from the buffer info + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @return int stride size + * @retval positive_value length of stride + * @return DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid parameter + * @return DBOX_STATUS_ERROR_FAULT Unrecoverable error + * @see dynamicbox_create_hw_buffer() + */ +extern int dynamicbox_buffer_stride(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Pre-processes for rendering content. + * @details This is only needed for accessing H/W accelerated buffer. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid handle + * @retval #DBOX_STATUS_ERROR_NONE Successfully done + * @post dynamicbox_buffer_post_render must be called after the rendering (accessing buffer) is completed. + * @see dynamicbox_support_hw_buffer() + * @see dynamicbox_buffer_post_render() + */ +extern int dynamicbox_buffer_pre_render(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Post-processes for rendering content. + * @since_tizen 2.3 + * @param[in] handle Buffer handle + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return If succes returns 0 or return less than 0 + * @retval #DBOX_STATUS_ERROR_NONE If succeed + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid argument + * @pre dynamicbox_buffer_pre_render must be called. + * @see dynamicbox_support_hw_buffer() + * @see dynamicbox_buffer_pre_render() + */ +extern int dynamicbox_buffer_post_render(struct dynamicbox_buffer *handle); + +/** + * @internal + * @brief Sends a request to the viewer (homescreen) to close the GBar. + * @details Even though you call this function. the homescreen can ignore it. + * @since_tizen 2.3 + * @param[in] dboxid Dynamic Box Package Id + * @param[in] id Instance Id which is passed to you via the first parameter of every dynamicbox_XXXX interface functions + * @param[in] reason DBOX_STATUS_ERROR_NONE(0) + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid parameters + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DBOX_STATUS_ERROR_FAULT Failed to send a request + * @retval #DBOX_STATUS_ERROR_NONE Successfully requested + */ +extern int dynamicbox_request_close_gbar(const char *dboxid, const char *id, int reason); + +/** + * @internal + * @brief Send a freeze request to the viewer (homescreen) + * @details + * The viewer will get this request via event callback. + * Then it should freeze its scroller or stop moving the dynamicbox. + * @since_tizen 2.3 + * @remarks If the viewer doesn't care this request, this will has no effect. + * @param[in] dboxid Dynamic Box Package Id + * @param[in] id Instance Id which is passed to you via the first parameter of every dynamicbox_XXXX interface functions + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid parameters + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DBOX_STATUS_ERROR_FAULT Failed to send requet + * @retval #DBOX_STATUS_ERROR_NONE Successfully requested + * @see dynamicbox_release_scroller() + */ +extern int dynamicbox_freeze_scroller(const char *dboxid, const char *id); + +/** + * @internal + * @brief Send a release request to the viewer (homescreen) + * @details + * The viewer will get this request via event callback. + * Then it should release its scroller or continue moving the dynamicbox. + * @since_tizen 2.3 + * @remarks If the viewer doesn't care this request, this will has no effect. + * @param[in] dboxid Dynamic Box Package Id + * @param[in] id Instance Id which is passed to you via the first parameter of every dynamicbox_XXXX interface functions + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #DBOX_STATUS_ERROR_INVALID_PARAMETER Invalid parameters + * @retval #DBOX_STATUS_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DBOX_STATUS_ERROR_FAULT Failed to send requet + * @retval #DBOX_STATUS_ERROR_NONE Successfully requested + * @see dynamicbox_freeze_scroller() + */ +extern int dynamicbox_thaw_scroller(const char *dboxid, const char *id); + +/** + * @internal + * @brief Get the configuration value for premultiplied alpha. + * @details + * If the system uses the premultiplied alpha for content, + * This function will returns 1. + * @since_tizen 2.3 + * @remarks This function only works with the inhouse provider. + * @return status of premultiplied alpha. + * @retval 1 Content rendered with premultiplied alpha. + * @retval 0 Content doesn't rendered with premultiplied alpha. + */ +extern int dynamicbox_conf_premultiplied_alpha(void); + +/** + * @internal + * @brief Get the configuration value for AUTO Alignment of canvas buffer. + * @details + * If the UIFW does not support the STRIDE information for rendering frame, + * This function will returns 1, then the dynamicbox will automatically aligning the buffer. + * @since_tizen 2.3 + * @return status of auto alignment. + * @retval 1 Content will be automatically aligned by dynamicbox. + * @retval 0 Content will be aligned by UIFW, using stride information. + */ +extern int dynamicbox_conf_auto_align(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* End of a file */ diff --git a/livebox/include/livebox.h b/livebox/include/livebox.h new file mode 100644 index 0000000..f8686d4 --- /dev/null +++ b/livebox/include/livebox.h @@ -0,0 +1,283 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __LIVEBOX_HELPER_H +#define __LIVEBOX_HELPER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** + * @file livebox.h + * @brief This file declares API of liblivebox library + */ + +/** + * @addtogroup CAPI_LIVEBOX_HELPER_MODULE + * @{ + */ + +/** + * @brief Definition for COLOR BLOCK. + */ +#define LB_DESC_TYPE_COLOR "color" + +/** + * @brief Definition for TEXT BLOCK. + */ +#define LB_DESC_TYPE_TEXT "text" + +/** + * @brief Definition for IMAGE BLOCK. + */ +#define LB_DESC_TYPE_IMAGE "image" + +/** + * @brief Definition for SIGNAL BLOCK. + */ +#define LB_DESC_TYPE_SIGNAL "signal" + +/** + * @brief Definition for INFO BLOCK. + */ +#define LB_DESC_TYPE_INFO "info" + +/** + * @brief Definition for DRAG BLOCK. + */ +#define LB_DESC_TYPE_DRAG "drag" + +/** + * @brief Definition for SCRIPT SCRIPT. + */ +#define LB_DESC_TYPE_SCRIPT "script" + +/** + * @brief Definition for ACCESSIBILITY INFORMATION BLOCK. + */ +#define LB_DESC_TYPE_ACCESS "access" + +/** + * @brief Definition for accessibility operation. + */ +#define LB_DESC_TYPE_ACCESS_OPERATION "access,operation" + +/** + * @brief Definition for set highlight on specified part. + */ +#define LB_DESC_DATA_ACCESS_OPERATION_HL_SET "set,hl" + +/** + * @brief Definition for remove highlight from specified part. + */ +#define LB_DESC_DATA_ACCESS_OPERATION_HL_UNSET "unset,hl" + +/** + * @brief Definition for move the highlight to next part. + */ +#define LB_DESC_DATA_ACCESS_OPERATION_HL_NEXT "next,hl" + +/** + * @brief Definition for move the highlight to previous part. + */ +#define LB_DESC_DATA_ACCESS_OPERATION_HL_PREV "prev,hl" + +/** + * @brief Definition for reset the chain of accessibility highlight list. + */ +#define LB_DESC_DATA_ACCESS_OPERATION_RESET "reset,focus" + +/** + * @brief Definition for specify the highlight move option. + * @details If the highlight list reaches to the last object, move back to the first object. + */ +#define LB_DESC_OPTION_ACCESS_HL_LOOP "cycle" + +/** + * @brief Definition for specify the highlight move option. + * @details If the highlight list reaches to the last object(or the first object), + * the "prev,hl", "next,hl" will be failed. + */ +#define LB_DESC_OPTION_ACCESS_HL_NOLOOP "no,cycle" + +/** + * @brief Livebox description data handle. + */ +struct livebox_desc; + +/** + * @brief Updates a description file. + * @remarks Must be used only by Inhouse livebox. + * @param[in] filename + * @param[in] for_pd + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return Handle of desc instance + * @pre Should be loaded by data-provider-slave. + * @post Should be destroyed(flushed) using livebox_desc_close() API. + * @see livebox_desc_close() + */ +extern struct livebox_desc *livebox_desc_open(const char *filename, int for_pd); + +/** + * @brief Completes the description file update. + * @details Only if this API is called, the description data will be applied to the content of livebox (or PD). + * @remarks Must be used only by Inhouse livebox. + * @param[in] handle Handle which is created by livebox_desc_open() function + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return int type + * @retval #LB_STATUS_SUCCESS If the flushing description data is successfully done + * @retval #LB_STATUS_ERROR_INVALID If the given handle is not valid + * @pre Handle must be created by livebox_desc_open() + * @post Handle must not be used after return from this function. + * @see livebox_desc_open() + */ +extern int livebox_desc_close(struct livebox_desc *handle); + +/** + * @brief Sets the category information of current description data. + * @details Creates a new description block for updating category information of layout object. + * @param[in] handle Handle which is created by livebox_desc_open() function + * @param[in] id Id string of target object + * @param[in] category Category string that will be used by layout object + * @privlevel N/P + * @return int type + * @retval #LB_STATUS_ERROR_INVALID Invalid handle + * @retval #LB_STATUS_ERROR_MEMORY Memory is not enough to add this block + * @retval index Index(>=0) of added block, which can be used by livebox_desc_set_id() + * @pre Must be called after create a handle using livebox_desc_open() + * @see livebox_desc_set_id() + */ +extern int livebox_desc_set_category(struct livebox_desc *handle, const char *id, const char *category); + +/** + * @brief Sets the content size. + * @details Sets the content size of layout. + * @param[in] handle Handle which is created by livebox_desc_open() function + * @param[in] id Id string of target object + * @param[in] w Width in pixel + * @param[in] h Height in pixel + * @privlevel N/P + * @return int type + * @retval #LB_STATUS_ERROR_INVALID Invalid argument + * @retval #LB_STATUS_ERROR_MEMORY Not enough memory to add a new block + * @retval index Index(>=0) of added block Successfully added + * @see livebox_desc_open() + * @see livebox_desc_set_id() + */ +extern int livebox_desc_set_size(struct livebox_desc *handle, const char *id, int w, int h); + +/** + * @brief Sets the target id of the given block. + * @details Only available for the script block. + * @param[in] handle Handle which is created by livebox_desc_open() function + * @param[in] idx Index of target block + * @param[in] id Id String which will be used by other livebox_desc_XXX functions + * @privlevel N/P + * @return int type + * @retval #LB_STATUS_SUCCESS Id is successfully updated for given idx of desc block + * @retval #LB_STATUS_ERROR_INVALID Invalid argument + * @retval #LB_STATUS_ERROR_NOT_EXIST Given index of desc block is not exists + * @pre Desc block should be exists which has given index "idx". + * @post Specified Id string("id") can be used by other livebox_desc_XXXX functions. + * @see livebox_desc_open() + * @see livebox_desc_set_id() + */ +extern int livebox_desc_set_id(struct livebox_desc *handle, int idx, const char *id); + +/** + * @brief Adds a new block. + * @param[in] handle Handle which is created by the livebox_desc_open() function + * @param[in] id ID of source script object + * @param[in] type Type (image|text|script|signal|.. etc) + * @param[in] part Target part to update with given content(data) + * @param[in] data Content for specified part + * @param[in] option Option for the block. (script: group, image: option, ...) + * @privlevel N/P + * @return Index of current description block + * @retval #LB_STATUS_ERROR_INVALID Invalid argument + * @retval #LB_STATUS_ERROR_MEMORY Not enough memory to add a new desc block + * @retval index Index(>=0) of added desc block + * @pre Handle must be created using livebox_desc_open. + * @see livebox_desc_set_id() + * @see livebox_desc_del_block() + */ +extern int livebox_desc_add_block(struct livebox_desc *handle, const char *id, const char *type, const char *part, const char *data, const char *option); + +/** + * @brief Deletes an added block. + * @details If you discard the added desc block, use this API and the index of the created desc block. + * @param[in] handle Handle which is created by livebox_desc_open() function + * @param[in] idx Index of added block, returned from livebox_desc_add_block(), livebox_desc_set_size(), livebox_desc_set_category(), etc + * @privlevel N/P + * @return int type + * @retval #LB_STATUS_SUCCESS Successfully deleted + * @retval #LB_STATUS_ERROR_NOT_EXIST Given index of desc block is not exists + * @pre Index must be exists. + * @see livebox_desc_add_block() + * @see livebox_desc_open() + */ +extern int livebox_desc_del_block(struct livebox_desc *handle, int idx); + +/** + * @brief Creates an Evas_Object to create an elm_win object. + * @details Creating a new Evas_Object using livebox frame buffer. + * @param[in] id Instance Id + * @param[in] is_pd 1 if this object is created for PD or 0 (for LB) + * @privlevel public + * @privilege %http://tizen.org/privilege/core/dynamicbox.provider + * @return Evas_Object* Evas Object type + * @retval Address Valid evas object + * @retval @c NULL failed to create + */ +extern Evas_Object *livebox_get_evas_object(const char *id, int is_pd); + +/** + * @brief Set extra information for updated content. + * @details + * If the provider should give some hints to the viewer, + * such as title, icon and name, this function can set them. + * provider will send those information to the viewer when the + * content is updated. + * @remarks This function only works with the buffer type inhouse provider. + * @param[in] id Livebox Instance Id + * @param[in] content Content string that will pass to a livebox via livebox_create interface when it is re-created. + * @param[in] title Human readable text for accessitility, summarized text for representing the content of a box. + * @param[in] icon Path of icon image file - alternative image content + * @param[in] name Name of a box - alternative text content + * @privlevel N/P + * @return int type + * @retval #LB_STATUS_ERROR_MEMORY Out of memory + * @retval #LB_STATUS_ERROR_INVALID Invalid parameters + * @retval #LB_STATUS_ERROR_FAULT Unrecoverable error + * @retval #LB_STATUS_SUCCESS Successfully sent + */ +extern int livebox_set_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* End of a file */ diff --git a/livebox/include/livebox_product.h b/livebox/include/livebox_product.h new file mode 100644 index 0000000..3df2eac --- /dev/null +++ b/livebox/include/livebox_product.h @@ -0,0 +1,474 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __LIVEBOX_HELPER_PRODUCT_H +#define __LIVEBOX_HELPER_PRODUCT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file livebox_product.h + * @brief This file declares API of liblivebox library for product + */ + +/** + * @addtogroup CAPI_LIVEBOX_HELPER_PRODUCT_MODULE + * @{ + */ + +/** + * @brief Structure for a livebox buffer defined by a provider. + */ +struct livebox_buffer; + +extern const int DONE; /** +#include + +#include +#include + +#include "livebox.h" + +#define PUBLIC __attribute__((visibility("default"))) + +struct livebox_desc { + FILE *fp; + int for_pd; + + unsigned int last_idx; + + //struct dlist *block_list; +}; + +PUBLIC const int DONE = 0x00; +PUBLIC const int OUTPUT_UPDATED = 0x02; +PUBLIC const int USE_NET = 0x04; + +PUBLIC const int NEED_TO_SCHEDULE = 0x01; +PUBLIC const int NEED_TO_CREATE = 0x01; +PUBLIC const int NEED_TO_DESTROY = 0x01; +PUBLIC const int NEED_TO_UPDATE = 0x01; +PUBLIC const int FORCE_TO_SCHEDULE = 0x08; + +PUBLIC const int LB_SYS_EVENT_FONT_CHANGED = 0x01; +PUBLIC const int LB_SYS_EVENT_LANG_CHANGED = 0x02; +PUBLIC const int LB_SYS_EVENT_TIME_CHANGED = 0x04; +PUBLIC const int LB_SYS_EVENT_REGION_CHANGED = 0x08; +PUBLIC const int LB_SYS_EVENT_TTS_CHANGED = 0x10; +PUBLIC const int LB_SYS_EVENT_PAUSED = 0x0100; +PUBLIC const int LB_SYS_EVENT_RESUMED = 0x0200; +PUBLIC const int LB_SYS_EVENT_MMC_STATUS_CHANGED = 0x0400; +PUBLIC const int LB_SYS_EVENT_DELETED = 0x0800; + +PUBLIC struct livebox_desc *livebox_desc_open(const char *filename, int for_pd) +{ + return NULL; +} + +PUBLIC int livebox_desc_close(struct livebox_desc *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_desc_set_category(struct livebox_desc *handle, const char *id, const char *category) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_desc_set_size(struct livebox_desc *handle, const char *id, int w, int h) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC char *livebox_util_nl2br(const char *str) +{ + return NULL; +} + +PUBLIC int livebox_desc_set_id(struct livebox_desc *handle, int idx, const char *id) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +/*! + * \return idx + */ +PUBLIC int livebox_desc_add_block(struct livebox_desc *handle, const char *id, const char *type, const char *part, const char *data, const char *option) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_desc_del_block(struct livebox_desc *handle, int idx) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC struct livebox_buffer *livebox_acquire_buffer(const char *filename, int is_pd, int width, int height, int pixels, int auto_align, int (*handler)(struct livebox_buffer *, struct buffer_event_data *, void *), void *data) +{ + return NULL; +} + +PUBLIC int livebox_request_update(const char *filename) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_conf_premultiplied_alpha(void) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC unsigned long livebox_pixmap_id(struct livebox_buffer *handle) +{ + return 0lu; +} + +PUBLIC int livebox_release_buffer(struct livebox_buffer *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC void *livebox_ref_buffer(struct livebox_buffer *handle) +{ + return NULL; +} + +PUBLIC int livebox_unref_buffer(void *buffer) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_sync_buffer(struct livebox_buffer *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_support_hw_buffer(struct livebox_buffer *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_create_hw_buffer(struct livebox_buffer *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_destroy_hw_buffer(struct livebox_buffer *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC void *livebox_buffer_hw_buffer(struct livebox_buffer *handle) +{ + return NULL; +} + +PUBLIC int livebox_buffer_pre_render(struct livebox_buffer *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_buffer_post_render(struct livebox_buffer *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_buffer_stride(struct livebox_buffer *handle) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_content_is_updated(const char *filename, int is_pd) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_request_close_pd(const char *pkgname, const char *id, int reason) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_freeze_scroller(const char *pkgname, const char *id) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_release_scroller(const char *pkgname, const char *id) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +PUBLIC int livebox_set_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name) +{ + return LB_STATUS_ERROR_NOT_IMPLEMENTED; +} + +/* End of a file */ diff --git a/packaging/libdynamicbox.spec b/packaging/libdynamicbox.spec index 51d2d1c..a5e6204 100644 --- a/packaging/libdynamicbox.spec +++ b/packaging/libdynamicbox.spec @@ -15,6 +15,7 @@ BuildRequires: pkgconfig(dynamicbox_provider) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(livebox-service) %if %{with wayland} %else @@ -75,14 +76,46 @@ mkdir -p %{buildroot}/%{_datarootdir}/license %files -n %{name} %defattr(-,root,root,-) %manifest %{name}.manifest -%{_libdir}/*.so* -%{_datarootdir}/license/* +%{_libdir}/libdynamicbox.so* +%{_datarootdir}/license/libdynamicbox %files devel %defattr(-,root,root,-) %manifest %{name}.manifest %{_includedir}/dynamicbox/dynamicbox.h %{_includedir}/dynamicbox/internal/dynamicbox.h -%{_libdir}/pkgconfig/*.pc +%{_libdir}/pkgconfig/dynamicbox.pc + +################################################# +# liblivebox (for old version) +%package -n liblivebox +Summary: Library for developing the dynamicbox (old version) +Group: HomeTF/Dynamicbox +License: Flora +Requires: libdynamicbox + +%description -n liblivebox +Provider APIs to develop the dynamicbox. (old version) + +%package -n liblivebox-devel +Summary: Header & package configuration files to support development of the dynamicbox (old version) +Group: Development/Libraries +Requires: liblivebox + +%description -n liblivebox-devel +Dynamicbox development library (dev) (old version) + +%files -n liblivebox +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_libdir}/liblivebox.so* +%{_datarootdir}/license/liblivebox + +%files -n liblivebox-devel +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_includedir}/livebox/livebox.h +%{_includedir}/livebox/livebox_product.h +%{_libdir}/pkgconfig/livebox.pc # End of a file