From b9e313bbfa219f5eddb5cd6b447b8ea45c89682e Mon Sep 17 00:00:00 2001 From: Mikko Ylinen Date: Fri, 29 Aug 2014 02:32:27 -0700 Subject: [PATCH] Revert "Corresponding to TizenIVI3.0 M14.3, GENIVI-LayerManagement was used instead of ico-uxf-weston-plugin, and ico-uxf-weston-plugin was eliminated." This reverts commit 929d286f4d3a9b773fc3deeee59b3f3a13c905b0. Change-Id: I99f921ce51066023ad956a489fd19e58c61c667a --- Makefile.am | 3 +- configure.ac | 6 +- .../lib/systemd/user/ico-system-controller.service | 1 + data/share/packages/org.tizen.ico.homescreen.xml | 2 +- data/share/packages/org.tizen.ico.onscreen.xml | 2 +- data/share/packages/org.tizen.ico.statusbar.xml | 2 +- .../packages/org.tizen.ico.system-controller.xml | 2 +- include/ico_syc_inputctl.h | 10 +- include/ico_syc_type.h | 15 +- include/ico_syc_winctl.h | 19 + lib/apps-framework/Makefile.am | 3 +- lib/apps-framework/ico_syc_winctl.c | 94 +++ lib/common/CicoAilItems.cpp | 8 +- lib/common/CicoAulItems.cpp | 2 +- lib/common/CicoSound.cpp | 4 +- lib/common/CicoSystemConfig.cpp | 1 - lib/common/CicoSystemConfig.h | 5 - lib/system-controller/CicoSCInputController.cpp | 13 + lib/system-controller/CicoSCInputController.h | 4 + lib/system-controller/CicoSCLayer.cpp | 4 +- lib/system-controller/CicoSCLayer.h | 2 +- lib/system-controller/CicoSCResourceManager.cpp | 4 +- .../CicoSCSysResourceController.cpp | 4 +- lib/system-controller/CicoSCWayland.cpp | 1 + lib/system-controller/CicoSCWaylandIF.cpp | 8 +- lib/system-controller/CicoSCWaylandIF.h | 18 +- lib/system-controller/CicoSCWindow.cpp | 6 +- lib/system-controller/CicoSCWindowController.cpp | 914 +++++---------------- lib/system-controller/CicoSCWindowController.h | 101 +-- lib/system-controller/CicoSCWlInputMgrIF.cpp | 150 +++- lib/system-controller/CicoSCWlInputMgrIF.h | 32 +- lib/system-controller/CicoSCWlWinMgrIF.cpp | 331 ++++++-- lib/system-controller/CicoSCWlWinMgrIF.h | 95 ++- lib/system-controller/Makefile.am | 5 +- packaging/ico-uxf-homescreen.changes | 6 - packaging/ico-uxf-homescreen.spec | 49 +- .../res/config/homescreen.conf | 4 - settings/ecore.sh | 6 - settings/weston.ini | 53 -- src/homescreen/CicoHSAppInfo.cpp | 46 +- src/homescreen/CicoHSControlBarWindow.cpp | 37 +- src/homescreen/CicoHSEFLApp.cpp | 3 +- src/homescreen/CicoHSMenuTile.cpp | 116 ++- src/homescreen/CicoHSMenuTile.h | 4 +- src/homescreen/CicoHSMenuWindow.cpp | 53 +- src/homescreen/CicoHSMenuWindow.h | 3 +- src/homescreen/CicoHSSwipeInputWindow.cpp | 2 + src/homescreen/CicoHSSwipeTouch.cpp | 2 +- src/homescreen/CicoHSSwipeTouch.h | 2 +- src/homescreen/CicoHSWindow.cpp | 91 +- src/homescreen/CicoHSWindow.h | 9 - src/homescreen/CicoHSWindowController.cpp | 37 +- src/homescreen/CicoHomeScreen.cpp | 216 +++-- src/homescreen/CicoHomeScreenCommon.h | 10 +- src/homescreen/Makefile.am | 5 +- src/onscreen/CicoOSPopWindow.cpp | 26 +- src/statusbar/CicoStatusBar.cpp | 21 - src/syscond/CicoSysConDaemon.cpp | 2 +- src/syscond/Makefile.am | 3 +- tests/Makefile.am | 4 + tests/homescreen/Makefile.am | 20 + tests/homescreen/homescreen-test-makedat.sh | 70 ++ tests/homescreen/homescreen-test-startall.sh | 45 + tests/homescreen/homescreen-test.sh | 76 ++ tests/homescreen/ico_send_hscommand.c | 263 ++++++ tests/homescreen/ico_set_vehicleinfo.c | 511 ++++++++++++ tests/homescreen/json/exec-app1.json | 17 + tests/homescreen/json/geom-app1-1.json | 16 + tests/homescreen/json/geom-app1-2.json | 16 + tests/homescreen/json/geom-app1-3.json | 16 + tests/homescreen/json/hide-tile.json | 14 + tests/homescreen/json/show-app1.json | 16 + tests/homescreen/json/show-tile.json | 14 + tests/homescreen/json/term-app1.json | 17 + tests/homescreen/testdata/gui-test-FHD-next.dat | 6 + tests/homescreen/testdata/gui-test-FHD.dat | 98 +++ tests/homescreen/testdata/gui-test-XGA-next.dat | 6 + tests/homescreen/testdata/gui-test-XGA.dat | 98 +++ .../testdata/gui-test-launch-template.dat | 6 + tests/system-controller/apps-framework/Makefile.am | 1 + tests/system-controller/test-dummy-hs/Makefile.am | 4 +- tool/Makefile.am | 14 +- tool/ico_clear_screen.c | 420 ++++++++++ tool/ico_clear_screen.h | 134 +++ tool/notification/Makefile.am | 60 ++ tool/notification/del_notification.cpp | 56 ++ tool/notification/dump_notification.cpp | 84 ++ tool/notification/send_notification.cpp | 200 +++++ tool/notification/send_notification2.cpp | 179 ++++ 89 files changed, 3701 insertions(+), 1457 deletions(-) delete mode 100644 settings/ecore.sh delete mode 100644 settings/weston.ini create mode 100644 tests/homescreen/Makefile.am create mode 100755 tests/homescreen/homescreen-test-makedat.sh create mode 100755 tests/homescreen/homescreen-test-startall.sh create mode 100755 tests/homescreen/homescreen-test.sh create mode 100644 tests/homescreen/ico_send_hscommand.c create mode 100644 tests/homescreen/ico_set_vehicleinfo.c create mode 100755 tests/homescreen/json/exec-app1.json create mode 100755 tests/homescreen/json/geom-app1-1.json create mode 100755 tests/homescreen/json/geom-app1-2.json create mode 100755 tests/homescreen/json/geom-app1-3.json create mode 100755 tests/homescreen/json/hide-tile.json create mode 100755 tests/homescreen/json/show-app1.json create mode 100755 tests/homescreen/json/show-tile.json create mode 100755 tests/homescreen/json/term-app1.json create mode 100644 tests/homescreen/testdata/gui-test-FHD-next.dat create mode 100644 tests/homescreen/testdata/gui-test-FHD.dat create mode 100644 tests/homescreen/testdata/gui-test-XGA-next.dat create mode 100644 tests/homescreen/testdata/gui-test-XGA.dat create mode 100644 tests/homescreen/testdata/gui-test-launch-template.dat create mode 100644 tool/ico_clear_screen.c create mode 100644 tool/ico_clear_screen.h create mode 100644 tool/notification/Makefile.am create mode 100644 tool/notification/del_notification.cpp create mode 100644 tool/notification/dump_notification.cpp create mode 100644 tool/notification/send_notification.cpp create mode 100644 tool/notification/send_notification2.cpp diff --git a/Makefile.am b/Makefile.am index 0ac0937..8826457 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,4 +2,5 @@ SUBDIRS= \ lib \ src \ tool \ - tests + tests \ + tool/notification diff --git a/configure.ac b/configure.ac index b1c2a25..d97c8ef 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) -AC_INIT([org.tizen.ico.homescreen], [0.9.31], []) +AC_INIT([org.tizen.ico.homescreen], [0.9.21], []) AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS([config.h]) @@ -91,6 +91,9 @@ WL_LIBS="$WAYLANDCLIENT_LIBS $WAYLANDCURSOR_LIBS" AC_SUBST(WL_CFLAGS) AC_SUBST(WL_LIBS) +WESTONPLUGIN_LIBS="-lico-uxf-weston-plugin" +AC_SUBST(WESTONPLUGIN_LIBS) + CFLAGS="$CFLAGS $EGL_CFLAGS" AC_SUBST(CFLAGS) @@ -135,6 +138,7 @@ AC_CONFIG_FILES([Makefile src/statusbar/Makefile src/onscreen/Makefile tool/Makefile + tool/notification/Makefile tests/Makefile tests/system-controller/Makefile tests/system-controller/apps-framework/Makefile]) diff --git a/data/lib/systemd/user/ico-system-controller.service b/data/lib/systemd/user/ico-system-controller.service index 16f01c5..29e00f4 100644 --- a/data/lib/systemd/user/ico-system-controller.service +++ b/data/lib/systemd/user/ico-system-controller.service @@ -9,3 +9,4 @@ Environment=TIZEN_PLATFORMLOGGING_MODE=1 Environment=TIZEN_DLOG_LEVEL=1 Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/dbus/user_bus_socket ExecStart=/bin/sh -l -c "/usr/apps/org.tizen.ico.system-controller/bin/IcoSysconDaemon --user app" + diff --git a/data/share/packages/org.tizen.ico.homescreen.xml b/data/share/packages/org.tizen.ico.homescreen.xml index 2c5d153..bdfdb75 100644 --- a/data/share/packages/org.tizen.ico.homescreen.xml +++ b/data/share/packages/org.tizen.ico.homescreen.xml @@ -1,5 +1,5 @@ - + IVI HomeScreen Application diff --git a/data/share/packages/org.tizen.ico.onscreen.xml b/data/share/packages/org.tizen.ico.onscreen.xml index 2c716bd..ee22d9c 100644 --- a/data/share/packages/org.tizen.ico.onscreen.xml +++ b/data/share/packages/org.tizen.ico.onscreen.xml @@ -1,5 +1,5 @@ - + IVI OnScreen Application diff --git a/data/share/packages/org.tizen.ico.statusbar.xml b/data/share/packages/org.tizen.ico.statusbar.xml index aeb4a1a..cbb8360 100644 --- a/data/share/packages/org.tizen.ico.statusbar.xml +++ b/data/share/packages/org.tizen.ico.statusbar.xml @@ -1,5 +1,5 @@ - + IVI StatusBar Application diff --git a/data/share/packages/org.tizen.ico.system-controller.xml b/data/share/packages/org.tizen.ico.system-controller.xml index 710f868..e0be7a8 100644 --- a/data/share/packages/org.tizen.ico.system-controller.xml +++ b/data/share/packages/org.tizen.ico.system-controller.xml @@ -1,5 +1,5 @@ - + ico system-controller diff --git a/include/ico_syc_inputctl.h b/include/ico_syc_inputctl.h index 65c7f6d..e38ac9e 100644 --- a/include/ico_syc_inputctl.h +++ b/include/ico_syc_inputctl.h @@ -16,6 +16,8 @@ #ifndef _ICO_SYC_INPUTCTL_H_ #define _ICO_SYC_INPUTCTL_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -41,10 +43,10 @@ typedef enum _input_alloc { * @ICO_SYC_INPUT_TYPE_SWITCH: switch event */ typedef enum _input_type { - ICO_SYC_INPUT_TYPE_POINTER = 1, - ICO_SYC_INPUT_TYPE_KEYBOARD = 2, - ICO_SYC_INPUT_TYPE_TOUCH = 4, - ICO_SYC_INPUT_TYPE_SWITCH = 8 + ICO_SYC_INPUT_TYPE_POINTER = ICO_INPUT_MGR_DEVICE_TYPE_POINTER, + ICO_SYC_INPUT_TYPE_KEYBOARD = ICO_INPUT_MGR_DEVICE_TYPE_KEYBOARD, + ICO_SYC_INPUT_TYPE_TOUCH = ICO_INPUT_MGR_DEVICE_TYPE_TOUCH, + ICO_SYC_INPUT_TYPE_SWITCH = ICO_INPUT_MGR_DEVICE_TYPE_SWITCH } ico_syc_input_type_e; /*============================================================================*/ diff --git a/include/ico_syc_type.h b/include/ico_syc_type.h index 141f6de..43db1f8 100644 --- a/include/ico_syc_type.h +++ b/include/ico_syc_type.h @@ -16,8 +16,7 @@ #ifndef _ICO_SYC_TYPE_H_ #define _ICO_SYC_TYPE_H_ -#include -#include +#include #ifdef __cplusplus extern "C" { @@ -195,16 +194,6 @@ typedef enum _state_onoff { ICO_SYC_STATE_ON = 1 /**< state of on */ } ico_syc_state_onoff_e; -/** - * window animation name - */ -#define ICO_SYC_WIN_ANIMATION_FADE "Fade" -#define ICO_SYC_WIN_ANIMATION_SLIDE "Slide" -#define ICO_SYC_WIN_ANIMATION_SLIDE_TOTOP "Slide.toTop" -#define ICO_SYC_WIN_ANIMATION_SLIDE_TOBUTTOM "Slide.toButtom" -#define ICO_SYC_WIN_ANIMATION_SLIDE_TOLEFT "Slide.toLeft" -#define ICO_SYC_WIN_ANIMATION_SLIDE_TORIGHT "Slide.toRight" - /*============================================================================*/ /* structure */ /*============================================================================*/ @@ -255,7 +244,7 @@ typedef struct _win_attr { typedef struct _thumb_info { char *appid; /* application id */ int surface; /* window's surface id */ - int type; /* buffer type */ + int type; /* buffer type(ICO_WINDOW_MGR_MAP_TYPE_EGL/SHM/PIXEL)*/ int width; /* window width */ int height; /* window height */ int stride; /* byte par line of frame buffer */ diff --git a/include/ico_syc_winctl.h b/include/ico_syc_winctl.h index 3fd6e8b..c95accc 100644 --- a/include/ico_syc_winctl.h +++ b/include/ico_syc_winctl.h @@ -16,6 +16,8 @@ #ifndef _ICO_SYC_WINCTL_H_ #define _ICO_SYC_WINCTL_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -106,6 +108,23 @@ int ico_syc_move(const char *appid, int surface, /*--------------------------------------------------------------------------*/ /** + * @brief ico_syc_set_animation + * Set the application window animation. + * + * @param[in] appid application id + * @param[in] surface window's surface id + * @param[in] type set animation target + * @param[in] animation animation information + * @return result + * @retval 0 success + * @retval not 0 error + */ +/*--------------------------------------------------------------------------*/ +int ico_syc_set_animation(const char *appid, int surface, int type, + const ico_syc_animation_t *animation); + +/*--------------------------------------------------------------------------*/ +/** * @brief ico_syc_change_active * Change the active window which receives the input-event notification * from System Controller. diff --git a/lib/apps-framework/Makefile.am b/lib/apps-framework/Makefile.am index de29944..a694060 100644 --- a/lib/apps-framework/Makefile.am +++ b/lib/apps-framework/Makefile.am @@ -1,11 +1,12 @@ lib_LTLIBRARIES = libico-appfw.la -COMMON_LIBS = -lm -lwebsockets -lilmCommon -lilmControl -lilmClient +COMMON_LIBS = -lm -lwebsockets -lico-uxf-weston-plugin -lilmCommon -lilmControl -lilmClient libico_appfw_la_CFLAGS = -I../../include $(OPT_CFLAGS) $(UWS_CFLAGS) \ $(AUL_CFLAGS) @ECORE_CFLAGS@ \ -I/usr/include/ilm \ -I/usr/include/layermanager \ + -I/usr/include/ico-uxf-weston-plugin \ -I/usr/include/ico-util libico_appfw_la_LIBADD = $(OPT_LIBS) $(WL_LIBS) $(AUL_LIBS) $(UWS_LIBS) $(COMMON_LIBS) @ECORE_LIBS@ diff --git a/lib/apps-framework/ico_syc_winctl.c b/lib/apps-framework/ico_syc_winctl.c index 3d33909..624e777 100644 --- a/lib/apps-framework/ico_syc_winctl.c +++ b/lib/apps-framework/ico_syc_winctl.c @@ -38,6 +38,8 @@ static msg_t _create_win_msg(const char *appid, int surface, static msg_t _create_win_move_msg(const char *appid, int surface, const ico_syc_win_move_t *move, const ico_syc_animation_t *animation); +static msg_t _create_win_animation_msg(const char *appid, int surface, + int type, const char *animation, int time); static msg_t _create_active_win_msg(const char *appid, int surface); static msg_t _create_change_layer_msg(const char *appid, int surface, int layer); static msg_t _create_map_get_msg(const char *appid, int surface, const char *filepath); @@ -187,6 +189,61 @@ _create_win_move_msg(const char *appid, int surface, /*--------------------------------------------------------------------------*/ /** + * @brief _create_win_animation_msg + * Create the message to set animation the application window. + * + * @param[in] appid application id + * @param[in] surface window's surface id + * @param[in] type set animation target + * @param[in] animation animation information + * @param[in] time animation time + * @return json generator + * @retval json generator success + * @retval NULL error + */ +/*--------------------------------------------------------------------------*/ +static msg_t +_create_win_animation_msg(const char *appid, int surface, + int type, const char *animation, int time) +{ + JsonObject *obj = NULL; + JsonObject *argobj = NULL; + JsonGenerator *gen = NULL; + JsonNode *root = NULL; + + /* create json object */ + obj = json_object_new(); + argobj = json_object_new(); + if (obj == NULL || argobj == NULL) { + _ERR("json_object_new failed"); + return NULL; + } + + /* set message */ + json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_ANIMATION); + json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid); + json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid()); + + json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface); + json_object_set_int_member(argobj, MSG_PRMKEY_ANIM_TYPE, type); + json_object_set_string_member(argobj, MSG_PRMKEY_ANIM_NAME, animation); + json_object_set_int_member(argobj, MSG_PRMKEY_ANIM_TIME, time); + + json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj); + + /* create root object */ + root = json_node_new(JSON_NODE_OBJECT); + json_node_take_object(root, obj); + + /* create generator object */ + gen = json_generator_new(); + json_generator_set_root(gen, root); + + return gen; +} + +/*--------------------------------------------------------------------------*/ +/** * @brief _create_active_win_msg * Create the message to change active window. * @@ -955,6 +1012,43 @@ ico_syc_move(const char *appid, int surface, /*--------------------------------------------------------------------------*/ /** + * @brief ico_syc_set_animation + * Set the application window animation. + * + * @param[in] appid application id + * @param[in] surface window's surface id + * @param[in] type set animation target + * @param[in] animation animation information + * @return result + * @retval 0 success + * @retval not 0 error + */ +/*--------------------------------------------------------------------------*/ +ICO_API int +ico_syc_set_animation(const char *appid, int surface, int type, + const ico_syc_animation_t *animation) +{ + int ret = ICO_SYC_ERR_NONE; + msg_t msg; + + /* check argument */ + if (appid == NULL) { + _ERR("invalid parameter (appid is NULL)"); + return ICO_SYC_ERR_INVALID_PARAM; + } + + /* make message */ + msg = _create_win_animation_msg(appid, surface, type, animation->name, animation->time); + /* send message */ + ret = ico_syc_send_msg(msg); + /* free send message */ + ico_syc_free_msg(msg); + + return ret; +} + +/*--------------------------------------------------------------------------*/ +/** * @brief ico_syc_change_active * Change the active window which receives the win-event notification * from System Controller. diff --git a/lib/common/CicoAilItems.cpp b/lib/common/CicoAilItems.cpp index 2454aa0..9a46239 100644 --- a/lib/common/CicoAilItems.cpp +++ b/lib/common/CicoAilItems.cpp @@ -90,8 +90,8 @@ CicoAilItems::CicoAilItems(const CicoAilItems &s) */ CicoAilItems::~CicoAilItems() { -// ICO_TRA("start"); -// ICO_TRA("end"); + ICO_TRA("start"); + ICO_TRA("end"); } /** * @brief init member @@ -604,8 +604,8 @@ bool CicoAilItems::categoryGetInput(const string& inputDev, } CicoSystemConfig* CSCSC = CicoSystemConfig::getInstance(); - m_inputDev = CSCSC->getInputDevIdbyName(inputDev); - ICO_DBG("input %s->%d", inputDev.c_str(), m_inputDev); + m_sound = CSCSC->getInputDevIdbyName(inputDev); + ICO_DBG("sound %s->%d", inputDev.c_str(), m_sound); if (false == sw.empty()) { m_switch = CSCSC->getSwitchIdbyName(inputDev, sw); ICO_DBG("switch %s, %s->%d", inputDev.c_str(), sw.c_str(), m_switch); diff --git a/lib/common/CicoAulItems.cpp b/lib/common/CicoAulItems.cpp index c04e1ad..88ff3b1 100644 --- a/lib/common/CicoAulItems.cpp +++ b/lib/common/CicoAulItems.cpp @@ -93,7 +93,7 @@ CicoAulItems::CicoAulItems(const CicoAulItems& s) */ CicoAulItems::~CicoAulItems() { -// ICO_TRA("CicoAulItems::~CicoAulItems"); + ICO_TRA("CicoAulItems::~CicoAulItems"); m_CSCWptrs.clear(); } diff --git a/lib/common/CicoSound.cpp b/lib/common/CicoSound.cpp index e084590..b7241e1 100644 --- a/lib/common/CicoSound.cpp +++ b/lib/common/CicoSound.cpp @@ -174,7 +174,7 @@ CicoSound::PlaySound(std::string & soundFile) { int pid; char command[256]; - + if (false == m_initialized) { return false; } @@ -196,7 +196,7 @@ CicoSound::PlaySound(std::string & soundFile) ICO_DBG("PlaySound:system(%s)", command); pid = fork(); if (!pid) { - (void) system(command); + system(command); exit(0); } diff --git a/lib/common/CicoSystemConfig.cpp b/lib/common/CicoSystemConfig.cpp index bb812d2..7da8c63 100644 --- a/lib/common/CicoSystemConfig.cpp +++ b/lib/common/CicoSystemConfig.cpp @@ -101,7 +101,6 @@ CicoSystemConfig::getInstance(void) { if (NULL == ms_myInstance) { ms_myInstance = new CicoSystemConfig(); - ms_myInstance->load(ICO_SYSTEM_CONFIG_PATH); } return ms_myInstance; } diff --git a/lib/common/CicoSystemConfig.h b/lib/common/CicoSystemConfig.h index 04a8219..7126c7f 100644 --- a/lib/common/CicoSystemConfig.h +++ b/lib/common/CicoSystemConfig.h @@ -52,11 +52,6 @@ class CicoSCPositionOSConf; #endif //========================================================================== -// Default configuration file -//========================================================================== -#define ICO_SYSTEM_CONFIG_PATH "/usr/apps/org.tizen.ico.system-controller/res/config/system.xml" - -//========================================================================== /** * @brief This class has function of access to system config information */ diff --git a/lib/system-controller/CicoSCInputController.cpp b/lib/system-controller/CicoSCInputController.cpp index 4b58924..6f06309 100644 --- a/lib/system-controller/CicoSCInputController.cpp +++ b/lib/system-controller/CicoSCInputController.cpp @@ -40,6 +40,11 @@ using namespace std; //-------------------------------------------------------------------------- CicoSCInputController::CicoSCInputController() { + CicoSCWayland* wayland = CicoSCWayland::getInstance(); + wayland->addWaylandIF(ICO_WL_INPUT_MGR_CTRL_IF, this); + wayland->addWaylandIF(ICO_WL_EXINPUT_IF, this); + wayland->addWaylandIF(ICO_WL_INPUT_MGR_DEV_IF, this); + } //-------------------------------------------------------------------------- @@ -274,6 +279,7 @@ CicoSCInputController::unsetInputRegion(const string &appid, * @brief callback to application for input switch information * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] device input device name * @param [in] type input device type (as enum type) * @param [in] swname input switch name @@ -284,6 +290,7 @@ CicoSCInputController::unsetInputRegion(const string &appid, //-------------------------------------------------------------------------- void CicoSCInputController::capabilitiesCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t type, const char *swname, @@ -333,6 +340,7 @@ CicoSCInputController::capabilitiesCB(void *data, * @brief callback to application for input code information * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] device input device name * @param [in] input input switch number * @param [in] codename input code name @@ -341,6 +349,7 @@ CicoSCInputController::capabilitiesCB(void *data, //-------------------------------------------------------------------------- void CicoSCInputController::codeCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t input, const char *codename, @@ -379,6 +388,7 @@ CicoSCInputController::codeCB(void *data, * @brief callback to application for switch input * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] time input time of millisecond * @param [in] device input device name * @param [in] input input switch number @@ -388,6 +398,7 @@ CicoSCInputController::codeCB(void *data, //-------------------------------------------------------------------------- void CicoSCInputController::inputCB(void *data, + struct ico_exinput *ico_exinput, uint32_t time, const char *device, int32_t input, @@ -416,11 +427,13 @@ CicoSCInputController::inputCB(void *data, * @brief callback to application for change input region * * @param [in] data user data + * @param [in] ico_input_mgr_dev wayland ico_exinput interface * @param [in] region input regions */ //-------------------------------------------------------------------------- void CicoSCInputController::regionCB(void *data, + struct ico_input_mgr_device *ico_input_mgr_dev, struct wl_array *region) { ICO_TRA("CicoSCInputController::regionCB Enter"); diff --git a/lib/system-controller/CicoSCInputController.h b/lib/system-controller/CicoSCInputController.h index 1d7efb2..41999f7 100644 --- a/lib/system-controller/CicoSCInputController.h +++ b/lib/system-controller/CicoSCInputController.h @@ -86,6 +86,7 @@ public: // callback to application for input switch information void capabilitiesCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t type, const char *swname, @@ -95,6 +96,7 @@ public: // callback to application for input code information void codeCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t input, const char *codename, @@ -102,6 +104,7 @@ public: // callback to application for switch input void inputCB(void *data, + struct ico_exinput *ico_exinput, uint32_t time, const char *device, int32_t input, @@ -110,6 +113,7 @@ public: // callback to application for change input region void regionCB(void *data, + struct ico_input_mgr_device *ico_input_mgr_device, struct wl_array *region); protected: diff --git a/lib/system-controller/CicoSCLayer.cpp b/lib/system-controller/CicoSCLayer.cpp index 933ccb1..95f4acc 100644 --- a/lib/system-controller/CicoSCLayer.cpp +++ b/lib/system-controller/CicoSCLayer.cpp @@ -64,7 +64,7 @@ CicoSCLayer::addSurface(int surfaceid, bool top) { int idx, idx2; int *wksurfaceids; - ICO_DBG("CicoSCLayer::addSurface(%d,%08x,%d)", layerid, surfaceid, top); + ICO_DBG("CicoSCLayer::addSurface(%08x,%d)", surfaceid, top); idx2 = 0; for (idx = 0; idx < numsurfaces; idx++) { @@ -108,7 +108,7 @@ void CicoSCLayer::removeSurface(int surfaceid) { int idx, idx2; - ICO_DBG("CicoSCLayer::removeSurface(%d,%08x)", layerid, surfaceid); + ICO_DBG("CicoSCLayer::removeSurface(%08x)", surfaceid); idx2 = 0; for (idx = 0; idx < numsurfaces; idx++) { diff --git a/lib/system-controller/CicoSCLayer.h b/lib/system-controller/CicoSCLayer.h index 7c0b914..b54d20a 100644 --- a/lib/system-controller/CicoSCLayer.h +++ b/lib/system-controller/CicoSCLayer.h @@ -55,7 +55,7 @@ private: public: int layerid; //!< layer id - int type; //!< layer attribute + int type; //!< enum ico_window_mgr_layer_attr int width; //!< The number of the lateral pixels int height; //!< The number of vertical pixels int displayid; //!< display ID diff --git a/lib/system-controller/CicoSCResourceManager.cpp b/lib/system-controller/CicoSCResourceManager.cpp index e894f13..9e97a1d 100644 --- a/lib/system-controller/CicoSCResourceManager.cpp +++ b/lib/system-controller/CicoSCResourceManager.cpp @@ -585,7 +585,7 @@ CicoSCResourceManager::releaseDisplayResource(resource_request_t *newreq) if (true == active) { resource_request_t* popreq = popWaitingDispResReq(*itr); updateDisplayResource(popreq); - m_winCtrl->activeCB(NULL, popreq->surfaceid, -1); + m_winCtrl->activeCB(NULL, NULL, popreq->surfaceid, -1); break; } } @@ -1004,7 +1004,7 @@ CicoSCResourceManager::updateDisplayResource(resource_request_t *req, // show request window m_winCtrl->show(req->surfaceid, req->animation, req->animationTime); #if 0 - m_winCtrl->activeCB(NULL, req->surfaceid, -1); + m_winCtrl->activeCB(NULL, NULL, req->surfaceid, -1); #endif ICO_TRA("CicoSCResourceManager::updateDisplayResource Leave"); return; diff --git a/lib/system-controller/CicoSCSysResourceController.cpp b/lib/system-controller/CicoSCSysResourceController.cpp index 297fa13..06cb008 100644 --- a/lib/system-controller/CicoSCSysResourceController.cpp +++ b/lib/system-controller/CicoSCSysResourceController.cpp @@ -56,6 +56,8 @@ static Eina_Bool ico_SCResourceWatch(void *data) } CicoSCSysResourceController* oCSCSRC = (CicoSCSysResourceController*)data; oCSCSRC->watch(); +// double tVal = (double)g_samplingWaitTimer / 100; +// ecore_timer_add(g_samplingWaitTimer, ico_SCResourceWatch, data); if (g_RC_LOG) ICO_TRA("end"); return ECORE_CALLBACK_RENEW; } @@ -148,7 +150,7 @@ bool CicoSCSysResourceController::startSysResource() return false; } // cpu,cpuacct cgroup init - init_cgroup(); // cgroup + init_cgroup(); // cgroup m_monitor = new CicoSCSysResourceMonitor(); CicoSystemConfig* CSCSC = CicoSystemConfig::getInstance(); string filePath(CSCSC->getDefaultConf()->confdir); diff --git a/lib/system-controller/CicoSCWayland.cpp b/lib/system-controller/CicoSCWayland.cpp index 1774275..a9ae56b 100644 --- a/lib/system-controller/CicoSCWayland.cpp +++ b/lib/system-controller/CicoSCWayland.cpp @@ -28,6 +28,7 @@ using namespace std; #include +#include #include #include "CicoSCWayland.h" diff --git a/lib/system-controller/CicoSCWaylandIF.cpp b/lib/system-controller/CicoSCWaylandIF.cpp index cdafa74..694250d 100644 --- a/lib/system-controller/CicoSCWaylandIF.cpp +++ b/lib/system-controller/CicoSCWaylandIF.cpp @@ -18,10 +18,12 @@ #include "CicoSCWaylandIF.h" #include "CicoLog.h" -const char * CicoSCWaylandIF::ICO_WL_IVI_CONTROLLER_IF = "ivi_controller"; -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ +const char * CicoSCWaylandIF::ICO_WL_WIN_MGR_IF = "ico_window_mgr"; +const char * CicoSCWaylandIF::ICO_WL_INPUT_MGR_CTRL_IF = "ico_input_mgr_control"; +const char * CicoSCWaylandIF::ICO_WL_EXINPUT_IF = "ico_exinput"; +const char * CicoSCWaylandIF::ICO_WL_INPUT_MGR_DEV_IF = "ico_input_mgr_device"; const char * CicoSCWaylandIF::ICO_WL_IVI_APPLICATION_IF= "ivi_application"; -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ +const char * CicoSCWaylandIF::ICO_WL_IVI_CONTROLLER_IF = "ivi_controller"; const char * CicoSCWaylandIF::ICO_WL_OUTPUT_IF = "wl_output"; diff --git a/lib/system-controller/CicoSCWaylandIF.h b/lib/system-controller/CicoSCWaylandIF.h index 97fb656..2e4a938 100644 --- a/lib/system-controller/CicoSCWaylandIF.h +++ b/lib/system-controller/CicoSCWaylandIF.h @@ -50,13 +50,19 @@ protected: CicoSCWaylandIF(const CicoSCWaylandIF &object); protected: - // interface name of genivi ivi_controller - static const char * ICO_WL_IVI_CONTROLLER_IF; -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ - // interface name of genivi ivi_application + /// interface name of wayland multi window manager + static const char * ICO_WL_WIN_MGR_IF; + /// interface name of wayland input manager control + static const char * ICO_WL_INPUT_MGR_CTRL_IF; + /// interface name of wayland exinput + static const char * ICO_WL_EXINPUT_IF; + /// interface name of wayland input manager device + static const char * ICO_WL_INPUT_MGR_DEV_IF; + /// interface name of genivi ivi_application static const char * ICO_WL_IVI_APPLICATION_IF; -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ - // interface name of wayland output + /// interface name of genivi ivi_controller + static const char * ICO_WL_IVI_CONTROLLER_IF; + /// interface name of wayland output static const char * ICO_WL_OUTPUT_IF; // initialized flag diff --git a/lib/system-controller/CicoSCWindow.cpp b/lib/system-controller/CicoSCWindow.cpp index 996d470..bb36f50 100644 --- a/lib/system-controller/CicoSCWindow.cpp +++ b/lib/system-controller/CicoSCWindow.cpp @@ -44,11 +44,9 @@ CicoSCWindow::CicoSCWindow() //-------------------------------------------------------------------------- CicoSCWindow::~CicoSCWindow() { -// ICO_TRA("CicoSCWindow::~CicoSCWindow Enter"); -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ + ICO_TRA("CicoSCWindow::~CicoSCWindow Enter"); CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(surfaceid); -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ -// ICO_TRA("CicoSCWindow::~CicoSCWindow Leave"); + ICO_TRA("CicoSCWindow::~CicoSCWindow Leave"); } //-------------------------------------------------------------------------- diff --git a/lib/system-controller/CicoSCWindowController.cpp b/lib/system-controller/CicoSCWindowController.cpp index 0e41242..d973906 100644 --- a/lib/system-controller/CicoSCWindowController.cpp +++ b/lib/system-controller/CicoSCWindowController.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -57,16 +56,6 @@ using namespace std; //========================================================================== CicoSCWindowController* CicoSCWindowController::ms_myInstance = NULL; -struct ico_sc_win_check_t* CicoSCWindowController::win_check_timer = NULL; -struct ico_sc_win_check_t* CicoSCWindowController::win_check_free = NULL; - -//========================================================================== -// static function for Ecore timer -//========================================================================== -static Ecore_Timer* g_SCWindowChecker = 0; -static struct timeval g_lasttime = { 0, 0 }; -static int g_hightimer = 0; - //-------------------------------------------------------------------------- /** * @brief get instance of CicoSCWindowController @@ -92,17 +81,13 @@ CicoSCWindowController::CicoSCWindowController() : m_resMgr(NULL), m_physicalDisplayTotal(0) { CicoSCWayland* wayland = CicoSCWayland::getInstance(); - wayland->getInstance()->addWaylandIF(ICO_WL_IVI_CONTROLLER_IF, this); -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ + wayland->getInstance()->addWaylandIF(ICO_WL_WIN_MGR_IF, this); wayland->getInstance()->addWaylandIF(ICO_WL_IVI_APPLICATION_IF, this); -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ + wayland->getInstance()->addWaylandIF(ICO_WL_IVI_CONTROLLER_IF, this); wayland->getInstance()->addWaylandIF(ICO_WL_OUTPUT_IF, this); initDB(); CicoSCWindowController::ms_myInstance = this; - - g_SCWindowChecker = ecore_timer_add(((double)ICO_SC_WINCHK_TIMER_BASE_L)/1000.0, - ico_SCWindowChecker, this); } //-------------------------------------------------------------------------- @@ -239,7 +224,7 @@ CicoSCWindowController::show(int surfaceid, } } - // set animation request + // set animation request to Multi Window Manager int raiseFlag = ICO_SYC_WIN_RAISE_NOCHANGE; if (type & ICO_SYC_WIN_SURF_RAISE) { raiseFlag = ICO_SYC_WIN_RAISE_RAISE; @@ -251,14 +236,14 @@ CicoSCWindowController::show(int surfaceid, (false == window->raise)) { raiseFlag = ICO_SYC_WIN_RAISE_RAISE; } - if ((animationTime > 0) && (NULL != animation) && - (animation[0] != '\0') && (strcasecmp(animation, "none") != 0)) { - // set animation - setWindowAnimation(window, ICO_SC_WINANIMA_SHOW, animation, animationTime); - } - else { - // reset animation - resetWindowAnimation(window); + if ((NULL != animation) && (animation[0] != '\0')) { + // set animation request to Multi Window Manager + CicoSCWlWinMgrIF::setAnimation(window->surfaceid, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, + animation, animationTime); } // set raise/lower request (if need) @@ -266,7 +251,7 @@ CicoSCWindowController::show(int surfaceid, raiselower(window, (raiseFlag == ICO_SYC_WIN_RAISE_RAISE)); } - // set visible request + // set visible request to Multi Window Manager CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_SYC_WIN_VISIBLE_SHOW); // flush display @@ -382,17 +367,19 @@ CicoSCWindowController::hide(int surfaceid, } } - if ((animationTime > 0) && (NULL != animation) && - (animation[0] != '\0') && (strcasecmp(animation, "none") != 0)) { - // set animation - setWindowAnimation(window, ICO_SC_WINANIMA_HIDE, animation, animationTime); - } - else { - // reset animation - resetWindowAnimation(window); - CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_SYC_WIN_VISIBLE_HIDE); + // set animation request to Multi Window Manager + if ((NULL != animation) && (animation[0] != '\0')) { + CicoSCWlWinMgrIF::setAnimation(window->surfaceid, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE, + animation, animationTime); } + // set visible request to Multi Window Manager + CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_SYC_LAYER_VISIBLE_HIDE); + // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -438,7 +425,17 @@ CicoSCWindowController::resize(int surfaceid, return ICO_SYC_ENOENT; } - // set visible request + // set animation request to Multi Window Manager + if ((NULL != animation) && (animation[0] != '\0')) { + CicoSCWlWinMgrIF::setAnimation(window->surfaceid, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE, + animation, animationTime); + } + + // set visible request to Multi Window Manager window->width = w; window->height = h; CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, window->nodeid, @@ -498,12 +495,22 @@ CicoSCWindowController::move(int surfaceid, return ICO_SYC_ENOENT; } + // set animation request to Multi Window Manager + if ((NULL != animation) && (animation[0] != '\0')) { + CicoSCWlWinMgrIF::setAnimation(window->surfaceid, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE, + animation, animationTime); + } + int moveNodeId = ICO_SYC_WIN_NOCHANGE; if (nodeid >= 0) { moveNodeId = nodeid; } - // set visible request + // set visible request to Multi Window Manager window->x = x; window->y = y; CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, @@ -551,7 +558,16 @@ CicoSCWindowController::raise(int surfaceid, return ICO_SYC_ENOENT; } - // set raise request + // set animation request to Multi Window Manager + if ((NULL != animation) && (animation[0] != '\0')) { + CicoSCWindowController::setAnimation(window->surfaceid, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, + animation, animationTime); + } + // set raise request to Multi Window Manager raiselower(window, true); if (ilm_commitChanges() != ILM_SUCCESS) { ICO_ERR("CicoSCWindowController::raise ilm_commitChanges() Error"); @@ -621,6 +637,22 @@ CicoSCWindowController::setGeometry(int surfaceid, return ICO_SYC_ENOENT; } + // set animation request to Multi Window Manager + const char *animation = ""; + if (NULL != resizeAnimation) { + animation = resizeAnimation; + } + CicoSCWlWinMgrIF::setAnimation(window->surfaceid, + ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE, + animation, resizeAnimationTime); + + if (NULL != moveAnimation) { + animation = moveAnimation; + } + CicoSCWlWinMgrIF::setAnimation(window->surfaceid, + ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE, + animation, moveAnimationTime); + int moveNodeId = ICO_SYC_WIN_NOCHANGE; if (nodeid >= 0) { moveNodeId = nodeid; @@ -660,7 +692,7 @@ CicoSCWindowController::setGeometry(int surfaceid, window->height = h; } - // set window layer + // set window layer to Multi Window Manager if (0 <= layerid) { setWindowLayer(window->surfaceid, layerid); } @@ -668,7 +700,7 @@ CicoSCWindowController::setGeometry(int surfaceid, // update window attr window->nodeid = moveNodeId; - // set visible request + // set visible request to Multi Window Manager CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, moveNodeId, moveX, moveY, moveW, moveH); @@ -828,7 +860,17 @@ CicoSCWindowController::lower(int surfaceid, return ICO_SYC_ENOENT; } - // set lower request + // set animation request to Multi Window Manager + if ((NULL != animation) && (animation[0] != '\0')) { + CicoSCWlWinMgrIF::setAnimation(window->surfaceid, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, + animation, animationTime); + } + + // set lower request to Multi Window Manager raiselower(window, false); if (ilm_commitChanges() != ILM_SUCCESS) { ICO_ERR("CicoSCWindowController::lower ilm_commitChanges() Error"); @@ -843,6 +885,50 @@ CicoSCWindowController::lower(int surfaceid, //-------------------------------------------------------------------------- /** + * @brief set window(surface) animation + * + * @param [in] surfaceid wayland surface id + * @param [in] target target(pointer and/or keyboard) + * @param [in] type set animation target + * @param [in] animation animation information + * @param [in] time animation time + * + * @return ICO_SYC_EOK on success, other on error + * @retval ICO_SYC_EOK success + * @retval ICO_SYC_ESRCH error(not initialized) + * @retval ICO_SYC_ENOENT error(layer dose not exist) + */ +//-------------------------------------------------------------------------- +int +CicoSCWindowController::setWindowAnimation(int surfaceid, int type, + const char *animation, int time) +{ + CicoSCWindow *window = NULL; + + ICO_TRA("CicoSCWindowController::setWindowAnimation Enter" + "(surfaceid=%08x, type=%x, animation=<%s>, time=%d)", + surfaceid, type, animation ? animation : "(null)", time); + + // find window information in window list + window = findWindow(surfaceid); + if (NULL == window) { + ICO_WRN("not found window information"); + ICO_TRA("CicoSCWindowController::setWindowAnimation Leave(ENOENT)"); + return ICO_SYC_ENOENT; + } + + // set animation request to Multi Window Manager + CicoSCWlWinMgrIF::setAnimation(surfaceid, type, animation, time); + + // flush display + CicoSCWayland::getInstance()->flushDisplay(); + + ICO_TRA("CicoSCWindowController::setWindowAnimation Leave(EOK)"); + return ICO_SYC_EOK; +} + +//-------------------------------------------------------------------------- +/** * @brief set window layer * * @param [in] surfaceid wayland surface id @@ -989,7 +1075,8 @@ CicoSCWindowController::showLayer(int displayid, int layerid) int CicoSCWindowController::hideLayer(int displayid, int layerid) { - ICO_TRA("CicoSCWindowController::hideLayer Enter(displayid=%d layerid=%d)", + ICO_TRA("CicoSCWindowController::hideLayer Enter" + "displayid=%d layerid=%d)", displayid, layerid); // find layer information in layer list @@ -1005,7 +1092,7 @@ CicoSCWindowController::hideLayer(int displayid, int layerid) // flush display CicoSCWayland::getInstance()->flushDisplay(); - ICO_TRA("CicoSCWindowController::hideLayer Leave(EOK)"); + ICO_TRA("CicoSCWindowController::hideVisible Leave(EOK)"); return ICO_SYC_EOK; } @@ -1044,7 +1131,7 @@ CicoSCWindowController::active(int surfaceid, int target) target = 0xffff; } - // set active request + // set active request to Multi Window Manager CicoSCWlWinMgrIF::setActive(surfaceid, target); // flush display @@ -1128,7 +1215,8 @@ CicoSCWindowController::mapSurface(int surfaceid, int framerate, const char *fil return ICO_SYC_ENOENT; } - setWindowMap(window, framerate, filepath); + CicoSCWlWinMgrIF::mapSurface(surfaceid, framerate, filepath); + CicoSCWayland::getInstance()->flushDisplay(); ICO_TRA("CicoSCWindowController::mapSurface Leave(EOK)"); return ICO_SYC_EOK; @@ -1159,7 +1247,8 @@ CicoSCWindowController::unmapSurface(int surfaceid) return ICO_SYC_ENOENT; } - resetWindowMap(surfaceid); + CicoSCWlWinMgrIF::unmapSurface(surfaceid); + CicoSCWayland::getInstance()->flushDisplay(); ICO_TRA("CicoSCWindowController::unmapSurface Leave(EOK)"); return ICO_SYC_EOK; @@ -1203,7 +1292,8 @@ CicoSCWindowController::getDisplayedWindow(int zoneid) int CicoSCWindowController::setAttributes(int surfaceid) { - ICO_TRA("CicoSCWindowController::setAttributes Enter(surfaceid=%08x)", surfaceid); + ICO_TRA("CicoSCWindowController::setAttributes Enter" + "(surfaceid=%08x)", surfaceid); // find window information in window list CicoSCWindow *window = findWindow(surfaceid); @@ -1246,18 +1336,20 @@ CicoSCWindowController::setAttributes(int surfaceid) * @brief wayland surface active callback * * @param [in] data user data(unused) - * @param [in] surfaceid surface Id + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid ico_window_mgr surface Id * @param [in] select select device(unused) * (0=not active/1=pointer/2=touch) */ //-------------------------------------------------------------------------- void CicoSCWindowController::activeCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid, int32_t select) { - ICO_TRA("CicoSCWindowController::activeCB Enter(surfaceid=%08x select=%d)", - surfaceid, select); + ICO_TRA("CicoSCWindowController::activeCB Enter" + "(surfaceid=%08x select=%d)", surfaceid, select); CicoSCWindow *window = findWindow(surfaceid); if (NULL == window) { @@ -1292,6 +1384,8 @@ CicoSCWindowController::activeCB(void *data, /** * @brief surface map event callback * + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface * @param [in] event event * @param [in] surfaceid surface Id * @param [in] type surface type (EGL buffer/Shared memory) @@ -1302,32 +1396,36 @@ CicoSCWindowController::activeCB(void *data, */ //-------------------------------------------------------------------------- void -CicoSCWindowController::mapSurfaceCB(int32_t event, - uint32_t surfaceid, - uint32_t type, - int32_t width, - int32_t height, - int32_t stride, +CicoSCWindowController::mapSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + int32_t event, + uint32_t surfaceid, + uint32_t type, + int32_t width, + int32_t height, + int32_t stride, uint32_t format) { - int command; + int command; - ICO_TRA("CicoSCWindowController::mapSurfaceCB Enter(ev=%d surf=%d[%x] w/h=%d/%d)", - event, surfaceid, surfaceid, width, height); + ICO_TRA("CicoSCWindowController::mapSurfaceCB Enter(ev=%d surf=%x " + "type=%d w/h=%d/%d stride=%d form=%x)", + event, surfaceid, type, width, height, stride, format); CicoSCWindow *window = findWindow(surfaceid); if (NULL == window) { - ICO_TRA("CicoSCWindowController::mapSurfaceCB Leave(NOENT)"); return; } // convert event to command switch (event) { - case ICO_SC_WINCHK_MAP_SURFACE_EVENT_MAP: - case ICO_SC_WINCHK_MAP_SURFACE_EVENT_CONTENTS: + case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS: + case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_RESIZE: + case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP: command = MSG_CMD_MAP_THUMB; break; - case ICO_SC_WINCHK_MAP_SURFACE_EVENT_UNMAP: + case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP: + case ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR: command = MSG_CMD_UNMAP_THUMB; break; default: @@ -1352,50 +1450,34 @@ CicoSCWindowController::mapSurfaceCB(int32_t event, //-------------------------------------------------------------------------- /** - * @brief surface update event callback from GENIVI-LM - * - * @param [in] surfaceid surface Id - * @param [in] surfprop surface Properties - * @param [in] maek attribute change mask bits(unused) - */ -//-------------------------------------------------------------------------- -void -CicoSCWindowController::wlGeniviSurfaceNotification(t_ilm_surface surfaceid, - struct ilmSurfaceProperties *surfprop, - t_ilm_notification_mask mask) -{ - ICO_TRA("CicoSCWindowController::wlGeniviSurfaceNotification(%d(%x),,%x)", - surfaceid, surfaceid, mask); - - if (mask & (ILM_NOTIFICATION_VISIBILITY | ILM_NOTIFICATION_SOURCE_RECT | - ILM_NOTIFICATION_DEST_RECT)) { - CicoSCWindowController::getInstance()-> - updateSurfaceCB((uint32_t)surfaceid, surfprop); - } - else if (mask & ILM_NOTIFICATION_CONTENT_REMOVED) { - CicoSCWindowController::getInstance()-> - destroySurfaceCB((uint32_t)surfaceid); - } -} - -//-------------------------------------------------------------------------- -/** * @brief surface update event callback * + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface * @param [in] surfaceid surface Id - * @param [in] surfprop surface Properties + * @param [in] visible visibility + * @param [in] srcwidth application buffer width + * @param [in] srcheight application buffer height + * @param [in] x X + * @param [in] y Y + * @param [in] width width + * @param [in] height height */ //-------------------------------------------------------------------------- void -CicoSCWindowController::updateSurfaceCB(uint32_t surfaceid, - struct ilmSurfaceProperties *surfprop) +CicoSCWindowController::updateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height) { - ICO_TRA("CicoSCWindowController::updateSurfaceCB: Enter" - "(%08x pid=%d v=%d,x/y=%d/%d,w/h=%d/%d->%d/%d)", - surfaceid, surfprop->creatorPid, surfprop->visibility, - surfprop->destX, surfprop->destY, - surfprop->sourceWidth, surfprop->sourceHeight, - surfprop->destWidth, surfprop->destHeight); + ICO_TRA("CicoSCWindowController::updateSurfaceCB: Enter(%08x %d,%d,%d,%d,%d,%d,%d)", + surfaceid, visible, srcwidth, srcheight, x, y, width, height); CicoSCWindow *window = findWindow(surfaceid); if (NULL == window) { @@ -1406,13 +1488,13 @@ CicoSCWindowController::updateSurfaceCB(uint32_t surfaceid, } // update attr - window->visible = surfprop->visibility; - window->srcwidth = surfprop->sourceWidth; - window->srcheight = surfprop->sourceHeight; - window->x = surfprop->destX; - window->y = surfprop->destY; - window->width = surfprop->destWidth; - window->height = surfprop->destHeight; + window->visible = visible; + window->srcwidth = srcwidth; + window->srcheight = srcheight; + window->x = x; + window->y = y; + window->width = width; + window->height = height; window->nodeid = window->layerid / ICO_SC_LAYERID_SCREENBASE; // notify to homescreen @@ -1446,11 +1528,15 @@ CicoSCWindowController::updateSurfaceCB(uint32_t surfaceid, /** * @brief wayland surface destroy callback * - * @param [in] surfaceid surface Id + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid ico_window_mgr surface Id */ //-------------------------------------------------------------------------- void -CicoSCWindowController::destroySurfaceCB(uint32_t surfaceid) +CicoSCWindowController::destroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid) { ICO_TRA("CicoSCWindowController::destroySurfaceCB: Enter(%08x)", surfaceid); @@ -1461,9 +1547,6 @@ CicoSCWindowController::destroySurfaceCB(uint32_t surfaceid) return; } - // remove window check - CicoSCWindowController::windowCheckerRemove(surfaceid); - // delete surface from layer CicoSCLayer* layer = findLayer(window->displayid, window->layerid); if (NULL == layer) { @@ -1595,7 +1678,7 @@ CicoSCWindowController::outputGeometryCB(void *data, x, y, physical_width, physical_height, subpixel, make, model, transform); - ++ m_physicalDisplayTotal; + ++m_physicalDisplayTotal; if (0 == m_displayList.size()) { ICO_TRA("CicoSCWindowController::outputGeometryCB Leave" "(display is zero)"); @@ -1692,6 +1775,7 @@ CicoSCWindowController::createSurfaceCB(void *data, struct ivi_controller *ivi_controller, uint32_t id_surface) { + int pid; struct ilmSurfaceProperties SurfaceProperties; ICO_TRA("CicoSCWindowController::createSurfaceCB Enter" @@ -1702,24 +1786,14 @@ CicoSCWindowController::createSurfaceCB(void *data, id_surface); return; } - ICO_TRA("createSurfaceCB: surface=%d(0x%08x) pid=%d w/h=%d/%d(%d/%d)->%d/%d", - id_surface, id_surface, SurfaceProperties.creatorPid, - SurfaceProperties.sourceWidth, SurfaceProperties.sourceHeight, - SurfaceProperties.origSourceWidth, SurfaceProperties.origSourceHeight, + ICO_TRA("createSurfaceCB: surface=%08x w/h=%d/%d->%d/%d", + id_surface, SurfaceProperties.sourceWidth, SurfaceProperties.sourceHeight, SurfaceProperties.destWidth, SurfaceProperties.destHeight); -#if 1 /* 2014/08/20 workaround, SurfaceProperties.creatorPid not set */ - if (SurfaceProperties.creatorPid == 0) { - SurfaceProperties.creatorPid = (id_surface - 6000) / 100; - ICO_WRN("createSurfaceCB: surface=%d(0x%08x) pid is Zero, workaround to %d", - id_surface, id_surface, SurfaceProperties.creatorPid); - } -#endif - CicoSCWindow* window = new CicoSCWindow(); window->surfaceid = id_surface; - window->name = ""; - window->pid = SurfaceProperties.creatorPid; + window->name = CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(id_surface, &pid); + window->pid = pid; window->displayid = 0; // currently fixed 0 window->raise = 1; // created surface is top of layer window->srcwidth = SurfaceProperties.sourceWidth; @@ -1728,18 +1802,6 @@ CicoSCWindowController::createSurfaceCB(void *data, window->height = SurfaceProperties.destHeight; window->layerid = 0; -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ - const char *title = CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(id_surface, &pid); - - if (title) { - window->name = title; - window->pid = pid; - } - else { - ICO_WRN("Could not find window title!"); - } -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ - CicoSCLifeCycleController* appctrl; appctrl = CicoSCLifeCycleController::getInstance(); const CicoAilItems* ailItem = NULL; @@ -1749,7 +1811,7 @@ CicoSCWindowController::createSurfaceCB(void *data, ICO_DBG("application information not found. search parent process"); int fd; - int cpid = window->pid; + int cpid = pid; int ppid; int size; char *ppid_line; @@ -1926,14 +1988,6 @@ CicoSCWindowController::createSurfaceCB(void *data, else { show(window->surfaceid, NULL, 0); } - - // set surface change notification - if (ilm_surfaceAddNotification(window->surfaceid, wlGeniviSurfaceNotification) - != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::createSurfaceCB " - "ilm_surfaceAddNotification(%08x) Error", window->surfaceid); - } - ICO_TRA("CicoSCWindowController::createSurfaceCB Leave"); } @@ -2263,6 +2317,11 @@ CicoSCWindowController::handleCommand(const CicoSCCommand * cmd) } break; } + case MSG_CMD_ANIMATION: + ICO_DBG("command: MSG_CMD_ANIMATION"); + (void)setWindowAnimation(opt->surfaceid, opt->animationType, + opt->animation.c_str(), opt->animationTime); + break; case MSG_CMD_CHANGE_ACTIVE: ICO_DBG("command: MSG_CMD_CHANGE_ACTIVE"); (void)active(opt->surfaceid, opt->active); @@ -2390,561 +2449,4 @@ CicoSCWindowController::getResourceManager(void) const { return m_resMgr; } - -//-------------------------------------------------------------------------- -/** - * @brief Window Check Timer - * @param data this object - */ -//-------------------------------------------------------------------------- -Eina_Bool -CicoSCWindowController::ico_SCWindowChecker(void *data) -{ - struct ico_sc_win_check_t *tp, *bp; - struct timeval curtime; - int ntime; - int delflag; - int commflag; - int par; - int htimer = 0; - double rate; - int x, y; - - gettimeofday(&curtime, NULL); - - if ((curtime.tv_sec < g_lasttime.tv_sec) || - ((curtime.tv_sec - g_lasttime.tv_sec) > 2)) { - ntime = ICO_SC_WINCHK_TIMER_BASE; - htimer ++; - } - else { - ntime = (curtime.tv_sec - g_lasttime.tv_sec) * 1000; - if (curtime.tv_usec >= g_lasttime.tv_usec) { - ntime += (curtime.tv_usec - g_lasttime.tv_usec) / 1000; - } - else { - ntime += ((1000000 + curtime.tv_usec - g_lasttime.tv_usec) / 1000) - 1000; - } - } - tp = CicoSCWindowController::win_check_timer; - bp = NULL; - delflag = 0; - commflag = 0; - while (tp) { - tp->lapsed += ntime; - tp->timeout += ntime; - if (tp->function != ICO_SC_WINCHK_CONTENTS_CHECK) { - htimer ++; - } - - if (tp->timeout >= tp->cycle) { - /* timedout */ - do { - tp->timeout -= tp->cycle; - } while (tp->timeout > 0); - - switch (tp->function) { - case ICO_SC_WINCHK_CONTENTS_CHECK: /* check contents change */ - if (tp->state == ICO_SC_WINCONT_CHECK) { - // GENIVI-LM 1.6.0 not support contents change event - // get surface image form GENIVI-LM - ICO_DBG("CicoSCWindowController::ico_SCWindowChecker " - "call ilm_takeSurfaceScreenshot %d[%x]", - tp->surfaceid, tp->surfaceid); - getInstance()->setmapGet(tp->surfaceid, tp->u.cont.path); - tp->state = ICO_SC_WINCONT_WAITFILE; - tp->time = ICO_SC_WINCHK_TIMER_BASE; - tp->cycle = ICO_SC_WINCHK_TIMER_BASE; - tp->timeout = 0; - } - else { - struct stat stat_buf; - - if (stat(tp->u.cont.path, &stat_buf) >= 0) { - tp->state = ICO_SC_WINCONT_CHECK; - tp->time = ICO_SC_WINCHK_CONTENTS_TIME; - tp->cycle = ICO_SC_WINCHK_CONTENTS_TIME; - tp->timeout = 0; - - getInstance()->mapSurfaceCB(ICO_SC_WINCHK_MAP_SURFACE_EVENT_MAP, - tp->surfaceid, 0, - tp->u.cont.width, tp->u.cont.height, - tp->u.cont.width * 4, 0); - } - } - break; - - case ICO_SC_WINCHK_ANIMA_FADE: /* fade animation */ - par = ((tp->lapsed * 100 / tp->time) / 3) * 3; - if (par == tp->par) break; - - if (par < 0) par = 0; - tp->par = par; - if (par >= 97) { - if (ilm_surfaceSetOpacity(tp->surfaceid, 1.0) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::ico_SCWindowChecker " - "ilm_surfaceSetOpacity Error %d[%x]", - tp->surfaceid, tp->surfaceid); - } - if (tp->state != ICO_SC_WINANIMA_SHOW) { - if (ilm_surfaceSetVisibility(tp->surfaceid, 0) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::ico_SCWindowChecker " - "ilm_surfaceSetVisibility Error %d[%x]", - tp->surfaceid, tp->surfaceid); - } - } - delflag = 1; - } - else { - if (tp->state == ICO_SC_WINANIMA_SHOW) { - rate = ((double)par) / 100.0; - } - else { - rate = ((double)(100 - par)) / 100.0; - } - if (ilm_surfaceSetOpacity(tp->surfaceid, rate) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::ico_SCWindowChecker " - "ilm_surfaceSetOpacity Error %d[%x]", - tp->surfaceid, tp->surfaceid); - } - } - commflag ++; - break; - - case ICO_SC_WINCHK_ANIMA_SLIDETOTOP: /* slide totop animation */ - case ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM: /* slide totop animation */ - case ICO_SC_WINCHK_ANIMA_SLIDETOLEFT: /* slide totop animation */ - case ICO_SC_WINCHK_ANIMA_SLIDETORIGHT: /* slide totop animation */ - par = ((tp->lapsed * 100 / tp->time) / 3) * 3; - if (par == tp->par) break; - - if (par < 0) par = 0; - tp->par = par; - if (par >= 97) { - if (tp->state != ICO_SC_WINANIMA_SHOW) { - if (ilm_surfaceSetVisibility(tp->surfaceid, 0) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::ico_SCWindowChecker " - "ilm_surfaceSetVisibility Error %d[%x]", - tp->surfaceid, tp->surfaceid); - } - } - x = tp->u.anim.x; - y = tp->u.anim.y; - delflag = 1; - } - else { - if (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOTOP) { - x = tp->u.anim.x; - if (tp->state == ICO_SC_WINANIMA_SHOW) { - y = tp->u.anim.screen_height - - (tp->u.anim.screen_height - tp->u.anim.y) * par / 100; - } - else { - y = tp->u.anim.y + - (tp->u.anim.screen_height - tp->u.anim.y) * par / 100; - } - } - else if (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM) { - x = tp->u.anim.x; - if (tp->state == ICO_SC_WINANIMA_SHOW) { - y = (-tp->u.anim.height) + - (tp->u.anim.y + tp->u.anim.height) * par / 100; - } - else { - y = tp->u.anim.y - - (tp->u.anim.height + tp->u.anim.y) * par / 100; - } - } - else if (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOLEFT) { - y = tp->u.anim.y; - if (tp->state == ICO_SC_WINANIMA_SHOW) { - x = tp->u.anim.screen_width - - (tp->u.anim.screen_width - tp->u.anim.x) * par / 100; - } - else { - x = tp->u.anim.x + - (tp->u.anim.screen_width - tp->u.anim.x) * par / 100; - } - } - else { - y = tp->u.anim.y; - if (tp->state == ICO_SC_WINANIMA_SHOW) { - x = (-tp->u.anim.width) + - (tp->u.anim.x + tp->u.anim.width) * par / 100; - } - else { - x = tp->u.anim.x - - (tp->u.anim.x + tp->u.anim.width) * par / 100; - } - } - } - if (ilm_surfaceSetDestinationRectangle(tp->surfaceid, x, y, - tp->u.anim.width, tp->u.anim.height) - != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::ico_SCWindowChecker " - "ilm_surfaceSetDestinationRectangle Error %d[%x]", - tp->surfaceid, tp->surfaceid); - } - commflag ++; - break; - } - } - if (delflag) { - delflag = 0; - if (bp == NULL) { - tp = tp->next; - CicoSCWindowController::win_check_timer = tp; - } - else { - bp->next = tp->next; - tp->next = CicoSCWindowController::win_check_free; - CicoSCWindowController::win_check_free = tp; - tp = bp->next; - } - } - else { - bp = tp; - tp = tp->next; - } - } - if (commflag) { - if (ilm_commitChanges() != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::ico_SCWindowChecker " - "ilm_commitChanges Error"); - } - } - g_lasttime = curtime; - if (((htimer == 0) && (g_hightimer != 0)) || - ((htimer != 0) && (g_hightimer == 0))) { - // change timer speed - g_hightimer = 1 - g_hightimer; - - ecore_timer_interval_set(g_SCWindowChecker, - ((double)(g_hightimer ? - ICO_SC_WINCHK_TIMER_BASE : ICO_SC_WINCHK_TIMER_BASE_L)) / 1000.0); - } - return ECORE_CALLBACK_RENEW; -} - -//-------------------------------------------------------------------------- -/** - * @brief window checker destroy surface - * @param surfaceid surface id - */ -//-------------------------------------------------------------------------- -void -CicoSCWindowController::windowCheckerRemove(uint32_t surfaceid) -{ - struct ico_sc_win_check_t *tp, *bp, *fp; - - ICO_TRA("CicoSCWindowController::windowCheckerRemove: Enter %d[%x]", - surfaceid, surfaceid); - - resetWindowMap(surfaceid); - - tp = CicoSCWindowController::win_check_timer; - bp = NULL; - while (tp) { - if (tp->surfaceid == surfaceid) { - // delete check target - if (tp->function == ICO_SC_WINCHK_CONTENTS_CHECK) { - ICO_DBG("CicoSCWindowController::windowCheckerRemove: Remove Thumbnail %d", - tp->surfaceid); - } - - fp = tp; - if (bp == NULL) { - tp = tp->next; - CicoSCWindowController::win_check_timer = tp; - } - else { - bp->next = tp->next; - tp = tp->next; - } - fp->next = CicoSCWindowController::win_check_free; - CicoSCWindowController::win_check_free = fp; - } - else { - bp = tp; - tp = tp->next; - } - } - ICO_TRA("CicoSCWindowController::windowCheckerRemove: Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief window checker set animation - * @param window window object - * @param show show/hide - * @param animation animation name - * @param time animation time(ms) - */ -//-------------------------------------------------------------------------- -void -CicoSCWindowController::setWindowAnimation(CicoSCWindow *window, - int show, const char *animation, int time) -{ - struct ico_sc_win_check_t *tp, *bp; - uint32_t surfaceid = window->surfaceid; - - ICO_TRA("CicoSCWindowController::setWindowAnimation: Enter %d[%x] %d <%s> %d", - surfaceid, surfaceid, show, animation, time); - - tp = CicoSCWindowController::win_check_timer; - bp = NULL; - while (tp) { - if ((tp->surfaceid == surfaceid) && - ((tp->function == ICO_SC_WINCHK_ANIMA_FADE) || - (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOTOP) || - (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM) || - (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOLEFT) || - (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETORIGHT))) { - // same surface target - break; - } - bp = tp; - tp = tp->next; - } - if (! tp) { - tp = CicoSCWindowController::win_check_free; - if (tp) { - CicoSCWindowController::win_check_free = tp->next; - } - else { - tp = (struct ico_sc_win_check_t *)malloc(sizeof(struct ico_sc_win_check_t)); - if (! tp) { - ICO_ERR("CicoSCWindowController::setWindowAnimation: Out of Memory"); - return; - } - } - memset(tp, 0, sizeof(struct ico_sc_win_check_t)); - if (bp) { - bp->next = tp; - } - else { - CicoSCWindowController::win_check_timer = tp; - } - } - - tp->surfaceid = surfaceid; - tp->time = time; - tp->lapsed = 0; - tp->par = -1; - tp->timeout = ICO_SC_WINCHK_ANIMATION_TIME; - tp->cycle = ICO_SC_WINCHK_ANIMATION_TIME; - if ((strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE) == 0) || - (strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE_TOTOP) == 0)) { - tp->function = ICO_SC_WINCHK_ANIMA_SLIDETOTOP; - } - else if (strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE_TOBUTTOM) == 0) { - tp->function = ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM; - } - else if (strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE_TOLEFT) == 0) { - tp->function = ICO_SC_WINCHK_ANIMA_SLIDETOLEFT; - } - else if (strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE_TORIGHT) == 0) { - tp->function = ICO_SC_WINCHK_ANIMA_SLIDETORIGHT; - } - else { - tp->function = ICO_SC_WINCHK_ANIMA_FADE; - } - tp->state = show; - tp->u.anim.x = window->x; - tp->u.anim.y = window->y; - tp->u.anim.width = window->width; - tp->u.anim.height = window->height; - tp->u.anim.screen_width = 1080; - tp->u.anim.screen_height = 1920; - - vector::iterator itr; - itr = m_displayList.begin(); - for (; itr != m_displayList.end(); ++itr) { - if ((*itr)->displayid == window->displayid) { - tp->u.anim.screen_width = (*itr)->pWidth; - tp->u.anim.screen_height = (*itr)->pHeight; - break; - } - } - (void) CicoSCWindowController::ico_SCWindowChecker(NULL); - - ICO_TRA("CicoSCWindowController::setWindowAnimation: Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief window checker reset animation - * @param window window object - */ -//-------------------------------------------------------------------------- -void -CicoSCWindowController::resetWindowAnimation(CicoSCWindow *window) -{ - struct ico_sc_win_check_t *tp, *bp; - uint32_t surfaceid = window->surfaceid; - - ICO_TRA("CicoSCWindowController::resetWindowAnimation: Enter %d[%x]", - surfaceid, surfaceid); - - tp = CicoSCWindowController::win_check_timer; - bp = NULL; - while (tp) { - if ((tp->surfaceid == surfaceid) && - ((tp->function == ICO_SC_WINCHK_ANIMA_FADE) || - (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOTOP) || - (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM) || - (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOLEFT) || - (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETORIGHT))) { - // delete surface target - if (ilm_surfaceSetOpacity(tp->surfaceid, 1.0) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::resetWindowAnimation " - "ilm_surfaceSetOpacity Error %d[%x]", - tp->surfaceid, tp->surfaceid); - } - if (ilm_surfaceSetDestinationRectangle(tp->surfaceid, - tp->u.anim.x, tp->u.anim.y, - tp->u.anim.width, tp->u.anim.height) - != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::resetWindowAnimation " - "ilm_surfaceSetDestinationRectangle Error %d[%x]", - tp->surfaceid, tp->surfaceid); - } - if (ilm_surfaceSetVisibility(tp->surfaceid, - (tp->state == ICO_SC_WINANIMA_SHOW) ? 1 : 0) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::resetWindowAnimation " - "ilm_surfaceSetVisibility Error %d[%x]", - tp->surfaceid, tp->surfaceid); - } - if (ilm_commitChanges() != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::resetWindowAnimation " - "ilm_commitChanges Error"); - } - if (bp == NULL) { - CicoSCWindowController::win_check_timer = tp->next; - } - else { - bp->next = tp->next; - } - tp->next = CicoSCWindowController::win_check_free; - CicoSCWindowController::win_check_free = tp; - break; - } - bp = tp; - tp = tp->next; - } - ICO_TRA("CicoSCWindowController::resetWindowAnimation: Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief window checker set map - * @param window window object - * @param framerate frame rate(frames/sec or -1) - * @param filepath surface image file path - */ -//-------------------------------------------------------------------------- -void -CicoSCWindowController::setWindowMap(CicoSCWindow *window, - int framerate, const char *filepath) -{ - struct ico_sc_win_check_t *tp, *bp; - uint32_t surfaceid = window->surfaceid; - - ICO_TRA("CicoSCWindowController::setWindowMap: Enter %d[%x],%d,<%s>", - surfaceid, surfaceid, framerate, filepath); - - tp = CicoSCWindowController::win_check_timer; - bp = NULL; - while (tp) { - if ((tp->surfaceid == surfaceid) && - (tp->function == ICO_SC_WINCHK_CONTENTS_CHECK)) { - // same surface target - break; - } - bp = tp; - tp = tp->next; - } - if (! tp) { - tp = CicoSCWindowController::win_check_free; - if (tp) { - CicoSCWindowController::win_check_free = tp->next; - } - else { - tp = (struct ico_sc_win_check_t *)malloc(sizeof(struct ico_sc_win_check_t)); - if (! tp) { - ICO_ERR("CicoSCWindowController::setWindowMap: Out of Memory"); - return; - } - } - memset(tp, 0, sizeof(struct ico_sc_win_check_t)); - if (bp) { - bp->next = tp; - } - else { - CicoSCWindowController::win_check_timer = tp; - } - } - tp->function = ICO_SC_WINCHK_CONTENTS_CHECK; - tp->surfaceid = surfaceid; - if (framerate <= 0) { - tp->cycle = 0x7fff; - } - else { - tp->cycle = 1000/framerate; - } - tp->time = 0x7fff; - tp->lapsed = 0; - tp->par = -1; - tp->timeout = 0; - strncpy(tp->u.cont.path, filepath, ICO_SYC_MAX_LEN-1); - tp->state = ICO_SC_WINCONT_CHECK; - tp->u.cont.x = window->x; - tp->u.cont.y = window->y; - tp->u.cont.width = window->width; - tp->u.cont.height = window->height; - - (void) CicoSCWindowController::ico_SCWindowChecker(NULL); - - ICO_TRA("CicoSCWindowController::setWindowMap: Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief window checker reset map - * @param surfaceid surface id - */ -//-------------------------------------------------------------------------- -void -CicoSCWindowController::resetWindowMap(uint32_t surfaceid) -{ - struct ico_sc_win_check_t *tp, *bp; - - ICO_TRA("CicoSCWindowController::resetWindowMap: Enter %d[%x]", - surfaceid, surfaceid); - - tp = CicoSCWindowController::win_check_timer; - bp = NULL; - while (tp) { - if ((tp->surfaceid == surfaceid) && - (tp->function == ICO_SC_WINCHK_CONTENTS_CHECK)) { - if (bp == NULL) { - CicoSCWindowController::win_check_timer = tp->next; - } - else { - bp->next = tp->next; - } - tp->next = CicoSCWindowController::win_check_free; - CicoSCWindowController::win_check_free = tp; - break; - } - bp = tp; - tp = tp->next; - } - if (tp) { - mapSurfaceCB(ICO_SC_WINCHK_MAP_SURFACE_EVENT_UNMAP, - tp->surfaceid, 0, tp->u.cont.width, tp->u.cont.height, - tp->u.cont.width * 4, 0); - } - ICO_TRA("CicoSCWindowController::resetWindowMap: Leave"); -} // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/CicoSCWindowController.h b/lib/system-controller/CicoSCWindowController.h index ba98657..e92f8b6 100644 --- a/lib/system-controller/CicoSCWindowController.h +++ b/lib/system-controller/CicoSCWindowController.h @@ -19,7 +19,6 @@ #include #include -#include "ico_syc_private.h" using namespace std; @@ -28,57 +27,6 @@ using namespace std; #define ICO_SC_APPID_DEFAULT_ONS "org.tizen.ico.onscreen" #define ICO_SC_LAYERID_SCREENBASE 1000 -#define ICO_SC_WINCHK_TIMER_BASE 20 /* window check timer cycle(ms) */ -#define ICO_SC_WINCHK_TIMER_BASE_L 50 /* window check timer slow cycle(ms)*/ -#define ICO_SC_WINCHK_ANIMATION_TIME 20 /* window check timer cycle(ms) */ -#define ICO_SC_WINCHK_CONTENTS_TIME 1000 /* window contents check time(ms) */ - -#define ICO_SC_WINCHK_CONTENTS_CHECK 101 -#define ICO_SC_WINCHK_ANIMA_FADE 201 -#define ICO_SC_WINCHK_ANIMA_SLIDETOTOP 211 -#define ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM 212 -#define ICO_SC_WINCHK_ANIMA_SLIDETOLEFT 213 -#define ICO_SC_WINCHK_ANIMA_SLIDETORIGHT 214 - -#define ICO_SC_WINANIMA_SHOW 1 -#define ICO_SC_WINANIMA_HIDE 2 - -#define ICO_SC_WINCONT_CHECK 1 -#define ICO_SC_WINCONT_WAITFILE 2 - -#define ICO_SC_WINCHK_MAP_SURFACE_EVENT_MAP 1 -#define ICO_SC_WINCHK_MAP_SURFACE_EVENT_UNMAP 2 -#define ICO_SC_WINCHK_MAP_SURFACE_EVENT_CONTENTS 3 - -struct ico_sc_win_check_t { - struct ico_sc_win_check_t *next; - uint32_t surfaceid; - short time; - short cycle; - short lapsed; - short timeout; - short function; - short state; - short par; - union { - struct { - short x; - short y; - short width; - short height; - short screen_width; - short screen_height; - } anim; - struct { - short x; - short y; - short width; - short height; - char path[ICO_SYC_MAX_LEN]; - } cont; - } u; -}; - //========================================================================== // Forward declaration //========================================================================== @@ -160,6 +108,8 @@ public: int lower(int surfaceid, const char *animation, int animationTime); + int setWindowAnimation(int surfaceid, int type, const char *animation, int time); + int setWindowLayer(int surfaceid, int layerid); int showLayer(int displayid, int layerid); @@ -185,10 +135,13 @@ public: t_ilm_notification_mask mask); // virtual void activeCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid, int32_t select); - virtual void mapSurfaceCB(int32_t event, + virtual void mapSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + int32_t event, uint32_t surfaceid, uint32_t type, int32_t width, @@ -196,14 +149,20 @@ public: int32_t stride, uint32_t format); - static void wlGeniviSurfaceNotification(t_ilm_surface surfaceid, - struct ilmSurfaceProperties *surfprop, - t_ilm_notification_mask mask); - - virtual void updateSurfaceCB(uint32_t surfaceid, - struct ilmSurfaceProperties *surfprop); - - virtual void destroySurfaceCB(uint32_t surfaceid); + virtual void updateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height); + + virtual void destroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid); virtual void updateWinnameCB(uint32_t surfaceid, const char *winname); @@ -258,21 +217,6 @@ private: const char *animation, int animationTime); - // window checker - void windowCheckerRemove(uint32_t surfaceid); - - void setWindowAnimation(CicoSCWindow *window, int show, - const char *animation, int time); - - void resetWindowAnimation(CicoSCWindow *window); - - void setWindowMap(CicoSCWindow *window, int framerate, const char *filepath); - - void resetWindowMap(uint32_t surfaceid); - -protected: - static Eina_Bool ico_SCWindowChecker(void *data); - private: /// my instance static CicoSCWindowController *ms_myInstance; @@ -288,11 +232,6 @@ private: // total of physical display unsigned int m_physicalDisplayTotal; - -protected: - // window check timer - static struct ico_sc_win_check_t *win_check_timer; - static struct ico_sc_win_check_t *win_check_free; }; #endif // __CICO_SC_WINDOW_CONTROLLER_H__ // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/CicoSCWlInputMgrIF.cpp b/lib/system-controller/CicoSCWlInputMgrIF.cpp index 9036123..5ade0a4 100644 --- a/lib/system-controller/CicoSCWlInputMgrIF.cpp +++ b/lib/system-controller/CicoSCWlInputMgrIF.cpp @@ -30,7 +30,15 @@ using namespace std; */ //-------------------------------------------------------------------------- CicoSCWlInputMgrIF::CicoSCWlInputMgrIF() + : m_inputmgr(NULL), m_exinput(NULL), m_inputmgrdev(NULL) { + // ico_exinput listener + m_exInputListener.capabilities = wlCapabilitiesCB; + m_exInputListener.code = wlCodeCB; + m_exInputListener.input = wlInputCB; + + // ico_input_mgr_device listener + m_devListener.input_regions = wlRegionCB; } //-------------------------------------------------------------------------- @@ -44,7 +52,7 @@ CicoSCWlInputMgrIF::~CicoSCWlInputMgrIF() //-------------------------------------------------------------------------- /** - * @brief initialize input interfaces + * @brief initialize ico_input_mgr interfaces * * @param [in] data user data * @param [in] registry wayland registry @@ -60,14 +68,74 @@ CicoSCWlInputMgrIF::initInterface(void *data, const char *interface, uint32_t version) { - ICO_TRA("CicoSCWlInputMgrIF::initInterface : Enter(interface=%s)", interface); - m_initialized = true; + ICO_TRA("CicoSCWlInputMgrIF::initInterface : Enter(interface=%s)", + interface); + + if (0 == strcmp(interface, ICO_WL_INPUT_MGR_CTRL_IF)) { + // get interface instance + ICO_DBG("called: wl_registry_bind"); + void *wlProxy = wl_registry_bind(registry, + name, + &ico_input_mgr_control_interface, + 1); + if (NULL == wlProxy) { + ICO_WRN("interface(%s) wl_registry_bind failed.", interface); + ICO_TRA("CicoSCWlInputMgrIF::initInterface Leave", + "(binding failed)"); + return; + } + m_inputmgr = (struct ico_input_mgr_control*)wlProxy; + } + else if (0 == strcmp(interface, ICO_WL_EXINPUT_IF)) { + // get interface instance + ICO_DBG("called: wl_registry_bind"); + void *wlProxy = wl_registry_bind(registry, + name, + &ico_exinput_interface, + 1); + if (NULL == wlProxy) { + ICO_WRN("interface(%s) wl_registry_bind failed.", interface); + ICO_TRA("CicoSCWlInputMgrIF::initInterface Leave", + "(binding failed)"); + return; + } + + m_exinput = (struct ico_exinput*)wlProxy; + ico_exinput_add_listener(m_exinput, + &m_exInputListener, + this); + } + else if (0 == strcmp(interface, ICO_WL_INPUT_MGR_DEV_IF)) { + // get interface instance + ICO_DBG("called: wl_registry_bind"); + void *wlProxy = wl_registry_bind(registry, + name, + &ico_input_mgr_device_interface, + 1); + if (NULL == wlProxy) { + ICO_WRN("interface(%s) wl_registry_bind failed.", interface); + ICO_TRA("CicoSCWlInputMgrIF::initInterface Leave" + "(binding failed)"); + return; + } + + m_inputmgrdev = (struct ico_input_mgr_device*)wlProxy; + ico_input_mgr_device_add_listener(m_inputmgrdev, + &m_devListener, + this); + } + + if ((NULL != m_inputmgrdev) && + (NULL != m_inputmgr) && + (NULL != m_exinput)) { + m_initialized = true; + } ICO_TRA("CicoSCWlInputMgrIF::initInterface Leave"); } //-------------------------------------------------------------------------- /** - * @brief wrapper function add_input_app + * @brief wrapper function ico_input_mgr_control_add_input_app * * @param [in] appid application id * @param [in] device input device name @@ -83,14 +151,18 @@ CicoSCWlInputMgrIF::addInputApp(const string &appid, int fix, int keycode) { - ICO_DBG("called: add_input_app" + ICO_DBG("called: ico_input_mgr_control_add_input_app" "(appid=%s device=%s input=%d fix=%d keycode=%d)", appid.c_str(), device.c_str(), input, fix, keycode); + ico_input_mgr_control_add_input_app(m_inputmgr,appid.c_str(), + device.c_str(), input, fix, keycode); + // flush display + CicoSCWayland::getInstance()->flushDisplay(); } //-------------------------------------------------------------------------- /** - * @brief wrapper function del_input_app + * @brief wrapper function ico_input_mgr_control_del_input_app * * @param [in] appid application id * @param [in] device input device name @@ -102,14 +174,18 @@ CicoSCWlInputMgrIF::delInputApp(const string &appid, const string &device, int input) { - ICO_DBG("called: del_input_app" + ICO_DBG("called: ico_input_mgr_control_del_input_app" "(appid=%s device=%s input=%d)", appid.c_str(), device.c_str(), input); + ico_input_mgr_control_del_input_app(m_inputmgr, appid.c_str(), + device.c_str(), input); + // flush display + CicoSCWayland::getInstance()->flushDisplay(); } //-------------------------------------------------------------------------- /** - * @brief wrapper function set_input_region + * @brief wrapper function ico_exinput_set_input_region * * @param [in] target target window name(winname@appid) * @param [in] x region x positon @@ -139,16 +215,21 @@ CicoSCWlInputMgrIF::setInputRegion(const string &target, int cursor_height, int attr) { - ICO_DBG("called: set_input_region" + ICO_DBG("called: ico_exinput_set_input_region" "(target=%s x/y=%d/%d w/h=%d/%d hot=%d/%d " "cursor=%d/%d-%d/%d attr=%d)", target.c_str(), x, y, width, height, hotspot_x, hotspot_y, cursor_x, cursor_y, cursor_width, cursor_height, attr); + ico_exinput_set_input_region(m_exinput, target.c_str(), x, y, + width, height, hotspot_x, hotspot_y, cursor_x, + cursor_y, cursor_width, cursor_height,attr); + // flush display + CicoSCWayland::getInstance()->flushDisplay(); } //-------------------------------------------------------------------------- /** - * @brief wrapper function unset_input_region + * @brief wrapper function ico_exinput_unset_input_region * * @param [in] target target window name(winname@appid) * @param [in] x region x positon @@ -164,9 +245,13 @@ CicoSCWlInputMgrIF::unsetInputRegion(const string &target, int width, int height) { - ICO_DBG("called: unset_input_region" + ICO_DBG("called: ico_exinput_unset_input_region" "(target=%s x=%d y=%d width=%d height=%d", target.c_str(), x, y, width, height); + ico_exinput_unset_input_region(m_exinput, target.c_str(), + x, y, width, height); + // flush display + CicoSCWayland::getInstance()->flushDisplay(); } //-------------------------------------------------------------------------- @@ -174,6 +259,7 @@ CicoSCWlInputMgrIF::unsetInputRegion(const string &target, * @brief callback to application for input switch information * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] device input device name * @param [in] type input device type (as enum type) * @param [in] swname input switch name @@ -184,6 +270,7 @@ CicoSCWlInputMgrIF::unsetInputRegion(const string &target, //-------------------------------------------------------------------------- void CicoSCWlInputMgrIF::capabilitiesCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t type, const char *swname, @@ -199,6 +286,7 @@ CicoSCWlInputMgrIF::capabilitiesCB(void *data, * @brief callback to application for input code information * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] device input device name * @param [in] input input switch number * @param [in] codename input code name @@ -207,6 +295,7 @@ CicoSCWlInputMgrIF::capabilitiesCB(void *data, //-------------------------------------------------------------------------- void CicoSCWlInputMgrIF::codeCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t input, const char *codename, @@ -220,6 +309,7 @@ CicoSCWlInputMgrIF::codeCB(void *data, * @brief callback to application for switch input * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] time input time of millisecond * @param [in] device input device name * @param [in] input input switch number @@ -229,6 +319,7 @@ CicoSCWlInputMgrIF::codeCB(void *data, //-------------------------------------------------------------------------- void CicoSCWlInputMgrIF::inputCB(void *data, + struct ico_exinput *ico_exinput, uint32_t time, const char *device, int32_t input, @@ -243,11 +334,13 @@ CicoSCWlInputMgrIF::inputCB(void *data, * @brief callback to application for change input region * * @param [in] data user data + * @param [in] ico_input_mgr_dev wayland ico_exinput interface * @param [in] region input regions */ //-------------------------------------------------------------------------- void CicoSCWlInputMgrIF::regionCB(void *data, + struct ico_input_mgr_device *ico_input_mgr_dev, struct wl_array *region) { ICO_WRN("CicoSCWlInputMgrIF::regionCB called."); @@ -262,6 +355,7 @@ CicoSCWlInputMgrIF::regionCB(void *data, * @brief callback to application for input switch information * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] device input device name * @param [in] type input device type (as enum type) * @param [in] swname input switch name @@ -272,6 +366,7 @@ CicoSCWlInputMgrIF::regionCB(void *data, //-------------------------------------------------------------------------- void CicoSCWlInputMgrIF::wlCapabilitiesCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t type, const char *swname, @@ -279,13 +374,17 @@ CicoSCWlInputMgrIF::wlCapabilitiesCB(void *data, const char *codename, int32_t code) { +// ICO_TRA("CicoSCWlInputMgrIF::wlCapabilitiesCB Enter"); + if (NULL == data) { ICO_WRN("wlCapabilitiesCB: data is null"); return; } - static_cast(data)->capabilitiesCB(data, device, type, + static_cast(data)->capabilitiesCB(data, ico_exinput, + device, type, swname, input, codename, code); +// ICO_TRA("CicoSCWlInputMgrIF::wlCapabilitiesCB Leave"); } //-------------------------------------------------------------------------- @@ -293,6 +392,7 @@ CicoSCWlInputMgrIF::wlCapabilitiesCB(void *data, * @brief callback to application for input code information * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] device input device name * @param [in] input input switch number * @param [in] codename input code name @@ -301,17 +401,23 @@ CicoSCWlInputMgrIF::wlCapabilitiesCB(void *data, //-------------------------------------------------------------------------- void CicoSCWlInputMgrIF::wlCodeCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t input, const char *codename, int32_t code) { +// ICO_TRA("CicoSCWlInputMgrIF::wlCodeCB Enter"); + if (NULL == data) { ICO_WRN("wlCodeCB: data is null"); return; } - static_cast(data)->codeCB(data, device, input, + static_cast(data)->codeCB(data, ico_exinput, + device, input, codename, code); + +// ICO_TRA("CicoSCWlInputMgrIF::wlCodeCB Leave"); } //-------------------------------------------------------------------------- @@ -319,6 +425,7 @@ CicoSCWlInputMgrIF::wlCodeCB(void *data, * @brief callback to application for switch input * * @param [in] data user data + * @param [in] ico_exinput wayland ico_exinput interface * @param [in] time input time of millisecond * @param [in] device input device name * @param [in] input input switch number @@ -328,18 +435,24 @@ CicoSCWlInputMgrIF::wlCodeCB(void *data, //-------------------------------------------------------------------------- void CicoSCWlInputMgrIF::wlInputCB(void *data, + struct ico_exinput *ico_exinput, uint32_t time, const char *device, int32_t input, int32_t code, int32_t state) { +// ICO_TRA("CicoSCWlInputMgrIF::wlInputCB Enter"); + if (NULL == data) { ICO_WRN("wlInputCB: data is null"); return; } - static_cast(data)->inputCB(data, time, device, input, + static_cast(data)->inputCB(data, ico_exinput, + time, device, input, code, state); + +// ICO_TRA("CicoSCWlInputMgrIF::wlInputCB Leave"); } //-------------------------------------------------------------------------- @@ -347,17 +460,24 @@ CicoSCWlInputMgrIF::wlInputCB(void *data, * @brief callback to application for change input region * * @param [in] data user data + * @param [in] ico_input_mgr_dev wayland ico_exinput interface * @param [in] region input regions */ //-------------------------------------------------------------------------- void CicoSCWlInputMgrIF::wlRegionCB(void *data, + struct ico_input_mgr_device *ico_input_mgr_dev, struct wl_array *region) { +// ICO_TRA("CicoSCWlInputMgrIF::wlRegionCB Enter"); + if (NULL == data) { ICO_WRN("wlRegionCB: data is null"); return; } - static_cast(data)->regionCB(data, region); + static_cast(data)->regionCB(data, ico_input_mgr_dev, + region); + +// ICO_TRA("CicoSCWlInputMgrIF::wlRegionCB Leave"); } // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/CicoSCWlInputMgrIF.h b/lib/system-controller/CicoSCWlInputMgrIF.h index 18eed91..261684c 100644 --- a/lib/system-controller/CicoSCWlInputMgrIF.h +++ b/lib/system-controller/CicoSCWlInputMgrIF.h @@ -18,6 +18,7 @@ #define __CICO_SC_WL_INPUT_MGR_IF_H__ #include +#include #include "CicoSCWaylandIF.h" //-------------------------------------------------------------------------- @@ -37,6 +38,7 @@ public: // capabilities callback function void capabilitiesCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t type, const char *swname, @@ -46,6 +48,7 @@ public: // code callback function void codeCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t input, const char *codename, @@ -53,6 +56,7 @@ public: // input callback function void inputCB(void *data, + struct ico_exinput *ico_exinput, uint32_t time, const char *device, int32_t input, @@ -61,6 +65,7 @@ public: // region callback function void regionCB(void *data, + struct ico_input_mgr_device *ico_input_mgr_device, struct wl_array *region); protected: @@ -76,19 +81,19 @@ protected: // copy constructor CicoSCWlInputMgrIF(const CicoSCWlInputMgrIF &object); - // wrapper function add_input_app + // wrapper function ico_input_mgr_control_add_input_app void addInputApp(const std::string &appid, const std::string &device, int input, int fix, int keycode); - // wrapper function del_input_app + // wrapper function ico_input_mgr_control_del_input_app void delInputApp(const std::string &appid, const std::string &device, int input); - // wrapper function input_region + // wrapper function ico_exinput_set_input_region void setInputRegion(const std::string &target, int x, int y, @@ -102,7 +107,7 @@ protected: int cursor_height, int attr); - // wrapper function unset_input_region + // wrapper function ico_exinput_unset_input_region void unsetInputRegion(const std::string &target, int x, int y, @@ -110,8 +115,11 @@ protected: int height); private: + // ico_input_mgr(Multi Input Manager) callback functions + // wayland capabilities callback function static void wlCapabilitiesCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t type, const char *swname, @@ -121,6 +129,7 @@ private: // wayland code callback function static void wlCodeCB(void *data, + struct ico_exinput *ico_exinput, const char *device, int32_t input, const char *codename, @@ -128,6 +137,7 @@ private: // wayland input callback function static void wlInputCB(void *data, + struct ico_exinput *ico_exinput, uint32_t time, const char *device, int32_t input, @@ -136,11 +146,25 @@ private: // wayland region callback function static void wlRegionCB(void *data, + struct ico_input_mgr_device *ico_input_mgr_device, struct wl_array *region); protected: + // input manager interface + struct ico_input_mgr_control *m_inputmgr; + + // extra input event interface + struct ico_exinput *m_exinput; + + // input manage device interface + struct ico_input_mgr_device *m_inputmgrdev; private: + // exinput listener + struct ico_exinput_listener m_exInputListener; + + // input manager device listener + struct ico_input_mgr_device_listener m_devListener; }; #endif // __CICO_SC_WL_INPUT_MGR_IF_H__ diff --git a/lib/system-controller/CicoSCWlWinMgrIF.cpp b/lib/system-controller/CicoSCWlWinMgrIF.cpp index 96d26af..88771f2 100644 --- a/lib/system-controller/CicoSCWlWinMgrIF.cpp +++ b/lib/system-controller/CicoSCWlWinMgrIF.cpp @@ -32,16 +32,15 @@ //========================================================================== // static variables //========================================================================== +struct ico_window_mgr *CicoSCWlWinMgrIF::m_winmgr = NULL; struct ivi_application *CicoSCWlWinMgrIF::m_ivi_app = NULL; struct ivi_controller *CicoSCWlWinMgrIF::m_ivi_ctrl = NULL; struct wl_output *CicoSCWlWinMgrIF::m_wloutput = NULL; int CicoSCWlWinMgrIF::m_id_surface = 0; -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ struct creation_surface_wait *CicoSCWlWinMgrIF::m_wait_surface_creation = NULL; struct creation_surface_wait *CicoSCWlWinMgrIF::m_free_surface_creation = NULL; -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ //-------------------------------------------------------------------------- /** @@ -50,17 +49,21 @@ struct creation_surface_wait *CicoSCWlWinMgrIF::m_free_surface_creation = NUL //-------------------------------------------------------------------------- CicoSCWlWinMgrIF::CicoSCWlWinMgrIF() { - // genivi ivi_controller listener - m_ivi_ctrl_listener.screen = wlIviCtrlScreenCB; - m_ivi_ctrl_listener.layer = wlIviCtrlLayerCB; - m_ivi_ctrl_listener.surface = wlIviCtrlSurfaceCB; - m_ivi_ctrl_listener.error = wlIviCtrlErrorCB; -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ - m_ivi_ctrl_listener.native_handle = wlIviCtrlNativeHandleCB; + // ico_window_mgr listener + m_listener.window_active = wlActiveCB; + m_listener.map_surface = wlMapSurfaceCB; + m_listener.update_surface = wlUpdateSurfaceCB; + m_listener.destroy_surface = wlDestroySurfaceCB; // genivi ivi_application listener m_ivi_app_listener.wl_shell_info = wlIviAppNativeShellInfoCB; -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ + + // genivi ivi_controller listener + m_ivi_ctrl_listener.screen = wlIviCtrlScreenCB; + m_ivi_ctrl_listener.layer = wlIviCtrlLayerCB; + m_ivi_ctrl_listener.surface = wlIviCtrlSurfaceCB; + m_ivi_ctrl_listener.error = wlIviCtrlErrorCB; + m_ivi_ctrl_listener.native_handle = wlIviCtrlNativeHandleCB; // wayland output listener m_wlOutputListener.geometry = wlOutputGeometryCB; @@ -78,7 +81,7 @@ CicoSCWlWinMgrIF::~CicoSCWlWinMgrIF() //-------------------------------------------------------------------------- /** - * @brief initialize GENIVI-LM interfaces + * @brief initialize ico_window_mgr interfaces * * @param [in] data user data * @param [in] registry wayland registry @@ -97,28 +100,33 @@ CicoSCWlWinMgrIF::initInterface(void *data, ICO_TRA("CicoSCWlWinMgrIF::initInterface Enter(interface=%s)", interface); // check interface name - if (0 == strcmp(interface, ICO_WL_IVI_CONTROLLER_IF)) { + if (0 == strcmp(interface, ICO_WL_WIN_MGR_IF)) { // get interface instance - ICO_DBG("called: wl_registry_bind for ivi_controller"); - void *wlProxy = wl_registry_bind(registry, name, - &ivi_controller_interface, 1); + ICO_DBG("called: wl_registry_bind"); + void *wlProxy = wl_registry_bind(registry, + name, + &ico_window_mgr_interface, + 1); if (NULL == wlProxy) { ICO_WRN("interface(%s) wl_registry_bind failed.", interface); ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)"); return; } - m_ivi_ctrl = (struct ivi_controller *)wlProxy; - ivi_controller_add_listener(m_ivi_ctrl, - &m_ivi_ctrl_listener, + + + m_winmgr = (struct ico_window_mgr *)wlProxy; + ico_window_mgr_add_listener(m_winmgr, + &m_listener, this); } -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ else if (0 == strcmp(interface, ICO_WL_IVI_APPLICATION_IF)) { // get interface instance ICO_DBG("called: wl_registry_bind for ivi_application"); - void *wlProxy = wl_registry_bind(registry, name, - &ivi_application_interface, 1); + void *wlProxy = wl_registry_bind(registry, + name, + &ivi_application_interface, + 1); if (NULL == wlProxy) { ICO_WRN("interface(%s) wl_registry_bind failed.", interface); @@ -130,12 +138,31 @@ CicoSCWlWinMgrIF::initInterface(void *data, &m_ivi_app_listener, this); } -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ + else if (0 == strcmp(interface, ICO_WL_IVI_CONTROLLER_IF)) { + // get interface instance + ICO_DBG("called: wl_registry_bind for ivi_controller"); + void *wlProxy = wl_registry_bind(registry, + name, + &ivi_controller_interface, + 1); + if (NULL == wlProxy) { + ICO_WRN("interface(%s) wl_registry_bind failed.", + interface); + ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)"); + return; + } + m_ivi_ctrl = (struct ivi_controller *)wlProxy; + ivi_controller_add_listener(m_ivi_ctrl, + &m_ivi_ctrl_listener, + this); + } else if (0 == strcmp(interface, ICO_WL_OUTPUT_IF)) { // get interface instance ICO_DBG("called: wl_registry_bind"); - void *wlProxy = wl_registry_bind(registry, name, - &wl_output_interface, 1); + void *wlProxy = wl_registry_bind(registry, + name, + &wl_output_interface, + 1); if (NULL == wlProxy) { ICO_WRN("interface(%s) wl_registry_bind failed.", interface); @@ -154,7 +181,7 @@ CicoSCWlWinMgrIF::initInterface(void *data, return; } - if(NULL != m_wloutput) { + if((NULL != m_winmgr) && (NULL != m_wloutput)) { m_initialized = true; } @@ -270,6 +297,28 @@ CicoSCWlWinMgrIF::setVisible(uint32_t surfaceid, int32_t visible) //-------------------------------------------------------------------------- /** + * @brief wrapper function of ico_window_mgr_set_animation + * + * @param [in] surfaceid wayland surface id + * @param [in] type transition type + * @param [in] animation name of animation + * @param [in] time time of animation + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::setAnimation(uint32_t surfaceid, int32_t type, + const char *animation, int32_t time) +{ + ICO_DBG("called: ico_window_mgr_set_animation" + "(surfaceid=%08x type=%d anima=%s time=%d)", + surfaceid, type, animation, time); + ico_window_mgr_set_animation(m_winmgr, surfaceid, type, animation, time); + // need wayland flush for GENIVI layer management + CicoSCWayland::getInstance()->flushDisplay(); +} + +//-------------------------------------------------------------------------- +/** * @brief wrapper function of ilm_SetKeyboardFocusOn * * @param [in] surfaceid wayland surface id @@ -328,7 +377,45 @@ CicoSCWlWinMgrIF::setmapGet(int surfaceid, const char *filepath) } } -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ +//-------------------------------------------------------------------------- +/** + * @brief wrapper function of ico_window_mgr_map_surface + * + * @param [in] surface id of wayland surface + * @param [in] framerate interval of changed notify[frame per second] + * @param [in] filepath surface image pixel file path + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::mapSurface(uint32_t surfaceid, int32_t framerate, const char *filepath) +{ + ICO_DBG("called: ico_window_mgr_map_surface(surfaceid=%08x framerate=%d file=%s)", + surfaceid, framerate, filepath ? filepath : "(null)"); + // currently GENIVI genivi-shell not support contents change, so use ico_window_mgr + if ((filepath != NULL) && (*filepath != 0) && (*filepath != ' ')) { + ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate, filepath); + } + else { + ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate, " "); + } +} + +//-------------------------------------------------------------------------- +/** + * @brief wrapper function of ico_window_mgr_unmap_surface + * + * @param [in] surface id of wayland surface + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::unmapSurface(uint32_t surfaceid) +{ + ICO_DBG("called: ico_window_mgr_unmap_surface" + "(surfaceid=%08x)", surfaceid); + // currently GENIVI genivi-shell not support contents change, so use ico_window_mgr + ico_window_mgr_unmap_surface(m_winmgr, surfaceid); +} + //-------------------------------------------------------------------------- /** * @brief get creation surface window name(title) and pid @@ -351,8 +438,7 @@ CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(uint32_t id_surface, int *pid) } tp = tp->next; } - ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(%x) dose not exist", - id_surface); + ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(%x) dose not exist", id_surface); return NULL; } @@ -388,20 +474,21 @@ CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(uint32_t id_surface) } ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) dose not exist", id_surface); } -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ //-------------------------------------------------------------------------- /** * @brief wayland surface active callback * * @param [in] data user data(unused) - * @param [in] surfaceid surface Id + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid ico_window_mgr surface Id * @param [in] select select device(unused) * (0=not active/1=pointer/2=touch) */ //-------------------------------------------------------------------------- void CicoSCWlWinMgrIF::activeCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid, int32_t select) { @@ -410,14 +497,76 @@ CicoSCWlWinMgrIF::activeCB(void *data, //-------------------------------------------------------------------------- /** + * @brief surface map event callback + * + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] event event + * @param [in] surfaceid surface Id + * @param [in] type surface buffer type(EGL buffer/Shared memory) + * @param [in] width surface width + * @param [in] height surface height + * @param [in] stride surface buffer(frame buffer) stride + * @param [in] format surface buffer format + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::mapSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + int32_t event, + uint32_t surfaceid, + uint32_t type, + int32_t width, + int32_t height, + int32_t stride, + uint32_t format) +{ + ICO_WRN("CicoSCWlWinMgrIF::mapSurfaceCB called."); +} + +//-------------------------------------------------------------------------- +/** + * @brief surface update event callback + * + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid surface Id + * @param [in] visible visibility + * @param [in] srcwidth application buffer width + * @param [in] srcheight application buffer height + * @param [in] x X + * @param [in] y Y + * @param [in] width width + * @param [in] height height + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::updateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height) +{ + ICO_WRN("CicoSCWlWinMgrIF::updateSurfaceCB called."); +} + +//-------------------------------------------------------------------------- +/** * @brief wayland surface destroy callback * * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface * @param [in] surfaceid surface Id */ //-------------------------------------------------------------------------- void CicoSCWlWinMgrIF::destroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid) { ICO_WRN("CicoSCWlWinMgrIF::destroySurfaceCB called."); @@ -497,6 +646,7 @@ CicoSCWlWinMgrIF::outputModeCB(void *data, * @brief wayland genivi ivi-surface create callback * * @param [in] data user data(unused) + * @param [in] ivi_controller wayland ivi-controller plugin interface * @param [in] id_surface surface id */ //-------------------------------------------------------------------------- @@ -517,24 +667,108 @@ CicoSCWlWinMgrIF::createSurfaceCB(void *data, * @brief wayland surface active callback * * @param [in] data user data(unused) - * @param [in] surfaceid surface Id + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid ico_window_mgr surface Id * @param [in] select select device(unused) * (0=not active/1=pointer/2=touch) */ //-------------------------------------------------------------------------- void CicoSCWlWinMgrIF::wlActiveCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid, int32_t select) { -// ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Enter"); +// ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Enter"); if (NULL == data) { ICO_WRN("wlActiveCB: data is null"); return; } - static_cast(data)->activeCB(data, surfaceid, select); -// ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Leave"); + static_cast(data)->activeCB(data, ico_window_mgr, + surfaceid, select); +// ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Leave"); +} + +//-------------------------------------------------------------------------- +/** + * @brief surface map event callback + * + * @param [in] data user data + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] event event + * @param [in] surfaceid surface Id + * @param [IN] type buffer type(fixed ICO_WINDOW_MGR_MAP_TYPE_EGL) + * @param [in] width surface width + * @param [in] height surface height + * @param [in] stride surface buffer(frame buffer) stride + * @param [in] format surface buffer format + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::wlMapSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + int32_t event, + uint32_t surfaceid, + uint32_t type, + int32_t width, + int32_t height, + int32_t stride, + uint32_t format) +{ +// ICO_TRA("CicoSCWlWinMgrIF::wlMapSurfaceCB Enter"); + + if (NULL == data) { + ICO_WRN("wlMapSurfaceCB: data is null"); + return; + } + static_cast(data)->mapSurfaceCB(data, ico_window_mgr, + event, surfaceid, + type, + width, height, + stride, format); +// ICO_TRA("CicoSCWlWinMgrIF::wlMapSurfaceCB Leave"); +} + +//-------------------------------------------------------------------------- +/** + * @brief surface update event callback + * + * @param [in] data user data + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid surface Id + * @param [in] visible visibility + * @param [in] srcwidth application buffer width + * @param [in] srcheight application buffer height + * @param [in] x X + * @param [in] y Y + * @param [in] width width + * @param [in] height height + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::wlUpdateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height) +{ +// ICO_TRA("CicoSCWlWinMgrIF::wlUpdateSurfaceCB Enter"); + + if (NULL == data) { + ICO_WRN("wlUpdateSurfaceCB: data is null"); + return; + } + static_cast(data)->updateSurfaceCB(data, ico_window_mgr, + surfaceid, visible, + srcwidth, srcheight, + x, y, width, height); +// ICO_TRA("CicoSCWlWinMgrIF::wlUpdateSurfaceCB Leave"); } //-------------------------------------------------------------------------- @@ -542,18 +776,26 @@ CicoSCWlWinMgrIF::wlActiveCB(void *data, * @brief surface destroy event callback * * @param [in] data user data + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface * @param [in] surfaceid surface Id */ //-------------------------------------------------------------------------- void CicoSCWlWinMgrIF::wlDestroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid) { +// ICO_TRA("CicoSCWlWinMgrIF::wlDestroySurfaceCB Enter"); + if (NULL == data) { ICO_WRN("wlDestroySurfaceCB: data is null"); return; } - static_cast(data)->destroySurfaceCB(data, surfaceid); + wlIviCtrlRemoveSurface(surfaceid); + + static_cast(data)->destroySurfaceCB(data, ico_window_mgr, + surfaceid); +// ICO_TRA("CicoSCWlWinMgrIF::wlDestroySurfaceCB Leave"); } //-------------------------------------------------------------------------- @@ -621,7 +863,7 @@ CicoSCWlWinMgrIF::wlOutputModeCB(void *data, int32_t height, int32_t refresh) { -// ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Enter"); +// ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Enter"); if (NULL == data) { ICO_WRN("wlOutputGeometryCB: data is null"); @@ -629,10 +871,9 @@ CicoSCWlWinMgrIF::wlOutputModeCB(void *data, } static_cast(data)->outputModeCB(data, wl_output, flags, width, height, refresh); -// ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Leave"); +// ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Leave"); } -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ //-------------------------------------------------------------------------- /** * @brief wayland ivi-shell ivi-application protocol create wl_surface callback @@ -704,7 +945,6 @@ CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB(void *data, } ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave"); } -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ //-------------------------------------------------------------------------- /** @@ -796,6 +1036,10 @@ CicoSCWlWinMgrIF::wlIviCtrlErrorCB(void *data, int32_t object_id, int32_t object_type, int32_t error_code, const char *error_text) { + struct creation_surface_wait *tp; + struct creation_surface_wait *tp2; + struct creation_surface_wait *deltp; + ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: Enter(%d[%d],%d,<%s>)", object_id, object_type, error_code, error_text ? error_text : "(null)"); @@ -803,10 +1047,6 @@ CicoSCWlWinMgrIF::wlIviCtrlErrorCB(void *data, ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: data is null"); return; } -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ - struct creation_surface_wait *tp; - struct creation_surface_wait *tp2; - struct creation_surface_wait *deltp; // search request wait tp = m_wait_surface_creation; @@ -846,12 +1086,10 @@ CicoSCWlWinMgrIF::wlIviCtrlErrorCB(void *data, "call ivi_controller_get_native_handle(%d,<%s>)", tp2->pid, tp2->title); ivi_controller_get_native_handle(m_ivi_ctrl, tp2->pid, tp2->title); } -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: Leave"); } -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ -/-------------------------------------------------------------------------- +//-------------------------------------------------------------------------- /** * @brief wayland ivi-shell ivi-controller protocol native handle callback * @@ -965,5 +1203,4 @@ CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB(void *data, } ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(id_surface=%08x)", id_surface); } -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/CicoSCWlWinMgrIF.h b/lib/system-controller/CicoSCWlWinMgrIF.h index de43745..e464192 100644 --- a/lib/system-controller/CicoSCWlWinMgrIF.h +++ b/lib/system-controller/CicoSCWlWinMgrIF.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,6 @@ * @brief This class is wayland interface of multi window manager */ //-------------------------------------------------------------------------- -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ struct creation_surface_wait { struct creation_surface_wait *next; int32_t pid; @@ -45,7 +45,6 @@ struct creation_surface_wait { #define SCWINMGR_GENIVI_BUSY_REQSURF 1 #define SCWINMGR_GENIVI_BUSY_REQBIND 2 #define SCWINMGR_GENIVI_BUSY_WAIT 3 -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ class CicoSCWlWinMgrIF : public CicoSCWaylandIF { public: @@ -56,10 +55,33 @@ public: uint32_t version); virtual void activeCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid, int32_t select); + virtual void mapSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + int32_t event, + uint32_t surfaceid, + uint32_t type, + int32_t width, + int32_t height, + int32_t stride, + uint32_t format); + + virtual void updateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height); + virtual void destroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid); virtual void updateWinnameCB(uint32_t surfaceid, @@ -86,9 +108,8 @@ public: virtual void createSurfaceCB(void *data, struct ivi_controller *ivi_controller, uint32_t id_surface); -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ + static void wlIviCtrlRemoveSurface(uint32_t id_surface); -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ protected: // default constructor @@ -103,36 +124,67 @@ protected: // copy constructor CicoSCWlWinMgrIF(const CicoSCWlWinMgrIF &object); - // wrapper function GENIVI-LM set layer + // wrapper function ico_window_mgr_set_window_layer void setWindowLayer(uint32_t surfaceid, uint32_t layer, uint32_t oldlayer); - // wrapper function GENIVI-LM set position and size + // wrapper function ico_window_mgr_set_positionsize void setPositionsize(uint32_t surfaceid, uint32_t node, int32_t x, int32_t y, int32_t width, int32_t height); - // wrapper function GENIVI-LM set visibility + // wrapper function ico_window_mgr_set_visible void setVisible(uint32_t surfaceid, int32_t visible); - // wrapper function of GENIVI-LM set active + // wrapper function of ico_window_mgr_set_animation + void setAnimation(uint32_t surfaceid, int32_t type, + const char *animation, int32_t time); + + // wrapper function of ico_window_mgr_set_active void setActive(uint32_t surfaceid, int32_t active); - // wrapper function of GENIVI-LM set layer visibility + // wrapper function of ico_window_mgr_set_layer_visible void setLayerVisible(uint32_t layer, int32_t visible); // wrapper function of ilm_takeSurfaceScreenshot void setmapGet(int surfaceid, const char *filepath); -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ + // wrapper function of ico_window_mgr_map_surface + void mapSurface(uint32_t surfaceid, int32_t framerate, const char *filepath); + + // wrapper function of ico_window_mgr_unmap_surface + void unmapSurface(uint32_t surfaceid); + static const char *wlIviCtrlGetSurfaceWaiting(uint32_t id_surface, int *pid); -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ private: - // GENIVI-LM callback functions + // ico_window_mgr(Multi Window Manager) callback functions static void wlActiveCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid, int32_t active); + static void wlMapSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + int32_t event, + uint32_t surfaceid, + uint32_t type, + int32_t width, + int32_t height, + int32_t stride, + uint32_t format); + + static void wlUpdateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int layer, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height); + static void wlDestroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, uint32_t surfaceid); // static void wlOutputGeometryCB(void *data, @@ -153,13 +205,10 @@ private: int32_t height, int32_t refresh); -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ static void wlIviAppNativeShellInfoCB(void *data, struct ivi_application *ivi_application, int32_t pid, const char *title); -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ - static void wlIviCtrlScreenCB(void *data, struct ivi_controller *ivi_controller, uint32_t id_screen, @@ -180,23 +229,25 @@ private: int32_t error_code, const char *error_text); -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ static void wlIviCtrlNativeHandleCB(void *data, struct ivi_controller *ivi_controller, struct wl_surface *surface); -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ protected: + // ico_window_mgr listener + struct ico_window_mgr_listener m_listener; + // wayland output listener struct wl_output_listener m_wlOutputListener; + // genivi ivi-application listener + struct ivi_application_listener m_ivi_app_listener; + // genivi ivi-controller listener struct ivi_controller_listener m_ivi_ctrl_listener; -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ - // genivi ivi-application listener - struct ivi_application_listener m_ivi_app_listener; -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ + // Wayland's Window Manager PlugIn instance + static struct ico_window_mgr *m_winmgr; // Wayland's genivi ivi_application instance static struct ivi_application *m_ivi_app; @@ -213,11 +264,9 @@ protected: // surface id for wayland/weston applications static int m_id_surface; -#ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */ // creation surface title name static struct creation_surface_wait *m_wait_surface_creation; static struct creation_surface_wait *m_free_surface_creation; -#endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */ }; #endif // __CICO_SC_WL_WINMGR_IF_H__ // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/Makefile.am b/lib/system-controller/Makefile.am index 72afcb8..df99372 100644 --- a/lib/system-controller/Makefile.am +++ b/lib/system-controller/Makefile.am @@ -6,7 +6,7 @@ noinst_LTLIBRARIES =\ #lib_LTLIBRARIES =\ # libico-system-controller.la -libico_system_controller_la_LDFLAGS = -version-info 0:9:0 +libico_system_controller_la_LDFLAGS = -version-info 0:9:0 libico_system_controller_la_SOURCES = \ CicoSCLifeCycleController.cpp \ CicoSCWaylandIF.cpp \ @@ -73,7 +73,8 @@ libico_system_controller_la_LIBADD = \ @MURPHYECORE_LIBS@ \ @MURPHYRESOURCE_LIBS@ \ $(UWS_LIBS) \ - $(GENIVI_LIBS) + $(GENIVI_LIBS) \ + $(WESTONPLUGIN_LIBS) AM_LDFLAGS = -module -avoid-version -rpath $(libdir) diff --git a/packaging/ico-uxf-homescreen.changes b/packaging/ico-uxf-homescreen.changes index b8903c0..cbbef6f 100644 --- a/packaging/ico-uxf-homescreen.changes +++ b/packaging/ico-uxf-homescreen.changes @@ -1,9 +1,3 @@ -* Fri Aug 29 2014 Shibata Makoto submit/tizen/20140827.131718@f8d5f54 -- 0.9.31 release --- Corresponding to TizenIVI3.0 M14.3, - GENIVI-LayerManagement was used instead of ico-uxf-weston-plugin, - and ico-uxf-weston-plugin was eliminated. - * Tue Apr 08 2014 Shibata Makoto accepted/tizen/ivi/panda/20140403.020026@294446b - 0.9.22 release -- bug fix: TIVI-3007 - Home button doesn't response after some operations. diff --git a/packaging/ico-uxf-homescreen.spec b/packaging/ico-uxf-homescreen.spec index 13fcf74..eeb4869 100644 --- a/packaging/ico-uxf-homescreen.spec +++ b/packaging/ico-uxf-homescreen.spec @@ -1,13 +1,14 @@ Name: ico-uxf-homescreen Summary: Sample homescreen and system controller -Version: 0.9.31 -Release: 1.1 +Version: 0.9.22 +Release: 0 Group: Automotive / ICO Homescreen License: Apache-2.0 URL: "" Source0: %{name}-%{version}.tar.bz2 -BuildRequires: pkgconfig(wayland-client) >= 1.5 +BuildRequires: pkgconfig(wayland-client) >= 1.4 +BuildRequires: ico-uxf-weston-plugin-devel >= 0.9.21 BuildRequires: pkgconfig(egl) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(ecore) @@ -32,16 +33,17 @@ BuildRequires: pkgconfig(notification) BuildRequires: pkgconfig(appsvc) BuildRequires: boost-devel BuildRequires: mesa-devel -BuildRequires: weston-ivi-shell-devel >= 0.1.7 -BuildRequires: genivi-shell-devel >= 0.2.3 +BuildRequires: weston-ivi-shell +BuildRequires: weston-ivi-shell-devel +BuildRequires: genivi-shell +BuildRequires: genivi-shell-devel BuildRequires: ico-uxf-utilities-devel >= 0.9.07 -Requires: weston >= 1.5 -Requires: weston-ivi-shell >= 0.1.7 -Requires: genivi-shell >= 0.2.3 +Requires: weston >= 1.4 +Requires: weston-ivi-shell +Requires: genivi-shell +Requires: ico-uxf-weston-plugin >= 0.9.21 Requires: ico-uxf-utilities >= 0.9.07 Requires: system-controller -Conflicts: weston-ivi-config -Conflicts: weston-ivi-shell-config %description Sample homescreen application. @@ -51,9 +53,10 @@ Sample homescreen application. Summary: System controller for ICO HomeScreen Group: Automotive / ICO Homescreen Requires: %{name} = %{version}-%{release} -Requires: weston >= 1.5 -Requires: weston-ivi-shell >= 0.1.7 -Requires: genivi-shell >= 0.2.3 +Requires: weston >= 1.4 +Requires: weston-ivi-shell +Requires: genivi-shell +Requires: ico-uxf-weston-plugin >= 0.9.21 Requires: ico-uxf-utilities >= 0.9.07 Provides: system-controller @@ -106,15 +109,12 @@ rm -rf %{buildroot} %make_install +cp tool/ico_clear_screen %{buildroot}%{_bindir} cp tool/ico_change_loginuser %{buildroot}%{_bindir} - -# configurations -%define weston_conf %{_sysconfdir}/xdg/weston -%define ecore_setting %{_sysconfdir}/profile.d -mkdir -p %{buildroot}%{weston_conf} > /dev/null 2>&1 -mkdir -p %{buildroot}%{ecore_setting} > /dev/null 2>&1 -install -m 0644 settings/weston.ini %{buildroot}%{weston_conf} -install -m 0644 settings/ecore.sh %{buildroot}%{ecore_setting} +cp tool/notification/ico_del_notification %{buildroot}%{_bindir} +cp tool/notification/ico_dump_notification %{buildroot}%{_bindir} +cp tool/notification/ico_send_notification %{buildroot}%{_bindir} +cp tool/notification/ico_send_notification2 %{buildroot}%{_bindir} %post /sbin/ldconfig @@ -150,9 +150,12 @@ rm -f /usr/share/applications/org.tizen.ico.system-controller.desktop /usr/share/packages/org.tizen.ico.onscreen.xml %{_libdir}/libico-appfw.* %{_libdir}/libico-state-machine.* +%{_bindir}/ico_clear_screen %{_bindir}/ico_change_loginuser -%{weston_conf}/weston.ini -%{ecore_setting}/ecore.sh +%{_bindir}/ico_del_notification +%{_bindir}/ico_dump_notification +%{_bindir}/ico_send_notification +%{_bindir}/ico_send_notification2 %files system-controller %manifest %{name}.manifest diff --git a/res/org.tizen.ico.homescreen/res/config/homescreen.conf b/res/org.tizen.ico.homescreen/res/config/homescreen.conf index 6fd691c..2f5cfa7 100644 --- a/res/org.tizen.ico.homescreen/res/config/homescreen.conf +++ b/res/org.tizen.ico.homescreen/res/config/homescreen.conf @@ -11,15 +11,11 @@ # StatusBar application id # -- onscreen # OnScreen application id -# -- background -# picture : picture as background -# transparent: see under runing APP window # #--------------------------------------------------------------------------- [homescreen] statusbar=org.tizen.ico.statusbar onscreen=org.tizen.ico.onscreen -background=picture #--------------------------------------------------------------------------- # HomeScreen application log setting diff --git a/settings/ecore.sh b/settings/ecore.sh deleted file mode 100644 index ee06ea6..0000000 --- a/settings/ecore.sh +++ /dev/null @@ -1,6 +0,0 @@ -##EFL_WAYLAND_USE_XDG_SHELL='defined' -##export EFL_WAYLAND_USE_XDG_SHELL - -# for EFL on GENIVI-LM -EFL_WAYLAND_USE_IVI_SHELL="defined" -export EFL_WAYLAND_USE_IVI_SHELL diff --git a/settings/weston.ini b/settings/weston.ini deleted file mode 100644 index f5fb998..0000000 --- a/settings/weston.ini +++ /dev/null @@ -1,53 +0,0 @@ -[core] -modules=ivi-controller.so -shell=ivi-shell.so - -[output] -name=LVDS1 -mode=1920x1080 -transform=90 - -[output] -name=VGA1 -mode=173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync -transform=90 - -#[output] -#name=X1 -#mode=1024x768 -#transform=flipped-270 - -[output] -name=HDMI1 -mode=1920x1080 -transform=90 - -[output] -name=HDMI3 -mode=1920x1080 -transform=90 - -[output] -name=DP1 -mode=1920x1080 -transform=90 - -[output] -name=UNKNOWN1 -mode=1280x768 -transform=90 - -[ivi-shell] -cursor-theme=default -cursor-size=32 - -ivi-module=ivi-layout.so -ivi-surface-creator-path=/usr/bin/LayerManagerControl - -[input-method] -path=/bin/weekeyboard - -#[keyboard] -#keymap_rules=evdev -#keymap_layout=jp - diff --git a/src/homescreen/CicoHSAppInfo.cpp b/src/homescreen/CicoHSAppInfo.cpp index ea36e90..7c0c6d8 100644 --- a/src/homescreen/CicoHSAppInfo.cpp +++ b/src/homescreen/CicoHSAppInfo.cpp @@ -19,7 +19,6 @@ #include "CicoSystemConfig.h" #include "CicoConf.h" #include "CicoHSLifeCycleController.h" -#include "CicoHSWindow.h" //========================================================================== // public functions @@ -58,14 +57,13 @@ CicoHSAppInfo::~CicoHSAppInfo(void) int CicoHSAppInfo::AddWindowInfo(ico_syc_win_info_t *wininfo) { - ico_syc_win_info_t wk_wininfo; if (NULL == wininfo) { ICO_ERR("wininfo is null."); return ICO_ERROR; } - ICO_TRA("CicoHSAppInfo::AddWindowInfo Enter(appid=%s surface=%x)", + ICO_TRA("CicoHSAppInfo::AddWindowInfo Enter(appid=%s surface=%x", wininfo->appid, wininfo->surface); // if exist window information, update current window information @@ -86,16 +84,9 @@ CicoHSAppInfo::AddWindowInfo(ico_syc_win_info_t *wininfo) ICO_ERR("CicoHSAppInfo::AddWindowInfo Leave(ERR)"); return ICO_ERROR; } - memcpy(&wk_wininfo, wininfo, sizeof(wk_wininfo)); - if ((wk_wininfo.name == NULL) || (*wk_wininfo.name == 0)) { - wk_wininfo.name = (char *)CicoHSWindow::getWindowName(m_window_num); - ICO_TRA("CicoHSAppInfo::AddWindowInfo surface=%d idx=%d name=<%s>", - wk_wininfo.surface, m_window_num, - wk_wininfo.name ? wk_wininfo.name : "(null)"); - } - SetWindowInfo(tmp_win_info, &wk_wininfo); + SetWindowInfo(tmp_win_info, wininfo); this->m_window_info.push_back(tmp_win_info); - ++ m_window_num; + ++m_window_num; ICO_TRA("CicoHSAppInfo::AddWindowInfo Leave(OK)"); return ICO_OK; @@ -112,8 +103,6 @@ CicoHSAppInfo::AddWindowInfo(ico_syc_win_info_t *wininfo) int CicoHSAppInfo::AddWindowAttr(ico_syc_win_attr_t *winattr) { - ico_syc_win_attr_t wk_winattr; - if (NULL == winattr) { ICO_ERR("winattr is null."); return ICO_ERROR; @@ -140,17 +129,10 @@ CicoHSAppInfo::AddWindowAttr(ico_syc_win_attr_t *winattr) ICO_TRA("CicoHSAppInfo::AddWindowAttr Leave(ERR)"); return ICO_ERROR; } - memcpy(&wk_winattr, winattr, sizeof(wk_winattr)); - if ((wk_winattr.name == NULL) || (*wk_winattr.name == 0)) { - wk_winattr.name = (char *)CicoHSWindow::getWindowName(m_window_num); - ICO_TRA("CicoHSAppInfo::AddWindowAttr surface=%d idx=%d name=<%s>", - wk_winattr.surface, m_window_num, - wk_winattr.name ? wk_winattr.name : "(null)"); - } - SetWindowAttr(tmp_win_info, &wk_winattr); + SetWindowAttr(tmp_win_info, winattr); m_window_info.push_back(tmp_win_info); - ++ m_window_num; + ++m_window_num; ICO_TRA("CicoHSAppInfo::AddWindowAttr Leave(OK)"); return ICO_OK; @@ -438,7 +420,7 @@ CicoHSAppInfo::SetWindowInfo(ico_hs_window_info *hs_wininfo, } // set window name(window title) - if((wininfo->name != NULL) && (*wininfo->name != 0)) { + if(wininfo->name != NULL){ strncpy(hs_wininfo->name, wininfo->name, ICO_HS_MAX_WINDOW_NAME); } // set surface id @@ -463,10 +445,9 @@ CicoHSAppInfo::SetWindowAttr(ico_hs_window_info *hs_wininfo, "(winifo=%p " "appid=%s winname=%s zone=%s surface=%x nodeid=%d layer=%d " "x/y=%d/%d w/h=%d/%d raise=%d visible=%d active=%d)", - hs_wininfo, winattr->appid, - ((winattr->name != NULL) && (*winattr->name != 0)) ? - winattr->name : hs_wininfo->name, - winattr->zone, winattr->surface, winattr->nodeid, winattr->layer, + hs_wininfo, + winattr->appid, winattr->name, winattr->zone, + winattr->surface, winattr->nodeid, winattr->layer, winattr->pos_x, winattr->pos_y, winattr->width, winattr->height, winattr->raise, winattr->visible, winattr->active); @@ -474,7 +455,7 @@ CicoHSAppInfo::SetWindowAttr(ico_hs_window_info *hs_wininfo, strncpy(hs_wininfo->appid, winattr->appid, ICO_HS_MAX_PROCESS_NAME); } - if ((winattr->name != NULL) && (*winattr->name != 0)) { + if (winattr->name != NULL) { strncpy(hs_wininfo->name, winattr->name, ICO_HS_MAX_WINDOW_NAME); } @@ -511,10 +492,9 @@ CicoHSAppInfo::GetFreeWindowInfoBuffer(void) ico_hs_window_info *tmp_win_info; for (int ii = 0; ii < ICO_HS_APP_MAX_WINDOW_NUM; ii++) { if (m_window_info_i[ii].valid == false) { - tmp_win_info = &m_window_info_i[ii]; - memset(tmp_win_info, 0, sizeof(ico_hs_window_info)); - tmp_win_info->valid = true; - return tmp_win_info; + tmp_win_info = &m_window_info_i[ii]; + tmp_win_info->valid = true; + return tmp_win_info; } } return NULL; diff --git a/src/homescreen/CicoHSControlBarWindow.cpp b/src/homescreen/CicoHSControlBarWindow.cpp index 40c936d..127e8f0 100644 --- a/src/homescreen/CicoHSControlBarWindow.cpp +++ b/src/homescreen/CicoHSControlBarWindow.cpp @@ -33,8 +33,6 @@ /*--------------------------------------------------------------------------*/ CicoHSControlBarWindow::CicoHSControlBarWindow(void) { - ICO_DBG("CicoHSControlBarWindow::CicoHSControlBarWindow: Enter"); - evas = NULL; CicoResourceConfig::GetImagePath(img_dir_path, ICO_HS_MAX_PATH_BUFF_LEN); @@ -95,7 +93,6 @@ CicoHSControlBarWindow::CicoHSControlBarWindow(void) ICO_DBG("shortcut_appid[%d] = NULL", ii); } } - ICO_DBG("CicoHSControlBarWindow::CicoHSControlBarWindow: Leave"); } /*--------------------------------------------------------------------------*/ @@ -124,25 +121,20 @@ CicoHSControlBarWindow::~CicoHSControlBarWindow(void) * @return OK or ERRROR */ /*--------------------------------------------------------------------------*/ -int +int CicoHSControlBarWindow::CreateControlBarWindow(int pos_x, int pos_y, int width, int height) { int ret; char img_path[ICO_HS_MAX_PATH_BUFF_LEN]; - - ICO_DBG("CicoHSControlBarWindow::CreateControlBarWindow: Enter(x/y=%d/%d,w/h=%d/%d)", - pos_x, pos_y, width, height); - + /*create window*/ ret = CreateWindow(ICO_HS_CONTROL_BAR_WINDOW_TITLE, pos_x, pos_y, width, height, EINA_TRUE); if(ret != ICO_OK){ - ICO_ERR("CreateWindow failed."); - ICO_DBG("CicoHSControlBarWindow::CreateControlBarWindow: Leave(Error=%d)", ret); - return ret; + return ret; } - + /* get evas */ evas = ecore_evas_get(window); if (!evas) { @@ -155,11 +147,11 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x, int pos_y, background = evas_object_rectangle_add(evas); // add callback functions - evas_object_event_callback_add(background, EVAS_CALLBACK_KEY_DOWN, + evas_object_event_callback_add(background, EVAS_CALLBACK_KEY_DOWN, CicoHSControlBarWindow::evasKeyDownCB, this); // key grab - evas_object_focus_set(background, EINA_FALSE); + evas_object_focus_set(background, EINA_FALSE); Eina_Bool eret = evas_object_key_grab(background, (const char*)changeZoneKeyName, 0, 0, EINA_TRUE); if (EINA_FALSE == eret) { @@ -212,7 +204,7 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x, int pos_y, ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT2); evas_object_image_file_set(menu_btn, img_path, NULL); - // load fisrt show icon image + // load fisrt show icon image snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path, ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY); evas_object_image_file_set(menu_btn, img_path, NULL); @@ -220,7 +212,7 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x, int pos_y, evas_object_move(menu_btn, (width/2) - (ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH /2), ICO_HS_CONTROL_BAR_MENU_BTN_START_POS_Y); - evas_object_resize(menu_btn, ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH, + evas_object_resize(menu_btn, ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH, ICO_HS_CONTROL_BAR_MENU_BTN_HEIGHT); evas_object_event_callback_add(menu_btn, EVAS_CALLBACK_MOUSE_DOWN, CicoHSControlBarTouch::TouchDownControlBar, @@ -228,12 +220,11 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x, int pos_y, evas_object_event_callback_add(menu_btn, EVAS_CALLBACK_MOUSE_UP, CicoHSControlBarTouch::TouchUpControlBar, NULL); - evas_object_show(menu_btn); + evas_object_show(menu_btn); /* shortcut */ AddShortcut(evas, width); - - ICO_DBG("CicoHSControlBarWindow::CreateControlBarWindow: Leave"); + return ICO_OK; } @@ -346,7 +337,7 @@ CicoHSControlBarWindow::FreeControlBarWindow(void) * @return none */ /*--------------------------------------------------------------------------*/ -void +void CicoHSControlBarWindow::TouchHome(void) { ActivationUpdate(); @@ -356,6 +347,7 @@ CicoHSControlBarWindow::TouchHome(void) else { CicoSound::GetInstance()->PlayOperationSound(); } + CicoHomeScreen::ChangeMode(ICO_HS_SHOW_HIDE_PATTERN_SLIDE); } @@ -521,6 +513,7 @@ CicoHSControlBarWindow::TouchShortcut(const char *appid) ICO_DBG("CicoHSControlBarWindow::TouchShortcut appid = [%s]", appid); CicoHomeScreen::ExecuteApp(appid); } + ICO_TRA("CicoHSControlBarWindow::TouchShortcut Leave"); } @@ -553,10 +546,10 @@ CicoHSControlBarWindow::onKeyDown(void *data, Evas *evas, TouchHome(); } else if (0 == strcmp(evinfo->keyname, backKeyName)) { - // TODO not assinded funciton + // TODO not assinded funciton } else if (0 == strcmp(evinfo->keyname, menuKeyName)) { - // TODO not assinded funciton + // TODO not assinded funciton } } diff --git a/src/homescreen/CicoHSEFLApp.cpp b/src/homescreen/CicoHSEFLApp.cpp index ed062cf..120f517 100644 --- a/src/homescreen/CicoHSEFLApp.cpp +++ b/src/homescreen/CicoHSEFLApp.cpp @@ -63,7 +63,8 @@ CicoHSEFLApp::onCreate(void *user_data) try { // load system config - (void) CicoSystemConfig::getInstance(); + CicoSystemConfig::getInstance()->load( + ICO_HS_LIFECYCLE_CONTROLLER_SETTING_PATH); // start homescreen m_homescreen = new CicoHomeScreen(); diff --git a/src/homescreen/CicoHSMenuTile.cpp b/src/homescreen/CicoHSMenuTile.cpp index 8f89118..d3a98c0 100644 --- a/src/homescreen/CicoHSMenuTile.cpp +++ b/src/homescreen/CicoHSMenuTile.cpp @@ -602,6 +602,7 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info) int unmap; int fd; char sWork[PATH_MAX]; +#if 0 /* for BMP format */ #pragma pack(push, 1) struct _bmphead { short magic; @@ -622,6 +623,7 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info) int colors2; } bmphead; #pragma pack(pop) +#endif ICO_DBG("CicoHSMenuTile::SetThumbnail(appid=%08x<%s>) info=%08x surf=%08x", (int)this->appid, appid, (int)info, info ? info->surface : 0); @@ -656,63 +658,17 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info) thumb.height = info->height; thumb.stride = info->stride; thumb.format = info->format; - - /* read surface image pixel */ - int bufsize = ((thumb.width * thumb.height * 4 + 4095) / 4096) * 4096; - if ((! thumb.pixel_data) || (bufsize > thumb.pixel_bufsize)) { - free(thumb.pixel_data); - thumb.pixel_data = (char *)malloc(bufsize); - thumb.pixel_bufsize = bufsize; - if (thumb.pixel_data) { - memset(thumb.pixel_data, 0, bufsize); - } - } - if (thumb.pixel_data) { - fd = open(sWork, O_RDONLY, 0644); - if (fd >= 0) { - if (read(fd, &bmphead, sizeof(bmphead)) != sizeof(bmphead)) { - ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)", - sWork); - close(fd); - fd = -1; - } - else if (read(fd, thumb.pixel_data, bufsize) <= 0) { - ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)", - sWork); - close(fd); - fd = -1; - } - else { - thumb.width = bmphead.width; - thumb.height = bmphead.height; - thumb.stride = thumb.width * 4; - } - } - else { - ICO_ERR("CicoHSMenuTile::SetThumbnail: can not open pixel file(%s)", - sWork); - } - if (fd >= 0) { - close(fd); - (void) unlink(sWork); - } - } - else { - ICO_ERR("CicoHSMenuTile::SetThumbnail: can not malloc pixel buffer"); - unmap = 1; - } - #if 0 /* too many log */ ICO_DBG("CicoHSMenuTile::SetThumbnail: make thumbnail %s(%08x) " "type=%d w/h/s=%d/%d/%d tile w/h=%d/%d", appid, thumb.surface, thumb.type, thumb.width, thumb.height, thumb.stride, width, height); #endif - if ((thumb.width <= 1) || (thumb.height <= 1)) { + if ((info->width <= 1) || (info->height <= 1)) { ICO_DBG("CicoHSMenuTile::SetThumbnail: small surface(%d,%d) skip", - thumb.width, thumb.height); + info->width, info->height); } - else if (unmap == 0) { + else { // create thumbnail image svx = thumb_reduce_x; svy = thumb_reduce_y; @@ -766,16 +722,54 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info) + ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2); } } - evas_object_image_data_update_add( - thumb_tile, 0, 0, thumb.width, thumb.height); - icon = thumb_tile; - evas_object_image_size_set(thumb_tile, thumb.width, thumb.height); - evas_object_image_data_set(thumb_tile, thumb.pixel_data); - evas_object_image_filled_set(thumb_tile, EINA_TRUE); - evas_object_resize(thumb_tile, width - thumb_reduce_x * 2, - height - thumb_reduce_y * 2); - evas_object_move(thumb_tile, - pos_x + thumb_reduce_x, pos_y + thumb_reduce_y); + /* read surface image pixel */ + int bufsize = ((thumb.width * thumb.height * 4 + 4095) / 4096) * 4096; + if ((! thumb.pixel_data) || (bufsize > thumb.pixel_bufsize)) { + free(thumb.pixel_data); + thumb.pixel_data = (char *)malloc(bufsize); + thumb.pixel_bufsize = bufsize; + if (thumb.pixel_data) { + memset(thumb.pixel_data, 0, bufsize); + } + } + if (thumb.pixel_data) { + fd = open(sWork, O_RDONLY, 0644); + if (fd >= 0) { +#if 0 /* for BMP format */ + if (read(fd, &bmphead, sizeof(bmphead)) != sizeof(bmphead)) { + ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)", + sWork); + } + else +#endif + if (read(fd, thumb.pixel_data, bufsize) <= 0) { + ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)", + sWork); + } + } + else { + ICO_ERR("CicoHSMenuTile::SetThumbnail: can not open pixel file(%s)", + sWork); + } + if (fd >= 0) { + close(fd); + (void) unlink(sWork); + } + evas_object_image_data_update_add( + thumb_tile, 0, 0, thumb.width, thumb.height); + icon = thumb_tile; + evas_object_image_size_set(thumb_tile, thumb.width, thumb.height); + evas_object_image_data_set(thumb_tile, thumb.pixel_data); + evas_object_image_filled_set(thumb_tile, EINA_TRUE); + evas_object_resize(thumb_tile, width - thumb_reduce_x * 2, + height - thumb_reduce_y * 2); + evas_object_move(thumb_tile, + pos_x + thumb_reduce_x, pos_y + thumb_reduce_y); + } + else { + ICO_ERR("CicoHSMenuTile::SetThumbnail: can not malloc pixel buffer"); + unmap = 1; + } } } @@ -825,9 +819,10 @@ CicoHSMenuTile::ShowMenu(bool show) { char sWork[PATH_MAX]; menu_show = show; - if (thumb.surface != 0) { + if ((thumb_tile) && (thumb.surface != 0)) { sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x." ICO_HS_THUMB_FILEEXT, thumb.surface); + (void) unlink(sWork); ico_syc_map_thumb(thumb.surface, menu_show ? ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW : ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE, sWork); @@ -846,6 +841,7 @@ CicoHSMenuTile::ShowMenu(bool show) void CicoHSMenuTile::SetOrgThumbnail(CicoHSMenuTile *orgTile) { + ICO_DBG("CicoHSMenuTile::SetOrgThumbnail Enter(appid=%08x<%s>) run=%d surf=%08x", (int)this->appid, this->appid, app_running, orgTile->thumb.surface ); diff --git a/src/homescreen/CicoHSMenuTile.h b/src/homescreen/CicoHSMenuTile.h index 76c2e1b..1950504 100644 --- a/src/homescreen/CicoHSMenuTile.h +++ b/src/homescreen/CicoHSMenuTile.h @@ -75,7 +75,7 @@ #define ICO_HS_MENUTILE_TERM_ICON_WIDTH 64 #define ICO_HS_MENUTILE_TERM_ICON_HEIGHT 64 -#define ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW 5 /* 5 frames/sec */ +#define ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW 15 /* 15 frames/sec */ #define ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE -1 /* meanse 'not update' */ #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX 4 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2 6 @@ -85,7 +85,7 @@ /*shared memory buffer*/ #define ICO_HS_THUMB_ICODIR "/tmp/ico" #define ICO_HS_THUMB_FILEDIR "/thumbnail" -#define ICO_HS_THUMB_FILEEXT "bmp" +#define ICO_HS_THUMB_FILEEXT "pixel" struct _CicoHSMenuTile_thumb { int surface; // surface id diff --git a/src/homescreen/CicoHSMenuWindow.cpp b/src/homescreen/CicoHSMenuWindow.cpp index ce8d9fa..bd67e73 100644 --- a/src/homescreen/CicoHSMenuWindow.cpp +++ b/src/homescreen/CicoHSMenuWindow.cpp @@ -39,13 +39,6 @@ int CicoHSMenuWindow::menu_tile_height = 290; /*--------------------------------------------------------------------------*/ CicoHSMenuWindow::CicoHSMenuWindow(void) { - CicoGKeyFileConfig config; - config.Initialize(ICO_HOMESCREEN_CONFIG_FILE); - const char *value = config.ConfigGetString("homescreen", "background", "picture"); - transparent_background = false; - if (strcmp(value, "picture") != 0) - transparent_background = true; - /*initialzie values*/ terminate_mode = false; @@ -101,26 +94,21 @@ CicoHSMenuWindow::SetMenuBack(void) { char img_path[ICO_HS_MAX_PATH_BUFF_LEN]; /* set menu back */ + /* image file name*/ + snprintf(img_path, sizeof(img_path), "%s%s", + img_dir_path, ICO_HS_IMAGE_FILE_MENU_BACK_GROUND); /* set object*/ - if (transparent_background) { - /* image file name*/ - snprintf(img_path, sizeof(img_path), "%s%s", - img_dir_path, ICO_HS_IMAGE_FILE_MENU_BACK_GROUND_BLANK); - - rectangle = evas_object_rectangle_add(evas); - if (true == CicoHSSystemState::getInstance()->getNightMode()) { - evas_object_color_set(rectangle,0,0,0,178); - } - else { - evas_object_color_set(rectangle,120,120,120,178); - } - evas_object_move(rectangle, 0, 0); - evas_object_resize(rectangle, width, height); - evas_object_show(rectangle); - } else - snprintf(img_path, sizeof(img_path), "%s%s", - img_dir_path, ICO_HS_IMAGE_FILE_MENU_BACK_GROUND_PICTURE); + rectangle = evas_object_rectangle_add(evas); + if (true == CicoHSSystemState::getInstance()->getNightMode()) { + evas_object_color_set(rectangle,0,0,0,178); + } + else { + evas_object_color_set(rectangle,120,120,120,178); + } + evas_object_move(rectangle, 0, 0); + evas_object_resize(rectangle, width, height); + evas_object_show(rectangle); /* set object*/ canvas = evas_object_image_filled_add(evas); @@ -157,8 +145,7 @@ void CicoHSMenuWindow::FreeMenuBack(void) { evas_object_del(canvas); - if (transparent_background) - evas_object_del(rectangle); + evas_object_del(rectangle); } /*--------------------------------------------------------------------------*/ @@ -1603,13 +1590,11 @@ void CicoHSMenuWindow::SetNightMode(void) { ICO_TRA("CicoHSMenuWindow::SetNightMode Enter"); - if (transparent_background) { - if (true == CicoHSSystemState::getInstance()->getNightMode()) { - evas_object_color_set(rectangle,0,0,0,178); - } - else { - evas_object_color_set(rectangle,120,120,120,178); - } + if (true == CicoHSSystemState::getInstance()->getNightMode()) { + evas_object_color_set(rectangle,0,0,0,178); + } + else { + evas_object_color_set(rectangle,120,120,120,178); } ICO_TRA("CicoHSMenuWindow::SetNightMode Leave"); } diff --git a/src/homescreen/CicoHSMenuWindow.h b/src/homescreen/CicoHSMenuWindow.h index badcf13..d96ebf4 100644 --- a/src/homescreen/CicoHSMenuWindow.h +++ b/src/homescreen/CicoHSMenuWindow.h @@ -59,7 +59,7 @@ #define ICO_HS_MENU_SHOW_ANIMATION_SLIDE "Slide" #define ICO_HS_MENU_HIDE_ANIMATION_FADE "Fade" #define ICO_HS_MENU_SHOW_ANIMATION_FADE "Fade" -#define ICO_HS_MENU_ANIMATION_DURATION 400 +#define ICO_HS_MENU_ANIMATION_DURATION 300 #define ICO_HS_MENU_OTHER_CATEGORY_ID -1 @@ -163,7 +163,6 @@ class CicoHSMenuWindow :public CicoHSWindow Evas *evas; /* menu back */ Evas_Object *canvas; - bool transparent_background; Evas_Object *rectangle; /* tiles */ CicoHSMenuTile *menu_tile[ICO_HS_MENU_MAX_TILE_NUM]; diff --git a/src/homescreen/CicoHSSwipeInputWindow.cpp b/src/homescreen/CicoHSSwipeInputWindow.cpp index e827a97..dbf6f8e 100644 --- a/src/homescreen/CicoHSSwipeInputWindow.cpp +++ b/src/homescreen/CicoHSSwipeInputWindow.cpp @@ -157,6 +157,8 @@ CicoHSSwipeInputWindow::SetupSwipeWindow(void) memset(&show, 0, sizeof(show)); show.name = (char *)"none"; + /* set default animation */ + ico_syc_set_animation(appid, surface, ICO_SYC_ANIMATION_TYPE_ALL, &show); /* move swipe input window to TouchLayer */ ico_syc_change_layer(appid, surface, HS_LAYER_TOUCHPANEL); /* move window position and size */ diff --git a/src/homescreen/CicoHSSwipeTouch.cpp b/src/homescreen/CicoHSSwipeTouch.cpp index 76e6046..8232668 100644 --- a/src/homescreen/CicoHSSwipeTouch.cpp +++ b/src/homescreen/CicoHSSwipeTouch.cpp @@ -440,7 +440,7 @@ CicoHSSwipeTouch::TouchMoveSwipe(void *data, Evas *evas, Evas_Object *obj, void set_xy_pos = true; touch_state_b_x = touch_state_a_x; touch_state_b_y = touch_state_a_y; -// ICO_DBG("TouchMoveSwipe: save x/y=%d/%d", touch_state_b_x, touch_state_b_y); + ICO_DBG("TouchMoveSwipe: save x/y=%d/%d", touch_state_b_x, touch_state_b_y); } #if 0 /* too many log */ ICO_DBG("TouchMoveSwipe: Swipe Move (%d,%d)->(%d,%d) Button=%x", diff --git a/src/homescreen/CicoHSSwipeTouch.h b/src/homescreen/CicoHSSwipeTouch.h index 5f78c56..4f5a0bc 100644 --- a/src/homescreen/CicoHSSwipeTouch.h +++ b/src/homescreen/CicoHSSwipeTouch.h @@ -28,7 +28,7 @@ #define ICO_HS_SWIPE_TOUCH_DISTANCE_TOP 200 #define ICO_HS_SWIPE_TOUCH_DISTANCE_BOTTOM 128 #define ICO_HS_SWIPE_TOUCH_SWIPE_THREASHOLD_DISTANCE 60 -#define ICO_HS_SWIPE_TOUCH_SWIPE_ANIMA_TIME 400 +#define ICO_HS_SWIPE_TOUCH_SWIPE_ANIMA_TIME 300 #define ICO_HS_MAX_SWIPEWINDOWS 4 diff --git a/src/homescreen/CicoHSWindow.cpp b/src/homescreen/CicoHSWindow.cpp index 5d7f5f5..1532716 100644 --- a/src/homescreen/CicoHSWindow.cpp +++ b/src/homescreen/CicoHSWindow.cpp @@ -13,11 +13,6 @@ */ #include "CicoHSWindow.h" -//========================================================================== -// static variables -//========================================================================== -struct created_window_name *CicoHSWindow::created_window_title = NULL; - /*============================================================================*/ /* functions */ /*============================================================================*/ @@ -34,7 +29,6 @@ CicoHSWindow::CicoHSWindow(void) { window = NULL; } - /*--------------------------------------------------------------------------*/ /** * @brief CicoHSWindow::~CicoHSWindow @@ -51,7 +45,6 @@ CicoHSWindow::~CicoHSWindow(void) FreeWindow(); } } - /*--------------------------------------------------------------------------*/ /** * @brief CicoHSWindow::CreateWindow @@ -61,86 +54,30 @@ CicoHSWindow::~CicoHSWindow(void) * @return none */ /*--------------------------------------------------------------------------*/ -int -CicoHSWindow::CreateWindow(const char *title, int pos_x, int pos_y, - int width, int height, int alpha) +int +CicoHSWindow::CreateWindow(const char *title,int pos_x,int pos_y,int width,int height,int alpha) { - struct created_window_name *winname; - struct created_window_name *tp; - - ICO_DBG("CicoHSWindow::CreateWindow: Enter(%s,x/y=%d/%d,w/h=%d/%d,a=%d)", - title, pos_x, pos_y, width, height, alpha); - + this->pos_x = pos_x; this->pos_y = pos_y; this->width = width; this->height = height; - /* Make a new ecore_evas */ - window = ecore_evas_new(NULL, pos_x, pos_y, width, height, "frame=0"); + /* Make a new ecore_evas */ + window = ecore_evas_new(NULL, pos_x, pos_y, width, height, "frame=0"); /* if do not creted new, enlightenment return NULL */ if (!window) { - ICO_ERR("CicoHSWindow::CreateWindow: could not create new_window."); - ICO_DBG("CicoHSWindow::CreateWindow: Leave(Error)"); + EINA_LOG_CRIT("CicoHSWindow::Initialize: could not create new_window."); return ICO_ERROR; } strncpy(this->title, title, ICO_MAX_TITLE_NAME_LEN); ecore_evas_title_set(window, this->title); - /* alpha channel is enable */ + /* alpha channel is enable*/ ecore_evas_alpha_set(window, alpha); - /* save window name(title) */ - winname = (struct created_window_name *)malloc(sizeof(struct created_window_name)); - if (! winname) { - ICO_ERR("CicoHSWindow::CreateWindow: out of memory"); - ICO_DBG("CicoHSWindow::CreateWindow: Leave(Error)"); - return ICO_ERROR; - } - else { - memset(winname, 0, sizeof(struct created_window_name)); - strncpy(winname->winname, title, ICO_MAX_TITLE_NAME_LEN-1); - if (created_window_title) { - tp = created_window_title; - while (tp->next) tp = tp->next; - tp->next = winname; - } - else { - created_window_title = winname; - } - } - ICO_DBG("CicoHSWindow::CreateWindow: Leave"); return ICO_OK; } - -/*--------------------------------------------------------------------------*/ -/** - * @brief CicoHSWindow::getWindowName - * get window title by window index - * - * @param[in] index - * @return window title - */ -/*--------------------------------------------------------------------------*/ -const char * -CicoHSWindow::getWindowName(const int index) -{ - int i = index; - struct created_window_name *tp = created_window_title; - - for (i = 0; i < index; i++) { - if (! tp) break; - tp = tp->next; - } - - if (tp) { - return tp->winname; - } - else { - return "\0"; - } -} - /*--------------------------------------------------------------------------*/ /** * @brief CicoHSWindow::FreeWindow @@ -150,12 +87,11 @@ CicoHSWindow::getWindowName(const int index) * @return none */ /*--------------------------------------------------------------------------*/ -void +void CicoHSWindow::FreeWindow(void) { ecore_evas_free(window); } - /*--------------------------------------------------------------------------*/ /** * @brief CicoHSWindow::WindowSetting @@ -173,14 +109,13 @@ CicoHSWindow::WindowSetting(int pos_x,int pos_y,int width,int height,int alpha) this->width = width; this->height = height; - /* move */ + /* move */ ecore_evas_move(window,pos_x,pos_y); - /* resize */ + /* resize */ ecore_evas_resize(window, width, height); - /* alpha channel is enable */ + /* alpha channel is enable*/ ecore_evas_alpha_set(window, alpha); } - /*--------------------------------------------------------------------------*/ /** * @brief CicoHSWindow::ShowWindow @@ -193,7 +128,7 @@ CicoHSWindow::WindowSetting(int pos_x,int pos_y,int width,int height,int alpha) void CicoHSWindow::ShowWindow(void) { - /* showing */ + /* showing */ ecore_evas_show(window); } @@ -209,7 +144,7 @@ CicoHSWindow::ShowWindow(void) void CicoHSWindow::HideWindow(void) { - /* hiding */ + /* hiding */ ecore_evas_hide(window); } // vim:set expandtab ts=4 sw=4: diff --git a/src/homescreen/CicoHSWindow.h b/src/homescreen/CicoHSWindow.h index 1efd19d..028a030 100644 --- a/src/homescreen/CicoHSWindow.h +++ b/src/homescreen/CicoHSWindow.h @@ -34,11 +34,6 @@ #define ICO_MAX_TITLE_NAME_LEN 64 -struct created_window_name { - struct created_window_name *next; - char winname[ICO_MAX_TITLE_NAME_LEN]; -}; - class CicoHSWindow { public: @@ -49,8 +44,6 @@ class CicoHSWindow void WindowSetting(int pos_x,int pos_y,int width,int height,int alpha); void ShowWindow(void); void HideWindow(void); - - static const char *getWindowName(const int index); private: protected: @@ -63,8 +56,6 @@ class CicoHSWindow int width; /*width*/ int height; /*height*/ Ecore_Evas *window; /* ecore-evas object */ - - static struct created_window_name *created_window_title; }; #endif // vim:set expandtab ts=4 sw=4: diff --git a/src/homescreen/CicoHSWindowController.cpp b/src/homescreen/CicoHSWindowController.cpp index c80c9ff..52e4c28 100644 --- a/src/homescreen/CicoHSWindowController.cpp +++ b/src/homescreen/CicoHSWindowController.cpp @@ -12,8 +12,6 @@ * @date Aug-08-2013 */ #include "CicoHSWindowController.h" -#include "CicoConf.h" -#include "CicoSystemConfig.h" Ecore_Evas *CicoHSWindowController::ms_ecoreEvas = NULL; @@ -104,28 +102,23 @@ CicoHSWindowController::GetFullScreenSize(int orientation, ICO_DBG("ecore_wl_screen_size_get => w/h=%d/%d", display_width, display_height); -#if 1 /* 2014/07/16 ecore_wl_screen_size_get() bug */ - if ((display_width <= 0) || (display_height <= 0)) { - const CicoSCDisplayConf* dispconf = CicoSystemConfig::getInstance() - ->findDisplayConfbyId(0); - if (dispconf) { - // if Ecore has no full screen size, get from configuration - display_width = dispconf->width; - display_height = dispconf->height; - ICO_DBG("Screen size w/h=%d/%d from Config", display_width, display_height); - } - else { - // if Ecore and config has no full screen size, fixed vaule - display_width = 1080; - display_height = 1920; - ICO_DBG("Screen size w/h=1080/1920 fixed"); - } - } -#endif /* 2014/07/16 ecore_wl_screen_size_get() bug */ - +#if 1 /* TizenIVI 3.0 ecore return correct display size */ *width = display_width; *height = display_height; - +#else /* TizenIVI 3.0 ecore return correct display size */ + if (orientation == ICO_ORIENTATION_VERTICAL) { + *width = display_width > display_height ? + display_height : display_width; + *height = (display_width > display_height ? + display_width : display_height); + } + else { + *width = display_width < display_height ? + display_height : display_width; + *height = (display_width < display_height ? + display_width : display_height); + } +#endif /* TizenIVI 3.0 ecore return correct display size */ ICO_TRA("CicoHSWindowController::GetFullScreenSize Leave(w/h=%d/%d)", *width, *height); } // vim:set expandtab ts=4 sw=4: diff --git a/src/homescreen/CicoHomeScreen.cpp b/src/homescreen/CicoHomeScreen.cpp index 7a0961d..9b64cfb 100644 --- a/src/homescreen/CicoHomeScreen.cpp +++ b/src/homescreen/CicoHomeScreen.cpp @@ -334,7 +334,7 @@ CicoHomeScreen::requestChangeZone(CicoHSAppInfo* appinfo) return; } - ICO_DBG("change zone: \"%s\"->\"%s\" move with (w/h=0/0)", wininfo->zone, dispzone); + ICO_DBG("change zone: \"%s\"->\"%s\"", wininfo->zone, dispzone); ico_syc_win_move_t move = { .zone = (char*)dispzone, .layer = layer, @@ -644,10 +644,10 @@ CicoHomeScreen::ShowHomeScreenWindow(ico_syc_win_info_t *win_info) return; } - ico_syc_change_layer(win_info->appid, win_info->surface, layer); - ICO_DBG("CicoHomeScreen::ShowHomeScreenWindow: id(%s) name(%s) layer(%d) surface(%x) " + ico_syc_change_layer(win_info->appid,win_info->surface,layer); + ICO_DBG("CicoHomeScreen::ShowHomeScreenWindow: id(%s) name(%s) surface(%d) " "pos(%d,%d) size(%d,%d)", win_info->appid, - win_info->name, layer, win_info->surface, move. pos_x, move.pos_y, + win_info->name, win_info->surface, move. pos_x, move.pos_y, move.width, move.height); ico_syc_move(win_info->appid, win_info->surface, &move, NULL); @@ -681,13 +681,13 @@ CicoHomeScreen::ShowStatusBarWindow(ico_syc_win_info_t *win_info) move.height = ICO_HS_STATUSBAR_WINDOW_HEIGHT; layer = HS_LAYER_CONTROLBAR; - ico_syc_change_layer(win_info->appid, win_info->surface, layer); + ico_syc_change_layer(win_info->appid,win_info->surface,layer); ICO_DBG("CicoHomeScreen::ShowStatusBarWindow: id(%s) name(%s) surface(%d) " - "pos(%d,%d) size(%d,%d)", win_info->appid, - win_info->name, win_info->surface, move.pos_x, move.pos_y, - move.width, move.height); - ico_syc_move(win_info->appid, win_info->surface, &move, NULL); - ico_syc_show(win_info->appid, win_info->surface, NULL); + "pos(%d,%d) size(%d,%d)",win_info->appid, + win_info->name,win_info->surface,move.pos_x,move.pos_y, + move.width,move.height); + ico_syc_move(win_info->appid,win_info->surface,&move,NULL); + ico_syc_show(win_info->appid, win_info->surface,NULL); } /*--------------------------------------------------------------------------*/ @@ -738,9 +738,9 @@ CicoHomeScreen::ShowApplicationWindow(ico_syc_win_info_t *win_info) move.height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT - ICO_HS_CONTROLBAR_WINDOW_HEIGHT; - ico_syc_move(win_info->appid, win_info->surface, &move, NULL); + ico_syc_move(win_info->appid,win_info->surface,&move,NULL); ico_syc_animation_t animation; - animation.name = (char*)ICO_SYC_WIN_ANIMATION_FADE; + animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE; animation.time = ICO_HS_MENU_ANIMATION_DURATION; const string& lastStartupApp = m_appHis->getLastStartupAppid(); if (true == lastStartupApp.empty()) { @@ -795,78 +795,70 @@ CicoHomeScreen::RaiseApplicationWindow(const char *appid,int surface) /*--------------------------------------------------------------------------*/ void CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, - const void *detail, void *user_data) + const void *detail,void *user_data) { int idx; - ICO_DBG("CicoHomeScreen::EventCallBack: start(event %d)", event); +// ICO_DBG("CicoHomeScreen::EventCallBack: start (event %d)",event); if (event == ICO_SYC_EV_WIN_CREATE) { - ico_syc_win_info_t wk_win_info; - - memcpy(&wk_win_info, detail, sizeof(wk_win_info)); - - ICO_DBG("Event:ICO_SYC_EV_WIN_CREATE(appid=%s surface=%d[%x])", - wk_win_info.appid, wk_win_info.surface, wk_win_info.surface); - /* only save information */ - if (strncmp(wk_win_info.appid, hs_instance->GetHsPackageName(), + ico_syc_win_info_t *win_info = + reinterpret_cast(const_cast(detail)); + ICO_DBG("Event:ICO_SYC_EV_WIN_CREATE(appid=%s surface=%08x)", + win_info->appid, win_info->surface); + /*only save information*/ + if (strncmp(win_info->appid, hs_instance->GetHsPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { - /* Home Screen */ - hs_instance->hs_app_info->AddWindowInfo(&wk_win_info); - - if ((wk_win_info.name == NULL) || (*wk_win_info.name == 0)) { - ico_hs_window_info *hs_win_info - = hs_instance->hs_app_info->GetWindowInfobySurface(wk_win_info.surface); - if (hs_win_info) wk_win_info.name = &hs_win_info->name[0]; - } + /*Home Screen*/ + hs_instance->hs_app_info->AddWindowInfo(win_info); - /* when Menu window */ - if (strncmp(wk_win_info.name, ICO_HS_MENU_WINDOW_TITLE, + /*when Menu window*/ + if (strncmp(win_info->name,ICO_HS_MENU_WINDOW_TITLE, ICO_MAX_TITLE_NAME_LEN) == 0) { - hs_instance->menu_window->SetMenuWindowID(wk_win_info.appid, - wk_win_info.surface); + hs_instance->menu_window->SetMenuWindowID(win_info->appid, + win_info->surface); } - else if (strncmp(wk_win_info.name, ICO_HS_CONTROL_BAR_WINDOW_TITLE, + else if (strncmp(win_info->name,ICO_HS_CONTROL_BAR_WINDOW_TITLE, ICO_MAX_TITLE_NAME_LEN) == 0) { - hs_instance->ctl_bar_window->SetWindowID(wk_win_info.appid, - wk_win_info.surface); + hs_instance->ctl_bar_window->SetWindowID(win_info->appid, + win_info->surface); } else { - if (wk_win_info.name[0] == 0) { - /* null name, nothing to do */ + if (win_info->name[0] == 0) { + /* null name, nothing to do */ return; } for (idx = 0; idx < hs_instance->num_swipe_input_windows; idx++) { if (hs_instance->swipe_input_windows[idx]-> - isMyWindowName(wk_win_info.name)) { + isMyWindowName(win_info->name)) { hs_instance->swipe_input_windows[idx]-> - SetWindowID(wk_win_info.appid, wk_win_info.surface); + SetWindowID(win_info->appid, win_info->surface); hs_instance->swipe_input_windows[idx]->SetupSwipeWindow(); break; } } } - /* show window */ - hs_instance->ShowHomeScreenWindow(&wk_win_info); + /*show window*/ + hs_instance->ShowHomeScreenWindow(win_info); } - else if (strncmp(wk_win_info.appid, + else if (strncmp(win_info->appid, hs_instance->GetSbPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { - /* Status Bar */ - hs_instance->sb_app_info->AddWindowInfo(&wk_win_info); + /*Status Bar*/ + hs_instance->sb_app_info->AddWindowInfo(win_info); - /* show window */ - hs_instance->ShowStatusBarWindow(&wk_win_info); + /*show window*/ + hs_instance->ShowStatusBarWindow(win_info); } - else if (strncmp(wk_win_info.appid, + else if (strncmp(win_info->appid, hs_instance->GetOsPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { // On Screen - hs_instance->os_app_info->AddWindowInfo(&wk_win_info); + hs_instance->os_app_info->AddWindowInfo(win_info); // change the layer of onscreen window - ico_syc_change_layer(wk_win_info.appid, wk_win_info.surface, + ico_syc_change_layer(win_info->appid, win_info->surface, HS_LAYER_ONSCREEN); const CicoSCPositionOSConf* oPOSC = @@ -879,28 +871,28 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, move.width = oPOSC->m_w; move.height = oPOSC->m_h; ico_syc_animation_t animation; - animation.name = (char*)ICO_SYC_WIN_ANIMATION_SLIDE_TOTOP; + animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_SLIDE; animation.time = ICO_HS_MENU_ANIMATION_DURATION; - ico_syc_move(wk_win_info.appid, wk_win_info.surface, &move, &animation); + ico_syc_move(win_info->appid, win_info->surface, &move, &animation); + } else { - /* Application */ - CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(wk_win_info.appid); + /*Application*/ + CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_info->appid); if (appinfo == NULL) { return; } - appinfo->AddWindowInfo(&wk_win_info); + appinfo->AddWindowInfo(win_info); - appinfo->SetLastSurface(wk_win_info.surface); - hs_instance->ShowApplicationWindow(&wk_win_info); - ico_syc_change_active(wk_win_info.appid, wk_win_info.surface); - hs_instance->SetActiveAppInfo(wk_win_info.appid); - hs_instance->UpdateTile(wk_win_info.appid); + appinfo->SetLastSurface(win_info->surface); + hs_instance->ShowApplicationWindow(win_info); + ico_syc_change_active(win_info->appid,win_info->surface); + hs_instance->SetActiveAppInfo(win_info->appid); + hs_instance->UpdateTile(win_info->appid); - hs_instance->startupCheck(wk_win_info.appid); + hs_instance->startupCheck(win_info->appid); } } -#if 0 /* GENIVI-LM not support window title */ else if (event == ICO_SYC_EV_WIN_NAME) { ico_syc_win_info_t *win_info = reinterpret_cast(const_cast(detail)); @@ -909,10 +901,10 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, if (strncmp(win_info->appid, hs_instance->GetHsPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { - /* Home Screen */ + /*Home Screen*/ hs_instance->hs_app_info->AddWindowInfo(win_info); - /* when Menu window */ + /*when Menu window*/ if (strncmp(win_info->name,ICO_HS_MENU_WINDOW_TITLE, ICO_MAX_TITLE_NAME_LEN) == 0) { hs_instance->menu_window->SetMenuWindowID(win_info->appid, @@ -935,21 +927,21 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, } } - /* show window */ + /*show window*/ hs_instance->ShowHomeScreenWindow(win_info); } else if (strncmp(win_info->appid, hs_instance->GetSbPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { - /* Status Bar */ + /*Status Bar*/ hs_instance->sb_app_info->AddWindowInfo(win_info); } else if (strncmp(win_info->appid, hs_instance->GetOsPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { - /* On Screen */ + /*On Screen*/ hs_instance->os_app_info->AddWindowInfo(win_info); } else { - /* Application */ + /*Application*/ CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_info->appid); if (appinfo == NULL) { return; @@ -957,13 +949,12 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, appinfo->AddWindowInfo(win_info); } } -#endif /* GENIVI-LM not support window title */ else if (event == ICO_SYC_EV_WIN_DESTROY) { ico_syc_win_info_t *win_info = reinterpret_cast(const_cast(detail)); - ICO_DBG("Event:ICO_SYC_EV_WIN_DESTROY(appid=%s surface=%d[%x])", - win_info->appid, win_info->surface, win_info->surface); - /* only save information */ + ICO_DBG("Event:ICO_SYC_EV_WIN_DESTROY(appid=%s surface=%08x)", + win_info->appid, win_info->surface); + /*only save information*/ if (strncmp(win_info->appid, hs_instance->GetHsPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { hs_instance->hs_app_info->FreeWindowInfo(win_info->name); @@ -979,7 +970,7 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, hs_instance->os_app_info->FreeWindowInfo(win_info->name); } else { - /* Application */ + /*Application*/ CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_info->appid); if (appinfo == NULL) { @@ -1004,34 +995,34 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, else if (event == ICO_SYC_EV_WIN_ACTIVE) { ico_syc_win_info_t *win_info = reinterpret_cast(const_cast(detail)); - ICO_DBG("Event:ICO_SYC_EV_WIN_ACTIVE(appid=%s surface=%d[%x])", - win_info->appid, win_info->surface, win_info->surface); + ICO_DBG("Event:ICO_SYC_EV_WIN_ACTIVE(appid=%s surface=%08x)", + win_info->appid, win_info->surface); hs_instance->ChangeActive(win_info->appid, win_info->surface); } else if (event == ICO_SYC_EV_WIN_ATTR_CHANGE) { ico_syc_win_attr_t *win_attr = reinterpret_cast(const_cast(detail)); - ICO_DBG("Event:ICO_SYC_EV_WIN_ATTR_CHANGE(appid=%s surface=%d[%x])", - win_attr->appid, win_attr->surface, win_attr->surface); + ICO_DBG("Event:ICO_SYC_EV_WIN_ATTR_CHANGE(appid=%s surface=%08x)", + win_attr->appid, win_attr->surface); if (strncmp(win_attr->appid, hs_instance->GetHsPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { - /* Home Screen */ + /*Home Screen*/ hs_instance->hs_app_info->AddWindowAttr(win_attr); } else if (strncmp(win_attr->appid, hs_instance->GetSbPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { - /* Status Bar */ + /*Status Bar*/ hs_instance->sb_app_info->AddWindowAttr(win_attr); } else if (strncmp(win_attr->appid, hs_instance->GetOsPackageName(), ICO_HS_MAX_PROCESS_NAME) == 0) { - /* On Screen */ + /*On Screen*/ hs_instance->os_app_info->AddWindowAttr(win_attr); } else { ICO_DBG("CicoHomeScreen::EventCallBack : application window %s %s", win_attr->appid,win_attr->name); - /* Application */ + /*Application*/ CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_attr->appid); if (appinfo == NULL) { return; @@ -1072,6 +1063,7 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, } } } + // update window information appinfo->AddWindowAttr(win_attr); hs_instance->UpdateTile(win_attr->appid); @@ -1082,9 +1074,8 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, reinterpret_cast(const_cast(detail)); CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(thumb_info->appid); if (appinfo == NULL) { - ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_CHANGE %s" - "(%d[%x]) no appinfo", - thumb_info->appid, thumb_info->surface, thumb_info->surface); + ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_CHANGE %s(%02x) " + "no appinfo", thumb_info->appid, thumb_info->surface); return; } // ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_CHANGE %s(%02x)", @@ -1097,13 +1088,12 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, reinterpret_cast(const_cast(detail)); CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(thumb_info->appid); if (appinfo == NULL) { - ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_UNMAP %s" - "(%d[%x]) no appinfo", - thumb_info->appid, thumb_info->surface, thumb_info->surface); + ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_UNMAP %s(%02x) " + "no appinfo", thumb_info->appid, thumb_info->surface); return; } - ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_UNMAP %s(%d[%x])", - thumb_info->appid, thumb_info->surface, thumb_info->surface); + ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_UNMAP %s(%02x)", + thumb_info->appid, thumb_info->surface); hs_instance->menu_window->SetThumbnail(thumb_info->appid, NULL); } else if (event == ICO_SYC_EV_THUMB_ERROR) { @@ -1111,9 +1101,8 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, reinterpret_cast(const_cast(detail)); CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(thumb_info->appid); if (appinfo == NULL) { - ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_ERROR %s" - "(%d[%x]) no appinfo", - thumb_info->appid, thumb_info->surface, thumb_info->surface); + ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_ERROR %s(%02x) " + "no appinfo", thumb_info->appid, thumb_info->surface); return; } ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_ERROR %s(%02x)", @@ -1121,24 +1110,34 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, hs_instance->menu_window->SetThumbnail(thumb_info->appid, NULL); } else if (event == ICO_SYC_EV_LAYER_ATTR_CHANGE) { + } else if (event == ICO_SYC_EV_USERLIST) { + } else if (event == ICO_SYC_EV_AUTH_FAIL) { + } else if (event == ICO_SYC_EV_RES_ACQUIRE) { + } else if (event == ICO_SYC_EV_RES_DEPRIVE) { + } else if (event == ICO_SYC_EV_RES_WAITING) { + } else if (event == ICO_SYC_EV_RES_REVERT) { + } else if (event == ICO_SYC_EV_RES_RELEASE) { + } else if (event == ICO_SYC_EV_INPUT_SET) { + } else if (event == ICO_SYC_EV_INPUT_UNSET) { + } else if (event == ICO_SYC_EV_STATE_CHANGE) { ico_syc_state_info_t *state_info = @@ -1158,7 +1157,7 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, ecore_main_loop_thread_safe_call_async(CicoHomeScreen::SetNightMode, NULL); } } - ICO_DBG("CicoHomeScreen::EventCallBack: end"); +// ICO_DBG("CicoHomeScreen::EventCallBack: end"); } /*--------------------------------------------------------------------------*/ @@ -1260,7 +1259,7 @@ CicoHomeScreen::Initialize(int orientation, CicoGKeyFileConfig *config) /* Get screen size */ CicoHSWindowController::GetFullScreenSize(orientation, - &full_width, &full_height); + &full_width,&full_height); ICO_DBG("full screen size x=%d y=%d",full_width,full_height); @@ -1282,7 +1281,7 @@ CicoHomeScreen::Initialize(int orientation, CicoGKeyFileConfig *config) moveZoneAnimation.name = (char*)config->ConfigGetString("switchzone", "animation", - ICO_SYC_WIN_ANIMATION_FADE); + ICO_HS_ANIMATION_FADE); moveZoneAnimation.time = config->ConfigGetInteger("switchzone", "animatime", 400); @@ -1498,13 +1497,12 @@ void CicoHomeScreen::CreateControlBarWindow(void) { /*create window*/ - ICO_DBG("CicoHomeScreen::CreateControlBarWindow: Enter"); + ICO_DBG("CicoHomeScreen::CreateControlBarWindow"); ctl_bar_window = new CicoHSControlBarWindow(); - ctl_bar_window->CreateControlBarWindow(ICO_HS_MENU_WINDOW_POS_X, - bg_height - ctl_bar_height, - ctl_bar_width, ctl_bar_height); + ctl_bar_window->CreateControlBarWindow(ICO_HS_MENU_WINDOW_POS_X,bg_height - + ctl_bar_height,ctl_bar_width, + ctl_bar_height); ctl_bar_window->ShowWindow(); - ICO_DBG("CicoHomeScreen::CreateControlBarWindow: Leave"); } /*--------------------------------------------------------------------------*/ @@ -1737,7 +1735,7 @@ CicoHomeScreen::StartHomeScreen(int orientation) moveZoneAnimation.name = (char*)config->ConfigGetString("switchzone", "animation", - ICO_SYC_WIN_ANIMATION_FADE); + ICO_HS_ANIMATION_FADE); moveZoneAnimation.time = config->ConfigGetInteger("switchzone", "animatime", 400); // debug log @@ -1831,10 +1829,10 @@ CicoHomeScreen::ChangeMode(int pattern) ico_syc_animation_t animation; ICO_DBG("CicoHomeScreen::ChangeMode: MENU->APP"); if (pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE) { - animation.name = (char*)ICO_SYC_WIN_ANIMATION_SLIDE_TOTOP; + animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE; } else { - animation.name = (char*)ICO_SYC_WIN_ANIMATION_FADE; + animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE; } animation.time = ICO_HS_MENU_ANIMATION_DURATION; hs_instance->menu_window->Hide(&animation); @@ -1851,10 +1849,10 @@ CicoHomeScreen::ChangeMode(int pattern) ico_syc_animation_t animation; ICO_DBG("CicoHomeScreen::ChangeMode: APP->MENU"); if (pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE) { - animation.name = (char*)ICO_SYC_WIN_ANIMATION_SLIDE_TOTOP; + animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_SLIDE; } else { - animation.name = (char*)ICO_SYC_WIN_ANIMATION_FADE; + animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_FADE; } animation.time = ICO_HS_MENU_ANIMATION_DURATION; hs_instance->menu_window->Show(&animation); @@ -1950,7 +1948,7 @@ CicoHomeScreen::SetRegulation(void* data) // regulation action hs_instance->ctl_bar_window->SetRegulation(); ico_syc_animation_t animation; - animation.name = (char*)ICO_SYC_WIN_ANIMATION_SLIDE_TOTOP; + animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE; animation.time = ICO_HS_MENU_ANIMATION_DURATION; hs_instance->menu_window->Hide(&animation); @@ -2380,7 +2378,7 @@ CicoHomeScreen::ShowApp_i(const std::string& app) } ico_syc_animation_t animation; - animation.name = (char*)ICO_SYC_WIN_ANIMATION_FADE; + animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE; animation.time = ICO_HS_MENU_ANIMATION_DURATION; ico_syc_show(appinfo->GetAppId(), appinfo->GetLastSurface(), &animation); @@ -2427,7 +2425,7 @@ CicoHomeScreen::HideApp(const std::string& app) } ico_syc_animation_t animation; - animation.name = (char*)ICO_SYC_WIN_ANIMATION_FADE; + animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE; animation.time = ICO_HS_MENU_ANIMATION_DURATION; int surface = ai->GetLastSurface(); diff --git a/src/homescreen/CicoHomeScreenCommon.h b/src/homescreen/CicoHomeScreenCommon.h index 24e499a..aa0d8d2 100644 --- a/src/homescreen/CicoHomeScreenCommon.h +++ b/src/homescreen/CicoHomeScreenCommon.h @@ -15,6 +15,7 @@ #define __CICO_HOMESCREEN_COMMON_H__ #include +#include #include "ico_syc_sysdef.h" #define ICO_OK 0 @@ -69,8 +70,7 @@ #define ICO_HS_BACK_WINDOW_IMAGE_FILE_PATH "/opt/usr/media/Images/Home_default.jpg" /*name of image file (in config image directry)*/ -#define ICO_HS_IMAGE_FILE_MENU_BACK_GROUND_BLANK "bg.png" -#define ICO_HS_IMAGE_FILE_MENU_BACK_GROUND_PICTURE "bg_bk.png" +#define ICO_HS_IMAGE_FILE_MENU_BACK_GROUND "bg.png" #define ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P "pagePointer_p.png" #define ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N "pagePointer_n.png" @@ -87,6 +87,8 @@ #define ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT "applist_on.png" #define ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT2 "applist_on_2.png" +#define ICO_HS_LIFECYCLE_CONTROLLER_SETTING_PATH "/usr/apps/org.tizen.ico.system-controller/res/config/system.xml" + /*config name*/ #define ICO_HS_CONFIG_HOMESCREEN "homescreen" #define ICO_HS_CONFIG_ONSCREEN "onscreen" @@ -118,6 +120,10 @@ #define ICO_HS_CONFIG_HSTRY_DEF3 "org.tizen.ico.login" #define ICO_HS_CONFIG_HSTRY_SPL ';' +#define ICO_HS_ANIMATION_SLIDE "Slide" +#define ICO_HS_ANIMATION_SLIDE "Slide" +#define ICO_HS_ANIMATION_FADE "Fade" +#define ICO_HS_ANIMATION_FADE "Fade" #define ICO_HS_ANIMATION_DURATION (400) #endif diff --git a/src/homescreen/Makefile.am b/src/homescreen/Makefile.am index 0ed3f77..d482572 100644 --- a/src/homescreen/Makefile.am +++ b/src/homescreen/Makefile.am @@ -2,7 +2,7 @@ AM_CFLAGS = $(GCC_CFLAGS) AM_CPPFLAGS = $(GCC_CXXFLAGS) AM_CXXFLAGS = $(GCC_CXXFLAGS) -COMMON_LIBS = -lm -lwebsockets -lsecurity-server-client +COMMON_LIBS = -lm -lwebsockets -lico-uxf-weston-plugin -lsecurity-server-client noinst_PROGRAMS = \ HomeScreen @@ -31,7 +31,7 @@ HomeScreen_SOURCES = \ CicoHSServer.cpp \ CicoHSMessage.cpp \ CicoHSAppControl.cpp \ - CicoHSCommandArg.cpp + CicoHSCommandArg.cpp HomeScreen_CFLAGS= \ @CAPIAPPFWAPPLICATION_CFLAGS@ \ @@ -100,7 +100,6 @@ install-exec-hook: install -m 0644 home_screen_bg.edj $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/edj install -m 0644 home_screen_touch.edj $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/edj install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/bg.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images - install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/bg_bk.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/ctrl.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/applist_off.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/applist_off_2.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images diff --git a/src/onscreen/CicoOSPopWindow.cpp b/src/onscreen/CicoOSPopWindow.cpp index c9d14ea..ecdec09 100644 --- a/src/onscreen/CicoOSPopWindow.cpp +++ b/src/onscreen/CicoOSPopWindow.cpp @@ -20,8 +20,6 @@ #include "ico_syc_type.h" #include "ico_syc_appresctl.h" #include "CicoOSClient.h" -#include "CicoConf.h" -#include "CicoSystemConfig.h" using namespace std; @@ -205,7 +203,7 @@ CicoOSPopWindow::showPopup() return true; } -bool +bool CicoOSPopWindow::acquireRes() { ICO_TRA("Enter"); @@ -246,7 +244,7 @@ CicoOSPopWindow::hidePopup(bool buttonTouch) ICO_TRA("Leave"); } -bool +bool CicoOSPopWindow::releaseRes() { ICO_TRA("Enter"); @@ -305,26 +303,6 @@ CicoOSPopWindow::InitializeWindow(void) ecore_wl_screen_size_get(&display_width, &display_height); ICO_DBG("display size w/h=%d/%d", display_width, display_height); - -#if 1 /* 2014/07/16 ecore_wl_screen_size_get() bug */ - if ((display_width <= 0) || (display_height <= 0)) { - const CicoSCDisplayConf* dispconf = CicoSystemConfig::getInstance() - ->findDisplayConfbyId(0); - if (dispconf) { - // if Ecore has no full screen size, get from configuration - display_width = dispconf->width; - display_height = dispconf->height; - ICO_DBG("Screen size w/h=%d/%d from Config", display_width, display_height); - } - else { - // if Ecore and config has no full screen size, fixed vaule - display_width = 1080; - display_height = 1920; - ICO_DBG("Screen size w/h=1080/1920 fixed"); - } - } -#endif /* 2014/07/16 ecore_wl_screen_size_get() bug */ - int popup_x = (display_width / 2) - (POPUP_FRAME_WIDTH / 2); int popup_y = (display_height / 2) - (POPUP_FRAME_HEIGHT/ 2); ICO_DBG("popup postion x/y=%d/%d", popup_x, popup_y); diff --git a/src/statusbar/CicoStatusBar.cpp b/src/statusbar/CicoStatusBar.cpp index ab13219..e13276b 100644 --- a/src/statusbar/CicoStatusBar.cpp +++ b/src/statusbar/CicoStatusBar.cpp @@ -14,8 +14,6 @@ #include #include #include "CicoStatusBar.h" -#include "CicoConf.h" -#include "CicoSystemConfig.h" using namespace std; @@ -83,25 +81,6 @@ CicoStatusBar::Initialize(void) } ecore_wl_screen_size_get(&width_, &height_); -#if 1 /* 2014/07/16 ecore_wl_screen_size_get() bug */ - if ((width_ <= 0) || (height_ <= 0)) { - const CicoSCDisplayConf* dispconf = CicoSystemConfig::getInstance() - ->findDisplayConfbyId(0); - if (dispconf) { - // if Ecore has no full screen size, get from configuration - width_ = dispconf->width; - height_ = dispconf->height; - ICO_DBG("Screen size w/h=%d/%d from Config", width_, height_); - } - else { - // if Ecore and config has no full screen size, fixed vaule - width_ = 1080; - height_ = 1920; - ICO_DBG("Screen size w/h=1080/1920 fixed"); - } - } -#endif /* 2014/07/16 ecore_wl_screen_size_get() bug */ - ecore_evas_size_min_set(window_, width_, STATUSBAR_HEIGHT); ecore_evas_size_max_set(window_, width_, STATUSBAR_HEIGHT); diff --git a/src/syscond/CicoSysConDaemon.cpp b/src/syscond/CicoSysConDaemon.cpp index 567f16b..a8d2572 100644 --- a/src/syscond/CicoSysConDaemon.cpp +++ b/src/syscond/CicoSysConDaemon.cpp @@ -77,7 +77,7 @@ CicoSysConDaemon::onCreate(void *user_data) try { int ret = ICO_SYC_EOK; - (void) CicoSystemConfig::getInstance(); + CicoSystemConfig::getInstance()->load("/usr/apps/org.tizen.ico.system-controller/res/config/system.xml"); initAulListenXSignal(); diff --git a/src/syscond/Makefile.am b/src/syscond/Makefile.am index b533922..9eb3a39 100644 --- a/src/syscond/Makefile.am +++ b/src/syscond/Makefile.am @@ -50,7 +50,8 @@ IcoSysconDaemon_LDADD = \ @MURPHYECORE_LIBS@ \ @MURPHYRESOURCE_LIBS@ \ $(UWS_LIBS) \ - $(GENIVI_LIBS) + $(GENIVI_LIBS) \ + $(WESTONPLUGIN_LIBS) CLEANFILES = $(BUILT_SOURCES) diff --git a/tests/Makefile.am b/tests/Makefile.am index 239f940..dad3933 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,2 +1,6 @@ +#SUBDIRS=\ +# system-controller \ +# homescreen + SUBDIRS=\ system-controller diff --git a/tests/homescreen/Makefile.am b/tests/homescreen/Makefile.am new file mode 100644 index 0000000..ffa4dd5 --- /dev/null +++ b/tests/homescreen/Makefile.am @@ -0,0 +1,20 @@ +AM_CFLAGS = $(GCC_CFLAGS) +AM_CPPFLAGS = $(GCC_CFLAGS) + +bin_PROGRAMS = \ + ico_set_vehicleinfo \ + ico_send_hscommand + +check_PROGRAMS = \ + ico_set_vehicleinfo + +ico_set_vehicleinfo_SOURCES = \ + ico_set_vehicleinfo.c +ico_set_vehicleinfo_LDADD = -lwebsockets + +ico_send_hscommand_SOURCES = \ + ico_send_hscommand.c +ico_send_hscommand_CFLAGS = -I../include $(UWS_CFLAGS) +#ico_send_hscommand_LDADD = $(UWS_LIBS) -lwebsockets -ldlog +ico_send_hscommand_LDADD = $(UWS_LIBS) + diff --git a/tests/homescreen/homescreen-test-makedat.sh b/tests/homescreen/homescreen-test-makedat.sh new file mode 100755 index 0000000..9c73eb6 --- /dev/null +++ b/tests/homescreen/homescreen-test-makedat.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +# Define +SCREEN_IS_FHD=1 +GUI_TEST_NEXT_DAT=gui-test-FHD-next.dat +GUI_TEST_DAT=gui-test-FHD.dat +# for GUI test launch +LAUNCH_APP=org.tizen.music-player +LAUNCH_APP_SEAT=0 +LAUNCH_APP_INDEX=0 +LAUNCH_APP_SEATCNT=0 +LAUNCH_APP_X=0 +LAUNCH_APP_Y=0 +SHIFT_X=576 +SHIFT_Y=28 + +#determin screen size 768x1024 or 1080x1920 +/bin/grep "ico_uxf_window_screen_size_get width=768 height=1024" $HOMESCREEN_LOG +if [ "$?" = 0 ]; then + SCREEN_IS_FHD=0 + SHIFT_X=0 + SHIFT_Y=0 + GUI_TEST_NEXT_DAT=gui-test-XGA-next.dat + GUI_TEST_DAT=gui-test-XGA.dat +fi + +#determin launch app index/position on application list +for str in `/bin/grep "ons_load_config: appid=$LAUNCH_APP" $ONSCREEN_LOG` +do + para=`echo $str|cut -d "=" -f 1` + val=`echo $str|cut -d "=" -f 2` + if [ "$para" = "seat" ]; then + LAUNCH_APP_SEAT=$val + fi + if [ "$para" = "idx" ]; then + LAUNCH_APP_INDEX=$val + fi + if [ "$para" = "seatcnt" ]; then + LAUNCH_APP_SEATCNT=$val + fi +done + +echo $LAUNCH_APP_INDEX + +LAUNCH_APP_X=`expr $LAUNCH_APP_INDEX % 5 \* 130 + 124 + $SHIFT_X` +LAUNCH_APP_Y=`expr $LAUNCH_APP_INDEX / 5 \* 130 + 374 + $SHIFT_Y` + +/bin/cp testdata/$GUI_TEST_DAT testdata/gui-test.dat + +if [ $LAUNCH_APP_SEATCNT = 2 ]; then + if [ $LAUNCH_APP_SEAT = 0 ]; then + cat testdata/$GUI_TEST_NEXT_DAT >> testdata/gui-test.dat + fi +elif [ $LAUNCH_APP_SEATCNT -gt 2 ]; then + num=0 + if [ $LAUNCH_APP_SEAT = 0 ]; then + num=`expr $LAUNCH_APP_SEATCNT - 1` + elif [ $LAUNCH_APP_SEAT -gt 1 ]; then + num=`expr $LAUNCH_APP_SEATCNT - $LAUNCH_APP_SEAT` + fi + for i in `seq 1 1 $num`; do + cat testdata/$GUI_TEST_NEXT_DAT >> testdata/gui-test.dat + done +fi + +cat testdata/gui-test-launch-template.dat >> testdata/gui-test.dat +sed -i "s/COORD_X/$LAUNCH_APP_X/g" testdata/gui-test.dat +sed -i "s/COORD_Y/$LAUNCH_APP_Y/g" testdata/gui-test.dat + + diff --git a/tests/homescreen/homescreen-test-startall.sh b/tests/homescreen/homescreen-test-startall.sh new file mode 100755 index 0000000..996672a --- /dev/null +++ b/tests/homescreen/homescreen-test-startall.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# 1 Delete log file +rm -fr /var/log/weston.log + +# 2 Weston/Wayland Envionment +export XDG_RUNTIME_DIR=/tmp/run-root +export QT_QPA_PLATFORM=wayland +export ELM_ENGINE=wayland_egl +export ECORE_EVAS_ENGINE=wayland_egl +#export ELM_ENGINE=wayland_shm +#export ECORE_EVAS_ENGINE=wayland_shm +export EVAS_FONT_DPI=72 +export ECORE_IMF_MODULE=isf +export ELM_MODULES="ctxpopup_copypasteUI>entry/api:datetime_input_ctxpopup>datetime/api" +export ELM_SCALE="0.7" +export ELM_PROFILE=mobile + +# 3 Start Device Input Controller for eGalax TouchPanel +/usr/bin/ico_ictl-touch_egalax -t +sleep 0.3 + +# 4 Start Weston +ORG_UMASK=`umask` +umask 000 +/usr/bin/weston --backend=drm-backend.so --idle-time=0 --log=/var/log/weston.log & +sleep 0.5 +if [ -f $XDG_RUNTIME_DIR/wayland-0 ] ; then + chmod 0777 $XDG_RUNTIME_DIR/wayland-0 +fi +umask $ORG_UMASK + +# 5 start app core daemon +sleep 1 +/usr/bin/launchpad_preloading_preinitializing_daemon & + +# 6 start homescreen +rm -fr /tmp/log +mkdir /tmp/log/ +chmod -R 0777 /tmp/log +/usr/bin/launch_app org.tizen.ico.homescreen & + +# 7 start test shell +sleep 5 +./homescreen-test.sh diff --git a/tests/homescreen/homescreen-test.sh b/tests/homescreen/homescreen-test.sh new file mode 100755 index 0000000..0721cfd --- /dev/null +++ b/tests/homescreen/homescreen-test.sh @@ -0,0 +1,76 @@ +#!/bin/sh + +## log file +mkdir /var/log/ico > /dev/null 2>&1 +export HOMESCREEN_LOG=/var/log/ico/org.tizen.ico.homescreen.log +export ONSCREEN_LOG=/var/log/ico/org.tizen.ico.onscreen.log + +## make dat +./homescreen-test-makedat.sh + +## GUI test +ico_send_inputevent -m < testdata/gui-test.dat + +## CUI test +#Hide tile screen +ico_send_hscommand json/hide-tile.json +sleep 3 +#Show tile screen +ico_send_hscommand json/show-tile.json +sleep 3 +#Show application +ico_send_hscommand json/hide-tile.json +sleep 3 +ico_send_hscommand json/show-app1.json +sleep 3 +#Move and resize application +ico_send_hscommand json/geom-app1-1.json +sleep 3 +ico_send_hscommand json/geom-app1-2.json +sleep 3 +ico_send_hscommand json/geom-app1-3.json +sleep 3 +#Terminate application +ico_send_hscommand json/term-app1.json +sleep 3 +ico_send_hscommand json/show-tile.json +sleep 3 +#Terminate application +ico_send_hscommand json/hide-tile.json +sleep 3 +ico_send_hscommand json/exec-app1.json +sleep 3 +#Application on tile screen +ico_send_hscommand json/show-tile.json +sleep 3 + +## Check Error +FOUND_ERR=0 +/bin/grep -i "err" $HOMESCREEN_LOG +if [ "$?" != "1" ] ; then + FOUND_ERR=1 +fi +/bin/grep -i "err" $ONSCREEN_LOG +if [ "$?" != "1" ] ; then + FOUND_ERR=1 +fi +/bin/grep -i "fail" $HOMESCREEN_LOG +if [ "$?" != "1" ] ; then + FOUND_ERR=1 +fi +/bin/grep -i "fail" $ONSCREEN_LOG +if [ "$?" != "1" ] ; then + FOUND_ERR=1 +fi + +## delete dat file +rm -f testdata/gui-test.dat + +echo " " +echo " " +if [ $FOUND_ERR = 0 ] ; then + echo "org.tizen.ico.homescreen Test: OK" +else + echo "org.tizen.ico.homescreen Test: Please check the upper log whether there is not a critical bug" +fi + diff --git a/tests/homescreen/ico_send_hscommand.c b/tests/homescreen/ico_send_hscommand.c new file mode 100644 index 0000000..4aeb7c9 --- /dev/null +++ b/tests/homescreen/ico_send_hscommand.c @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +/** + * @brief applicatoin that send a command to homescreen + * + * @date Feb-15-2013 + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "home_screen.h" +#include "home_screen_res.h" + + +/*============================================================================*/ +/* Define data types */ +/*============================================================================*/ +#define ICO_HSCMD_WS_TIMEOUT 0.05 +#define ICO_HSCMD_WS_ADDRESS "127.0.0.1" +#define ICO_HSCMD_WS_PROTOCOL_NAME ICO_HS_PROTOCOL_CM + +//#define hscmd_trace(...) +#define hscmd_trace(fmt, arg...) fprintf(stderr, ""fmt"\n",##arg) + +/*============================================================================*/ +/* static(internal) functions prototype */ +/*============================================================================*/ +static void hscmd_callback_uws(const struct ico_uws_context *context, + const ico_uws_evt_e event, const void *id, + const ico_uws_detail *detail, void *data); + +static void hscmd_create_ws_context(void); +static void hscmd_destroy_ws_context(void); +static void hscmd_ws_service_loop(void); +static void hscmd_usage(const char *prog); + +/*============================================================================*/ +/* variabe & table */ +/*============================================================================*/ +static int hscmd_ws_port = ICO_HS_WS_PORT; +static int hscmd_ws_connected = 0; +static struct ico_uws_context *hscmd_uws_context = NULL; +static void *hscmd_uws_id = NULL; +static FILE *hscmd_fp; +static int hscnd_send_end = 0; + +/*============================================================================*/ +/* functions */ +/*============================================================================*/ +/*--------------------------------------------------------------------------*/ +/* + * @brief hscmd_callback_uws + * callback function from UWS + * + * @param[in] context context + * @param[in] event event kinds + * @param[in] id client id + * @param[in] detail event detail + * @param[in] data user data + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +hscmd_callback_uws(const struct ico_uws_context *context, + const ico_uws_evt_e event, const void *id, + const ico_uws_detail *detail, void *data) +{ + unsigned char msg[ICO_HS_TEMP_BUF_SIZE]; + unsigned char *send; + char *in; + long fsize; + int len; + + hscmd_trace("hscmd_callback_uws %p", context); + + switch (event) { + case ICO_UWS_EVT_OPEN: + hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_OPEN(id=%d)", (int)id); + hscmd_uws_id = (void *)id; + len = sprintf((char *)msg, "%s %s", ICO_HS_MSG_HEAD_CM, HS_REQ_ANS_HELLO); + ico_uws_send((struct ico_uws_context *)context, (void *)id, msg, len); + break; + + case ICO_UWS_EVT_CLOSE: + hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_CLOSE(id=%d)", (int)id); + hscmd_uws_context = NULL; + hscmd_uws_id = NULL; + break; + + case ICO_UWS_EVT_RECEIVE: + hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_RECEIVE(id=%d, msg=%s, len=%d)", + (int)id, (char *)detail->_ico_uws_message.recv_data, + detail->_ico_uws_message.recv_len); + in = (char *)detail->_ico_uws_message.recv_data; + + if(strncmp("ANS HELLO", in, 9) == 0) { + fseek(hscmd_fp, 0, SEEK_END); + fsize = ftell(hscmd_fp); + fseek(hscmd_fp, 0L, SEEK_SET); + + len = (int)fsize + 4; + send = (void *)malloc(len); + + memset(send, 0, len); + + sprintf((char *)send, "%s ", ICO_HS_MSG_HEAD_CM); + + fread(send + 4, 1, fsize, hscmd_fp); + hscmd_trace("hscmd_callback_uws: send (%s)", send); + + ico_uws_send((struct ico_uws_context *)context, (void *)id, send, len); + + hscnd_send_end = 1; + } + break; + + case ICO_UWS_EVT_ERROR: + hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_ERROR(id=%d, err=%d)", + (int)id, detail->_ico_uws_error.code); + break; + + case ICO_UWS_EVT_ADD_FD: + hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_ADD_FD(id=%d, fd=%d)", + (int)id, detail->_ico_uws_fd.fd); + break; + + case ICO_UWS_EVT_DEL_FD: + hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)", + (int)id, detail->_ico_uws_fd.fd); + break; + + default: + break; + } + + return; +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief hscmd_create_ws_context + * connect to the homescreen using websocket. + * + * @param[in] none + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +hscmd_create_ws_context(void) +{ + int ret; + char uri[ICO_HS_TEMP_BUF_SIZE]; + + /* set up URI "ws://HOST:PORT" */ + sprintf(uri, "ws://%s:%d", ICO_HS_WS_HOST, hscmd_ws_port); + + hscmd_uws_context = ico_uws_create_context(uri, ICO_HS_PROTOCOL); + + hscmd_ws_connected = 0; + if (hscmd_uws_context == NULL) { + fprintf(stderr, "libwebsocket_create_context failed.\n"); + } else { + /* set callback */ + ret = ico_uws_set_event_cb(hscmd_uws_context, hscmd_callback_uws, NULL); + if (ret != ICO_UWS_ERR_NONE) { + hscmd_trace("hscmd_create_ws_context: cannnot set callback"); + } + hscmd_ws_connected = 1; + } +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief hscmd_destroy_ws_context + * destroy websokets connection. + * + * @param[in] none + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +hscmd_destroy_ws_context(void) +{ + if (hscmd_uws_context) { + ico_uws_service(hscmd_uws_context); + usleep(50 * 1000); + ico_uws_unset_event_cb(hscmd_uws_context); + ico_uws_close(hscmd_uws_context); + hscmd_uws_context = NULL; + hscmd_ws_connected = 0; + } +} + +static void +hscmd_ws_service_loop(void) +{ + while (hscmd_ws_connected) { + ico_uws_service(hscmd_uws_context); + usleep(50 * 1000); + if (hscnd_send_end == 1) { + hscmd_destroy_ws_context(); + } + } +} + +static void +hscmd_usage(const char *prog) +{ + fprintf(stderr, "Usage: %s filename\n", prog); + exit(0); +} + +/*--------------------------------------------------------------------------*/ +/* + * @brief test command tools + * send json format command to + * main routine + * + * @param main() finction's standard parameter (argc,argv) + * @return result + * @retval 0 success + * @retval 1 failed + */ +/*--------------------------------------------------------------------------*/ +int +main(int argc, char *argv[]) +{ + + /* read json file */ + if (argc < 1) { + hscmd_usage(argv[0]); + } + + hscmd_fp = fopen(argv[1], "rb"); + if (hscmd_fp == NULL) { + hscmd_usage(argv[0]); + } + + /* Init websockets */ + hscmd_create_ws_context(); + + hscmd_ws_service_loop(); + + hscmd_destroy_ws_context(); + + fclose(hscmd_fp); + + return 0; +} + diff --git a/tests/homescreen/ico_set_vehicleinfo.c b/tests/homescreen/ico_set_vehicleinfo.c new file mode 100644 index 0000000..bdc93d7 --- /dev/null +++ b/tests/homescreen/ico_set_vehicleinfo.c @@ -0,0 +1,511 @@ +/* + * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +/** + * @brief System Test Tool for set VehicleInfo + * + * @date Apr-09-2013 + */ + +#define MSG_INTERFACE 0 /* 1= Message Queue Interface */ +#define LWS_INTERFACE 1 /* 1= WebSockets Interface */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if LWS_INTERFACE > 0 /* WebSocket Interface */ +#include +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + +#define TYPE_NULL 0 +#define TYPE_BOOL 1 +#define TYPE_BYTE 2 +#define TYPE_INT16 3 +#define TYPE_UINT16 4 +#define TYPE_INT32 5 +#define TYPE_UINT32 6 +#define TYPE_DOUBLE 7 +#define TYPE_STRING 8 +#define TYPE_SHIFT 12 + +#if LWS_INTERFACE > 0 /* WebSocket Interface */ +#define LWS_DEFAULTIP "127.0.0.1" /* websockets default ip(localhost) */ +#define LWS_DEFAULTPORT 25010 /* websockets default port */ +#define LWS_PROTOCOLNAME "standarddatamessage-only" + /* websockets protocol name */ +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + +static const struct { + char *prop; + char *eventtype; + unsigned char datatype[4]; +} vehicleinfo_key[] = { + { "VehicleSpeed", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0,0} }, + { "Speed", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0,0} }, + { "Velocity", "VELOCITY", {TYPE_INT32, TYPE_NULL, 0,0} }, + { "Location", "LOCATION", {TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, TYPE_NULL} }, + { "Direction", "DIRECTION", {TYPE_DOUBLE, TYPE_NULL, 0,0} }, + { "EngineSpeed", "ENGINE_SPEED", {TYPE_INT32, TYPE_NULL, 0, 0} }, + { "Engine", "ENGINE_SPEED", {TYPE_INT32, TYPE_NULL, 0, 0} }, + { "Shift", "SHIFT", {TYPE_SHIFT, TYPE_BYTE, TYPE_NULL, 0} }, + { "ShiftPosition", "SHIFT", {TYPE_SHIFT, TYPE_BYTE, TYPE_NULL, 0} }, + { "Break_Signal", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0,0} }, + { "BreakSignal", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0,0} }, + { "Break", "BRAKE_SIGNAL", {TYPE_BOOL, TYPE_NULL, 0,0} }, + { "Blinker", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0} }, + { "Winker", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0} }, + { "TurnSignal", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0} }, + { "Turn", "TURN_SIGNAL", {TYPE_INT32, TYPE_NULL, 0, 0} }, + { "lightStatus", "LIGHTSTATUS", {TYPE_BOOL, TYPE_BOOL, TYPE_BOOL, TYPE_BOOL} }, + { "light", "LIGHTSTATUS", {TYPE_BOOL, TYPE_BOOL, TYPE_BOOL, TYPE_BOOL} }, + { "WATER_TEMP", "WATER_TEMP", {TYPE_INT32, TYPE_NULL, 0, 0} }, + { "\0", "\0", {TYPE_NULL, 0,0,0} } }; + +struct KeyDataMsg_t +{ +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + long mtype; +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ + char KeyEventType[64]; + struct timeval recordtime; + struct KeyData + { + int common_status; + char status[]; + } data; +}; + +#if MSG_INTERFACE > 0 /* Message Queue Interface */ +static int sndqueuekey = 55555; +static int sndqueueid = 0; + +static int mqid = -1; +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ + +#if LWS_INTERFACE > 0 /* WebSocket Interface */ +static struct libwebsocket_context *context = NULL; + /* websockets context */ +static struct libwebsocket *websocket = NULL; + /* websockets connection */ +static int connected = 0; /* connection flag */ + +static int lws_callback(struct libwebsocket_context *context, struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len); + +static struct libwebsocket_protocols protocols[] = { + {LWS_PROTOCOLNAME, lws_callback, 0}, + {NULL, NULL, -1} + }; +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + +#if MSG_INTERFACE > 0 /* Message Queue Interface */ +static void +init_comm(const int mqkey) +{ + char dummy[256]; + + if (mqkey == 0) { + mqid = -1; + } + else { + mqid = msgget(mqkey, 0); + if (mqid < 0) { + mqid = msgget(mqkey, IPC_CREAT); + } + if (mqid < 0) { + fprintf(stderr, "Can not create message queue(%d(0x%x))[%d]\n", + mqkey, mqkey, errno); + return; + } + while (msgrcv(mqid, dummy, sizeof(dummy)-sizeof(long), 0, IPC_NOWAIT) > 0) ; + } +} +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ + +#if LWS_INTERFACE > 0 /* WebSocket Interface */ +static int +lws_callback(struct libwebsocket_context *context, struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, void *user, + void *in, size_t len) +{ + if (reason == LWS_CALLBACK_CLIENT_ESTABLISHED) { + connected = 1; + } + /* do nothing */ + return 0; +} + +static void +init_comm(const int port, const char *spadr) +{ + int rep; + + context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, + spadr, protocols, + libwebsocket_internal_extensions, + NULL, NULL, -1, -1, 0); + if (context == NULL) { + fprintf(stderr, "Can not create libwebsockets context(ip=%s port=%d)\n", + spadr, port); + exit(2); + } + + connected = 0; + websocket = libwebsocket_client_connect(context, spadr, port, + 0, "/", spadr, "websocket", + protocols[0].name, -1); + if (websocket == NULL) { + fprintf(stderr, "Can not connect libwebsockets context(ip=%s port=%d)\n", + spadr, port); + exit(2); + } + /* wait for connection */ + for (rep = 0; rep < (2*1000); rep += 50) { + if (connected) break; + libwebsocket_service(context, 50); + } +} +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + +static void +init_vehicleinfo(void) +{ +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + sndqueueid = msgget(sndqueuekey, 0); + if (sndqueueid < 0) { + fprintf(stderr, "Send Message Queue(%d(0x%x)) dose not exist[%d].\n", + sndqueuekey, sndqueuekey, errno); + } +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ +} + +static void +set_vehicleinfo(const char *cmd) +{ + int i, j; + int idx, key, pt; + int msgsize; + char prop[64]; + char value[128]; + int sec, msec; + struct { + struct KeyDataMsg_t msg; + char dummy[128]; + } msg; +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + LWS_SEND_BUFFER_POST_PADDING]; + unsigned char *bufpt = &buf[LWS_SEND_BUFFER_PRE_PADDING]; +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + + j = 0; + for (i = 0; cmd[i]; i++) { + if ((cmd[i] == '=') || (cmd[i] == ' ')) break; + if (j < (int)(sizeof(prop)-1)) { + prop[j++] = cmd[i]; + } + } + + prop[j] = 0; + j = 0; + if (cmd[i] != 0) { + for (i++; cmd[i]; i++) { + if (cmd[i] == ' ') continue; + if (j < (int)(sizeof(value)-1)) { + value[j++] = cmd[i]; + } + } + } + value[j] = 0; + + if (strcasecmp(prop, "sleep") == 0) { + sec = 0; + msec = 0; + for (i = 0; value[i]; i++) { + if (value[i] == '.') break; + sec = sec * 10 + (value[i] & 0x0f); + } + if (value[i] == '.') { + i++; + if (value[i] != 0) { + msec = (value[i] & 0x0f) * 100; + i++; + } + if (value[i] != 0) { + msec = msec + (value[i] & 0x0f) * 10; + i++; + } + if (value[i] != 0) { + msec = msec + (value[i] & 0x0f); + } + } + if (sec > 0) sleep(sec); + if (msec > 0) usleep(msec * 1000); + + return; + } + + for (key = 0; vehicleinfo_key[key].prop[0]; key++) { + if (strcasecmp(prop, vehicleinfo_key[key].prop) == 0) break; + } + if (! vehicleinfo_key[key].prop[0]) { + fprintf(stderr, "VehicleInfo UnKnown property[%s]\n", prop); + return; + } + + memset(&msg, 0, sizeof(msg)); +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + msg.msg.mtype = 1; +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ + strcpy(msg.msg.KeyEventType, vehicleinfo_key[key].eventtype); + gettimeofday(&(msg.msg.recordtime), NULL); +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + msgsize = sizeof(msg) - 128 - sizeof(long); +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + msgsize = sizeof(msg) - 128; +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + + i = 0; + pt = 0; + for (idx = 0; idx < 4; idx++) { + if (vehicleinfo_key[key].datatype[idx] == TYPE_NULL) break; + + if (value[i]) { + for (j = i; value[j]; j++) { + if ((value[j] == ',') || (value[j] == ';') || + (value[j] == ':') || (value[j] == ' ')) break; + } + if (value[j] != 0) { + value[j++] = 0; + } + switch (vehicleinfo_key[key].datatype[idx] % 10) { + case TYPE_BOOL: + case TYPE_BYTE: + if (vehicleinfo_key[key].datatype[idx] == TYPE_SHIFT) { + if ((strcasecmp(&value[i], "sp") == 0) || + (strcasecmp(&value[i], "s0") == 0)) { + strcpy(&value[i], "0"); + } + else if (strcasecmp(&value[i], "sr") == 0) { + strcpy(&value[i], "1"); + } + else if (strcasecmp(&value[i], "sn") == 0) { + strcpy(&value[i], "2"); + } + else if ((strcasecmp(&value[i], "sd") == 0) || + (strcasecmp(&value[i], "s4") == 0)) { + strcpy(&value[i], "4"); + } + else if ((strcasecmp(&value[i], "s1") == 0) || + (strcasecmp(&value[i], "sl") == 0)) { + strcpy(&value[i], "5"); + } + else if (strcasecmp(&value[i], "s2") == 0) { + strcpy(&value[i], "6"); + } + else if (strcasecmp(&value[i], "s3") == 0) { + strcpy(&value[i], "7"); + } + } + msg.msg.data.status[pt++] = strtoul(&value[i], (char **)0, 0); + msgsize += 1; + break; + case TYPE_INT16: + case TYPE_UINT16: + *((short *)&msg.msg.data.status[pt]) = strtol(&value[i], (char **)0, 0); + pt += sizeof(short); + msgsize += sizeof(short); + break; + case TYPE_INT32: + case TYPE_UINT32: + *((int *)&msg.msg.data.status[pt]) = strtol(&value[i], (char **)0, 0); + pt += sizeof(int); + msgsize += sizeof(int); + break; + case TYPE_DOUBLE: + *((double *)&msg.msg.data.status[pt]) = strtod(&value[i], (char **)0); + pt += sizeof(double); + msgsize += sizeof(double); + break; + default: + break; + } + i = j; + } + else { + switch (vehicleinfo_key[key].datatype[idx]) { + case TYPE_BOOL: + case TYPE_BYTE: + msgsize += 1; + break; + case TYPE_INT16: + case TYPE_UINT16: + msgsize += sizeof(short); + break; + case TYPE_INT32: + case TYPE_UINT32: + msgsize += sizeof(int); + break; + case TYPE_DOUBLE: + msgsize += sizeof(double); + break; + default: + break; + } + } + } + +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + if (msgsnd(sndqueueid, &msg, msgsize, 0) < 0) { + fprintf(stderr, "Message Queue(%d(0x%x)) send error[%d].\n", + sndqueuekey, sndqueuekey, errno); + } +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + memcpy(bufpt, &msg, msgsize); + if (libwebsocket_write(websocket, bufpt, msgsize, LWS_WRITE_BINARY) < 0) { + fprintf(stderr, "libwebsockets send error\n"); fflush(stderr); + } +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ +} + +static void +usage(const char *prog) +{ +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + fprintf(stderr, "Usage: %s [-port=port] [-ip=ip_addr] [propaty=value] [propaty=value] ...\n", prog); +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + fprintf(stderr, "Usage: %s [-ambkey=key] [-mq[=key]] [propaty=value] [propaty=value] ...\n", prog); +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ + exit(0); +} + +int +main(int argc, char *argv[]) +{ + int i, j; +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + int port = LWS_DEFAULTPORT; + char spadr[64]; +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + int mqkey = 0; + struct { + long mtype; + char buf[240]; + } mqbuf; +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ + char buf[240]; + +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + strcpy(spadr, LWS_DEFAULTIP); +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + + j = 0; + for (i = 1; i < argc; i++) { + if (argv[i][0] == '-') { +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + if (strncasecmp(argv[i], "-ambkey=", 8) == 0) { + sndqueuekey = strtoul(&argv[i][8], (char **)0, 0); + } + else if (strncasecmp(argv[i], "-mq", 3) == 0) { + if (argv[i][3] == '=') { + mqkey = strtol(&argv[i][4], (char **)0, 0); + } + else { + mqkey = 55552; /* default message queue key */ + } + } +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + if (strncasecmp(argv[i], "-port=", 6) == 0) { + port = strtoul(&argv[i][6], (char **)0, 0); + } + else if (strncasecmp(argv[i], "-ip=", 4) == 0) { + memset(spadr, 0, sizeof(spadr)); + strncpy(spadr, &argv[i][4], sizeof(spadr)-1); + } +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + else { + usage(argv[0]); + } + } + else { + j++; + } + } + +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + init_comm(mqkey); +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + init_comm(port, spadr); +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + + init_vehicleinfo(); + +#if MSG_INTERFACE > 0 /* Message Queue Interface */ + if (mqid >= 0) { + while (1) { + memset(&mqbuf, 0, sizeof(mqbuf)); + if (msgrcv(mqid, &mqbuf, sizeof(mqbuf)-sizeof(long), 0, 0) < 0) break; + k = 0; + j = -1; + for (i = 0; mqbuf.buf[i]; i++) { + if ((mqbuf.buf[i] == '#') || (mqbuf.buf[i] == '\n') + || (mqbuf.buf[i] == '\r')) break; + if (mqbuf.buf[i] == '\t') buf[k++] = ' '; + else buf[k++] = mqbuf.buf[i]; + if ((j < 0) && (mqbuf.buf[i] != ' ')) j = i; + } + if (j < 0) continue; + buf[k] = 0; + set_vehicleinfo(&buf[j]); + } + msgctl(mqid, IPC_RMID, NULL); + } + else +#endif /*MSG_INTERFACE*/ /* Message Queue Interface */ + if (j <= 0) { + while (fgets(buf, sizeof(buf), stdin)) { + j = -1; + for (i = 0; buf[i]; i++) { + if ((buf[i] == '#') || (buf[i] == '\n') || (buf[i] == '\r')) break; + if (buf[i] == '\t') buf[i] = ' '; + if ((j < 0) && (buf[i] != ' ')) j = i; + } + if (j < 0) continue; + buf[i] = 0; + set_vehicleinfo(&buf[j]); + } + } + else { + for (i = 1; i < argc; i++) { + if (argv[i][0] == '-') continue; + set_vehicleinfo(argv[i]); + } + } +#if LWS_INTERFACE > 0 /* WebSocket Interface */ + if (context) { + libwebsocket_context_destroy(context); + } +#endif /*LWS_INTERFACE*/ /* WebSocket Interface */ + + exit(0); +} + diff --git a/tests/homescreen/json/exec-app1.json b/tests/homescreen/json/exec-app1.json new file mode 100755 index 0000000..2a53395 --- /dev/null +++ b/tests/homescreen/json/exec-app1.json @@ -0,0 +1,17 @@ +{ + "application": [ + { + "program": { + "id":"org.tizen.music-player", + "execute":"org.tizen.music-player" + }, + "window": [ + { + "resize":"0,100,100", + "move":"0,0,64", + "visible_raise":"0,1,1" + } + ] + } + ] +} diff --git a/tests/homescreen/json/geom-app1-1.json b/tests/homescreen/json/geom-app1-1.json new file mode 100755 index 0000000..3475893 --- /dev/null +++ b/tests/homescreen/json/geom-app1-1.json @@ -0,0 +1,16 @@ +{ + "application": [ + { + "program": { + "id":"org.tizen.music-player" + }, + "window": [ + { + "resize":"0,200,200", + "move":"0,100,164", + "visible_raise":"0,1,1" + } + ] + } + ] +} diff --git a/tests/homescreen/json/geom-app1-2.json b/tests/homescreen/json/geom-app1-2.json new file mode 100755 index 0000000..0e3fbef --- /dev/null +++ b/tests/homescreen/json/geom-app1-2.json @@ -0,0 +1,16 @@ +{ + "application": [ + { + "program": { + "id":"org.tizen.music-player" + }, + "window": [ + { + "resize":"0,400,400", + "move":"0,200,264", + "visible_raise":"0,1,1" + } + ] + } + ] +} diff --git a/tests/homescreen/json/geom-app1-3.json b/tests/homescreen/json/geom-app1-3.json new file mode 100755 index 0000000..d62a3db --- /dev/null +++ b/tests/homescreen/json/geom-app1-3.json @@ -0,0 +1,16 @@ +{ + "application": [ + { + "program": { + "id":"org.tizen.music-player" + }, + "window": [ + { + "resize":"0,800,800", + "move":"0,300,364", + "visible_raise":"0,1,1" + } + ] + } + ] +} diff --git a/tests/homescreen/json/hide-tile.json b/tests/homescreen/json/hide-tile.json new file mode 100755 index 0000000..94dda0e --- /dev/null +++ b/tests/homescreen/json/hide-tile.json @@ -0,0 +1,14 @@ +{ + "application": [ + { + "program": { + "id":"TOUCH_SCREEN" + }, + "window": [ + { + "hide":"0" + } + ] + } + ] +} diff --git a/tests/homescreen/json/show-app1.json b/tests/homescreen/json/show-app1.json new file mode 100755 index 0000000..ca33f8a --- /dev/null +++ b/tests/homescreen/json/show-app1.json @@ -0,0 +1,16 @@ +{ + "application": [ + { + "program": { + "id":"org.tizen.music-player" + }, + "window": [ + { + "resize":"0,100,100", + "move":"0,0,64", + "visible_raise":"0,1,1" + } + ] + } + ] +} diff --git a/tests/homescreen/json/show-tile.json b/tests/homescreen/json/show-tile.json new file mode 100755 index 0000000..a354436 --- /dev/null +++ b/tests/homescreen/json/show-tile.json @@ -0,0 +1,14 @@ +{ + "application": [ + { + "program": { + "id":"TOUCH_SCREEN" + }, + "window": [ + { + "show":"0" + } + ] + } + ] +} diff --git a/tests/homescreen/json/term-app1.json b/tests/homescreen/json/term-app1.json new file mode 100755 index 0000000..647ccd1 --- /dev/null +++ b/tests/homescreen/json/term-app1.json @@ -0,0 +1,17 @@ +{ + "application": [ + { + "program": { + "id":"org.tizen.music-player", + "terminate":"org.tizen.music-player" + }, + "window": [ + { + "resize":"0,100,100", + "move":"0,0,64", + "visible_raise":"0,1,1" + } + ] + } + ] +} diff --git a/tests/homescreen/testdata/gui-test-FHD-next.dat b/tests/homescreen/testdata/gui-test-FHD-next.dat new file mode 100644 index 0000000..744e3a6 --- /dev/null +++ b/tests/homescreen/testdata/gui-test-FHD-next.dat @@ -0,0 +1,6 @@ +XY=800,794 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 diff --git a/tests/homescreen/testdata/gui-test-FHD.dat b/tests/homescreen/testdata/gui-test-FHD.dat new file mode 100644 index 0000000..9e8c535 --- /dev/null +++ b/tests/homescreen/testdata/gui-test-FHD.dat @@ -0,0 +1,98 @@ +#wait for starting weston +sleep 5 + +#Change button pushed at tile screen +XY=960,30 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Change button pushed at application screen +XY=960,30 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Application is selected +XY=1466,242 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Hide shown application +XY=960,30 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Holiding down a application tile +XY=1466,242 +sleep 0.1 +Button=Down +sleep 3 +Button=Up +sleep 2 + +#Cancel selected on confirmation screen +XY=1115,664 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#OK selected on confirmation screen +XY=1466,242 +sleep 0.1 +Button=Down +sleep 3 +Button=Up +sleep 2 +XY=669,664 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Application list button is pushed +XY=335,32 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Next selected on applicaton list +XY=800,794 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Cancel selected on applicaton list +XY=1115,794 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#application icon selected on applicaton list +XY=335,32 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + + diff --git a/tests/homescreen/testdata/gui-test-XGA-next.dat b/tests/homescreen/testdata/gui-test-XGA-next.dat new file mode 100644 index 0000000..fd76912 --- /dev/null +++ b/tests/homescreen/testdata/gui-test-XGA-next.dat @@ -0,0 +1,6 @@ +XY=221,774 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 diff --git a/tests/homescreen/testdata/gui-test-XGA.dat b/tests/homescreen/testdata/gui-test-XGA.dat new file mode 100644 index 0000000..2bee10b --- /dev/null +++ b/tests/homescreen/testdata/gui-test-XGA.dat @@ -0,0 +1,98 @@ +#wait for starting weston +sleep 5 + +#Change button pushed at tile screen +XY=384,30 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Change button pushed at application screen +XY=384,30 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Application is selected +XY=666,168 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Hide shown application +XY=384,30 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Holiding down a application tile +XY=666,168 +sleep 0.1 +Button=Down +sleep 3 +Button=Up +sleep 2 + +#Cancel selected on confirmation screen +XY=546,628 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#OK selected on confirmation screen +XY=666,168 +sleep 0.1 +Button=Down +sleep 3 +Button=Up +sleep 2 +XY=221,628 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Application list button is pushed +XY=666,920 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Next selected on applicaton list +XY=221,744 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#Cancel selected on applicaton list +XY=546,744 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + +#application icon selected on applicaton list +XY=666,920 +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 + + diff --git a/tests/homescreen/testdata/gui-test-launch-template.dat b/tests/homescreen/testdata/gui-test-launch-template.dat new file mode 100644 index 0000000..56f5199 --- /dev/null +++ b/tests/homescreen/testdata/gui-test-launch-template.dat @@ -0,0 +1,6 @@ +XY=COORD_X,COORD_Y +sleep 0.1 +Button=Down +sleep 0.1 +Button=Up +sleep 2 diff --git a/tests/system-controller/apps-framework/Makefile.am b/tests/system-controller/apps-framework/Makefile.am index 79a1815..acec0d5 100644 --- a/tests/system-controller/apps-framework/Makefile.am +++ b/tests/system-controller/apps-framework/Makefile.am @@ -19,6 +19,7 @@ check_PROGRAMS = tst_common tst_appresctl tst_appresctl_main tst_inputctl tst_us test_target_flag = -I../../../include $(AIL_CFLAGS) $(OPT_CFLAGS) \ @ECORE_CFLAGS@ @EINA_CFLAGS@ \ + -I/usr/include/ico-uxf-weston-plugin \ -I/usr/include/ico-util test_target_lib = ../../../lib/apps-framework/.libs/libico-appfw.so \ @ECORE_LIBS@ @EINA_LIBS@ \ diff --git a/tests/system-controller/test-dummy-hs/Makefile.am b/tests/system-controller/test-dummy-hs/Makefile.am index da947ff..592d9cc 100644 --- a/tests/system-controller/test-dummy-hs/Makefile.am +++ b/tests/system-controller/test-dummy-hs/Makefile.am @@ -1,7 +1,7 @@ AM_CFLAGS = $(GCC_CFLAGS) AM_CPPFLAGS = $(GCC_CXXFLAGS) -COMMON_LIBS = -L/usr/local/lib -lm -lwebsockets +COMMON_LIBS = -L/usr/local/lib -lm -lwebsockets -lico-uxf-weston-plugin noinst_PROGRAMS = \ DummyHomeScreen @@ -30,6 +30,7 @@ DummyHomeScreen_CXXFLAGS = \ @WAYLANDCLIENT_CFLAGS@ \ @CAPIAPPFWAPPLICATION_CFLAGS@ \ -I/usr/include/ico-util \ + -I/usr/include/ico-uxf-weston-plugin \ -I../../../include DummyHomeScreen_LDADD = \ @@ -45,6 +46,7 @@ DummyHomeScreen_LDADD = \ @WAYLANDCLIENT_LIBS@ \ @CAPIAPPFWAPPLICATION_LIBS@ \ -L/usr/lib \ + -lico-uxf-weston-plugin \ -lico-util \ ../../../lib/apps-framework/.libs/libico-appfw.so \ -lreadline diff --git a/tool/Makefile.am b/tool/Makefile.am index eacac94..062704d 100644 --- a/tool/Makefile.am +++ b/tool/Makefile.am @@ -1,17 +1,23 @@ export abs_builddir wayland_client_lib = -lwayland-client -wayland_ivi_client_lib = $(GENIVI_LIBS) +wayland_ivi_client_lib = -lico-uxf-weston-plugin +wayland_ivi_client_inc = -I/usr/include/ico-uxf-weston-plugin appfw_client_lib = ../lib/apps-framework/.libs/libico-appfw.so -AM_CFLAGS = $(GCC_CFLAGS) -I../include -I/usr/include/ico-util +AM_CFLAGS = $(GCC_CFLAGS) -I../include -I/usr/include/ico-util $(wayland_ivi_client_inc) AM_LDFLAGS = -module -avoid-version -rpath $(libdir) $(GLIB_LIBS) bin_PROGRAMS = \ - ico_change_loginuser + ico_change_loginuser \ + ico_clear_screen check_LTLIBRARIES = $(TESTS) -check_PROGRAMS = ico_login_user +check_PROGRAMS = ico_clear_screen ico_login_user + +ico_clear_screen_SOURCES = \ + ico_clear_screen.c +ico_clear_screen_LDADD = $(SIMPLE_CLIENT_LIBS) -lico-util $(wayland_ivi_client_lib) $(wayland_client_lib) -lwayland-egl -lEGL -lGLESv2 ico_change_loginuser = \ ico_change_loginuser.c diff --git a/tool/ico_clear_screen.c b/tool/ico_clear_screen.c new file mode 100644 index 0000000..e13ce1f --- /dev/null +++ b/tool/ico_clear_screen.c @@ -0,0 +1,420 @@ +/* + * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +/** + * @brief Display screen clear tool + * + * @date Sep-30-2013 + */ + +#include +#include +#include +#include +#include +#include "ico_clear_screen.h" +#include + +static struct display *_display; +static int signal_flag = 0; + +static void +sigterm_catch(int signo) +{ + signal_flag = 1; + + if (_display->ico_window_mgr) { + ico_window_mgr_layout_surface(_display->ico_window_mgr, -1, -1, + -1, -1, -1, -1, 0); + } +} + +void +wayland_dispatch_nonblock(struct wl_display *display) +{ + int nread; + + /* Check wayland input */ + do { + /* Flush send data */ + wl_display_flush(display); + + nread = 0; + if (ioctl(wl_display_get_fd(display), FIONREAD, &nread) < 0) { + nread = 0; + } + if (nread >= 8) { + /* Read event from wayland */ + wl_display_dispatch(display); + } + } while (nread > 0); +} + +EGLDisplay +opengl_init(struct wl_display *display, EGLConfig *rconf, EGLContext *rctx) +{ + EGLDisplay dpy; /* EGL dsplay id */ + EGLint major, minor; + EGLint num_configs; + EGLConfig conf = 0; + EGLContext ctx; + + static const EGLint config_attribs[] = { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RED_SIZE, 1, + EGL_GREEN_SIZE, 1, + EGL_BLUE_SIZE, 1, + EGL_ALPHA_SIZE, 1, + EGL_DEPTH_SIZE, 1, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_NONE + }; + static const EGLint context_attribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE + }; + + dpy = eglGetDisplay((EGLNativeDisplayType)display); + if (! dpy) { + fprintf(stderr, "eglGetDisplay Error\n"); + return NULL; + } + + if (eglInitialize(dpy, &major, &minor) == EGL_FALSE) { + fprintf(stderr, "eglInitialize Error\n"); + return NULL; + } + + if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) { + fprintf(stderr, "eglBindAPI Error\n"); + return NULL; + } + + if (eglChooseConfig(dpy, config_attribs, &conf, 1, &num_configs) == EGL_FALSE) { + fprintf(stderr, "eglChooseConfig Error\n"); + return NULL; + } + + ctx = eglCreateContext(dpy, conf, EGL_NO_CONTEXT, context_attribs); + if (! ctx) { + fprintf(stderr, "eglCreateContext Error\n"); + return NULL; + } + *rconf = conf; + *rctx = ctx; + + wayland_dispatch_nonblock(display); + + return(dpy); +} + +EGLSurface +opengl_create_window(struct display *display, struct wl_surface *surface, + EGLDisplay dpy, EGLConfig conf, EGLContext ctx, + const int width, const int height, const unsigned int color, + const int displayno, const int posx, const int posy) +{ + struct wl_egl_window *egl_window; + EGLSurface egl_surface; + + static const EGLint surface_attribs[] = { + EGL_ALPHA_FORMAT, EGL_ALPHA_FORMAT_PRE, EGL_NONE + }; + + egl_window = wl_egl_window_create(surface, width, height); + egl_surface = eglCreateWindowSurface(dpy, conf, (EGLNativeWindowType)egl_window, + surface_attribs); + eglMakeCurrent(dpy, egl_surface, egl_surface, ctx); + glViewport(0, 0, width, height); + + wayland_dispatch_nonblock(display->display); + + opengl_clear_window(color); + + opengl_swap_buffer(display->display, dpy, egl_surface); + + ico_window_mgr_set_animation(display->ico_window_mgr, 0, + ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE| + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, + display->animation, display->animatime); + ico_window_mgr_layout_surface(display->ico_window_mgr, 0, display->init_layer, + posx, posy, width, height, 1); + return(egl_surface); +} + +void +opengl_clear_window(const unsigned int color) +{ + double r, g, b, a; + + r = (double)((color>>16) & 0x0ff); + r = r / 256.0; + g = (double)((color>>8) & 0x0ff); + g = g / 256.0; + b = (double)(color & 0x0ff); + b = b / 256.0; + a = (double)((color>>24) & 0x0ff); + a = (a + 1.0) / 256.0; + + glClearColor(r, g, b, a); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT| GL_STENCIL_BUFFER_BIT); +} + +void +opengl_swap_buffer(struct wl_display *display, EGLDisplay dpy, EGLSurface egl_surface) +{ + eglSwapBuffers(dpy, egl_surface); + + wayland_dispatch_nonblock(display); +} + +void +shell_surface_ping(void *data, struct wl_shell_surface *wl_shell_surface, uint32_t serial) +{ +} + +void +shell_surface_configure(void *data, struct wl_shell_surface *wl_shell_surface, +uint32_t edges, int32_t width, int32_t height) +{ +} + +void +shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface) +{ +} + +void +output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, + int physical_width, int physical_height, int subpixel, + const char *make, const char *model, int32_t transform) +{ + struct output *output = (struct output*)data; + + output->x = x; + output->y = y; +} + +void +output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, + int width, int height, int refresh) +{ + struct output *output = (struct output*)data; + + if (flags & WL_OUTPUT_MODE_CURRENT) { + output->width = width; + output->height = height; + } +} + +void +handle_global(void *data, struct wl_registry *registry, uint32_t id, + const char *interface, uint32_t version) { + struct display *display = (struct display*)data; + struct output *output; + + if (strcmp(interface, "wl_compositor") == 0) { + display->compositor = (struct wl_compositor*)wl_registry_bind(display->registry, id, + &wl_compositor_interface, 1); + } + else if (strcmp(interface, "wl_output") == 0) { + if (display->num_output < MAX_DISPLAY) { + output = (struct output*)malloc(sizeof *output); + output->display = display; + output->output = (struct wl_output*)wl_registry_bind(display->registry, id, &wl_output_interface, 1); + wl_output_add_listener(output->output, &output_listener, output); + display->output[display->num_output++] = output; + } + } + else if (strcmp(interface, "wl_shell") == 0) { + display->shell = (struct wl_shell*)wl_registry_bind(display->registry, id, &wl_shell_interface, 1); + } + else if (strcmp(interface, "ico_window_mgr") == 0) { + display->ico_window_mgr = (struct ico_window_mgr *)wl_registry_bind(display->registry, id, &ico_window_mgr_interface, 1); + } +} + +void +surface_enter(void *data, struct wl_surface *wl_surface, struct wl_output *output) +{ + struct surface *surface = (struct surface *)data; + + surface->output = (struct output*)wl_output_get_user_data(output); +} + +void +surface_leave(void *data, struct wl_surface *wl_surface, struct wl_output *output) +{ + struct surface *surface = (struct surface*)data; + + surface->output = NULL; + +} + +void +sleep_with_wayland(struct wl_display *display, int msec) +{ + int nread; + int fd; + + fd = wl_display_get_fd(display); + + do { + /* Flush send data */ + wl_display_flush(display); + + /* Check wayland input */ + nread = 0; + if (ioctl(fd, FIONREAD, &nread) < 0) { + nread = 0; + } + if (nread >= 8) { + /* Read event from wayland */ + wl_display_dispatch(display); + } + msec -= 20; + if (msec >= 0) usleep(20*1000); + } while (msec > 0); +} + +void +create_surface(struct display *display, const char *title) { + struct surface *surface; + + if (display->num_surface >= MAX_SURFACE) { + exit(1); + } + surface = (struct surface *)malloc(sizeof(struct surface)); + assert(surface); + memset(surface, 0, sizeof(struct surface)); + surface->display = display; + display->surface[display->num_surface++] = surface; + surface->surface = wl_compositor_create_surface(display->compositor); + wl_surface_add_listener(surface->surface, &surface_listener, surface); + + if (display->shell) { + surface->shell_surface = wl_shell_get_shell_surface(display->shell, + surface->surface); + if (surface->shell_surface) { + wl_shell_surface_add_listener(surface->shell_surface, + &shell_surface_listener, display); + wl_shell_surface_set_toplevel(surface->shell_surface); + wl_shell_surface_set_title(surface->shell_surface, title); + } + } + wl_display_flush(display->display); + poll(NULL, 0, 100); + + wl_display_roundtrip(display->display); + + surface->dpy = opengl_init(display->display, &surface->conf, &surface->ctx); + if (surface->dpy) { + surface->egl_surface = opengl_create_window(display, + surface->surface, + surface->dpy, + surface->conf, + surface->ctx, + display->init_width, + display->init_height, + display->init_color, + display->displayno, + display->init_posx, + display->init_posy); + clear_surface(surface); + } +} + +void +clear_surface(struct surface *surface) +{ + struct display *display = surface->display; + + opengl_clear_window(display->init_color); + opengl_swap_buffer(display->display, + surface->dpy, surface->egl_surface); +} + +int main(int argc, char *argv[]) +{ + int i; + char sname[64]; + + _display = malloc(sizeof(struct display)); + memset(_display, 0, sizeof(struct display)); + + _display->displayno = 0; + _display->init_color = 0xff000000; + _display->init_width = 1920; + _display->init_height = 1920; + _display->init_layer = 201; + strcpy(_display->animation, "fade"); + _display->animatime = 600; + + for (i = 1; i < (argc-1); i++) { + if (strcasecmp(argv[i], "-display") == 0) { + i++; + _display->displayno = strtol(argv[i], (char **)0, 0); + } + else if (strcasecmp(argv[i], "-width") == 0) { + i++; + _display->init_width = strtol(argv[i], (char **)0, 0); + } + else if (strcasecmp(argv[i], "-height") == 0) { + i++; + _display->init_height = strtol(argv[i], (char **)0, 0); + } + else if (strcasecmp(argv[i], "-color") == 0) { + i++; + _display->init_color = strtoul(argv[i], (char **)0, 0); + } + else if (strcasecmp(argv[i], "-layer") == 0) { + i++; + _display->init_layer = strtol(argv[i], (char **)0, 0); + } + else if (strcasecmp(argv[i], "-animation") == 0) { + i++; + memset(_display->animation, 0, sizeof(_display->animation)); + strncpy(_display->animation, argv[i], sizeof(_display->animation)-1); + } + else if (strcasecmp(argv[i], "-animatime") == 0) { + i++; + _display->animatime = strtol(argv[i], (char **)0, 0); + } + else { + fprintf(stderr, + "usage: %s [-display no][-layer layer][-color aarrggbb][-width width]" + "[-height height]\n", argv[0]); + exit(1); + } + } + + _display->display = wl_display_connect(NULL); + if (! _display->display) { + fprintf(stderr, "can not connect to wayland\n"); + return 1; + } + _display->registry = wl_display_get_registry(_display->display); + wl_registry_add_listener(_display->registry, ®istry_listener, _display); + + wl_display_dispatch(_display->display); + sleep_with_wayland(_display->display, 300); + + sprintf(sname, "Clear-Screen-%d-%d", getpid(), _display->displayno); + create_surface(_display, sname); + + signal_flag = 0; + signal(SIGTERM, sigterm_catch); + + while (signal_flag == 0) { + sleep_with_wayland(_display->display, 50); + } + for (i = 0; i < (450/50); i++) { + sleep_with_wayland(_display->display, 50); + } + return 0; +} + diff --git a/tool/ico_clear_screen.h b/tool/ico_clear_screen.h new file mode 100644 index 0000000..52a8813 --- /dev/null +++ b/tool/ico_clear_screen.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +/** + * @brief Display screen clear tool + * + * @date Sep-30-2013 + */ + +#ifndef _CLEAR_SCREEN_H_ +#define _CLEAR_SCREEN_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_CON_NAME 127 +#define MAX_DISPLAY 4 +#define MAX_SURFACE 4 + +struct display { + struct wl_display *display; + struct wl_registry *registry; + struct wl_compositor *compositor; + struct wl_shell *shell; + struct ico_window_mgr *ico_window_mgr; + struct ico_exinput *ico_exinput; + struct input *input; + int num_output; + struct output *output[MAX_DISPLAY]; + int num_surface; + struct surface *surface[MAX_SURFACE]; + unsigned int init_color; + int init_width; + int init_height; + int init_layer; + int displayno; + int init_posx; + int init_posy; + char animation[64]; + int animatime; + char connect[MAX_CON_NAME + 1]; +}; + +struct input { + struct display *display; + struct wl_seat *seat; + struct wl_pointer *pointer; + struct wl_keyboard *keyboard; + float x, y; + uint32_t button_mask; + struct surface *pointer_focus; + struct surface *keyboard_focus; + uint32_t last_key, last_key_state; +}; + +struct output { + struct display *display; + struct wl_output *output; + int x, y; + int width, height; + int trans; +}; + +struct surface { + struct display *display; + struct wl_surface *surface; + struct wl_shell_surface *shell_surface; + struct output *output; + EGLDisplay dpy; + EGLConfig conf; + EGLContext ctx; + EGLSurface egl_surface; +}; + +void wayland_dispatch_nonblock(struct wl_display *display); +void sleep_with_wayland(struct wl_display *display, int msec); +void wait_with_wayland(struct wl_display *display, int msec, int *endflag); +int sec_str_2_value(const char *ssec); +EGLDisplay opengl_init(struct wl_display *display, EGLConfig *rconf, EGLContext *rctx); +EGLSurface opengl_create_window(struct display *display, struct wl_surface *surface, + EGLDisplay dpy, EGLConfig conf, EGLContext ctx, + const int width, const int height, const unsigned int color, + const int displayno, const int posx, const int posy); +void opengl_clear_window(const unsigned int color); +void opengl_swap_buffer(struct wl_display *display, EGLDisplay dpy, EGLSurface egl_surface); +void create_surface(struct display *display, const char *title); +void clear_surface(struct surface *surface); +void shell_surface_ping(void *data, struct wl_shell_surface *wl_shell_surface, uint32_t serial); +void shell_surface_configure(void *data, struct wl_shell_surface *wl_shell_surface, + uint32_t edges, int32_t width, int32_t height); +void shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface); +void output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, + int physical_width, int physical_height, int subpixel, + const char *make, const char *model, int32_t transform); +void output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, + int width, int height, int refresh); +void handle_global(void *data, struct wl_registry *registry, uint32_t id, + const char *interface, uint32_t version); +void surface_enter(void *data, struct wl_surface *wl_surface, struct wl_output *output); +void surface_leave(void *data, struct wl_surface *wl_surface, struct wl_output *output); + +const struct wl_shell_surface_listener shell_surface_listener = { + shell_surface_ping, + shell_surface_configure, + shell_surface_popup_done +}; + +const struct wl_output_listener output_listener = { + output_handle_geometry, + output_handle_mode +}; + +const struct wl_registry_listener registry_listener = { + handle_global +}; + +const struct wl_surface_listener surface_listener = { + surface_enter, + surface_leave +}; + +#endif /*_CLEAR_SCREEN_H_*/ diff --git a/tool/notification/Makefile.am b/tool/notification/Makefile.am new file mode 100644 index 0000000..eef4206 --- /dev/null +++ b/tool/notification/Makefile.am @@ -0,0 +1,60 @@ +AM_CFLAGS = $(GCC_CFLAGS) +AM_CPPFLAGS = $(GCC_CXXFLAGS) + +noinst_PROGRAMS = \ + ico_send_notification \ + ico_send_notification2 \ + ico_dump_notification \ + ico_del_notification + +check_PROGRAMS = \ + ico_send_notification \ + ico_send_notification2 \ + ico_dump_notification \ + ico_dump_notification + +# +# +# +ico_send_notification_SOURCES = \ + send_notification.cpp + +ico_send_notification_CXXFLAGS = \ + $(NOTIFICATION_CFLAGS) + +ico_send_notification_LDADD = \ + $(NOTIFICATION_LIBS) + +ico_send_notification2_SOURCES = \ + send_notification2.cpp + +ico_send_notification2_CXXFLAGS = \ + $(NOTIFICATION_CFLAGS) + +ico_send_notification2_LDADD = \ + $(NOTIFICATION_LIBS) \ + $(APPSVC_LIBS) + +# +# +# +ico_dump_notification_SOURCES = \ + dump_notification.cpp + +ico_dump_notification_CXXFLAGS = \ + $(NOTIFICATION_CFLAGS) + +ico_dump_notification_LDADD = \ + $(NOTIFICATION_LIBS) + +# +# +# +ico_del_notification_SOURCES = \ + del_notification.cpp + +ico_del_notification_CXXFLAGS = \ + $(NOTIFICATION_CFLAGS) + +ico_del_notification_LDADD = \ + $(NOTIFICATION_LIBS) diff --git a/tool/notification/del_notification.cpp b/tool/notification/del_notification.cpp new file mode 100644 index 0000000..c65d12b --- /dev/null +++ b/tool/notification/del_notification.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include "notification.h" +using namespace std; + +int +main(int argc, char **argv) +{ + notification_error_e err = NOTIFICATION_ERROR_NONE; + + if (argc == 2) { + if (0 == strcmp("--all", argv[1])) { + printf("delete all notifications\n"); + err = notification_delete_all_by_type("", NOTIFICATION_TYPE_NOTI); + if (NOTIFICATION_ERROR_NONE != err) { + printf("notification_delete_group_by_priv_id failed(%d).\n", err); + return -1; + } + err = notification_delete_all_by_type("", NOTIFICATION_TYPE_ONGOING); + if (NOTIFICATION_ERROR_NONE != err) { + printf("notification_delete_group_by_priv_id failed(%d).\n", err); + return -1; + } + return 0; + } + } + + if (argc < 3) { + printf("%s [--ongoing] pkgname priv_id\n", argv[0]); + return -1; + } + int n_geta = 1; + notification_type_e nType = NOTIFICATION_TYPE_NOTI; + string sargv1(argv[1]); + if (0 == sargv1.compare("--ongoing")) { + nType = NOTIFICATION_TYPE_ONGOING; + n_geta = 2; + if (argc < 4) { + printf("%s --ongoing pkgname priv_id\n", argv[0]); + return -1; + } + } + + char *pkgname = argv[n_geta]; + int priv_id = atoi(argv[n_geta+1]); + err = notification_delete_by_priv_id(pkgname, nType, priv_id); + if (err != NOTIFICATION_ERROR_NONE) { + printf("notification_delete_by_priv_id failed(%d).\n", err); + return -1; + } + + return 0; +} diff --git a/tool/notification/dump_notification.cpp b/tool/notification/dump_notification.cpp new file mode 100644 index 0000000..ae0ee34 --- /dev/null +++ b/tool/notification/dump_notification.cpp @@ -0,0 +1,84 @@ +#include +#include +#include "notification.h" +using namespace std; + +int +main() +{ + cout << "Notification TestProgram Start=========" << endl; + + //notification variable declaration + notification_error_e err = NOTIFICATION_ERROR_NONE; + notification_list_h noti_list = NULL; + + err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); + if (err != NOTIFICATION_ERROR_NONE) { + cout << "Failed to get notificationList :"<< err << endl; + return -1; + } + + if (NULL == noti_list){ + cout <<"Nothing NotificationList" < +#include +#include +#include +#include +#include "notification.h" +using namespace std; + +const char * +errorToString(notification_error_e error) +{ + const char *strerr = NULL; + + switch (error) { + case NOTIFICATION_ERROR_NONE: + strerr = "NOTIFICATION_ERROR_NONE"; + break; + case NOTIFICATION_ERROR_INVALID_DATA: + strerr = "NOTIFICATION_ERROR_INVALID_DATA"; + break; + case NOTIFICATION_ERROR_NO_MEMORY: + strerr = "NOTIFICATION_ERROR_NO_MEMORY"; + break; + case NOTIFICATION_ERROR_FROM_DB: + strerr = "NOTIFICATION_ERROR_FROM_DB"; + break; + case NOTIFICATION_ERROR_ALREADY_EXIST_ID: + strerr = "NOTIFICATION_ERROR_ALREADY_EXIST_ID"; + break; + case NOTIFICATION_ERROR_FROM_DBUS: + strerr = "NOTIFICATION_ERROR_FROM_DBUS"; + break; + case NOTIFICATION_ERROR_NOT_EXIST_ID: + strerr = "NOTIFICATION_ERROR_NOT_EXIST_ID"; + break; + case NOTIFICATION_ERROR_IO: + strerr = "NOTIFICATION_ERROR_IO"; + break; + case NOTIFICATION_ERROR_SERVICE_NOT_READY: + strerr = "NOTIFICATION_ERROR_SERVICE_NOT_READY"; + break; + case NOTIFICATION_ERROR_PERMISSION_DENIED: + strerr = "NOTIFICATION_ERROR_PERMISSION_DENIED"; + break; + default: + strerr = "UNKOWN"; + break; + } + + return strerr; +} + +int +insert_notification(notification_type_e type, + int group_id, + int priv_id, + const char *pkgname, + const char *title, + const char *content, + const char *icon) +{ + notification_h noti = notification_new(type, + group_id, + priv_id); + if (NULL == noti) { + cout << "notification_new() failed." << endl; + return -1; + } + + //set Pkgname + if (NULL == pkgname) { + return -1; + } + + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_pkgname(noti, pkgname); + if (noti_err != NOTIFICATION_ERROR_NONE) { + printf("notification_set_pkgname failed(%s).\n", + errorToString(noti_err)); + return -1; + } + + //set Title + if (NULL == title) { + return -1; + } + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TITLE, + title, + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + cout << "Failed to set notification title :"<< noti_err<:"<< noti_err<:"<< noti_err <:"<< noti_err < +#include +#include +#include +#include +#include +#include "notification.h" +using namespace std; + +const char * +errorToString(notification_error_e error) +{ + const char *strerr = NULL; + + switch (error) { + case NOTIFICATION_ERROR_NONE: + strerr = "NOTIFICATION_ERROR_NONE"; + break; + case NOTIFICATION_ERROR_INVALID_DATA: + strerr = "NOTIFICATION_ERROR_INVALID_DATA"; + break; + case NOTIFICATION_ERROR_NO_MEMORY: + strerr = "NOTIFICATION_ERROR_NO_MEMORY"; + break; + case NOTIFICATION_ERROR_FROM_DB: + strerr = "NOTIFICATION_ERROR_FROM_DB"; + break; + case NOTIFICATION_ERROR_ALREADY_EXIST_ID: + strerr = "NOTIFICATION_ERROR_ALREADY_EXIST_ID"; + break; + case NOTIFICATION_ERROR_FROM_DBUS: + strerr = "NOTIFICATION_ERROR_FROM_DBUS"; + break; + case NOTIFICATION_ERROR_NOT_EXIST_ID: + strerr = "NOTIFICATION_ERROR_NOT_EXIST_ID"; + break; + case NOTIFICATION_ERROR_IO: + strerr = "NOTIFICATION_ERROR_IO"; + break; + case NOTIFICATION_ERROR_SERVICE_NOT_READY: + strerr = "NOTIFICATION_ERROR_SERVICE_NOT_READY"; + break; + case NOTIFICATION_ERROR_PERMISSION_DENIED: + strerr = "NOTIFICATION_ERROR_PERMISSION_DENIED"; + break; + default: + strerr = "UNKOWN"; + break; + } + + return strerr; +} + +int +insert_notification(notification_type_e type, + int group_id, + int priv_id, + const char *pkgname, + const char *title, + const char *content, + const char *icon) +{ + notification_h noti = notification_new(type, + group_id, + priv_id); + if (NULL == noti) { + cout << "notification_new() failed." << endl; + return -1; + } + + //set Pkgname + if (NULL == pkgname) { + return -1; + } + + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_pkgname(noti, pkgname); + if (noti_err != NOTIFICATION_ERROR_NONE) { + printf("notification_set_pkgname failed(%s).\n", + errorToString(noti_err)); + return -1; + } + + //set Title + if (NULL == title) { + return -1; + } + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TITLE, + title, + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + cout << "Failed to set notification title :"<< noti_err<:"<< noti_err<:"<< noti_err <:"<< noti_err <