Bug Fix for TIVI-1935. 03/10603/1 tizen_ivi_genivi accepted/tizen/20131008.162143 accepted/tizen/20131010.203321 accepted/tizen/ivi/genivi/20140131.070552 accepted/tizen_ivi_milestone/20131113.053414 accepted/tizen_ivi_milestone/20131113.054108 accepted/tizen_ivi_release/20131120.050051 ivi_oct_m2 submit/tizen/20131008.121948 submit/tizen_ivi_generic/20140131.065429 submit/tizen_ivi_genivi/20140131.070609 submit/tizen_ivi_milestone/20131113.052531 submit/tizen_ivi_milestone/20131113.053333 submit/tizen_ivi_milestone/20131113.054033 submit/tizen_ivi_release/20131120.032344
authorHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Tue, 8 Oct 2013 01:38:09 +0000 (10:38 +0900)
committerHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Tue, 8 Oct 2013 01:40:43 +0000 (10:40 +0900)
Change-Id: Ie38e10cebc800150576b944568dab56a82dd9322
Signed-off-by: Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
40 files changed:
Makefile.am
configure.ac
include/ico_syc_common.h
lib/apps-framework/Makefile.am
lib/apps-framework/ico_syc_common.c
lib/system-controller/CicoSCPolicyManager.cpp
lib/system-controller/CicoSCPolicyManager.h
lib/system-controller/CicoSCResourceManager.cpp
lib/system-controller/CicoSCResourceManager.h
lib/system-controller/CicoSCServer.cpp
lib/system-controller/CicoSCServer.h
lib/system-controller/CicoSCUserManager.cpp
lib/system-controller/CicoSCUserManager.h
lib/system-controller/Makefile.am
lib/system-controller/ico_syc_mrp_resource.c
packaging/ico-uxf-homescreen.changes
packaging/ico-uxf-homescreen.spec
res/org.tizen.ico.homescreen/res/config/app_attr.conf [deleted file]
res/org.tizen.ico.homescreen/res/config/homescreen.conf
res/org.tizen.ico.homescreen/res/config/system.conf [deleted file]
res/org.tizen.ico.system-controller/res/config/user.xml
src/homescreen/CicoHSAppHistory.cpp
src/homescreen/CicoHSAppHistory.h
src/homescreen/CicoHSAppHistoryExt.cpp
src/homescreen/CicoHSAppHistoryExt.h
src/homescreen/CicoHSControlBarWindow.cpp
src/homescreen/CicoHSControlBarWindow.h
src/homescreen/CicoHSFlickInputWindow.cpp
src/homescreen/CicoHSFlickTouch.cpp
src/homescreen/CicoHSFlickTouch.h
src/homescreen/CicoHSMenuWindow.cpp
src/homescreen/CicoHomeScreen.cpp
src/homescreen/CicoHomeScreen.h
src/homescreen/CicoHomeScreenCommon.h
src/homescreen/home_screen_main.cpp
src/syscond/CicoSysConDaemon.cpp
tool/Makefile.am [new file with mode: 0644]
tool/ico_change_loginuser.c [new file with mode: 0644]
tool/ico_clear_screen.c [new file with mode: 0644]
tool/ico_clear_screen.h [new file with mode: 0644]

index 9176cad..0ac0937 100644 (file)
@@ -1,4 +1,5 @@
 SUBDIRS=       \
        lib     \
        src     \
+       tool    \
        tests
index 3b9947a..3539de0 100644 (file)
@@ -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.0.1], [])
+AC_INIT([org.tizen.ico.homescreen], [0.9.05], [])
 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_HEADERS([config.h])
@@ -128,7 +128,8 @@ AC_CONFIG_FILES([Makefile
                  src/Makefile
                  src/syscond/Makefile
                  src/homescreen/Makefile
-                                 tests/Makefile
+                 tool/Makefile
+                 tests/Makefile
                  tests/system-controller/Makefile
                  tests/system-controller/apps-framework/Makefile])
 AC_PROG_RANLIB([ranlib])
index 48e5315..bc2f581 100644 (file)
@@ -54,6 +54,16 @@ int ico_syc_connect(ico_syc_callback_t callback, void *user_data);
 /*--------------------------------------------------------------------------*/
 void ico_syc_disconnect(void);
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_service
+ *          Service for communication to System Controller.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_service(void);
 
 #ifdef __cplusplus
 }
index 4412b5b..3eec727 100644 (file)
@@ -8,7 +8,7 @@ libico_appfw_la_CFLAGS = -I../../include $(OPT_CFLAGS) $(UWS_CFLAGS) \
                           -I/usr/include/ico-util
 
 libico_appfw_la_LIBADD =  $(OPT_LIBS) $(WL_LIBS) $(AUL_LIBS) $(UWS_LIBS) $(COMMON_LIBS) @ECORE_LIBS@
-libico_appfw_la_LDFLAGS = -version-info 0:1:0 
+libico_appfw_la_LDFLAGS = -version-info 0:9:0 
 libico_appfw_la_SOURCES =          \
     ico_syc_appresctl.c \
        ico_syc_common.c    \
index ba9d3c6..4632b49 100644 (file)
@@ -41,7 +41,7 @@ static void _syc_ev_callback(const struct ico_uws_context *uws_context,
                              void *user_data);
 static void _add_queue(void *data, size_t len);
 static int _get_event_from_cmd(int command);
-static int _exec_callback(void *user_data);
+static void _exec_callback(void *user_data);
 static Eina_Bool _ecore_fd_cb(void *data, Ecore_Fd_Handler *handler);
 static void _add_poll_fd(int fd);
 static void _del_poll_fd(int fd);
@@ -316,7 +316,7 @@ static int _get_event_from_cmd(int command)
  * @retval      0                       success (always success)
  */
 /*--------------------------------------------------------------------------*/
-static int
+static void
 _exec_callback(void *user_data)
 {
     recv_info_t *recv_data  = NULL;
@@ -325,7 +325,7 @@ _exec_callback(void *user_data)
 
     if (syc_callback == NULL) {
         _DBG("not setting callback function");
-        return ICO_SYC_ERR_NONE;
+        return;
     }
 
     while (g_queue_is_empty(recv_info_q) != TRUE) {
@@ -399,8 +399,6 @@ _exec_callback(void *user_data)
         /* mutex unlock */
         pthread_mutex_unlock(&q_mutex);
     }
-
-    return ICO_SYC_ERR_NONE;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -483,7 +481,7 @@ _poll_fd_thread(void *args)
         }
         /* recive message */
         ico_uws_service(uws_context);
-        _exec_callback(syc_user_data);
+        ecore_main_loop_thread_safe_call_async(_exec_callback, syc_user_data);
     }
     pthread_exit(0);
 
@@ -714,6 +712,24 @@ ico_syc_disconnect(void)
     return;
 }
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_service
+ *          Service for communication to System Controller.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API void
+ico_syc_service(void)
+{
+    /* close the connection */
+    if (uws_context != NULL) {
+        ico_uws_service(uws_context);
+    }
+}
+
 /*============================================================================*/
 /* internal common function                                                   */
 /*============================================================================*/
index 9e6fe48..ea57127 100644 (file)
@@ -15,6 +15,9 @@
  */
 //==========================================================================
 
+#include <string>
+using namespace std;
+
 #include "CicoSCPolicyManager.h"
 #include "CicoStateMachine.h"
 #include "CicoState.h"
@@ -867,4 +870,37 @@ CicoSCPolicyManager::getInputState(int input) const
     }
     return false;
 }
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  notify connected
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCPolicyManager::notifyConnected(const string & appid)
+{
+    // Notify regulation changed state
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_NOTIFY_CHANGED_STATE);
+    message->addArgObject(MSG_PRMKEY_STATEID, ICO_SYC_STATE_REGULATION);
+    if (true == m_policyStates[STID_DRVREGULATION_ON]->isActive()) {
+        message->addArgObject(MSG_PRMKEY_STATE, ICO_SYC_STATE_ON);
+    }
+    else {
+        message->addArgObject(MSG_PRMKEY_STATE, ICO_SYC_STATE_OFF);
+    }
+    CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
+
+    // Notify NightMode changed state
+    message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_NOTIFY_CHANGED_STATE);
+    message->addArgObject(MSG_PRMKEY_STATEID, ICO_SYC_STATE_NIGHTMODE);
+    if (true == m_policyStates[STID_NIGHTMODE_ON]->isActive()) {
+        message->addArgObject(MSG_PRMKEY_STATE, ICO_SYC_STATE_ON);
+    }
+    else {
+        message->addArgObject(MSG_PRMKEY_STATE, ICO_SYC_STATE_OFF);
+    }
+    CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
+}
 // vim:set expandtab ts=4 sw=4:
index 2c0733e..5007d37 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <map>
 #include <vector>
+#include <string>
 using namespace std;
 
 //==========================================================================
@@ -78,6 +79,9 @@ public:
     bool getSoundZoneState(int zoneid) const;
     bool getInputState(int input) const;
 
+    // notify connected process
+    void notifyConnected(const std::string & appid);
+
 private:
     // default constructor
     CicoSCPolicyManager();
@@ -102,6 +106,7 @@ private:
 
     // initialize state machine
     int initStateMachine(void);
+
 private:
     bool                  m_initialized;
     DBusConnection        *m_dbusConnection;
index f5d42d7..fe4aaab 100644 (file)
@@ -398,11 +398,6 @@ CicoSCResourceManager::acquireDisplayResource(resource_request_t *newreq,
             req = popCurDispResOwerReq(req);
             chgzone = newreq->dispzoneid;
         }
-        else {
-            ICO_DBG("already ower appid=%s", req->appid);
-            ICO_DBG("CicoSCResourceManager::acquireDisplayResource Leave(true)");
-            return true;
-        }
     }
 
     // if exist in wating request list, pop request
@@ -472,13 +467,17 @@ CicoSCResourceManager::releaseDisplayResource(resource_request_t *newreq)
     ICO_DBG("CicoSCResourceManager::releaseDisplayResource Enter"
             "(newreq=0x%08x)", newreq);
 
-    // if exist current ower request, pop request
-    resource_request_t *req = popCurDispResOwerReq(newreq);
-    if (NULL == req) {
-        // if exist in wating request list, pop request
-        req = popWaitingDispResReq(newreq);
+    // if exist in wating request list, pop request
+    resource_request_t *req = popWaitingDispResReq(newreq);
+    if (NULL != req) {
+        delResourceRequest(req);
+        delResourceRequest(newreq);
+        ICO_DBG("CicoSCResourceManager::releaseDisplayResource Leave");
+        return;
     }
 
+    // if exist current ower request, pop request
+    req = popCurDispResOwerReq(newreq);
     if (NULL != req) {
         delResourceRequest(req);
     }
@@ -494,6 +493,7 @@ CicoSCResourceManager::releaseDisplayResource(resource_request_t *newreq)
         if (true == active) {
             resource_request_t* popreq = popWaitingDispResReq(*itr);
             updateDisplayResource(popreq);
+            m_winCtrl->active(popreq->surfaceid, -1);
             break;
         }
     }
@@ -827,6 +827,19 @@ CicoSCResourceManager::receiveChangedState(int state)
     ICO_DBG("CicoSCResourceManager::receiveChangedState Leave");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get policy manager instance
+ *
+ *  @return resource manager instace
+ */
+//--------------------------------------------------------------------------
+CicoSCPolicyManager *
+CicoSCResourceManager::getPolicyManager(void)
+{
+    return m_policyMgr;
+}
+
 void
 CicoSCResourceManager::updateDisplayResource(resource_request_t *req,
                                              int chgzoneid)
@@ -840,6 +853,9 @@ CicoSCResourceManager::updateDisplayResource(resource_request_t *req,
         if (itr->second == req) {
             ICO_DBG("already ower appid=%s pid=%d surfaceid=0x%08X",
                     req->appid, req->pid, req->surfaceid);
+            // show request window
+            m_winCtrl->show(req->surfaceid, req->animation, req->animationTime);
+            m_winCtrl->active(req->surfaceid, -1);
             return;
         }
         resource_request_t *popreq = popCurDispResOwerReq(itr->second);
@@ -862,17 +878,14 @@ CicoSCResourceManager::updateDisplayResource(resource_request_t *req,
     }
         
     if (NULL != m_winCtrl) {
-        if (-1 == chgzoneid) {
-            // show request window
-            m_winCtrl->show(req->surfaceid, req->animation, req->animationTime);
-        }
-        else {
+        if (-1 != chgzoneid) {
             // move request window
             m_winCtrl->setGeometry(req->surfaceid, req->dispzone,
                                    req->animation, req->animationTime,
                                    req->animation, req->animationTime);
-            m_winCtrl->show(req->surfaceid, NULL, 0);
         }
+        // show request window
+        m_winCtrl->show(req->surfaceid, req->animation, req->animationTime);
     }
     // state change to acquired
     req->state = RES_STATE_ACQUIRED;
@@ -907,6 +920,7 @@ CicoSCResourceManager::updateDisplayResource(resource_request_t *req,
                 dumpWaitingDispResReq();
 #endif  //DEBUG
                 updateDisplayResource(req);
+                m_winCtrl->active(req->surfaceid, -1);
                 break;
             }
         }
@@ -1047,6 +1061,7 @@ CicoSCResourceManager::updateDisplayResourceRegulation(int state)
                     // show current window
                     // TODO animation?
                     m_winCtrl->show((*itr2)->surfaceid, NULL, 0);
+                    m_winCtrl->active((*itr2)->surfaceid, -1);
                 }
                 break;
             }
@@ -1068,9 +1083,10 @@ CicoSCResourceManager::updateDisplayResourceRegulation(int state)
                                                          current->prio);
             if (true == active) {
                 if (NULL != m_winCtrl) {
-                    // hide current window
+                    // show current window
                     // TODO animation?
                     m_winCtrl->show(current->surfaceid, NULL, 0);
+                    m_winCtrl->active(current->surfaceid, -1);
                 }
             }
         }
index 558759f..42dc7c5 100644 (file)
@@ -64,6 +64,9 @@ public:
     // receive changed state
     void receiveChangedState(int state);
 
+    // get resource manager instance
+    CicoSCPolicyManager * getPolicyManager(void);
+
 private:
     // assignment operator
     CicoSCResourceManager& operator=(const CicoSCResourceManager &object);
index 7f7c477..438e09a 100644 (file)
@@ -29,6 +29,7 @@ using namespace std;
 #include "CicoSCUserManager.h"
 #include "CicoSCUser.h"
 #include "CicoSCResourceManager.h"
+#include "CicoSCPolicyManager.h"
 
 class CicoSCUwsHandler
 {
@@ -147,6 +148,19 @@ CicoSCServer::setResourceMgr(CicoSCResourceManager *resourceMgr)
 
 //--------------------------------------------------------------------------
 /**
+ *  @brief   set policy manager instance
+ *
+ *  @param [in] policyMgr policy manager instance
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCServer::setPolicyMgr(CicoSCPolicyManager *policyMgr)
+{
+    m_policyMgr = policyMgr;
+}
+
+//--------------------------------------------------------------------------
+/**
  *  @brief   startup server
  *
  *  @param [in] port        websocket port
@@ -520,6 +534,7 @@ CicoSCServer::receiveEventCB(const struct ico_uws_context *context,
 
             ecore_main_fd_handler_active_set(handler->ecoreFdHandler, flags);
 
+            notifyConnected(handler->appid);
             break;
         }
         
@@ -643,4 +658,28 @@ CicoSCServer::isExistUwsHandler(const CicoSCUwsHandler *handler)
     }
     return false;
 }
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  notify information to homescreen on connected
+ *
+ *  @param [in] appid   application id
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCServer::notifyConnected(const std::string & appid)
+{
+    const CicoSCUser *loginUser = m_userMgr->getLoginUser();
+    if (NULL == loginUser) {
+        ICO_WRN("homescreen unknown");
+        return;
+    }
+
+    // if appid equal homescreen
+    if (0 == loginUser->homescreen.compare(appid)) {
+        if (NULL != m_policyMgr) {
+            m_policyMgr->notifyConnected(appid);
+        }
+    }
+}
 // vim:set expandtab ts=4 sw=4:
index 729c74d..ac5253f 100644 (file)
 #define __CICO_SC_SERVER_H__
 
 #include <list>
-using namespace std;
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-#include <math.h>
-#include <stdbool.h>
-#include <sys/epoll.h>
-
-#include <getopt.h>
+#include <string>
 
 #include <Ecore.h>
 #include <Eina.h>
@@ -46,6 +35,7 @@ class CicoSCWindowController;
 class CicoSCInputController;
 class CicoSCUserManager;
 class CicoSCResourceManager;
+class CicoSCPolicyManager;
 
 //==========================================================================
 /**
@@ -70,11 +60,14 @@ public:
     // set resource manager instance
     void setResourceMgr(CicoSCResourceManager* resourceMgr);
 
+    // set resource manager instance
+    void setPolicyMgr(CicoSCPolicyManager* policyMgr);
+
     // startup server
     int startup(int port, const char *protocol);
 
     // send message to application client
-    int sendMessage(const string & appid, CicoSCMessage* msg);
+    int sendMessage(const std::string & appid, CicoSCMessage* msg);
 
     // send message to homescreen
     int sendMessageToHomeScreen(CicoSCMessage* msg);
@@ -127,11 +120,14 @@ private:
     CicoSCUwsHandler* findUwsHandler(const Ecore_Fd_Handler *ecoreFdHandler);
 
     // find websocket handle by appid
-    CicoSCUwsHandler* findUwsHandler(const string & appid);
+    CicoSCUwsHandler* findUwsHandler(const std::string & appid);
 
     // query whether the handler exists
     bool isExistUwsHandler(const CicoSCUwsHandler *handler);
 
+    // notify connected appilication
+    void notifyConnected(const std::string & appid);
+
 private:
     static CicoSCServer*    ms_myInstance;   ///< this class instance
 
@@ -141,10 +137,16 @@ private:
     CicoSCInputController   *m_inputCtrl;    ///< input controller instance
     CicoSCUserManager       *m_userMgr;      ///< user manager instance
     CicoSCResourceManager   *m_resourceMgr;  ///< resource manager instance
+    CicoSCPolicyManager     *m_policyMgr;    ///< policy manager instance
+
+    /// websocket handler list
+    std::list<CicoSCUwsHandler*> m_uwsHandlerList;
+
+    /// send message queue
+    std::list<CicoSCMessage*> m_sendMsgQueue;
 
-    list<CicoSCUwsHandler*> m_uwsHandlerList;///< websocket handler list
-    list<CicoSCMessage*>    m_sendMsgQueue;  ///< send message queue
-    list<CicoSCCommand*>    m_recvCmdQueue;  ///< recieve message queue
+    /// recieve message queue
+    std::list<CicoSCCommand*> m_recvCmdQueue;
 };
 #endif  // __CICO_SC_SERVER_H__
 // vim:set expandtab ts=4 sw=4:
index f6fa651..597a4bb 100644 (file)
@@ -376,6 +376,7 @@ CicoSCUserManager::changeUser(const string & name, const string & passwd)
 
     // change login user
     m_login = conf->name;
+    saveLastUser();
     ICO_DBG("login user changed (user=%s)", m_login.c_str());
     ICO_INF("%s", tmpText);
     flagFileOff();
@@ -712,6 +713,23 @@ CicoSCUserManager::loadLastUser(void)
     stream >> m_login;
     stream.close();
 
+    // check login name is valid
+    if (false == m_login.empty()) {
+        bool bValid = false;
+        vector<CicoSCUser*>::iterator it = m_userList.begin();
+        while (it != m_userList.end()) {
+            if (0 == (*it)->name.compare(m_login)) {
+                bValid = true;
+                break;
+            }
+            ++it;
+        }
+        if (false == bValid) {
+            ICO_WRN("last user NG!, user name \"%s\" clear", m_login.c_str());
+            m_login.clear();
+        }
+    }
+
     ICO_DBG("CicoSCUserManager::loadLastUser Leave(EOK)");
 }
 
@@ -732,6 +750,16 @@ CicoSCUserManager::loadLastInfo()
         return;
     }
 
+    // get login user object
+    CicoSCUser* loginUser = NULL;
+    loginUser = const_cast<CicoSCUser*>(findUserConfbyName(m_login));
+    // check login user
+    if (NULL == loginUser) {
+        // login user does not exist in the user list
+        ICO_DBG("CicoSCUserManager::setLastInfo Leave(ENXIO)");
+        return;
+    }
+
     // check weather file exists
     struct stat st;
     string dir = m_parentDir + m_login + ICO_SYC_LASTINFO_DIR;
@@ -754,13 +782,18 @@ CicoSCUserManager::loadLastInfo()
             string info;
             std::ifstream stream;
             stream.open(infofile.c_str());
-            stream >> info;
+            std::getline(stream, info);
             stream.close();
 
             // get appid (erase ".txt" from filename)
             filename.erase(index, filename.size());
-            // set last information
-            setLastInfo(filename, info);
+            // create new object
+            CicoSCLastInfo* lastInfo = new CicoSCLastInfo;
+            // set application's information
+            lastInfo->appid = filename;
+            lastInfo->lastinfo = info;
+            // add to list
+            loginUser->lastInfoList.push_back(lastInfo);
         }
         free(filelist[i]);
     }
index 5c4bd34..907ee6d 100644 (file)
@@ -48,8 +48,8 @@ public:
 
     // get information
     const CicoSCUser* getLoginUser(void);
-    const vector<CicoSCUser*>& getUserList(void);
-    const vector<std::string>& getHomeScreenList(void);
+    const std::vector<CicoSCUser*>& getUserList(void);
+    const std::vector<std::string>& getHomeScreenList(void);
 
     // change user
     void changeUser(const std::string & name, const std::string & passwd);
@@ -101,7 +101,7 @@ private:
     bool killingAppsAndHS(const std::string& usrnm);
 
     // working user directory make
-    void getWorkingDir(const std::string& usr, string& dir);
+    void getWorkingDir(const std::string& usr, std::string& dir);
 
     // launch homescreen request
     bool launchHomescreenReq(const std::string& usr,
index 84c0952..561eb84 100644 (file)
@@ -6,6 +6,7 @@ noinst_LTLIBRARIES =\
 #lib_LTLIBRARIES =\
 #      libico-system-controller.la
 
+libico_system_controller_la_LDFLAGS = -version-info 0:9:0 
 libico_system_controller_la_SOURCES =  \
        CicoSCAilItems.cpp                                      \
        CicoSCAulItems.cpp                                      \
index 4429242..391c4df 100644 (file)
@@ -158,6 +158,19 @@ ico_syc_mrp_del_request(resource_request_t *req)
         return;
     }
 
+    resource_request_t *findreq = ico_syc_mrp_find_request(req->id,
+                                                           req->appid);
+    if (NULL != findreq) {
+        if (req->pid != findreq->pid) {
+            ICO_DBG("ico_syc_mrp_del_request: pid not match");
+            return;
+        }
+    }
+    else {
+        ICO_DBG("ico_syc_mrp_del_request: not found in req list");
+        return;
+    }
+
     ICO_DBG("ico_syc_mrp_del_request: "
             "del request %p to mrp_reqs list", req);
     mrp_list_delete(&req->hook);
index 21d60e4..24c4346 100644 (file)
@@ -1,3 +1,11 @@
+* Tue Oct 08 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/20131003.220120@49e6831
+- 0.9.05 release.
+-- bugfix: The page which does not exist by scrolling downward in a menu screen is displayed.
+-- addition: Notice of the operation event to application except the application history flick operation.
+-- addition: Prohibition of the application history operation of the driving mode.
+-- addition: Addition of two tools. ico_clear_screen and ico_change_loginuser.
+-- bugfix: TIVI-1935 - Input focus is not switched to the new top most app when switching via gesture
+
 * Thu Sep 26 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/20130919.204217@93c93da
 - 0.9.04 release
 -- addition of the application operation history.
index 019cfc1..96b23cf 100644 (file)
@@ -1,14 +1,14 @@
 Name:       ico-uxf-homescreen
 Summary:    Sample homescreen and system controller
-Version:    0.9.04
-Release:    1.2
+Version:    0.9.05
+Release:    1.3
 Group:         Graphics & UI Framework/Automotive UI
 License:    Apache-2.0
 URL:        ""
 Source0:    %{name}-%{version}.tar.bz2
 
 BuildRequires: pkgconfig(wayland-client) >= 1.2
-BuildRequires: ico-uxf-weston-plugin-devel >= 0.9.05
+BuildRequires: ico-uxf-weston-plugin-devel >= 0.9.06
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(ecore)
 BuildRequires: pkgconfig(ecore-wayland)
@@ -30,10 +30,11 @@ BuildRequires: pkgconfig(murphy-domain-controller)
 BuildRequires: pkgconfig(murphy-ecore)
 BuildRequires: pkgconfig(murphy-resource)
 BuildRequires: boost-devel
-BuildRequires: ico-uxf-utilities-devel >= 0.2.04
+BuildRequires: mesa-devel
+BuildRequires: ico-uxf-utilities-devel
 Requires: weston >= 1.2
-Requires: ico-uxf-weston-plugin >= 0.9.05
-Requires: ico-uxf-utilities >= 0.2.04
+Requires: ico-uxf-weston-plugin >= 0.9.06
+Requires: ico-uxf-utilities
 
 %description
 Sample homescreen application and system controller daemon
@@ -72,11 +73,14 @@ mkdir -p ${STATUSBARDIR}/res/images
 mkdir -p ${STATUSBARDIR}/res/edj
 mkdir -p ${STATUSBARDIR}/res/config
 mkdir -p ${STATUSBARDIR}/bin
+mkdir -p %{_bindir}
 cp -rf data/apps/org.tizen.ico.statusbar %{buildroot}/usr/apps/
 install -m 0755 src/homescreen/StatusBar ${STATUSBARDIR}/bin/
 install -m 0644 res/org.tizen.ico.homescreen/res/images/time*.png ${STATUSBARDIR}/res/images
 install -m 0644 data/share/packages/org.tizen.ico.statusbar.xml %{buildroot}/usr/share/packages
 cp res/org.tizen.ico.homescreen/res/apps/org.tizen.ico.statusbar/* ${STATUSBARDIR}/res/config
+cp tool/ico_clear_screen %{buildroot}%{_bindir}
+cp tool/ico_change_loginuser %{buildroot}%{_bindir}
 
 %post
 /sbin/ldconfig
@@ -109,6 +113,8 @@ rm -f /home/app/layout.txt
 /usr/lib/systemd/user/ico-system-controller.service
 /usr/lib/systemd/user/ico-uxf-wait-launchpad-ready.path
 /usr/lib/systemd/user/weston.target.wants/ico-uxf-wait-launchpad-ready.path
+%{_bindir}/ico_clear_screen
+%{_bindir}/ico_change_loginuser
 %attr(644,app,app) /home/app/ico/defaultApps.info
 %attr(755,app,app) /home/app/ico
 /home/app/ico/defaultApps.info
diff --git a/res/org.tizen.ico.homescreen/res/config/app_attr.conf b/res/org.tizen.ico.homescreen/res/config/app_attr.conf
deleted file mode 100644 (file)
index 2abe477..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# OpenPF System Configurations
-#  /usr/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
-#  Sep-30-2013
-#
-
-[app-attributes]
-# attributes of HomeScreen
-org.tizen.ico.homescreen=Menu;kind=HomeScreen;run=Center;noauto;type=menu
-org.tizen.ico.onscreen=Menu;kind=HomeScreen;run=Center;noauto;type=menu
-org.tizen.ico.statusbar=Menu;kind=HomeScreen;run=Center;noauto;type=menu
-org.tizen.ico.app-samplenavi=Map
-
-# attrinutes of native applictions
-org.tizen.soft-keyboard=Menu;kind=SysApp;dispzone=SysApp;layer=SoftKeyboard
-org.tizen.setting=CarSetting;kind=SysApp.audio
-org.tizen.music-player=Map
-
-# attributes of web applications
-MediaPlayer=Map
-MyMediaPlayer=Map
-MeterWidget=Map
-GhostCluster=Map
-WinkerLeft=Camera.Left;kind=Maker;dispzone=SysApp.Left;layer=InterruptApp
-WinkerLeft.1=NoDisplay;auto;Animation=Slide.toRight;invisiblecpu=no;noconfigure
-WinkerRight=Camera.Right;kind=Maker;dispzone=SysApp.Right;layer=InterruptApp
-WinkerRight.1=NoDisplay;auto;Animation=Slide.toLeft;invisiblecpu=no;noconfigure
-
index 402dc3b..fda527c 100644 (file)
@@ -46,3 +46,13 @@ shortcut_app0=t8j6HTRpuz.MediaPlayer
 shortcut_app1=
 shortcut_app2=
 shortcut_app3=
+
+[standardswitch]
+# trigger home switch keyname
+homekeyname=h
+
+# trigger back switch keyname
+backkeyname=b
+
+# trigger menu switch keyname
+menukeyname=l
diff --git a/res/org.tizen.ico.homescreen/res/config/system.conf b/res/org.tizen.ico.homescreen/res/config/system.conf
deleted file mode 100644 (file)
index 51b6ab9..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-## OpenPF System Configurations
-##  /opt/apps/org.tizen.ico.homescreen/res/config/system.conf
-##     May-15-2013
-
-## System ECUs
-[host]
-##      Center Display ECU
-# ECU name
-0=Center
-# ECU type
-0.type=Center
-# IP address(if environment valiable'SYSHOSTIP0' NOT defined)
-0.ip=127.0.0.1
-# This ECU has HomeScreen(null:no, not null:applicationId of HomeScreen)
-0.homescreen=org.tizen.ico.homescreen
-#
-
-## Displays
-[display]
-## Center Display
-# Display name
-0=Center
-# ECU name
-0.host=Center
-# Display Number
-0.displayno=0
-# Wayland connection name(ex.'wayland-0')
-0.wayland=wayland-0
-# Display Type
-0.type=Center
-# Display Size
-#0.width=1920
-#0.height=1080
-0.width=1080
-0.height=1920
-# number of Layers
-0.layer=5
-# inch (in 0.1 inchs)
-0.inch=101
-# Display Layer
-0.layer.0=BackGround
-0.layer.1=HomeScreen
-0.layer.2=Application
-0.layer.3=SoftKeyboard
-0.layer.4=InterruptApp
-0.layer.5=Touch
-0.layer.6=OnScreen;menuoverlap
-# Display Zone
-## id=name;x;y;width;height[;overlap-zone;overlap-zone;...]
-##   if 'id=name', size is all of display, no overlap
-0.zone.0=Base
-0.zone.1=Full;0;64;dispw;disph-64;Upper;Lower;UpperLeft;UpperRight;LowerLeft;LowerRight
-0.zone.2=Upper;0;64;dispw;disph-64/2;Full;UpperLeft;UpperRight
-0.zone.3=Lower;0;heigh-64/2+64;dispw;disph-64/2;Full;LowerLeft;LowerRight
-0.zone.4=UpperLeft;0;64;dispw/2;disph-64/2;Full;Upper
-0.zone.5=UpperRight;dispw/2;64;dispw/2;disph-64/2;Full;Upper
-0.zone.6=LowerLeft;0;heigh-64/2+64;dispw/2;disph-64/2;Full;Lower
-0.zone.7=LowerRight;dispw/2;heigh-64/2+64;dispw/2;disph-64/2;Full;Lower
-0.zone.8=SysApp;0;64;dispw;disph-64
-0.zone.9=SysApp.Left;0;64;dispw/2-140;disph-64
-0.zone.10=SysApp.Right;dispw/2+140;64;dispw/2-140;disph-64
-#
-## Sound
-[sound]
-## Center ECU
-# Sound device name
-0=Center
-# ECU name
-0.host=Center
-# Device Number
-0.soundno=0
-# Sound Zone
-## id=name[;overlap;overlap-zone;overlap-zone;...]
-0.zone.0=Base
-0.zone.1=Full
-0.zone.2=Driver
-
-## Port Numbers
-[port]
-# AppsController Port Number
-appscontrollerport=18081
-# PulseAudio UIFW-PlugIn Port Number
-soundpluginport=8088
-
-## Application Category name
-[category]
-0=Menu
-0.type=system
-0.view=always
-0.sound=always
-0.input=always
-0.priority=4
-1=Message
-1.type=message
-1.view=always
-1.sound=always
-1.input=always
-1.priority=5
-2=Map
-2.type=map
-2.view=always
-2.sound=always
-2.input=always
-2.priority=3
-3=Driving
-3.type=maker
-3.view=run
-3.sound=run
-3.input=run
-3.priority=2
-4=CarSetting
-4.type=maker
-4.view=shift_park
-4.sound=shift_park
-4.input=shift_park
-4.priority=2
-5=Camera.Back
-5.type=maker
-5.view=shift_back
-5.sound=shift_back
-5.input=shift_back
-5.priority=6
-6=Camera.Left
-6.type=maker
-6.view=blinker_left
-6.sound=blinker_left
-6.input=blinker_left
-6.priority=6
-7=Camera.Right
-7.type=maker
-7.view=blinker_right
-7.sound=blinker_right
-7.input=blinker_right
-7.priority=6
-8=Entertainment
-8.type=unknown
-8.view=parked
-8.sound=parked
-8.input=parked
-8.priority=0
-9=Entertainment.audio
-9.type=unknown
-9.view=parked
-9.sound=always
-9.input=always
-9.priority=0
-10=Entertainment.visual
-10.type=unknown
-10.view=always
-10.sound=parked
-10.input=always
-10.priority=0
-#
-## Application Kind
-[kind]
-0=Almighty
-0.privilege=almighty
-0.priority=5
-1=HomeScreen
-1.privilege=system
-1.priority=4
-2=SysApp
-2.privilege=system
-2.priority=3
-3=SysApp.audio
-3.privilege=system.audio
-3.priority=3
-4=SysApp.visual
-4.privilege=system.visible
-4.priority=3
-5=Maker
-5.privilege=maker
-5.priority=2
-6=Certificate
-6.privilege=certificate
-6.priority=1
-7=UnKnown
-7.privilege=none
-7.priority=0
-#
-## Input Sw
-[input]
-0=DrivingForceGT
-0.sw.0=JS_UpDown
-0.sw.1=JS_LR
-0.sw.2=JS_Cross;org.tizen.ico.app-soundsample
-0.sw.3=JS_Square;org.tizen.ico.homescreen
-0.sw.4=JS_Circle;org.tizen.ico.app-soundsample
-0.sw.5=JS_Triangle;org.tizen.ico.homescreen
-#
-## Default target
-[default]
-host=Center
-kind=UnKnown
-category=Entertainment.audio
-display=Center
-layer=Application
-displayzone=Full
-sound=Center
-soundzone=Full
-inputdev=DrivingForceGT
-inputsw=JS_UpDown
-#
-## default transition
-[transition]
-transition=none
-#
-## Log
-[log]
-# loglevel:ERROR=4,CRITICAL=8,WARNING=16,INFO=64,DEBUG=128
-loglevel=128
-# log flush on log output
-logflush=yes
-
index 853d8b7..e933cd6 100644 (file)
@@ -6,12 +6,12 @@
 <userconfig>
 <users>
     <user>
-        <name>Alice</name>
+        <name>Daddy</name>
         <passwd></passwd>
         <hs>org.tizen.ico.homescreen</hs>
     </user>
     <user>
-        <name>Bob</name>
+        <name>Mommy</name>
         <passwd></passwd>
         <hs>org.tizen.ico.homescreen</hs>
     </user>
@@ -19,7 +19,7 @@
 
 <default>
     <user>
-        <name>Alice</name>
+        <name>Daddy</name>
     </user>
 </default>
 
index c72ef0a..ff95cc6 100644 (file)
 #include <vector>
 #include <utility>
 #include <cstdio>
+#include <cstring>
 #include <aul/aul.h>
 #include <sys/stat.h>
+#include <cerrno>
 #include "CicoHSAppHistory.h"
+#include "CicoHomeScreenCommon.h"
+#include "CicoHomeScreen.h"
 #include "CicoLog.h"
 
 using namespace std;
@@ -33,7 +37,9 @@ CicoHSAppHistory::CicoHSAppHistory()
     ICO_DBG("constructor");
     m_user.clear();
     m_path.clear();
+    m_pathD.clear();
     m_flagPath.clear();
+    m_hs = NULL;
     homeSwipe();
 }
 
@@ -44,10 +50,11 @@ CicoHSAppHistory::CicoHSAppHistory()
  * @param flagpath control flag file path
  */
 CicoHSAppHistory::CicoHSAppHistory(const char* user, const char* path,
-                                   const char* flagpath)
-    :m_user(user), m_path(path), m_flagPath(flagpath)
+                                   const char* pathD, const char* flagpath)
+    :m_user(user), m_path(path), m_pathD(pathD), m_flagPath(flagpath)
 {
-    ICO_DBG("constructor %s, %s, %s", user, path, flagpath);
+    ICO_DBG("constructor %s, %s", user, path, pathD, flagpath);
+    m_hs = NULL;
     homeSwipe();
 }
 
@@ -58,10 +65,11 @@ CicoHSAppHistory::CicoHSAppHistory(const char* user, const char* path,
  * @param flagpath control flag file path
  */
 CicoHSAppHistory::CicoHSAppHistory(const string& user, const string& path,
-                                   const string& flagpath)
-    :m_user(user), m_path(path), m_flagPath(flagpath)
+                                   const string& pathD, const string& flagpath)
+    :m_user(user), m_path(path), m_pathD(pathD), m_flagPath(flagpath)
 {
-    ICO_DBG("constructor %s, %s, %s", user.c_str(), path.c_str(), flagpath.c_str());
+    ICO_DBG("constructor %s, %s", user.c_str(), flagpath.c_str());
+    m_hs = NULL;
     homeSwipe();
 }
 
@@ -74,6 +82,7 @@ CicoHSAppHistory::~CicoHSAppHistory()
     writeAppHistory();
     m_user.clear();
     m_path.clear();
+    m_pathD.clear();
     m_flagPath.clear();
 }
 
@@ -187,6 +196,52 @@ bool CicoHSAppHistory::force_flagoff()
 }
 
 /**
+ * @brief read application history
+ * @param app appid's and sub display status store vector
+ */
+bool CicoHSAppHistory::readAppHistory(vector<pairAppidSubd>& apps)
+{
+    ICO_DBG("start");
+    apps.clear();
+
+    string fpath(m_path);
+    struct stat stat_buf;
+    if ((true == fpath.empty()) || (0 != stat(fpath.c_str(), &stat_buf))) {
+        ICO_DBG("file path ng(%d, %s)", errno, fpath.c_str());
+        fpath =  m_pathD;
+        if ((true == fpath.empty()) || (0 != stat(fpath.c_str(), &stat_buf))) {
+            ICO_DBG("file path ng(%d, %s)", errno, fpath.c_str());
+            return false;
+        }
+    }
+
+    ICO_DBG("read history %s", fpath.c_str());
+    string tagApp;
+    ifstream ifs(fpath.c_str());
+    char sBuff[128];
+    int szF = strlen(DEF_SUBDISPLAY_TAG);
+    while(ifs >> tagApp) {
+        if (true == tagApp.empty()) {
+            continue;
+        }
+        bool bFLAG = false;
+        strcpy(sBuff, tagApp.c_str());
+        int szR = strlen(sBuff);
+        if (szF < szR) {
+            if (0 == strcmp(&sBuff[(szR-szF)], DEF_SUBDISPLAY_TAG)) {
+                bFLAG = true;
+                sBuff[(szR-szF)] = '\0';
+                tagApp = sBuff;
+            }
+        }
+        ICO_DBG("read [%d]=(%s, %d)", apps.size(), sBuff, bFLAG);
+        apps.push_back(pairAppidSubd(sBuff,bFLAG));
+    }
+    ifs.close();
+    return true;
+}
+
+/**
  * @brief write application history
  */
 bool CicoHSAppHistory::writeAppHistory()
@@ -196,6 +251,7 @@ bool CicoHSAppHistory::writeAppHistory()
         ICO_DBG("end false file none");
         return false;
     }
+    const char* pSubD = getAppidSubDispBySystem();
     vector<string> vs;
     list<string>::iterator p = m_appHistoryList.begin();
     for (; p != m_appHistoryList.end(); ++p) {
@@ -205,7 +261,11 @@ bool CicoHSAppHistory::writeAppHistory()
         if (true == filterChk(m_filterW, (*p).c_str())) {
             continue;   // continue of for p
         }
-        vs.push_back(*p);
+        string tmp(*p);
+        if (0 == tmp.compare(pSubD)) {
+            tmp += DEF_SUBDISPLAY_TAG;
+        }
+        vs.push_back(tmp);
     }
     if (0 == vs.size()) {
         remove(m_path.c_str());
@@ -248,6 +308,22 @@ bool CicoHSAppHistory::filterChk(vector<string>& filter, const char* tgt) const
 }
 
 /**
+ * @brief get sub display used appid
+ * @return const char*
+ */
+const char* CicoHSAppHistory::getAppidSubDispBySystem() const
+{
+    static const char* pSubD = "";
+    if (NULL != m_hs) {
+        const char* p = m_hs->GetSubDisplayAppid();
+        if (NULL != p) {
+            return p;
+        }
+    }
+    return pSubD;
+}
+
+/**
  * @brief next swipe app and appid get
  * @ret  appid
  * @retval empty is stopped
index 2a89667..7d323da 100644 (file)
 #include <vector>
 #include <utility>
 
+#define DEF_SUBDISPLAY_TAG ":SUBDISPLAY"
+
+typedef std::pair<std::string, bool> pairAppidSubd;
+
+class CicoHomeScreen;
+
 class CicoHSAppHistory
 {
 public:
     CicoHSAppHistory();
-    CicoHSAppHistory(const char* user, const char* path, const char* flagpath);
+    CicoHSAppHistory(const char* user, const char* path, const char* pathD,
+                     const char* flagpath);
     CicoHSAppHistory(const std::string& user, const std::string& path,
-                     const std::string& flagpath);
+                     const std::string& pathD, const std::string& flagpath);
     virtual ~CicoHSAppHistory();
 
     // get
     const std::string& getUser() const;
     const std::string& getPath() const;
+    const std::string& getPathDef() const;
     const std::list<std::string>& getAppHistory() const;
 
     // operate
@@ -48,19 +56,25 @@ public:
     bool force_flagoff();
     void setFilterManage(std::vector<std::string>& filter);
     void setFilterWrite(std::vector<std::string>& filter);
-protected:
+
+    bool readAppHistory(std::vector<pairAppidSubd>& apps);
     bool writeAppHistory();
+    void setHomeScreen(CicoHomeScreen* p);
+protected:
     bool filterChk(std::vector<std::string>& filter, const char* tgt) const;
+    const char* getAppidSubDispBySystem() const;
 
 protected:
     std::string         m_user;     // login-user name
     std::string         m_path;     // history application file path
+    std::string         m_pathD;    // history application file path default
     std::string         m_flagPath; // flag file path
     std::list<std::string>   m_appHistoryList;  // history application list
     std::vector<std::string> m_filterM;   // history manage filter string
     std::vector<std::string> m_filterW;   // history write filter string
     std::list<std::string>::iterator m_swipeCurr;
     std::string         m_swipeStr;
+    CicoHomeScreen*     m_hs;
 };
 
 /**
@@ -81,6 +95,14 @@ inline const std::string& CicoHSAppHistory::getPath() const
     return m_path;
 }
 
+/**
+ * @brief get file path default
+ * @ret file path
+ */
+inline const std::string& CicoHSAppHistory::getPathDef() const
+{
+    return m_pathD;
+}
 
 /**
  * @brief get history appid list
@@ -109,5 +131,9 @@ inline void CicoHSAppHistory::setFilterWrite(std::vector<std::string>& filter)
     m_filterW = filter;   // history write filter string
 }
 
+inline void CicoHSAppHistory::setHomeScreen(CicoHomeScreen* hs)
+{
+    m_hs = hs;
+}
 
 #endif // CICOHSAPPHISTORY_H
index bf1dc88..d6767ff 100644 (file)
@@ -25,6 +25,8 @@
 #include "CicoHSAppHistory.h"
 #include "CicoHSAppHistoryExt.h"
 #include "Cico_aul_listen_app.h"
+#include "CicoHomeScreenCommon.h"
+#include "CicoHomeScreen.h"
 #include "CicoLog.h"
 
 using namespace std;
@@ -101,6 +103,8 @@ CicoHSAppHistoryExt::CicoHSAppHistoryExt()
     setHandler();
     setWaitTime(DEFAULT_WAIT_TIME);
     m_lastStartupApp.clear();
+    m_subDispApp.clear();
+    m_empty.clear();
 }
 
 /**
@@ -110,13 +114,15 @@ CicoHSAppHistoryExt::CicoHSAppHistoryExt()
  * @param flagpath control flag file path
  */
 CicoHSAppHistoryExt::CicoHSAppHistoryExt(const char* user, const char* path,
-                                         const char* flagpath)
-    :CicoHSAppHistory(user, path, flagpath)
+                                         const char* pathD, const char* flagpath)
+    :CicoHSAppHistory(user, path, pathD, flagpath)
 {
     resetCounter();
     setHandler();
     setWaitTime(DEFAULT_WAIT_TIME);
     m_lastStartupApp.clear();
+    m_subDispApp.clear();
+    m_empty.clear();
 }
 
 /**
@@ -127,13 +133,16 @@ CicoHSAppHistoryExt::CicoHSAppHistoryExt(const char* user, const char* path,
  */
 CicoHSAppHistoryExt::CicoHSAppHistoryExt(const string& user,
                                          const string& path,
+                                         const string& pathD,
                                          const string& flagpath)
-    :CicoHSAppHistory(user, path, flagpath)
+    :CicoHSAppHistory(user, path, pathD, flagpath)
 {
     resetCounter();
     setHandler();
     setWaitTime(DEFAULT_WAIT_TIME);
     m_lastStartupApp.clear();
+    m_subDispApp.clear();
+    m_empty.clear();
 }
 
 /**
@@ -300,7 +309,7 @@ void CicoHSAppHistoryExt::selectApp(const char* appid)
     ICO_DBG("timer set(%x) %s, %d", data, appid, data->id);
     ecore_timer_add(m_waitTimer, ico_CHSAHE_timeout, data);
     m_lCdt.push_back(data);
-    m_currentAppid = appid;
+    m_waitSelApp = appid;
 }
 
 /**
@@ -317,14 +326,18 @@ void CicoHSAppHistoryExt::determined(CHSAHE_data_t* data)
         ICO_DBG("free %x", data);
         delete data;        // area free
     }
-    if (true == m_currentAppid.empty()) {
+    if (true == m_waitSelApp.empty()) {
         ICO_DBG("end appid lost");
         return;
     }
     if (id == getCounter()) {
+        string appid(m_waitSelApp);
         ICO_DBG("Match id");
-        moveHistoryHead(m_currentAppid);
-        m_currentAppid.clear();
+        moveHistoryHead(m_waitSelApp);
+        m_waitSelApp.clear();
+        if (m_hs) {
+            m_hs->requestWaitActivation(appid);
+        }
     }
     ICO_DBG("end");
 }
@@ -361,25 +374,24 @@ void CicoHSAppHistoryExt::activeApp(const string& appid)
 void CicoHSAppHistoryExt::activeApp(const char* appid)
 {
     ICO_DBG("start %s", appid);
-    if (true == m_currentAppid.empty()) {
+    if (true == m_waitSelApp.empty()) {
 #if 1
         moveHistoryHead(appid);
 #endif
         ICO_DBG("end current none");
         return;
     }
-    if (m_currentAppid == appid) { // touch operate app
-        moveHistoryHead(m_currentAppid);
-        m_currentAppid.clear();
+    if (m_waitSelApp == appid) { // touch operate app
+        moveHistoryHead(m_waitSelApp);
+        m_waitSelApp.clear();
         ICO_DBG("end touch operate app");
         return;
     }
-    ICO_DBG("end  no match curr(%s)", m_currentAppid.c_str());
-#if 1
-    moveHistoryHead(appid);
-#endif
+    ICO_DBG("end  no match select app(%s)", m_waitSelApp.c_str());
 #if 1
-    m_currentAppid.clear();
+    if (true == moveHistoryHead(appid)) {
+        m_waitSelApp.clear();
+    }
 #endif
     return;
 }
@@ -389,12 +401,16 @@ bool CicoHSAppHistoryExt::chgChk()
     string tmp(m_bkTmp);
     m_bkTmp.clear();
     int i = 0;
+    const char* pAppidSubD = getAppidSubDispBySystem();
     list<string>::iterator p = m_appHistoryList.begin();
     while (p != m_appHistoryList.end()) {
         if (i != 0) {
             m_bkTmp += ',';
         }
         m_bkTmp += *p;
+        if (0 == (*p).compare(pAppidSubD)) {
+            m_bkTmp += "(S)";
+        }
         i++;
         ++p;
     }
@@ -405,6 +421,7 @@ bool CicoHSAppHistoryExt::chgChk()
     ICO_DBG("true, %d %d", m_bkTmp.size(), tmp.size());
     return true;
 }
+
 bool CicoHSAppHistoryExt::addAppHistory(const string& app)
 {
     bool r;
@@ -414,6 +431,7 @@ bool CicoHSAppHistoryExt::addAppHistory(const string& app)
     }
     return r;
 }
+
 bool CicoHSAppHistoryExt::delAppHistory(const string& app)
 {
     bool r;
@@ -421,6 +439,20 @@ bool CicoHSAppHistoryExt::delAppHistory(const string& app)
     if (true == chgChk()) {
         writeAppHistory();
     }
+    if (true == isStartupChecking()) {
+        if (0 == m_lastStartupApp.compare(app)) {
+            m_lastStartupApp.clear();
+        }
+        if (0 == m_subDispApp.compare(app)) {
+            m_subDispApp.clear();
+        }
+        startupEntryFinish(app);
+        if (true == isFinish()) {
+            if (NULL != m_hs) {
+                m_hs->finishStartup();
+            }
+        }
+    }
     return r;
 }
 /**
@@ -469,20 +501,33 @@ void CicoHSAppHistoryExt::update_appid(int pid, string& appid, int& aulstt)
  */
 const string& CicoHSAppHistoryExt::nextSwipe()
 {
-    m_swipeStr.clear();
-    if (false == m_lastStartupApp.empty()) {
+    if (true == isStartupChecking()) {
         ICO_DBG("Next empty! stoped");
-        return m_swipeStr;
+        return m_empty;
     }
     if (m_swipeCurr == m_appHistoryList.begin()) {
         ICO_DBG("Next empty! stoped");
-        return m_swipeStr;
+        return m_empty;
     }
     --m_swipeCurr;
     m_swipeStr = *m_swipeCurr;
     if (true == update_pairPidAppid(m_swipeStr)) {
         *m_swipeCurr = m_swipeStr;
     }
+    const char* pAppidSubD = getAppidSubDispBySystem();
+    if (0 == m_swipeStr.compare(pAppidSubD)) {
+        if (m_swipeCurr == m_appHistoryList.begin()) {
+            ++m_swipeCurr; // back
+            m_swipeStr = *m_swipeCurr;
+            ICO_DBG("begin is sub display appid");
+            return m_empty;
+        }
+        --m_swipeCurr;  // one more
+        m_swipeStr = *m_swipeCurr;
+        if (true == update_pairPidAppid(m_swipeStr)) {
+            *m_swipeCurr = m_swipeStr;
+        }
+    }
     ICO_DBG("Next %s", m_swipeStr.c_str());
     return m_swipeStr;
 }
@@ -494,21 +539,42 @@ const string& CicoHSAppHistoryExt::nextSwipe()
  */
 const string& CicoHSAppHistoryExt::prevSwipe()
 {
-    m_swipeStr.clear();
-    if (false == m_lastStartupApp.empty()) {
+    if (true == isStartupChecking()) {
+        ICO_DBG("Next empty! stoped");
+        return m_empty;
+    }
+    if (m_swipeCurr == m_appHistoryList.end()) {
         ICO_DBG("Next empty! stoped");
-        return m_swipeStr;
+        return m_empty;
     }
     ++m_swipeCurr;
     if (m_swipeCurr == m_appHistoryList.end()) {
         --m_swipeCurr;
         ICO_DBG("Prev empty! stoped");
-        return m_swipeStr;
+        return m_empty;
     }
     m_swipeStr = *m_swipeCurr;
     if (true == update_pairPidAppid(m_swipeStr)) {
         *m_swipeCurr = m_swipeStr;
     }
+    const char* pAppidSubD = getAppidSubDispBySystem();
+    if (0 == m_swipeStr.compare(pAppidSubD)) {
+        ++m_swipeCurr;
+        if (m_swipeCurr == m_appHistoryList.end()) {
+            --m_swipeCurr;
+            --m_swipeCurr;
+            m_swipeStr = *m_swipeCurr;
+            if (true == update_pairPidAppid(m_swipeStr)) {
+                *m_swipeCurr = m_swipeStr;
+            }
+            ICO_DBG("old history appid is sub display");
+            return m_empty;
+        }
+        m_swipeStr = *m_swipeCurr;
+        if (true == update_pairPidAppid(m_swipeStr)) {
+            *m_swipeCurr = m_swipeStr;
+        }
+    }
     ICO_DBG("Prev %s", m_swipeStr.c_str());
     return m_swipeStr;
 }
@@ -527,11 +593,50 @@ const string& CicoHSAppHistoryExt::homeSwipe()
         if (true == update_pairPidAppid(m_swipeStr)) {
             *m_swipeCurr = m_swipeStr;
         }
+        const char* pAppidSubD = getAppidSubDispBySystem();
+        if (0 == m_swipeStr.compare(pAppidSubD)) {
+            if (1 < m_appHistoryList.size()) {
+                prevSwipe();
+            }
+            else {
+                m_swipeStr.clear();
+            }
+        }
     }
+    ICO_DBG("swipe home is %s", m_swipeStr.c_str());
     return m_swipeStr;
 }
 
 /**
+ * @brief get near entry history
+ * @ret appid
+ */
+const string& CicoHSAppHistoryExt::getNearHistory()
+{
+    ICO_TRA("start");
+    list<string>::iterator p = m_appHistoryList.begin();
+    if (p == m_appHistoryList.end()) {
+        // NO history
+        ICO_TRA("end no history");
+        return m_empty;
+    }
+    const char* pAppidSubD = getAppidSubDispBySystem();
+    if (0 != (*p).compare(pAppidSubD)) {
+        // on history
+        ICO_TRA("end near history is %s", (*p).c_str());
+        return *p;
+    }
+    ++p;
+    if (p == m_appHistoryList.end()) {
+        // NO history
+        ICO_TRA("end no history");
+        return m_empty;
+    }
+    ICO_TRA("end near history is %s", (*p).c_str());
+    return *p;
+}
+
+/**
  * @brief get swipe current appid
  * @ret appid
  */
@@ -629,9 +734,12 @@ void CicoHSAppHistoryExt::startupCheckAdd(int pid, const std::string& appid,
 {
     ICO_DBG("add pid=%d, appid=%s", pid, appid.c_str());
     m_vpbpa.push_back(pairBoolPidAppid(false, pairPidAppid(pid, appid)));
-    if (false == d) {
-       m_lastStartupApp = appid;
+    if (true == d) {
+        m_subDispApp = appid;
     } 
+    else {
+        m_lastStartupApp = appid;
+    }
 }
 
 /**
@@ -652,6 +760,19 @@ void CicoHSAppHistoryExt::startupEntryFinish(int pid)
     }
 }
 
+void CicoHSAppHistoryExt::startupEntryFinish(const string& appid)
+{
+    vector<pairBoolPidAppid>::iterator it = m_vpbpa.begin();
+    while (it != m_vpbpa.end()) {
+        if (0 == (*it).second.second.compare(appid)) {
+            ICO_DBG("FINISH!! %d, %s", (*it).second.first,
+                    (*it).second.second.c_str());
+            (*it).first = true;
+        }
+        it++;
+    }
+}
+
 /**
  * @brief is finish start-up check
  * @ret bool
index f3f297f..6fc453b 100644 (file)
@@ -42,9 +42,10 @@ class CicoHSAppHistoryExt :public CicoHSAppHistory
 {
 public:
     CicoHSAppHistoryExt();
-    CicoHSAppHistoryExt(const char* user, const char* path, const char* flagpath);
+    CicoHSAppHistoryExt(const char* user, const char* path, const char* pathD,
+                        const char* flagpath);
     CicoHSAppHistoryExt(const std::string& user, const std::string& path,
-                        const std::string& flagpath);
+                        const std::string& pathD, const std::string& flagpath);
     virtual ~CicoHSAppHistoryExt();
     void setWaitTime(double msec);
 
@@ -52,6 +53,7 @@ public:
     virtual bool addAppHistory(const std::string& app);
     virtual bool delAppHistory(const std::string& app);
     virtual bool moveHistoryHead(const std::string& app);
+    const std::string& getNearHistory();
 
     // AUL I/F
     int appLaunch(int pid, const char* appid, int aulstt);
@@ -64,6 +66,7 @@ public:
     void selectApp(int pid);
     void selectApp(const std::string& appid);
     void selectApp(const char* appid);
+    const std::string& getSelectApp() const;
 
     // time out selected app
     void determined(CHSAHE_data_t* data);
@@ -87,10 +90,13 @@ public:
     void startupCheckAdd(int pid, const std::string& appid, bool d = false);
     bool isStartupChecking() const;
     void startupEntryFinish(int pid);
+    void startupEntryFinish(const std::string& appid);
     bool isFinish();
     void stopStartupCheck();
-    const std::string& lastStartupApp() const;
+    const std::string& getLastStartupAppid() const;
+    const std::string& getSubDispAppid() const;
 
+    bool chgChk();
 protected:
     enum {
         COUNTER_START = 1,
@@ -100,18 +106,19 @@ protected:
     int resetCounter();
     int getCounter();
     int nextCounter();
-    bool chgChk();
 
 protected:
     std::vector<pairPidAppid> m_vppa;
     std::vector<int> m_aulstt;
     int   m_cnt;
-    std::string m_currentAppid;
+    std::string m_waitSelApp;
     std::list<CHSAHE_data_t*> m_lCdt;
     double   m_waitTimer;    // ex.) 1sec = 1.0
     std::string m_bkTmp;
     std::vector<pairBoolPidAppid> m_vpbpa;
     std::string m_lastStartupApp;
+    std::string m_subDispApp;
+    std::string m_empty;
 };
 
 /**
@@ -169,12 +176,36 @@ inline bool CicoHSAppHistoryExt::isStartupChecking() const
     return true;
 }
 
+/**
+ * @brief get last start-up appid
+ * @retuen appid Valid only application startup
+ * @retval empty is application startup finish or no have history
+*/
 
-
-inline const std::string& CicoHSAppHistoryExt::lastStartupApp() const
+inline const std::string& CicoHSAppHistoryExt::getLastStartupAppid() const
 {
     return m_lastStartupApp;
 }
 
+/**
+ * @brief get history sub display appid
+ * @return appid 
+ * @retval empty is no have history sub display
+ */
+inline const std::string& CicoHSAppHistoryExt::getSubDispAppid() const
+{
+    return m_subDispApp;
+}
+
+/**
+ * @brief get select App entry appid
+ * @ret appid
+ * @retval empty is time out or none select
+ */
+inline const std::string& CicoHSAppHistoryExt::getSelectApp() const
+{
+    return m_waitSelApp;
+}
+
 #endif // CICOHSAPPHISTORYEXT_H
 
index 4afb781..5a68658 100644 (file)
@@ -39,8 +39,46 @@ CicoHSControlBarWindow::CicoHSControlBarWindow(void)
 
     CicoHomeScreenConfig config;
     config.Initialize(ICO_HOMESCREEN_CONFIG_FILE);
-    const char *value = config.ConfigGetString("switchzone", "keyname", NULL);
-    changeZoneKeyName = value[0];
+    const char *value = config.ConfigGetString("switchzone", "keyname", "m");
+    if (strlen(value) > (sizeof(changeZoneKeyName) - 1)) {
+        ICO_WRN("[switchzone] keyname is strlen overflow. use default keyname(m)");
+    }
+    else {
+        memset(changeZoneKeyName, 0, sizeof(changeZoneKeyName));
+        strncpy(changeZoneKeyName, value, strlen(value));
+    }
+
+    value = config.ConfigGetString("standardswitch", "homekeyname", "h");
+    if (strlen(value) > (sizeof(homeKeyName) - 1)) {
+        ICO_WRN("[standardswitch] keyname is strlen overflow. use default keyname(h)");
+    }
+    else {
+        memset(homeKeyName, 0, sizeof(homeKeyName));
+        strncpy(homeKeyName, value, strlen(value));
+    }
+
+    value = config.ConfigGetString("standardswitch", "backkeyname", "b");
+    if (strlen(value) > (sizeof(backKeyName) - 1)) {
+        ICO_WRN("[standardswitch] keyname is strlen overflow. use default keyname(b)");
+    }
+    else {
+        memset(backKeyName, 0, sizeof(backKeyName));
+        strncpy(backKeyName, value, strlen(value));
+    }
+
+    value = config.ConfigGetString("standardswitch", "menukeyname", "l");
+    menuKeyName[0] = value[0];
+    if (strlen(value) > (sizeof(menuKeyName) - 1)) {
+        ICO_WRN("[standardswitch] keyname is strlen overflow. use default keyname(l)");
+    }
+    else {
+        memset(menuKeyName, 0, sizeof(menuKeyName));
+        strncpy(menuKeyName, value, strlen(value));
+    }
+    ICO_DBG("Assigned key config : changeZone[%s]", changeZoneKeyName);
+    ICO_DBG("Assigned key config : home[%s]", homeKeyName);
+    ICO_DBG("Assigned key config : back[%s]", backKeyName);
+    ICO_DBG("Assigned key config : menu[%s]", menuKeyName);
 
     char tmp_str[16];
     for (unsigned int ii = 0; ii < ICO_HS_CONTROL_BAR_SHORTCUT_MAX_NUM; ii++) {
@@ -91,7 +129,8 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x, int pos_y,
     char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
     
     /*create window*/
-    ret = CreateWindow(ICO_HS_CONTROL_BAR_WINDOW_TITLE,pos_x,pos_y,width,height,EINA_TRUE);
+    ret = CreateWindow(ICO_HS_CONTROL_BAR_WINDOW_TITLE,
+                       pos_x, pos_y, width, height, EINA_TRUE);
     if(ret != ICO_OK){
        return ret;
     }
@@ -111,8 +150,25 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x, int pos_y,
     evas_object_event_callback_add(background, EVAS_CALLBACK_KEY_DOWN, 
                                    CicoHSControlBarWindow::evasKeyDownCB, this);
 
+    // key grab
     evas_object_focus_set(background, EINA_FALSE);     
-    Eina_Bool eret = evas_object_key_grab(background, "m", 0, 0, EINA_TRUE);
+    Eina_Bool eret = evas_object_key_grab(background, (const char*)changeZoneKeyName,
+                                          0, 0, EINA_TRUE);
+    if (EINA_FALSE == eret) {
+        ICO_WRN("evas_object_key_grab failed.");
+    }
+    eret = evas_object_key_grab(background, (const char*)homeKeyName,
+                                0, 0, EINA_TRUE);
+    if (EINA_FALSE == eret) {
+        ICO_WRN("evas_object_key_grab failed.");
+    }
+    eret = evas_object_key_grab(background, (const char*)backKeyName,
+                                0, 0, EINA_TRUE);
+    if (EINA_FALSE == eret) {
+        ICO_WRN("evas_object_key_grab failed.");
+    }
+    eret = evas_object_key_grab(background, (const char*)menuKeyName,
+                                0, 0, EINA_TRUE);
     if (EINA_FALSE == eret) {
         ICO_WRN("evas_object_key_grab failed.");
     }
@@ -386,33 +442,40 @@ CicoHSControlBarWindow::SetRegulation(void)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   CicoHSControlBarWindow::GetChangeZoneKeyName
- *          get change zone key name
+ * @brief   CicoHSControlBarWindow::SetMenuWindowID
+ *          set appid and surface
  *
  * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
-char
-CicoHSControlBarWindow::GetChangeZoneKeyName(void)
+void
+CicoHSControlBarWindow::SetWindowID(const char *appid,int surface)
 {
-    return changeZoneKeyName;
+    strncpy(this->appid,appid,ICO_HS_MAX_PROCESS_NAME);
+    this->surface = surface;
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   CicoHSControlBarWindow::SetMenuWindowID
- *          set appid and surface
+ * @brief   CicoHSControlBarWindow::TouchShortcut
+ *          touch shortcut button
  *
  * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
-CicoHSControlBarWindow::SetWindowID(const char *appid,int surface)
+CicoHSControlBarWindow::TouchShortcut(const char *appid)
 {
-    strncpy(this->appid,appid,ICO_HS_MAX_PROCESS_NAME);
-    this->surface = surface;
+    ICO_DBG("CicoHSControlBarWindow::TouchShortcut Enter");
+
+    if (appid != NULL) {
+        ICO_DBG("CicoHSControlBarWindow::TouchShortcut appid = [%s]", appid);
+        CicoHomeScreen::ExecuteApp(appid);
+    }
+
+    ICO_DBG("CicoHSControlBarWindow::TouchShortcut Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -426,41 +489,44 @@ CicoHSControlBarWindow::SetWindowID(const char *appid,int surface)
  */
 //--------------------------------------------------------------------------
 void
-CicoHSControlBarWindow::evasKeyDownCB(void *data, Evas *evas,
-                                      Evas_Object *obj, void *info)
+CicoHSControlBarWindow::onKeyDown(void *data, Evas *evas,
+                                  Evas_Object *obj, void *info)
 {
     Evas_Event_Key_Down *evinfo = NULL;
     evinfo = (Evas_Event_Key_Down*)info;
-    CicoHSControlBarWindow *ctrlbarwin = (CicoHSControlBarWindow*)(data);
 
-    ICO_DBG("KeyDownCB: keyname=%s, key=%d",
+    ICO_DBG("onKeyDown: keyname=%s, key=%d",
             evinfo->keyname, (char)*evinfo->key);
 
-    if (evinfo->keyname[0] == ctrlbarwin->GetChangeZoneKeyName()) {
+    if (0 == strcmp(evinfo->keyname, changeZoneKeyName)) {
         CicoHomeScreen::ChangeZone();
     }
+    else if (0 == strcmp(evinfo->keyname, homeKeyName)) {
+        TouchHome();
+    }
+    else if (0 == strcmp(evinfo->keyname, backKeyName)) {
+        // TODO not assinded funciton 
+    }
+    else if (0 == strcmp(evinfo->keyname, menuKeyName)) {
+        // TODO not assinded funciton 
+    }
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSControlBarWindow::TouchShortcut
- *          touch shortcut button
+ *  @brief  key up event callback function
  *
- * @param[in]   none
- * @return      none
+ *  @pamam [in] data    user data
+ *  @param [in] evas    evas instcance
+ *  @param [in] obj     evas object instcance
+ *  @param [in] info    event information(Evas_Event_Key_Down)
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 void
-CicoHSControlBarWindow::TouchShortcut(const char *appid)
+CicoHSControlBarWindow::evasKeyDownCB(void *data, Evas *evas,
+                                      Evas_Object *obj, void *info)
 {
-    ICO_DBG("CicoHSControlBarWindow::TouchShortcut Enter");
-
-    if (appid != NULL) {
-        ICO_DBG("CicoHSControlBarWindow::TouchShortcut appid = [%s]", appid);
-        CicoHomeScreen::ExecuteApp(appid);
-    }
-
-    ICO_DBG("CicoHSControlBarWindow::TouchShortcut Leave");
+    CicoHSControlBarWindow *ctrlbarwin = (CicoHSControlBarWindow*)(data);
+    ctrlbarwin->onKeyDown(data, evas, obj, info);
 }
-
 // vim: set expandtab ts=4 sw=4:
index beaff1a..127982d 100644 (file)
@@ -58,10 +58,11 @@ class CicoHSControlBarWindow :public CicoHSWindow
 
     void SetNightMode(void);
     void SetRegulation(void);
-    char GetChangeZoneKeyName(void);
     void AddShortcut(Evas *evas, int width);
     void TouchShortcut(const char *appid);
 
+    void onKeyDown(void *data, Evas *evas, Evas_Object *obj, void *info);
+
 protected:
     // assignment operator
     CicoHSControlBarWindow operator=(const CicoHSControlBarWindow&);
@@ -82,10 +83,12 @@ private:
     Evas        *evas;          ///! evas instance
     Evas_Object *background;    ///! background evas object instance
     Evas_Object *menu_btn;      ///! menu button evas object instance
-    char changeZoneKeyName;     ///! change zone key name
+    char changeZoneKeyName[8];  ///! change zone key name
+    char homeKeyName[8];        ///! home button assigned key name
+    char backKeyName[8];        ///! back button assigned key name
+    char menuKeyName[8];        ///! menu button assigned key name
     const char *shortcut_appid[ICO_HS_CONTROL_BAR_SHORTCUT_MAX_NUM];
     Evas_Object *shortcut[ICO_HS_CONTROL_BAR_SHORTCUT_MAX_NUM];
-
 };
 #endif
 // vim: set expandtab ts=4 sw=4:
index 65ac5bf..9f6177e 100644 (file)
@@ -104,6 +104,8 @@ CicoHSFlickInputWindow::CreateFlickInputWindow(int pos_x, int pos_y,
                                        CicoHSFlickTouch::TouchDownFlick, this);
     evas_object_event_callback_add(background, EVAS_CALLBACK_MOUSE_UP,
                                        CicoHSFlickTouch::TouchUpFlick, this);
+    evas_object_event_callback_add(background, EVAS_CALLBACK_MOUSE_MOVE,
+                                       CicoHSFlickTouch::TouchMoveFlick, this);
 
     /* move and show window     */
     evas_object_move(background, 0, 0);
index 826ec74..d6e9c3d 100644 (file)
@@ -14,6 +14,7 @@
 #include "CicoHSFlickTouch.h"
 #include "CicoHSAppInfo.h"
 #include "CicoHomeScreen.h"
+#include "CicoHSSystemState.h"
 #include "ico_syc_inputctl.h"
 #include <linux/input.h>
 
@@ -31,7 +32,9 @@ int CicoHSFlickTouch::touch_state_a_y;
 int CicoHSFlickTouch::touch_lasttime;
 
 Ecore_Timer *CicoHSFlickTouch::timer;
+bool CicoHSFlickTouch::touch_down;
 bool CicoHSFlickTouch::long_act;
+bool CicoHSFlickTouch::set_xy_pos;
 
 int CicoHSFlickTouch::num_windows;
 CicoHSFlickInputWindow* CicoHSFlickTouch::flick_windows[ICO_HS_MAX_FLICKWINDOWS];
@@ -57,7 +60,9 @@ CicoHSFlickTouch::Initialize(CicoHSControlBarWindow* ctl_bar, CicoHSAppHistoryEx
 {
     timer = NULL;
     num_windows = 0;
+    touch_down = false;
     long_act = false;
+    set_xy_pos = false;
 
     ctl_bar_window = ctl_bar;
     app_history = apphist;
@@ -104,14 +109,28 @@ CicoHSFlickTouch::TouchDownFlick(void *data, Evas *evas, Evas_Object *obj, void
 
     info = reinterpret_cast<Evas_Event_Mouse_Down*>(event_info);
     window = (CicoHSFlickInputWindow *)data;
-    touch_state_b_x = info->output.x + window->GetPosX();
-    touch_state_b_y = info->output.y + window->GetPosY();
+
+    if ((info->output.x < 0) || (info->output.y < 0) ||
+        (info->output.x >= 4096) || (info->output.y >= 4096))   {
+        ICO_DBG("TouchDownFlick: illegal position(%d/%d)", info->output.x, info->output.y);
+    }
+    else if (set_xy_pos == false)   {
+        set_xy_pos = true;
+        touch_state_b_x = info->output.x + window->GetPosX();
+        touch_state_b_y = info->output.y + window->GetPosY();
+    }
+    if (touch_down) {
+        ICO_DBG("TouchDownFlick: dual touch down, Skip");
+        return;
+    }
 
     gettimeofday(&ctime, NULL);
     touch_lasttime = (ctime.tv_sec * 1000 + ctime.tv_usec/1000);
 
-    ICO_DBG("TouchDownFlick: x/y=%d/%d", touch_state_b_x, touch_state_b_y);
+    ICO_DBG("TouchDownFlick: x/y=%d/%d->%d/%d", info->output.x, info->output.y,
+            touch_state_b_x, touch_state_b_y);
 
+    touch_down = true;
     long_act = false;
     timer = ecore_timer_add(ICO_HS_FLICK_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS,
                             LongPushed,NULL);
@@ -133,8 +152,8 @@ CicoHSFlickTouch::LongPushed(void *data)
     long_act = true;
     timer = NULL;
 
-#if 0           /* not yet support  */
     /* send ABS_X/Y     */
+    ICO_DBG("LongPushed: Not Flick, send Touch Down event to application");
     ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 2,
                        ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
     /* send TOUCH Down  */
@@ -142,10 +161,7 @@ CicoHSFlickTouch::LongPushed(void *data)
                        BTN_TOUCH, 1);
     /* send ABS_X/Y     */
     ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
-                       ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
-#endif
-    touch_state_b_x = 0;
-    touch_state_b_y = 0;
+                       ABS_Z, ((touch_state_b_x+1) << 16) | (touch_state_b_y+1));
 
     return ECORE_CALLBACK_CANCEL;
 }
@@ -177,86 +193,107 @@ CicoHSFlickTouch::TouchUpFlick(void *data, Evas *evas, Evas_Object *obj, void *e
     std::string histapp;
     std::string curapp;
 
+    info = reinterpret_cast<Evas_Event_Mouse_Up*>(event_info);
+    window = (CicoHSFlickInputWindow *)data;
+    touch_state_a_x = info->output.x + window->GetPosX();
+    touch_state_a_y = info->output.y + window->GetPosY();
+    set_xy_pos = false;
+
+    ICO_DBG("TouchUpFlick: x/y=%d/%d->%d/%d (before %d/%d)",
+            info->output.x, info->output.y,
+            touch_state_b_x, touch_state_b_y, touch_state_a_x, touch_state_a_y);
+
     if(timer != NULL){
         ecore_timer_del(timer);
         timer = NULL;
     }
-    /* long push*/
-    if(long_act == true){
+    /* long push    */
+    if((touch_down == false) || (long_act == true)) {
         ICO_DBG("TouchUpFlick: timedout");
-        long_act = false;
-        return;
-    }
+        touch_down = false;
 
-    info = reinterpret_cast<Evas_Event_Mouse_Up*>(event_info);
-    window = (CicoHSFlickInputWindow *)data;
-    touch_state_a_x = info->output.x + window->GetPosX();
-    touch_state_a_y = info->output.y + window->GetPosY();
+        /* send touch release event */
+        gettimeofday(&ctime, NULL);
+        touch_lasttime = (ctime.tv_sec * 1000 + ctime.tv_usec/1000);
 
-    ICO_DBG("TouchUpFlick: x/y=%d/%d->%d/%d",
-            touch_state_b_x, touch_state_b_y, touch_state_a_x, touch_state_a_y);
+        /* send ABS_X/Y     */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 2,
+                           ABS_Z, (touch_state_a_x << 16) | touch_state_a_y);
+        /* send TOUCH Up    */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 1,
+                           BTN_TOUCH, 0);
+        /* send ABS_X/Y     */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
+                           ABS_Z, ((touch_state_a_x+1) << 16) | (touch_state_a_y+1));
+        return;
+    }
+    touch_down = false;
     sub = touch_state_a_x - touch_state_b_x;
 
     /* check slide left to right or right to left   */
     if (sub > ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE) {
         if (touch_state_b_x < ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE) {
-
-            /* flick at left side to right = back before application*/
-            ICO_DBG("TouchUpFlick: Flick left side to right");
-
-            /* get before application   */
-            curapp = app_history->getSwipeCurrentAppid();
-            histapp = app_history->prevSwipe();
-            ICO_DBG("TouchUpFlick: Flick left to right(cur/prev=%s/%s)",
-                    curapp.c_str(), histapp.c_str());
-            if (histapp.empty())    {
-                ICO_DBG("TouchUpFlick: Flick left to right(prev not exist)");
+            if (CicoHSSystemState::getInstance()->getRegulation() == true)  {
+                ICO_DBG("TouchUpFlick: Flick left side to right, but Regulation=ON");
             }
             else    {
-                animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
-                                 ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL;
-
-                /* show before application with slide to right  */
-                appinfo = CicoHomeScreen::GetAppInfo(histapp.c_str());
-                if (appinfo)    {
-                    animation.name = (char *)"slide.toright";
-                    for (idx = 0; ; idx++)  {
-                        wininfo = appinfo->GetWindowInfo(idx);
-                        if (! wininfo)  break;
-                        ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
-                                wininfo->appid, idx, wininfo->surface);
-                        ico_syc_show(wininfo->appid, wininfo->surface, &animation);
-                    }
-                }
-                else    {
-                    ICO_DBG("TouchUpFlick: prev app(%s) dose not exist", histapp.c_str());
-                }
+                /* flick at left side to right = back before application*/
+                ICO_DBG("TouchUpFlick: Flick left side to right");
 
-                /* hide current applicaiton with slide to right */
-                if (curapp.empty()) {
-                    ICO_DBG("TouchUpFlick: Flick left to right(current not exist)");
+                /* get before application   */
+                curapp = app_history->getSwipeCurrentAppid();
+                histapp = app_history->prevSwipe();
+                ICO_DBG("TouchUpFlick: Flick left to right(cur/prev=%s/%s)",
+                        curapp.c_str(), histapp.c_str());
+                if (histapp.empty())    {
+                    ICO_DBG("TouchUpFlick: Flick left to right(prev not exist)");
                 }
                 else    {
                     animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
-                                     ICO_SYC_WIN_SURF_NORESCTL;
-                    appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str());
+                                     ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL;
+
+                    /* show before application with slide to right  */
+                    appinfo = CicoHomeScreen::GetAppInfo(histapp.c_str());
                     if (appinfo)    {
-                        animation.name = (char *)"slide.toleft";
+                        animation.name = (char *)"slide.toright";
                         for (idx = 0; ; idx++)  {
                             wininfo = appinfo->GetWindowInfo(idx);
                             if (! wininfo)  break;
                             ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
                                     wininfo->appid, idx, wininfo->surface);
-                            ico_syc_hide(wininfo->appid, wininfo->surface, &animation);
+                            ico_syc_show(wininfo->appid, wininfo->surface, &animation);
                         }
                     }
                     else    {
-                        ICO_DBG("TouchUpFlick: current app(%s) dose not exist",
-                                curapp.c_str());
+                        ICO_DBG("TouchUpFlick: prev app(%s) dose not exist", histapp.c_str());
+                    }
+
+                    /* hide current applicaiton with slide to right */
+                    if (curapp.empty()) {
+                        ICO_DBG("TouchUpFlick: Flick left to right(current not exist)");
                     }
+                    else    {
+                        animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
+                                         ICO_SYC_WIN_SURF_NORESCTL;
+                        appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str());
+                        if (appinfo)    {
+                            animation.name = (char *)"slide.toleft";
+                            for (idx = 0; ; idx++)  {
+                                wininfo = appinfo->GetWindowInfo(idx);
+                                if (! wininfo)  break;
+                                ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
+                                        wininfo->appid, idx, wininfo->surface);
+                                ico_syc_hide(wininfo->appid, wininfo->surface, &animation);
+                            }
+                        }
+                        else    {
+                            ICO_DBG("TouchUpFlick: current app(%s) dose not exist",
+                                    curapp.c_str());
+                        }
+                    }
+                    /* set history timer                            */
+                    app_history->selectApp(histapp.c_str());
                 }
-                /* set history timer                            */
-                app_history->selectApp(histapp.c_str());
             }
             flick = 1;
         }
@@ -266,62 +303,68 @@ CicoHSFlickTouch::TouchUpFlick(void *data, Evas *evas, Evas_Object *obj, void *e
         }
     }
     else if (sub < (-1 * ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE)) {
-        if (touch_state_b_x > (full_width - ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE)) {
-            /* flick at right side to left = go next applicaton     */
-
-            /* get next application     */
-            curapp = app_history->getSwipeCurrentAppid();
-            histapp = app_history->nextSwipe();
-            ICO_DBG("TouchUpFlick: Flick right to left(cur/next=%s/%s)",
-                    curapp.c_str(), histapp.c_str());
-            if (histapp.empty())    {
-                ICO_DBG("TouchUpFlick: Flick right to left(next not exist)");
+        if (touch_state_b_x >
+            (full_width - ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE))    {
+            if (CicoHSSystemState::getInstance()->getRegulation() == true)  {
+                ICO_DBG("TouchUpFlick: Flick right side to left, but Regulation=ON");
             }
             else    {
-                animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
-                                 ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL;
-
-                /* show next application with slide to left     */
-                appinfo = CicoHomeScreen::GetAppInfo(histapp.c_str());
-                if (appinfo)    {
-                    animation.name = (char *)"slide.toleft";
-                    for (idx = 0; ; idx++)  {
-                        wininfo = appinfo->GetWindowInfo(idx);
-                        if (! wininfo)  break;
-                        ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
-                                wininfo->appid, idx, wininfo->surface);
-                        ico_syc_show(wininfo->appid, wininfo->surface, &animation);
-                    }
-                }
-                else    {
-                    ICO_DBG("TouchUpFlick: next app(%s) dose not exist", histapp.c_str());
-                }
+                /* flick at right side to left = go next applicaton     */
 
-                /* hide current applicaiton with slide to left  */
-                if (curapp.empty()) {
-                    ICO_DBG("TouchUpFlick: Flick right to left(current not exist)");
+                /* get next application     */
+                curapp = app_history->getSwipeCurrentAppid();
+                histapp = app_history->nextSwipe();
+                ICO_DBG("TouchUpFlick: Flick right to left(cur/next=%s/%s)",
+                        curapp.c_str(), histapp.c_str());
+                if (histapp.empty())    {
+                    ICO_DBG("TouchUpFlick: Flick right to left(next not exist)");
                 }
                 else    {
                     animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
-                                     ICO_SYC_WIN_SURF_NORESCTL;
-                    appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str());
+                                     ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL;
+
+                    /* show next application with slide to left     */
+                    appinfo = CicoHomeScreen::GetAppInfo(histapp.c_str());
                     if (appinfo)    {
-                    animation.name = (char *)"slide.toright";
+                        animation.name = (char *)"slide.toleft";
                         for (idx = 0; ; idx++)  {
                             wininfo = appinfo->GetWindowInfo(idx);
                             if (! wininfo)  break;
                             ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
                                     wininfo->appid, idx, wininfo->surface);
-                            ico_syc_hide(wininfo->appid, wininfo->surface, &animation);
+                            ico_syc_show(wininfo->appid, wininfo->surface, &animation);
                         }
                     }
                     else    {
-                        ICO_DBG("TouchUpFlick: current app(%s) dose not exist",
-                                curapp.c_str());
+                        ICO_DBG("TouchUpFlick: next app(%s) dose not exist", histapp.c_str());
                     }
+
+                    /* hide current applicaiton with slide to left  */
+                    if (curapp.empty()) {
+                        ICO_DBG("TouchUpFlick: Flick right to left(current not exist)");
+                    }
+                    else    {
+                        animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
+                                         ICO_SYC_WIN_SURF_NORESCTL;
+                        appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str());
+                        if (appinfo)    {
+                        animation.name = (char *)"slide.toright";
+                            for (idx = 0; ; idx++)  {
+                                wininfo = appinfo->GetWindowInfo(idx);
+                                if (! wininfo)  break;
+                                ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
+                                        wininfo->appid, idx, wininfo->surface);
+                                ico_syc_hide(wininfo->appid, wininfo->surface, &animation);
+                            }
+                        }
+                        else    {
+                            ICO_DBG("TouchUpFlick: current app(%s) dose not exist",
+                                    curapp.c_str());
+                        }
+                    }
+                    /* set history timer                            */
+                    app_history->selectApp(histapp.c_str());
                 }
-                /* set history timer                            */
-                app_history->selectApp(histapp.c_str());
             }
             flick = 1;
         }
@@ -338,30 +381,32 @@ CicoHSFlickTouch::TouchUpFlick(void *data, Evas *evas, Evas_Object *obj, void *e
         if (touch_state_b_y < ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE) {
             /* flick at top side to buttom = unknown    */
             ICO_DBG("TouchUpFlick: Flick top side to buttom");
+            flick = 1;
         }
         else    {
             ICO_DBG("TouchUpFlick: Flick top side to buttom, but nop");
+            flick = -1;
         }
     }
     else if (sub < (-1 * ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE)) {
-        if (touch_state_b_y > (full_width - ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE)) {
+        if (touch_state_b_y >
+            (full_width - ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE))    {
             /* flick at buttom side to top = show home menu screen  */
             ICO_DBG("TouchUpFlick: Flick buttom side to top");
+            flick = 1;
             if (ctl_bar_window) {
                 ctl_bar_window->TouchHome();
             }
         }
         else    {
             ICO_DBG("TouchUpFlick: Flick buttom side to top, but nop");
+            flick = -1;
         }
     }
 #endif
-    touch_state_b_x = 0;
-    touch_state_b_y = 0;
-
-#if 0           /* not yet support  */
     if (flick <= 0) {
         /* send touch press event   */
+        ICO_DBG("TouchUpFlick: Not Flick, send event to application");
         /* send ABS_X/Y     */
         ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 2,
                            ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
@@ -370,7 +415,7 @@ CicoHSFlickTouch::TouchUpFlick(void *data, Evas *evas, Evas_Object *obj, void *e
                            BTN_TOUCH, 1);
         /* send ABS_X/Y     */
         ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
-                           ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
+                           ABS_Z, ((touch_state_b_x+1) << 16) | (touch_state_b_y+1));
 
         /* send touch release event */
         gettimeofday(&ctime, NULL);
@@ -384,7 +429,89 @@ CicoHSFlickTouch::TouchUpFlick(void *data, Evas *evas, Evas_Object *obj, void *e
                            BTN_TOUCH, 0);
         /* send ABS_X/Y     */
         ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
+                           ABS_Z, ((touch_state_a_x+1) << 16) | (touch_state_a_y+1));
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickTouch::TouchMoveFlick
+ *          touch move action at flick input window
+ *
+ * @param[in]   data    CicoHSFlickInputWindow object
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickTouch::TouchMoveFlick(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    Evas_Event_Mouse_Move   *info;
+    CicoHSFlickInputWindow  *window;
+    struct timeval ctime;
+
+    info = reinterpret_cast<Evas_Event_Mouse_Move*>(event_info);
+
+    ICO_DBG("TouchMoveFlick: button=%x cur.x/y=%d/%d prv.x/y=%d/%d",
+            info->buttons, info->cur.output.x, info->cur.output.y,
+            info->prev.output.x, info->prev.output.y);
+
+    window = (CicoHSFlickInputWindow *)data;
+    if ((info->cur.output.x < 0) || (info->cur.output.y < 0) ||
+        (info->cur.output.x >= 4096) || (info->cur.output.y >= 4096))   {
+        ICO_DBG("TouchMoveFlick: Illegal position(x/y=%d/%d), Skip",
+                info->cur.output.x, info->cur.output.y);
+        return;
+    }
+    if (set_xy_pos == false)    {
+        set_xy_pos = true;
+        touch_state_b_x = info->cur.output.x + window->GetPosX();
+        touch_state_b_y = info->cur.output.y + window->GetPosY();
+    }
+    touch_state_a_x = info->cur.output.x + window->GetPosX();
+    touch_state_a_y = info->cur.output.y + window->GetPosY();
+
+    /* long push    */
+    if((touch_down == false) || (long_act == true)) {
+        ICO_DBG("TouchMoveFlick: not down(%d) or timedout(%d)",
+                (int)touch_down, (int)long_act);
+
+        if(timer != NULL){
+            ecore_timer_del(timer);
+            timer = NULL;
+        }
+
+        /* send ABS_X/Y     */
+        gettimeofday(&ctime, NULL);
+        touch_lasttime = (ctime.tv_sec * 1000 + ctime.tv_usec/1000);
+
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
+                           ABS_Z, (touch_state_a_x << 16) | touch_state_a_y);
+        return;
+    }
+
+    if (abs(touch_state_b_y - touch_state_a_y)
+        > ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_MOVE_Y)  {
+        /* slide to top or buttom over threashold, flick cancel */
+        ICO_DBG("TouchMoveFlick: over Y direction");
+        if(timer != NULL){
+            ecore_timer_del(timer);
+            timer = NULL;
+        }
+        long_act = true;
+
+        /* send ABS_X/Y     */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 2,
+                           ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
+        /* send TOUCH Down  */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 1,
+                               BTN_TOUCH, 1);
+        /* send ABS_X/Y     */
+        gettimeofday(&ctime, NULL);
+        touch_lasttime = (ctime.tv_sec * 1000 + ctime.tv_usec/1000);
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
                            ABS_Z, (touch_state_a_x << 16) | touch_state_a_y);
     }
-#endif
 }
index ae425e4..8835646 100644 (file)
 #include "CicoHSControlBarWindow.h"
 #include "CicoHSAppHistoryExt.h"
 
-#define ICO_HS_FLICK_TOUCH_FLICK_WIDTH 60
-#define ICO_HS_FLICK_TOUCH_FLICK_HEIGHT 60
+#define ICO_HS_FLICK_TOUCH_FLICK_WIDTH 80
+#define ICO_HS_FLICK_TOUCH_FLICK_HEIGHT 80
 #define ICO_HS_FLICK_TOUCH_DISTANCE_XY 200
 #define ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE 100
+#define ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_MOVE_Y 80
 #define ICO_HS_FLICK_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS 2.5d
 #define ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME 300
 
@@ -40,6 +41,7 @@ class CicoHSFlickTouch
     static void Finalize(void);
     static void TouchDownFlick(void *data, Evas *evas, Evas_Object *obj, void *event_info); 
     static void TouchUpFlick(void *data, Evas *evas, Evas_Object *obj, void *event_info);
+    static void TouchMoveFlick(void *data, Evas *evas, Evas_Object *obj, void *event_info);
     static Eina_Bool LongPushed(void *data);
 
   private:
@@ -54,7 +56,9 @@ class CicoHSFlickTouch
     static int touch_lasttime;
 
     static Ecore_Timer *timer;
+    static bool touch_down;
     static bool long_act;
+    static bool set_xy_pos;
     static int num_windows;
     static CicoHSFlickInputWindow* flick_windows[ICO_HS_MAX_FLICKWINDOWS];
     static CicoHSAppHistoryExt*    app_history;
index fbf1903..ed5c42f 100644 (file)
@@ -1125,11 +1125,9 @@ void
 CicoHSMenuWindow::DownNextMenu(void)
 {
     for (int i = 0; i < all_category_num; i++) {
-        if (category_info[i].tile_num > 0) {
-            if (current_page == category_info[i].page) {
-                if (subcurrent_page >= category_info[i].subpage_max){
-                    return;
-                }
+        if (current_page == category_info[i].page) {
+            if (subcurrent_page >= category_info[i].subpage_max){
+                return;
             }
         }
     }
@@ -1196,11 +1194,9 @@ CicoHSMenuWindow::DspCtrlPageCursor(void)
 {
     int subpage_max = 0;
     for (int i = 0; i < all_category_num ; i++) {
-        if (category_info[i].tile_num > 0) {
-            if (current_page == category_info[i].page) {
-                subpage_max = category_info[i].subpage_max;
-                break;
-            }
+        if (current_page == category_info[i].page) {
+            subpage_max = category_info[i].subpage_max;
+            break;
         }
     }
     
index 94018b7..91ab376 100644 (file)
@@ -296,23 +296,34 @@ CicoHomeScreen::ChangeZone(void)
             return;
         }
     }
+    hs_instance->requestChangeZone(appinfo);
+    ICO_TRA("CicoHomeScreen::ChangeZone Leave");
+}
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   change application display zone for appinfo
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::requestChangeZone(CicoHSAppInfo* appinfo)
+{
     int surface = appinfo->GetLastSurface();
-    ICO_TRA("appid=%s, lastsurface=%d",
-            appinfo->GetAppId(), appinfo->GetLastSurface());
+    ICO_TRA("Enter appid=%s, lastsurface=%d", appinfo->GetAppId(), surface);
     ico_hs_window_info* wininfo = appinfo->GetWindowInfobySurface(surface);
     if (NULL == wininfo) {
-        ICO_TRA("CicoHomeScreen::ChangeZone Leave(not found wininfo)");
+        ICO_TRA("Leave(not found wininfo)");
         return;
     }
     ICO_DBG("wininfo=%p", wininfo);
 
-    const char *dispzone = hs_instance->moveZoneName;
-    if (NULL != hs_instance->GetSubDisplayAppInfo()) {
+    const char *dispzone = moveZoneName;
+    if (NULL != GetSubDisplayAppInfo()) {
         dispzone = appinfo->GetDefaultZone();
     }
 
     if (NULL == dispzone) {
+        ICO_TRA("Leave(not found dispzone)");
         return;
     }
 
@@ -324,18 +335,42 @@ CicoHomeScreen::ChangeZone(void)
         .width  = 0,
         .height = 0
     };
+
+    int layer = HS_LAYER_APPLICATION;
+    if (NULL == hs_instance->GetSubDisplayAppInfo()) {
+        layer = HS_LAYER_2NDDISP_APP;
+    }
+    
+    ico_syc_change_layer(wininfo->appid, wininfo->surface, layer);
     ico_syc_move(wininfo->appid, wininfo->surface, &move,
                  &hs_instance->moveZoneAnimation);
 
-    if (NULL != hs_instance->GetSubDisplayAppInfo()) {
-        hs_instance->SetSubDisplayAppInfo(NULL);
-        hs_instance->ChangeActive(wininfo->appid, wininfo->surface);
+    if (NULL != GetSubDisplayAppInfo()) {
+        if (m_appHis) {
+            const string& wapp = m_appHis->getSelectApp();
+            ICO_DBG("\"%s\"->\"%s\"", wapp.c_str(), wininfo->appid);
+            if ((false == wapp.empty()) &&
+                (0 != wapp.compare(wininfo->appid))) {
+                cancelWaitActivation(wapp);
+            }
+        }
+        ICO_TRA("reset sub display");
+        SetSubDisplayAppInfo(NULL);
+        ChangeActive(wininfo->appid, wininfo->surface);
     }
     else {
-        hs_instance->SetSubDisplayAppInfo(wininfo->appid);
+        ICO_TRA("set sub display");
+        SetSubDisplayAppInfo(wininfo->appid);
+    }
+
+    if (m_appHis) {
+        if (true == m_appHis->chgChk()) {
+            m_appHis->writeAppHistory();
+        }
+        m_appHis->homeSwipe();
     }
  
-    ICO_TRA("CicoHomeScreen::ChangeZone Leave");
+    ICO_TRA("Leave");
 }
 
 /*--------------------------------------------------------------------------*/
@@ -494,7 +529,6 @@ CicoHomeScreen::SetSubDisplayAppInfo(const char *appid)
 /**
  *  @brief  update current sub display application information
  *
- *  @param [in] appid    application id
  */
 /*--------------------------------------------------------------------------*/
 CicoHSAppInfo *
@@ -505,6 +539,27 @@ CicoHomeScreen::GetSubDisplayAppInfo(void)
 
 /*--------------------------------------------------------------------------*/
 /**
+ *  @brief  update current sub display application appid
+ *
+ *  @return appid    application id
+ *  @retval NULL : sub display application nothing
+ *  @retval not NULL : appid
+ */
+/*--------------------------------------------------------------------------*/
+const char* 
+CicoHomeScreen::GetSubDisplayAppid(void)
+{
+    if (NULL == sub_display_appinfo) {
+        return NULL;
+    }
+    const char* pR = sub_display_appinfo->GetAppId();
+    if ((NULL == pR) || (0 == pR) || (0 == strlen(pR))) {
+        return NULL;
+    }
+    return pR;
+}
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHomeScreen::ExecuteApp_i
  *          execute and showing application
  *
@@ -515,26 +570,37 @@ CicoHomeScreen::GetSubDisplayAppInfo(void)
 void
 CicoHomeScreen::ExecuteApp_i(const char *appid)
 {
+    ICO_TRA("start %s", appid);
     CicoHSAppInfo *appinfo = GetAppInfo(appid);
     if (appinfo == NULL)    {
+        ICO_TRA("end get appinfo is NULL");
         return;
     }
-
-    if (appinfo->GetStatus() == false)  {
-        //execute
-        appinfo->Execute();
-        ICO_DBG("CicoHomeScreen::ExecuteApp_i: execute app %s",appid);
-    }
-    else    {
-        //raise
-        RaiseApplicationWindow(appinfo->GetAppId(),appinfo->GetLastSurface());
-        ICO_DBG("CicoHomeScreen::ExecuteApp_i: raise app %s",appid);
-        m_appHis->moveHistoryHead(appid);
+    if (sub_display_appinfo != appinfo) {
+        if (appinfo->GetStatus() == false)  {
+            //execute
+            appinfo->Execute();
+            ICO_DBG("execute app %s", appid);
+        }
+        else {
+            //raise
+            if (m_appHis) {
+                const string& wapp = m_appHis->getSelectApp();
+                if (false == wapp.empty()) {
+                    cancelWaitActivation(wapp);
+                }
+            }
+            RaiseApplicationWindow(appinfo->GetAppId(),
+                                   appinfo->GetLastSurface());
+            ICO_DBG("raise app %s", appid);
+            m_appHis->moveHistoryHead(appid);
+        }
     }
     /* hide HomeScreen layer                        */
     if (GetMode() == ICO_HS_MODE_MENU)  {
         ChangeMode(ICO_HS_SHOW_HIDE_PATTERN_FADE);
     }
+    ICO_TRA("end");
 }
 
 /*--------------------------------------------------------------------------*/
@@ -705,18 +771,32 @@ CicoHomeScreen::ShowApplicationWindow(ico_syc_win_info_t *win_info)
 #if 0
     ico_syc_show(win_info->appid, win_info->surface, &animation);
 #else
-    const string& lastStartupApp = m_appHis->lastStartupApp();
+    const string& lastStartupApp = m_appHis->getLastStartupAppid();
     if (true == lastStartupApp.empty()) {
         ICO_DBG("show (empty) %s", win_info->appid);
         ico_syc_show(win_info->appid, win_info->surface, &animation);
     }
-    else if (0 == lastStartupApp.compare(win_info->appid)) {
-        ICO_DBG("show (last) %s", win_info->appid);
-        ico_syc_show(win_info->appid, win_info->surface, &animation);
-    }
     else {
-        ICO_DBG("hide (no last) %s", win_info->appid);
-        ico_syc_hide(win_info->appid, win_info->surface, &animation);
+        bool bShow = false;
+#if 0
+        const string& subDispApp = m_appHis->getSubDispAppid();
+#endif
+        if (0 == lastStartupApp.compare(win_info->appid)) {
+            bShow = true;
+        }
+#if 0
+        if (0 == subDispApp.compare(win_info->appid)) {
+            bShow = true;
+        }
+#endif
+        if (true == bShow) {
+            ICO_DBG("show (last) %s", win_info->appid);
+            ico_syc_show(win_info->appid, win_info->surface, &animation);
+        }
+        else {
+            ICO_DBG("hide (no last) %s", win_info->appid);
+            ico_syc_hide(win_info->appid, win_info->surface, &animation);
+        }
     }
 #endif
     ICO_DBG("CicoHomeScreen::ShowApplicationWindow Leave");
@@ -1163,6 +1243,7 @@ CicoHomeScreen::Initialize(int orientation,CicoHomeScreenConfig *config)
 /*--------------------------------------------------------------------------*/
 void
 CicoHomeScreen::InitializeAppHistory(const string& user, const string& path,
+                                     const string& pathD,
                                      const string& flagpath)
 {
     ICO_DBG("start %s, %s, %s", user.c_str(), path.c_str(), flagpath.c_str());
@@ -1170,8 +1251,9 @@ CicoHomeScreen::InitializeAppHistory(const string& user, const string& path,
         ICO_DBG("end");
         return;
     }
-    m_appHis = new CicoHSAppHistoryExt(user, path, flagpath);
+    m_appHis = new CicoHSAppHistoryExt(user, path, pathD, flagpath);
     m_appHis->force_flagoff();
+    m_appHis->setHomeScreen(this);
 
     const char* val;
     val = config->ConfigGetString(ICO_HS_CONFIG_HISTORY,
@@ -1562,6 +1644,10 @@ CicoHomeScreen::ChangeMode(int pattern)
             hs_instance->flick_input_windows[idx]->Show();
         }
         hs_instance->SetMode(ICO_HS_MODE_APPLICATION);
+        CicoHSAppInfo *appinfo = hs_instance->GetActiveAppInfo();
+        if (NULL != appinfo) {
+            ico_syc_change_active(appinfo->GetAppId(), appinfo->GetLastSurface());
+        }
     }
     else if (hs_instance->GetMode() ==ICO_HS_MODE_APPLICATION)  {
         ico_syc_animation_t animation;
@@ -1776,33 +1862,42 @@ CicoHomeScreen::RenewAppInfoList(void)
  * @return     none
  */
 /*--------------------------------------------------------------------------*/
-void CicoHomeScreen::startupCheckAdd(int pid, const std::string& appid)
+void CicoHomeScreen::startupCheckAdd(int pid, const std::string& appid,
+                                     bool bSubDisp)
 {
     if (NULL != m_appHis) {
-        m_appHis->startupCheckAdd(pid, appid);
+        m_appHis->startupCheckAdd(pid, appid, bSubDisp);
     }
 }
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::startupCheck
+ *          start-up application check
+ *
+ * @param[in]  appid check target
+ */
+/*--------------------------------------------------------------------------*/
 void CicoHomeScreen::startupCheck(const char* appid)
 {
-    ICO_DBG("start");
+    ICO_TRA("start");
     if (NULL == life_cycle_controller) {
-        ICO_DBG("end");
+        ICO_TRA("end");
         return;
     }
     if (NULL == m_appHis) {
-        ICO_DBG("end");
+        ICO_TRA("end");
         return;
     }
     if (false == m_appHis->isStartupChecking()) {
-        ICO_DBG("end");
+        ICO_TRA("end");
         return;
     }
     m_appHis->update_appid();
     vector<int> pids;
     life_cycle_controller->getPIDs(appid, pids);
     if (0 == pids.size()) {
-        ICO_DBG("end");
+        ICO_TRA("end");
         return;
     }
     vector<int>::iterator it = pids.begin();
@@ -1811,18 +1906,41 @@ void CicoHomeScreen::startupCheck(const char* appid)
         ++it;
     }
     if (false == m_appHis->isFinish()) {
-        ICO_DBG("end");
+        ICO_TRA("end");
         return;
     }
+    finishStartup();
+    ICO_TRA("end");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::finishStartup
+ *          start-up application check
+ *
+ * @param[in]  appid check target
+ */
+/*--------------------------------------------------------------------------*/
+
+void CicoHomeScreen::finishStartup(void)
+{
+    ICO_TRA("start");
+
+    string last = m_appHis->getLastStartupAppid();
+    const string& subDisp = m_appHis->getSubDispAppid();
+
     list<string> h = m_appHis->getAppHistory();
-    string last = m_appHis->lastStartupApp();
-    list<string>::iterator it_h = h.begin();
+    // last appid is empty then get new last appid
     if (true == last.empty()) {
-        list<string>::iterator it_hb = h.end();
-        --it_hb;
-        last = *it_hb;
+        list<string>::iterator it_h = h.begin();
+        while (it_h != h.end()) {
+            if (0 != subDisp.compare(*it_h)) {
+                last = *it_h;
+            }
+            ++it_h;
+        }
     }
-   
+    
     list<string>::reverse_iterator rit_h = h.rbegin();
     while(rit_h != h.rend()) {
         CicoHSAppInfo *ai = GetAppInfo((*rit_h).c_str());
@@ -1834,8 +1952,7 @@ void CicoHomeScreen::startupCheck(const char* appid)
         {
             const char* appid = ai->GetAppId();
             int surface = ai->GetLastSurface();
-        
-            if (0 != last.compare(appid)) {
+            if ((0 != last.compare(appid)) && (0 != subDisp.compare(appid))) {
                 ico_syc_show(appid, surface, NULL);
                 ico_syc_hide(appid, surface, NULL);
             }
@@ -1843,7 +1960,12 @@ void CicoHomeScreen::startupCheck(const char* appid)
         ++rit_h;
     }
 
-    CicoHSAppInfo *ai = GetAppInfo(last.c_str());
+    CicoHSAppInfo *ai = GetAppInfo(subDisp.c_str());
+    if (ai != NULL) {
+        requestChangeZone(ai);
+    }
+
+    ai = GetAppInfo(last.c_str());
     if (ai != NULL) {
         const char* appid = ai->GetAppId();
         int surface = ai->GetLastSurface();
@@ -1853,7 +1975,73 @@ void CicoHomeScreen::startupCheck(const char* appid)
     }
         
     m_appHis->stopStartupCheck();
-    ICO_DBG("end");
+    ICO_TRA("end");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::readStartupApp
+ *          read start-up application data
+ *
+ * @param[in]  appid check target
+ */
+/*--------------------------------------------------------------------------*/
+void CicoHomeScreen::readStartupApp(std::vector<pairAppidSubd>& apps)
+{
+    ICO_DBG("start");
+    if (NULL == m_appHis) {
+        apps.clear();
+    }
+    else {
+        m_appHis->readAppHistory(apps);
+    }
+    ICO_DBG("end (%d)", (int)apps.size());
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::cancelWaitActivation
+ *          cancel wait Activation time out(Swipe move operate)
+ *
+ * @param  app appid
+ * @param  bOldShow  true is home appid show / false is no show
+ */
+/*--------------------------------------------------------------------------*/
+void CicoHomeScreen::cancelWaitActivation(const std::string& app)
+{
+    const char* appid = app.c_str();
+    ICO_TRA("start %s", appid);
+    CicoHSAppInfo *ai = GetAppInfo(appid);
+    if (NULL == ai) {
+        ICO_DBG("end %d", appid);
+        return;
+    }
+    int surface = ai->GetLastSurface();
+    ico_syc_hide(appid, surface, NULL);
+    ICO_TRA("end");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::requestWaitActivation
+ *          request wait Activation time out(Swipe move operate)
+ *
+ * @param  app appid
+ */
+/*--------------------------------------------------------------------------*/
+void CicoHomeScreen::requestWaitActivation(const std::string& app)
+{
+    const char* appid = app.c_str();
+    ICO_TRA("start %s", appid);
+    CicoHSAppInfo *ai = GetAppInfo(appid);
+    if (NULL == ai) {
+        ICO_DBG("end %d", appid);
+        return;
+    }
+    int surface = ai->GetLastSurface();
+    ico_syc_change_active(appid, surface);
+    ICO_TRA("end");
 }
 
 // vim: set expandtab ts=4 sw=4:
index 7597198..9dc1fe1 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "CicoSCSystemConfig.h"
 #include "CicoSCLifeCycleController.h"
+#include "CicoHSAppHistory.h"
 #include "CicoHSAppHistoryExt.h"
 
 /* display position and size */
@@ -77,6 +78,7 @@ class CicoHomeScreen
     ~CicoHomeScreen(void);
     int Initialize(int orientation,CicoHomeScreenConfig *config);
     void InitializeAppHistory(const std::string& user, const std::string& path,
+                              const std::string& pathD,
                               const std::string& flagpath);
     void Finalize(void);
     int StartRelations();
@@ -105,6 +107,7 @@ class CicoHomeScreen
     static bool GetAppStatus(const char *appid);
     void ChangeActive(const char *appid, int surface);
     static void ChangeZone(void);
+    void requestChangeZone(CicoHSAppInfo* appinfo);
     static CicoHSAppInfo *GetAppInfo(const char *appid);
     void SetMode(int mode);
     int GetMode(void);
@@ -120,10 +123,15 @@ class CicoHomeScreen
     // update current sub displaye applicatin information
     void SetSubDisplayAppInfo(const char *appid);
     CicoHSAppInfo* GetSubDisplayAppInfo(void);
+    const char* GetSubDisplayAppid(void);
     // order of the start-up window
-    void startupCheckAdd(int pid, const std::string& appid);
+    void startupCheckAdd(int pid, const std::string& appid,
+                         bool bSubDisp = false);
     void startupCheck(const char* appid);
-
+    void finishStartup(void);
+    void readStartupApp(std::vector<pairAppidSubd>& apps);
+    void cancelWaitActivation(const std::string& app);
+    void requestWaitActivation(const std::string& app);
   private:
     int GetProcessWindow(const char *appid);
     static void EventCallBack(ico_syc_ev_e event,const void* detail,void* user_data);
index 780b186..b810734 100644 (file)
 #define HS_LAYER_CURSOR         ICO_WINDOW_MGR_V_LAYER_CURSOR
                                             /* layer of Cursor   */
 
+#define HS_LAYER_2NDDISP_APP    3         // second display application layer
+
 /* config history name */
 #define ICO_HS_CONFIG_HSTRY_KEY1      "timer"
 #define ICO_HS_CONFIG_HSTRY_DEF1      "1"
index ff630a5..b9ec27c 100644 (file)
@@ -26,6 +26,7 @@
 #include "CicoSCConf.h"
 #include "CicoSCSystemConfig.h"
 #include "Cico_aul_listen_app.h"
+#include "CicoHomeScreen.h"
 
 using namespace std;
 
@@ -139,7 +140,8 @@ main(int argc, char *argv[])
 
     ICO_DBG("main: create homescreen ");
     /* application history class init. before call launchApps */
-    home_screen->InitializeAppHistory(g_login_user_name, x.filePath, flagPath);
+    home_screen->InitializeAppHistory(g_login_user_name, x.filePath,
+                                      x.filePathD, flagPath);
     /* application history launch */
     x.hs = home_screen;
     ecore_timer_add(0.01, launchApps, &x);
@@ -176,35 +178,26 @@ main(int argc, char *argv[])
 /*--------------------------------------------------------------------------*/
 static Eina_Bool launchApps(void* data)
 {
+    ICO_DBG("start");
     launcApps_data_t* x = (launcApps_data_t*) data;
-    ICO_DBG("launcApps start");
-    string fpath(x->filePath);
-    struct stat stat_buf;
-    if (0 != stat(fpath.c_str(), &stat_buf)) {
-        ICO_DBG("launcApps end false(%d, %s)", errno, fpath.c_str());
-        fpath = x->filePathD;
-        if (0 != stat(fpath.c_str(), &stat_buf)) {
-            ICO_DBG("launcApps end false(%d, %s)", errno, fpath.c_str());
-            return ECORE_CALLBACK_CANCEL;
-        }
-    }
-    vector<string> apps;
-    string tagApp;
-    ifstream ifs(fpath.c_str());
-    while(ifs >> tagApp) {
-        if (true == tagApp.empty()) {
-            continue;
-        }
-        apps.push_back(tagApp);
+    if ((NULL == x) || (NULL == x->hs)) {
+        ICO_DBG("end");
+        return ECORE_CALLBACK_CANCEL;
     }
+
+    vector<pairAppidSubd> apps;
+    x->hs->readStartupApp(apps);
+
     int sz = apps.size();
     for (int i =sz; i > 0; i--) {
-        int pid = aul_launch_app(apps[i-1].c_str(), NULL);
-        ICO_DBG("aul_launch_app %d:appid(%s), pid(%d)", i, apps[i-1].c_str(), pid);
+        string appid = apps[i-1].first;
+        bool bFLAG = apps[i-1].second;
+        int pid = aul_launch_app(appid.c_str(), NULL);
+        ICO_DBG("aul_launch_app[%d]%d:%s:%d", i, pid, appid.c_str(), (int)bFLAG);
         if ((0 < pid) && (NULL != x->hs)) {
-            x->hs->startupCheckAdd(pid, apps[i-1]);
+            x->hs->startupCheckAdd(pid, appid, bFLAG);
         }
     }
-    ICO_DBG("launcApps end read is %s", fpath.c_str());
+    ICO_DBG("end");
     return ECORE_CALLBACK_CANCEL;
 }
index 65c6266..e19d6a3 100644 (file)
@@ -81,6 +81,7 @@ CicoSysConDaemon::onCreate(void *user_data)
         server->setInputCtrl(inputctrl);
         server->setUserMgr(usermgr);
         server->setResourceMgr(resourcemgr);
+        server->setPolicyMgr(resourcemgr->getPolicyManager());
 
         server->startup(18081, (const char*)"ico_syc_protocol");
         ret = CicoSCWayland::getInstance()->intialize();
@@ -90,8 +91,6 @@ CicoSysConDaemon::onCreate(void *user_data)
         CicoSCWayland::getInstance()->addEcoreMainWlFdHandler();
         
         usermgr->initialize();
-
-
     }
     catch (const std::exception& e) {
         std::cerr << e.what() << std::endl;
diff --git a/tool/Makefile.am b/tool/Makefile.am
new file mode 100644 (file)
index 0000000..44cc439
--- /dev/null
@@ -0,0 +1,25 @@
+export abs_builddir
+
+wayland_client_lib = -lwayland-client
+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 $(wayland_ivi_client_inc)
+AM_LDFLAGS = -module -avoid-version -rpath $(libdir) $(GLIB_LIBS)
+
+bin_PROGRAMS =         \
+       ico_clear_screen        \
+       ico_change_loginuser
+
+check_LTLIBRARIES = $(TESTS)
+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
+ico_change_loginuser_LDADD = $(SIMPLE_CLIENT_LIBS) $(appfw_client_lib) -lico-util
+
diff --git a/tool/ico_change_loginuser.c b/tool/ico_change_loginuser.c
new file mode 100644 (file)
index 0000000..f2de2c2
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * 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   Login Tool to change login user
+ *
+ * @date    Sep-30-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <ico_syc_common.h>
+#include <ico_syc_error.h>
+#include <ico_syc_userctl.h>
+#include <ico_log.h>
+
+/*============================================================================*/
+/* Function prototype for static(internal) functions                          */
+/*============================================================================*/
+static void _sysctl_callback(const ico_syc_ev_e event, const void *detail,
+                             void *user_data);
+
+/*============================================================================*/
+/* Tables and Variables                                                       */
+/*============================================================================*/
+/* original stdout file discriptor  */
+static FILE *org_stdout;
+/* new user name    */
+static char newuser[128];
+/* program name     */
+static char progname[128];
+
+/*============================================================================*/
+/* Function                                                                   */
+/*============================================================================*/
+/**
+ * @brief _sysctl_callback
+ */
+static void
+_sysctl_callback(const ico_syc_ev_e event, const void *detail, void *user_data)
+{
+    ico_syc_userlist_t  *userlist;
+    int     i;
+
+    switch (event) {
+    case ICO_SYC_EV_USERLIST:
+        userlist = (ico_syc_userlist_t *)detail;
+
+        fprintf(org_stdout, "%s: # of users = %d\n", progname, userlist->user_num);
+        ICO_INF("%s: # of users = %d", progname, userlist->user_num);
+        for (i = 0; i < userlist->user_num; i++) {
+            if (strcmp(userlist->user_login, userlist->userlist[i]))    {
+                fprintf(org_stdout, "%s:%2d. %s *\n", progname, i+1, userlist->userlist[i]);
+                ICO_INF("%s:%2d. %s *", progname, i+1, userlist->userlist[i]);
+            }
+            else    {
+                fprintf(org_stdout, "%s:%2d. %s\n", progname, i+1, userlist->userlist[i]);
+                ICO_INF("%s:%2d. %s", progname, i+1, userlist->userlist[i]);
+            }
+        }
+        (void)ico_syc_disconnect();
+        ico_log_close();
+        break;
+    case ICO_SYC_EV_AUTH_FAIL:
+        fprintf(org_stdout, "%s: fail to authenticate user<%s>\n", progname, newuser);
+        ICO_ERR("%s: fail to authenticate user<%s>", progname, newuser);
+        (void)ico_syc_disconnect();
+        ico_log_close();
+        break;
+    default:
+        ICO_WRN("other event (%d)", event);
+        break;
+    }
+}
+
+/**
+ * @brief main
+ */
+int
+main(int argc, char *argv[])
+{
+    int retry;
+    int ret;
+
+    strncpy(progname, argv[0], sizeof(progname));
+    progname[sizeof(progname)-1] = 0;
+
+    /* setting the log output       */
+    org_stdout = stdout;
+    ico_log_open("ico_change_loginuser");
+
+    memset(newuser, 0, sizeof(newuser));
+    if (argc > 1)   {
+        strncpy(newuser, argv[1], sizeof(newuser)-1);
+        ICO_INF("%s: change user to <%s>", progname, newuser);
+    }
+    else    {
+        ICO_INF("%s: user list", progname);
+    }
+
+    /* connect to SystemController  */
+    ret = ico_syc_connect(_sysctl_callback, NULL);
+    if (ret != ICO_SYC_ERR_NONE) {
+        ICO_WRN("%s: ico_syc_connect failed (ret: %d)", progname, ret);
+        ico_log_close();
+        fprintf(org_stdout, "%s: ico_syc_connect failed (ret: %d)\n", progname, ret);
+        exit(1);
+    }
+    /* connect wait 200 ms          */
+    for (retry = 0; retry < (200/20); retry++) {
+        /* service for conection of SystemController    */
+        ico_syc_service();
+        usleep(20*1000);
+    }
+    if (argc <= 1)  {
+        /* get userlist             */
+        (void)ico_syc_get_userlist();
+    }
+    else    {
+        /* change login user        */
+        (void)ico_syc_change_user(newuser, "\0");
+    }
+
+    /* wait 300 ms                  */
+    for (retry = 0; retry < (300/20); retry++)  {
+        /* service for send/receive */
+        ico_syc_service();
+        usleep(20*1000);
+    }
+
+    (void)ico_syc_disconnect();
+    ico_log_close();
+    return 0;
+}
diff --git a/tool/ico_clear_screen.c b/tool/ico_clear_screen.c
new file mode 100644 (file)
index 0000000..527519c
--- /dev/null
@@ -0,0 +1,431 @@
+/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include "ico_clear_screen.h"
+#include <ico-uxf-weston-plugin/ico_window_mgr-client-protocol.h>
+
+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_set_visible(_display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE,
+                                   ICO_WINDOW_MGR_VISIBLE_HIDE, ICO_WINDOW_MGR_V_NOCHANGE,
+                                   ICO_WINDOW_MGR_FLAGS_ANIMATION |
+                                     ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE);
+    }
+}
+
+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, ICO_WINDOW_MGR_V_MAINSURFACE,
+                                 ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE|
+                                   ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
+                                 display->animation, display->animatime);
+    ico_window_mgr_set_positionsize(display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE,
+                                    displayno, posx, posy,
+                                    ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_V_NOCHANGE,
+                                    ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE);
+    ico_window_mgr_set_window_layer(display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE,
+                                    display->init_layer);
+    ico_window_mgr_set_layer_visible(display->ico_window_mgr, display->init_layer, 1);
+    ico_window_mgr_set_visible(display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE,
+                               ICO_WINDOW_MGR_VISIBLE_SHOW, ICO_WINDOW_MGR_RAISE_RAISE,
+                               ICO_WINDOW_MGR_FLAGS_ANIMATION |
+                                 ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE);
+    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, &registry_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 (file)
index 0000000..52a8813
--- /dev/null
@@ -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 <sys/ioctl.h>
+#include <GLES2/gl2.h>
+#include <EGL/egl.h>
+#include <wayland-client.h>
+#include <wayland-client-protocol.h>
+#include <wayland-egl.h>
+#include <wayland-util.h>
+#include <poll.h>
+#include <assert.h>
+
+#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_*/