bug fix: HomeScreen sometimes fails in connection with SystemController at the time...
[profile/ivi/ico-uxf-homescreen.git] / lib / system-controller / CicoSCWlWinMgrIF.cpp
index d75b980..6b86ff1 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCWlWinMgrIF.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCWlInputMgrIF class
  */
 //==========================================================================
 
 #include <fcntl.h>
 #include <cstring>
 
+#include "ico_syc_type.h"
 #include "CicoSCWlWinMgrIF.h"
 #include "CicoLog.h"
+#include "CicoSystemConfig.h"
+#include "CicoConf.h"
+#include "CicoSCWindowController.h"
 
 //==========================================================================
 //  static variables
 //==========================================================================
+struct ico_window_mgr *CicoSCWlWinMgrIF::m_winmgr = NULL;
+struct ivi_application *CicoSCWlWinMgrIF::m_ivi_app = NULL;
+struct ivi_controller *CicoSCWlWinMgrIF::m_ivi_ctrl = NULL;
+struct wl_output *CicoSCWlWinMgrIF::m_wloutput = NULL;
 
-// ico_window_mgr listener
-struct ico_window_mgr_listener CicoSCWlWinMgrIF::ms_listener = {
-    .window_created   = CicoSCWlWinMgrIF::wlCreatedCB,
-    .window_name      = CicoSCWlWinMgrIF::wlNameCB,
-    .window_destroyed = CicoSCWlWinMgrIF::wlDestroyedCB,
-    .window_visible   = CicoSCWlWinMgrIF::wlVisibleCB,
-    .window_configure = CicoSCWlWinMgrIF::wlConfigureCB,
-    .window_active    = CicoSCWlWinMgrIF::wlActiveCB,
-    .layer_visible    = CicoSCWlWinMgrIF::wlLayerVisibleCB,
-    .app_surfaces     = CicoSCWlWinMgrIF::wlAppSurfacesCB,
-    .map_surface      = CicoSCWlWinMgrIF::wlMapSurfaceCB 
-};
+int CicoSCWlWinMgrIF::m_id_surface = 0;
 
-// wayland output listener
-struct wl_output_listener CicoSCWlWinMgrIF::ms_wlOutputListener = {
-    .geometry = CicoSCWlWinMgrIF::wlOutputGeometryCB,
-    .mode     = CicoSCWlWinMgrIF::wlOutputModeCB
-};
+struct creation_surface_wait    *CicoSCWlWinMgrIF::m_wait_surface_creation = NULL;
+struct creation_surface_wait    *CicoSCWlWinMgrIF::m_free_surface_creation = NULL;
 
 //--------------------------------------------------------------------------
 /**
@@ -53,9 +47,27 @@ struct wl_output_listener CicoSCWlWinMgrIF::ms_wlOutputListener = {
  */
 //--------------------------------------------------------------------------
 CicoSCWlWinMgrIF::CicoSCWlWinMgrIF()
-    : m_winmgr(NULL), m_wloutput(NULL), m_wlshm(NULL)
 {
-       strcpy(m_shmName, "/tmp/ico/thumbnail-shm-XXXXXX");
+    // ico_window_mgr listener
+    m_listener.window_active    = wlActiveCB;
+    m_listener.map_surface      = wlMapSurfaceCB;
+    m_listener.update_surface   = wlUpdateSurfaceCB;
+    m_listener.destroy_surface  = wlDestroySurfaceCB;
+
+    // genivi ivi_application listener
+    m_ivi_app_listener.error = wlIviAppErrorCB;
+    m_ivi_app_listener.wl_shell_info = wlIviAppNativeShellInfoCB;
+
+    // genivi ivi_controller listener
+    m_ivi_ctrl_listener.screen = wlIviCtrlScreenCB;
+    m_ivi_ctrl_listener.layer = wlIviCtrlLayerCB;
+    m_ivi_ctrl_listener.surface = wlIviCtrlSurfaceCB;
+    m_ivi_ctrl_listener.error = wlIviCtrlErrorCB;
+    m_ivi_ctrl_listener.native_handle = wlIviCtrlNativeHandleCB;
+
+    // wayland output listener
+    m_wlOutputListener.geometry = wlOutputGeometryCB;
+    m_wlOutputListener.mode     = wlOutputModeCB;
 }
 
 //--------------------------------------------------------------------------
@@ -71,11 +83,11 @@ CicoSCWlWinMgrIF::~CicoSCWlWinMgrIF()
 /**
  *  @brief  initialize ico_window_mgr interfaces
  *
- *  @param [IN] data        user data
- *  @param [IN] registry    wayland registry
- *  @param [IN] name        wayland display id
- *  @parma [IN] interface   wayland interface name
- *  @parma [IN] version     wayland interface version number
+ *  @param [in] data        user data
+ *  @param [in] registry    wayland registry
+ *  @param [in] name        wayland display id
+ *  @parma [in] interface   wayland interface name
+ *  @parma [in] version     wayland interface version number
  */
 //--------------------------------------------------------------------------
 void
@@ -85,286 +97,413 @@ CicoSCWlWinMgrIF::initInterface(void               *data,
                                 const char         *interface,
                                 uint32_t           version)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::initInterface : Enter(interface=%s)", interface);
+    ICO_TRA("CicoSCWlWinMgrIF::initInterface Enter(interface=%s)", interface);
 
     // check interface name
     if (0 == strcmp(interface, ICO_WL_WIN_MGR_IF)) {
         // get interface instance
+        ICO_DBG("called: wl_registry_bind");
         void *wlProxy = wl_registry_bind(registry,
                                          name,
                                          &ico_window_mgr_interface,
                                          1);
         if (NULL == wlProxy) {
-            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
+            ICO_WRN("interface(%s) wl_registry_bind failed.",
                     interface);
-            ICO_WRN("CicoSCWlWinMgrIF::initInterface : Leave(binding failed)");
+            ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
             return;
         }
 
 
         m_winmgr = (struct ico_window_mgr *)wlProxy;
-        ico_window_mgr_add_listener(m_winmgr, 
-                                    &ms_listener,
+        ico_window_mgr_add_listener(m_winmgr,
+                                    &m_listener,
                                     this);
-#if 0
-        ico_window_mgr_set_user_data(m_winmgr, NULL/*TODO*/);
-#endif
-
-        ICO_DBG("call ico_window_mgr_declare_manager");
-        ico_window_mgr_declare_manager(m_winmgr,
-                                       ICO_WINDOW_MGR_DECLARE_MANAGER_MANAGER);
-
     }
-    else if (0 == strcmp(interface, ICO_WL_OUTPUT_IF)) {
+    else if (0 == strcmp(interface, ICO_WL_IVI_APPLICATION_IF)) {
         // get interface instance
+        ICO_DBG("called: wl_registry_bind for ivi_application");
         void *wlProxy = wl_registry_bind(registry,
                                          name,
-                                         &wl_output_interface,
+                                         &ivi_application_interface,
                                          1);
         if (NULL == wlProxy) {
-            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
+            ICO_WRN("interface(%s) wl_registry_bind failed.",
                     interface);
-            ICO_WRN("CicoSCWlWinMgrIF::initInterface : Leave(binding failed)");
+            ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
             return;
         }
-
-        m_wloutput = (struct wl_output*)wlProxy;
-        wl_output_add_listener(m_wloutput, 
-                               &ms_wlOutputListener,
-                               this);
-#if 0
-        wl_output_set_user_data(m_wloutput, NULL/*TODO*/);
-#endif
+        m_ivi_app = (struct ivi_application *)wlProxy;
+        ivi_application_add_listener(m_ivi_app,
+                                     &m_ivi_app_listener,
+                                     this);
     }
-    else if (0 == strcmp(interface, ICO_WL_SHM_IF)) {
+    else if (0 == strcmp(interface, ICO_WL_IVI_CONTROLLER_IF)) {
         // get interface instance
+        ICO_DBG("called: wl_registry_bind for ivi_controller");
         void *wlProxy = wl_registry_bind(registry,
                                          name,
-                                         &wl_shm_interface,
+                                         &ivi_controller_interface,
                                          1);
-               m_wlshm = (struct wl_shm*)wlProxy;
         if (NULL == wlProxy) {
-            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
+            ICO_WRN("interface(%s) wl_registry_bind failed.",
                     interface);
-            ICO_WRN("CicoSCWlWinMgrIF::initInterface : Leave(binding failed)");
-            return;
-        }
-        // TODO mkdir
-        int fd = mkostemp(m_shmName, O_CLOEXEC);
-        if (fd < 0) {
-            ICO_ERR("CicoSCWlWinMgrIF::initInterface : Leave(mkostemp failed)");
-            return;
-        }
-        if (ftruncate(fd, ICO_WL_SHM_SIZE) < 0) {
-            ICO_ERR("CicoSCWlWinMgrIF::initInterface : Leave(ftruncate failed)");
-            close(fd);
+            ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
             return;
         }
-        m_wlshmpool = wl_shm_create_pool(m_wlshm, fd, ICO_WL_SHM_SIZE);
-        close(fd);
-        if (NULL == m_wlshmpool) {
-            ICO_ERR("CicoSCWlWinMgrIF::initInterface : Leave(wl_shm_create_pool failed)");
+        m_ivi_ctrl = (struct ivi_controller *)wlProxy;
+        ivi_controller_add_listener(m_ivi_ctrl,
+                                    &m_ivi_ctrl_listener,
+                                    this);
+    }
+    else if (0 == strcmp(interface, ICO_WL_OUTPUT_IF)) {
+        // get interface instance
+        ICO_DBG("called: wl_registry_bind");
+        void *wlProxy = wl_registry_bind(registry,
+                                         name,
+                                         &wl_output_interface,
+                                         1);
+        if (NULL == wlProxy) {
+            ICO_WRN("interface(%s) wl_registry_bind failed.",
+                    interface);
+            ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
             return;
         }
+
+        m_wloutput = (struct wl_output*)wlProxy;
+        wl_output_add_listener(m_wloutput,
+                               &m_wlOutputListener,
+                               this);
     }
     else {
-        ICO_WRN("initInterface : Leave(unmatch interface)");
+        ICO_WRN("unmatch interface");
+        ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(unmatch interface)");
         return;
     }
 
-    if((NULL != m_winmgr) && (NULL != m_wloutput) && (NULL != m_wlshm)) {
+    if((NULL != m_winmgr) && (NULL != m_wloutput)) {
         m_initialized = true;
     }
 
-    ICO_DBG("CicoSCWlWinMgrIF::initInterface : Leave");
+    ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   wrapper function of ilm_layerAddSurface
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] layer           layer id
+ *  @param [in] oldlayer        old layer id(if 0xffffffff, no old layer)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::setWindowLayer(uint32_t surfaceid, uint32_t layer, uint32_t oldlayer)
+{
+    // set window layer request to Multi Window Manager
+    ICO_DBG("CicoSCWlWinMgrIF::setWindowLayer: "
+            "surfaceid=0x%08X layer=%d->%d", surfaceid, oldlayer, layer);
+
+    if (oldlayer == layer)  {
+        ICO_DBG("CicoSCWlWinMgrIF::setWindowLayer: new layer same as old, NOP");
+        return;
+    }
+
+    // remove original layer
+    if (oldlayer <= 0x7fffffff) {
+        ICO_TRA("CicoSCWlWinMgrIF::setWindowLayer: remove surface %08x "
+                "from layer(%d)", surfaceid, oldlayer);
+        if (ilm_layerRemoveSurface(oldlayer, surfaceid) != ILM_SUCCESS) {
+            ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_layerRemoveSurface(%d,%08x) "
+                    "Error", oldlayer, surfaceid);
+        }
+        // must need ilm_commitChanges() after ilm_layerRemoveSurface()
+        if (ilm_commitChanges() != ILM_SUCCESS) {
+            ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_commitChanges Error");
+        }
+    }
+    else    {
+        ICO_TRA("CicoSCWlWinMgrIF::setWindowLayer: surface %08x has no old layer(%d)",
+                surfaceid, oldlayer);
+    }
+
+    // add new layer
+    if (ilm_layerAddSurface(layer, surfaceid) != ILM_SUCCESS)   {
+        ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_layerAddSurface(%d,%08x) Error",
+                layer, surfaceid);
+    }
+    if (ilm_commitChanges() != ILM_SUCCESS) {
+        ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_commitChanges Error");
+    }
 }
 
 //--------------------------------------------------------------------------
-/** 
- *  @brief   wayland surface create callback
- *  
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
- *  @param [IN] winname         surface window name(title)
- *  @param [IN] pid             wayland client process Id
- *  @param [IN] appid           wayland client application Id
+/**
+ *  @brief   wrapper function of ilm_surfaceSetDestinationRectangle
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] layer           number of layer
+ *  @param [in] x
+ *  @param [in] y
+ *  @param [in] width
+ *  @param [in] height
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::createdCB(void                  *data,
-                            struct ico_window_mgr *ico_window_mgr,
-                            uint32_t              surfaceid,
-                            const char            *winname,
-                            int32_t               pid,
-                            const char            *appid)
+CicoSCWlWinMgrIF::setPositionsize(uint32_t surfaceid, uint32_t node,
+                                  int32_t x, int32_t y, int32_t width, int32_t height)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::createdCB called.");
+    // set position size request to Multi Window Manager
+    ICO_DBG("called: ilm_surfaceSetDestinationRectangle"
+            "(surfaceid=0x%08X node=%d x=%d y=%d w=%d h=%d)",
+            surfaceid, node, x, y, width, height);
+
+    if (ilm_surfaceSetDestinationRectangle(surfaceid, x, y, width, height)
+            != ILM_SUCCESS) {
+        ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_surfaceSetDestinationRectangle"
+                "(%08x,%d,%d,%d,%d) Error", surfaceid, x, y, width, height);
+    }
+    else if (ilm_surfaceSetSourceRectangle(surfaceid, 0, 0, width, height)
+            != ILM_SUCCESS) {
+        ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_surfaceSetSourceRectangle"
+                "(%08x,0,0,%d,%d) Error", surfaceid, width, height);
+    }
+    else if (ilm_commitChanges() != ILM_SUCCESS)    {
+        ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_commitChanges() Error");
+    }
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland change surface name callback
+ *  @brief   wrapper function of ilm_surfaceSetVisibility
  *
- * @param [IN] data            user data(unused)
- * @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- * @param [IN] surfaceid       ico_window_mgr surface Id
- * @param [IN] winname         surface window name(title)
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] visible         visible state
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::nameCB(void                  *data,
-                         struct ico_window_mgr *ico_window_mgr,
-                         uint32_t              surfaceid,
-                         const char            *winname)
+CicoSCWlWinMgrIF::setVisible(uint32_t surfaceid, int32_t visible)
 {
-    ICO_WRN("CicoSCWlWinMgrIF::nameCB called.");
+    // set visible request to Multi Window Manager
+    ICO_DBG("called: ilm_surfaceSetVisibility(surfaceid=0x%08X visible=%d)",
+            surfaceid, visible);
+    if ((visible == ICO_SYC_WIN_VISIBLE_SHOW) || (visible == ICO_SYC_WIN_VISIBLE_HIDE)) {
+        ilm_surfaceSetVisibility(surfaceid, visible);
+        if (ilm_commitChanges() != ILM_SUCCESS) {
+            ICO_ERR("CicoSCWlWinMgrIF::setVisible: ilm_commitChanges() Error");
+        }
+    }
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface destroy callback
+ *  @brief   wrapper function of ico_window_mgr_set_animation
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] type            transition type
+ *  @param [in] animation       name of animation
+ *  @param [in] time            time of animation
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::destroyedCB(void                  *data,
-                              struct ico_window_mgr *ico_window_mgr,
-                              uint32_t              surfaceid)
+CicoSCWlWinMgrIF::setAnimation(uint32_t surfaceid, int32_t type,
+                               const char *animation, int32_t time)
 {
-    ICO_WRN("CicoSCWlWinMgrIF::destroyedCB called.");
+    ICO_DBG("called: ico_window_mgr_set_animation"
+            "(surfaceid=0x%08X type=%d anima=%s time=%d)",
+            surfaceid, type, animation, time);
+    ico_window_mgr_set_animation(m_winmgr, surfaceid, type, animation, time);
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface visible callback(static fu *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
- *  @param [IN] visible         surface visible
- *                              (1=visible/0=unvisible/other=nochange)
- *  @param [IN] raise           surface raise
- *                              (1=raise/0=lower/other=nochange)
- *  @param [IN] hint            client request
- *                              (1=client request(not changed)/0=changed)
+ *  @brief   wrapper function of ilm_SetKeyboardFocusOn
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] active          flags or active device(unused)
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::visibleCB(void                  *data,
-                            struct ico_window_mgr *ico_window_mgr,
-                            uint32_t              surfaceid,
-                            int32_t               visible,
-                            int32_t               raise,
-                            int32_t               hint)
+CicoSCWlWinMgrIF::setActive(uint32_t surfaceid, int32_t active)
 {
-    ICO_WRN("CicoSCWlWinMgrIF::visibleCB called.");
+    ICO_DBG("called: ilm_SetKeyboardFocusOn"
+            "(surfaceid=0x%08X active=%d)", surfaceid, active);
+    if ((ilm_SetKeyboardFocusOn(surfaceid) != ILM_SUCCESS) ||
+        (ilm_commitChanges() != ILM_SUCCESS))   {
+        ICO_ERR("CicoSCWlWinMgrIF::setActive ilm_SetKeyboardFocusOn(%08x) Error", surfaceid);
+    }
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface configure callback
+ *  @brief   wrapper function of ilm_layerSetVisibility
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
- *  @param [IN] node            surface node Id
- *  @param [IN] x               surface upper-left X coodinate
- *  @param [IN] y               surface upper-left Y coodinate
- *  @param [IN] width           surface width
- *  @param [IN] height          surface height
- *  @param [IN] hint            client request
- *                              (1=client request(not changed)/0=changed)
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] layer           id of layer
+ *  @param [in] visible         visible state
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::configureCB(void                  *data,
-                              struct ico_window_mgr *ico_window_mgr,
-                              uint32_t              surfaceid,
-                              uint32_t              node,
-                              uint32_t              layer,
-                              int32_t               x,
-                              int32_t               y,
-                              int32_t               width,
-                              int32_t               height,
-                              int32_t               hint)
+CicoSCWlWinMgrIF::setLayerVisible(uint32_t layer, int32_t visible)
 {
-    ICO_WRN("CicoSCWlWinMgrIF::configureCB called.");
+    ICO_DBG("called: ilm_layerSetVisibility"
+            "(layer=%d visible=%d)", layer, visible);
+    if ((ilm_layerSetVisibility(layer, visible) != ILM_SUCCESS) ||
+        (ilm_commitChanges() != ILM_SUCCESS))   {
+        ICO_ERR("CicoSCWlWinMgrIF::setLayerVisible ilm_layerSetVisibility(%d,%d) Error",
+                layer, visible);
+    }
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface active callback(static func
+ *  @brief   wrapper function of ilm_takeSurfaceScreenshot
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
- *  @param [IN] active          surface active
- *                              (1=active/0=not active)
+ *  @param [in] surface     id of wayland surface
+ *  @param [in] filepath    surface image pixel file path
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::activeCB(void                  *data,
-                           struct ico_window_mgr *ico_window_mgr,
-                           uint32_t              surfaceid,
-                           int32_t               active)
+CicoSCWlWinMgrIF::setmapGet(int surfaceid, const char *filepath)
 {
-    ICO_WRN("CicoSCWlWinMgrIF::activeCB called.");
+    ICO_DBG("called: ilm_takeSurfaceScreenshot(filepath=%s,, surface=0x%08x)",
+            filepath ? filepath : "(null)", surfaceid);
+    if ((ilm_takeSurfaceScreenshot(filepath, surfaceid) != ILM_SUCCESS) ||
+        (ilm_commitChanges() != ILM_SUCCESS))   {
+        ICO_ERR("CicoSCWlWinMgrIF::setmapGet ilm_takeSurfaceScreenshot(%s,%x) Error",
+                filepath ? filepath : "(null)", surfaceid);
+    }
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland layer visible callback(stati
+ *  @brief   wrapper function of ico_window_mgr_map_surface
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] layer           layer Id
- *  @param [IN] visible         layer visible
- *                              (1=visible/0=unvisible/other=nochange)
+ *  @param [in] surface     id of wayland surface
+ *  @param [in] framerate   interval of changed notify[frame per second]
+ *  @param [in] filepath    surface image pixel file path
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::layerVisibleCB(void                  *data,
-                                 struct ico_window_mgr *ico_window_mgr,
-                                 uint32_t              layer,
-                                 int32_t               visible)
+CicoSCWlWinMgrIF::mapSurface(uint32_t surfaceid, int32_t framerate, const char *filepath)
 {
-    ICO_WRN("CicoSCWlWinMgrIF::layerVisibleCB called.");
+    ICO_DBG("called: ico_window_mgr_map_surface(surfaceid=0x%08X framerate=%d file=%s)",
+            surfaceid, framerate, filepath ? filepath : "(null)");
+    // currently GENIVI genivi-shell not support contents change, so use ico_window_mgr
+    if ((filepath != NULL) && (*filepath != 0) && (*filepath != ' '))   {
+        ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate, filepath);
+    }
+    else    {
+        ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate, " ");
+    }
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  query applicationsurface callback
+ *  @brief   wrapper function of ico_window_mgr_unmap_surface
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] appid           application Id
- *  @param [IN] suface          surface Id array
+ *  @param [in] surface     id of wayland surface
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::appSurfacesCB(void                  *data,
-                                struct ico_window_mgr *ico_window_mgr,
-                                const char            *appid,
-                                struct wl_array       *surfaces)
+CicoSCWlWinMgrIF::unmapSurface(uint32_t surfaceid)
+{
+    ICO_DBG("called: ico_window_mgr_unmap_surface"
+            "(surfaceid=0x%08X)", surfaceid);
+    // currently GENIVI genivi-shell not support contents change, so use ico_window_mgr
+    ico_window_mgr_unmap_surface(m_winmgr, surfaceid);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   get creation surface window name(title) and pid
+ *
+ *  @param [in]  id_surface surface id
+ *  @param [out] pid        application process id
+ */
+//--------------------------------------------------------------------------
+const char *
+CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(uint32_t id_surface, int *pid)
 {
-    ICO_WRN("CicoSCWlWinMgrIF::appSurfacesCB called.");
+    struct creation_surface_wait    *tp = m_wait_surface_creation;
+
+    while (tp)   {
+        if (tp->id_surface == id_surface)   {
+            ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(%x) pid=%d title=<%s>",
+                    id_surface, tp->pid, tp->title);
+            *pid = tp->pid;
+            return tp->title;
+        }
+        tp = tp->next;
+    }
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(%x) dose not exist", id_surface);
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   remove surface window
+ *
+ *  @param [in]  id_surface surface id
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(uint32_t id_surface)
+{
+    struct creation_surface_wait    *tp = m_wait_surface_creation;
+    struct creation_surface_wait    *bp = NULL;
+
+    while (tp)   {
+        if (tp->id_surface == id_surface)   {
+            if (bp) {
+                bp->next = tp->next;
+            }
+            else    {
+                m_wait_surface_creation = tp->next;
+            }
+            tp->next = m_free_surface_creation;
+            m_free_surface_creation = tp;
+
+            ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) removed", id_surface);
+            return;
+        }
+    }
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) dose not exist", id_surface);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland surface active callback
+ *
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] surfaceid       ico_window_mgr surface Id
+ *  @param [in] select          select device(unused)
+ *                              (0=not active/1=pointer/2=touch)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::activeCB(void                  *data,
+                           struct ico_window_mgr *ico_window_mgr,
+                           uint32_t              surfaceid,
+                           int32_t               select)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::activeCB called.");
 }
 
 //--------------------------------------------------------------------------
 /**
  *  @brief   surface map event callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] event           event
- *  @param [IN] surfaceid       surface Id
- *  @param [IN] width           surface width
- *  @param [IN] height          surface height
- *  @param [IN] stride          surface buffer(frame buffer) stride
- *  @param [IN] format          surface buffer format
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] event           event
+ *  @param [in] surfaceid       surface Id
+ *  @param [in] type            surface buffer type(EGL buffer/Shared memory)
+ *  @param [in] width           surface width
+ *  @param [in] height          surface height
+ *  @param [in] stride          surface buffer(frame buffer) stride
+ *  @param [in] format          surface buffer format
  */
 //--------------------------------------------------------------------------
 void
@@ -373,7 +512,6 @@ CicoSCWlWinMgrIF::mapSurfaceCB(void                  *data,
                                int32_t               event,
                                uint32_t              surfaceid,
                                uint32_t              type,
-                               uint32_t              target,
                                int32_t               width,
                                int32_t               height,
                                int32_t               stride,
@@ -384,18 +522,81 @@ CicoSCWlWinMgrIF::mapSurfaceCB(void                  *data,
 
 //--------------------------------------------------------------------------
 /**
+ *  @brief   surface update event callback
+ *
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] surfaceid       surface Id
+ *  @param [in] visible         visibility
+ *  @param [in] srcwidth        application buffer width
+ *  @param [in] srcheight       application buffer height
+ *  @param [in] x               X
+ *  @param [in] y               Y
+ *  @param [in] width           width
+ *  @param [in] height          height
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::updateSurfaceCB(void                  *data,
+                                  struct ico_window_mgr *ico_window_mgr,
+                                  uint32_t              surfaceid,
+                                  int                   visible,
+                                  int                   srcwidth,
+                                  int                   srcheight,
+                                  int                   x,
+                                  int                   y,
+                                  int                   width,
+                                  int                   height)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::updateSurfaceCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland surface destroy callback
+ *
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] surfaceid       surface Id
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::destroySurfaceCB(void                  *data,
+                                   struct ico_window_mgr *ico_window_mgr,
+                                   uint32_t              surfaceid)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::destroySurfaceCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland update surface name callback
+ *
+ *  @param [in] surfaceid       surface Id
+ *  @param [in] winname         surface name (title)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::updateWinnameCB(uint32_t surfaceid,
+                                  const char *winname)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::updateWinnameCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
  *  @brief   wayland display attribute callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] wl_output       wayland wl_output interface
- *  @param [IN] x               display upper-left X coodinate
- *  @param [IN] y               display upper-left Y coodinate
- *  @param [IN] physical_width  display physical width
- *  @param [IN] physical_height display physical height
- *  @param [IN] subpixel        display sub pixcel
- *  @param [IN] make            display maker
- *  @param [IN] model           diaplay model
- *  @param [IN] transform       transform
+ *  @param [in] data            user data(unused)
+ *  @param [in] wl_output       wayland wl_output interface
+ *  @param [in] x               display upper-left X coordinate
+ *  @param [in] y               display upper-left Y coordinate
+ *  @param [in] physical_width  display physical width
+ *  @param [in] physical_height display physical height
+ *  @param [in] subpixel        display sub pixel
+ *  @param [in] make            display maker
+ *  @param [in] model           display model
+ *  @param [in] transform       transform
  */
 //--------------------------------------------------------------------------
 void
@@ -417,12 +618,12 @@ CicoSCWlWinMgrIF::outputGeometryCB(void             *data,
 /**
  *  @brief  wayland display mode callback
  *
- *  @param [IN] data        user data(unused)
- *  @param [IN] wl_output   wayland wl_output interface
- *  @param [IN] flags       flags
- *  @param [IN] width       display width
- *  @param [IN] height      display height
- *  @param [IN] refresh     display refresh rate
+ *  @param [in] data        user data(unused)
+ *  @param [in] wl_output   wayland wl_output interface
+ *  @param [in] flags       flags
+ *  @param [in] width       display width
+ *  @param [in] height      display height
+ *  @param [in] refresh     display refresh rate
  */
 //--------------------------------------------------------------------------
 void
@@ -434,6 +635,23 @@ CicoSCWlWinMgrIF::outputModeCB(void             *data,
                                int32_t          refresh)
 {
     ICO_WRN("CicoSCWlWinMgrIF::outputModeCB called.");
+};
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   wayland genivi ivi-surface create callback
+ *
+ *  @param [in] data            user data(unused)
+ *  @param [in] ivi_controller  wayland ivi-controller plugin interface
+ *  @param [in] id_surface      surface id
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::createSurfaceCB(void                  *data,
+                                  struct ivi_controller *ivi_controller,
+                                  uint32_t id_surface)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::createSurfaceCB called.");
 }
 
 //==========================================================================
@@ -441,359 +659,540 @@ CicoSCWlWinMgrIF::outputModeCB(void             *data,
 //==========================================================================
 
 //--------------------------------------------------------------------------
-/** 
- *  @brief   wayland surface create callback
- *  
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
- *  @param [IN] winname         surface window name(title)
- *  @param [IN] pid             wayland client process Id
- *  @param [IN] appid           wayland client application Id
+/**
+ *  @brief  wayland surface active callback
+ *
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] surfaceid       ico_window_mgr surface Id
+ *  @param [in] select          select device(unused)
+ *                              (0=not active/1=pointer/2=touch)
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlCreatedCB(void                  *data,
-                              struct ico_window_mgr *ico_window_mgr,
-                              uint32_t              surfaceid,
-                              const char            *winname,
-                              int32_t               pid,
-                              const char            *appid)
+CicoSCWlWinMgrIF::wlActiveCB(void                  *data,
+                             struct ico_window_mgr *ico_window_mgr,
+                             uint32_t              surfaceid,
+                             int32_t               select)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlCreatedCB Enter");
+//    ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Enter");
+
     if (NULL == data) {
-        ICO_WRN("wlCreatedCB : data is null");
+        ICO_WRN("wlActiveCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->createdCB(data, ico_window_mgr,
-                                                    surfaceid, winname,
-                                                    pid, appid);
-    ICO_DBG("CicoSCWlWinMgrIF::wlCreatedCB Leave");
+    static_cast<CicoSCWlWinMgrIF*>(data)->activeCB(data, ico_window_mgr,
+                                                   surfaceid, select);
+//    ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland change surface name callback
+ *  @brief   surface map event callback
  *
- * @param [IN] data            user data(unused)
- * @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- * @param [IN] surfaceid       ico_window_mgr surface Id
- * @param [IN] winname         surface window name(title)
+ *  @param [in] data            user data
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] event           event
+ *  @param [in] surfaceid       surface Id
+ *  @param [IN] type            buffer type(fixed ICO_WINDOW_MGR_MAP_TYPE_EGL)
+ *  @param [in] width           surface width
+ *  @param [in] height          surface height
+ *  @param [in] stride          surface buffer(frame buffer) stride
+ *  @param [in] format          surface buffer format
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlNameCB(void                  *data,
-                           struct ico_window_mgr *ico_window_mgr,
-                           uint32_t              surfaceid,
-                           const char            *winname)
+CicoSCWlWinMgrIF::wlMapSurfaceCB(void                  *data,
+                                 struct ico_window_mgr *ico_window_mgr,
+                                 int32_t               event,
+                                 uint32_t              surfaceid,
+                                 uint32_t              type,
+                                 int32_t               width,
+                                 int32_t               height,
+                                 int32_t               stride,
+                                 uint32_t              format)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlNameCB Enter");
+//    ICO_TRA("CicoSCWlWinMgrIF::wlMapSurfaceCB Enter");
 
     if (NULL == data) {
-        ICO_WRN("wlNameCB: data is null");
+        ICO_WRN("wlMapSurfaceCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->nameCB(data, ico_window_mgr,
-                                                 surfaceid, winname);
-    ICO_DBG("CicoSCWlWinMgrIF::wlNameCB Leave");
+    static_cast<CicoSCWlWinMgrIF*>(data)->mapSurfaceCB(data, ico_window_mgr,
+                                                       event, surfaceid,
+                                                       type,
+                                                       width, height,
+                                                       stride, format);
+//    ICO_TRA("CicoSCWlWinMgrIF::wlMapSurfaceCB Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface destroy callback
+ *  @brief   surface update event callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
+ *  @param [in] data            user data
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] surfaceid       surface Id
+ *  @param [in] visible         visibility
+ *  @param [in] srcwidth        application buffer width
+ *  @param [in] srcheight       application buffer height
+ *  @param [in] x               X
+ *  @param [in] y               Y
+ *  @param [in] width           width
+ *  @param [in] height          height
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlDestroyedCB(void                  *data,
-                                struct ico_window_mgr *ico_window_mgr,
-                                uint32_t              surfaceid)
+CicoSCWlWinMgrIF::wlUpdateSurfaceCB(void                  *data,
+                                    struct ico_window_mgr *ico_window_mgr,
+                                    uint32_t              surfaceid,
+                                    int                   visible,
+                                    int                   srcwidth,
+                                    int                   srcheight,
+                                    int                   x,
+                                    int                   y,
+                                    int                   width,
+                                    int                   height)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlDestroyedCB Enter");
+//    ICO_TRA("CicoSCWlWinMgrIF::wlUpdateSurfaceCB Enter");
 
     if (NULL == data) {
-        ICO_WRN("wlDestroyedCB: data is null");
+        ICO_WRN("wlUpdateSurfaceCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->destroyedCB(data, ico_window_mgr,
-                                                      surfaceid);
-    ICO_DBG("CicoSCWlWinMgrIF::wlDestroyedCB Leave");
+    static_cast<CicoSCWlWinMgrIF*>(data)->updateSurfaceCB(data, ico_window_mgr,
+                                                          surfaceid, visible,
+                                                          srcwidth, srcheight,
+                                                          x, y, width, height);
+//    ICO_TRA("CicoSCWlWinMgrIF::wlUpdateSurfaceCB Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface visible callback
+ *  @brief   surface destroy event callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
- *  @param [IN] visible         surface visible
- *                              (1=visible/0=unvisible/other=nochange)
- *  @param [IN] raise           surface raise
- *                              (1=raise/0=lower/other=nochange)
- *  @param [IN] hint            client request
- *                              (1=client request(not changed)/0=changed)
+ *  @param [in] data            user data
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] surfaceid       surface Id
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlVisibleCB(void                  *data,
-                              struct ico_window_mgr *ico_window_mgr,
-                              uint32_t              surfaceid,
-                              int32_t               visible,
-                              int32_t               raise,
-                              int32_t               hint)
+CicoSCWlWinMgrIF::wlDestroySurfaceCB(void                  *data,
+                                     struct ico_window_mgr *ico_window_mgr,
+                                     uint32_t             surfaceid)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlVisibleCB Enter");
+//    ICO_TRA("CicoSCWlWinMgrIF::wlDestroySurfaceCB Enter");
 
     if (NULL == data) {
-        ICO_WRN("wlVisibleCB: data is null");
+        ICO_WRN("wlDestroySurfaceCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->visibleCB(data, ico_window_mgr,
-                                                    surfaceid, visible,
-                                                    raise, hint);
-    ICO_DBG("CicoSCWlWinMgrIF::wlVisibleCB Leave");
+    wlIviCtrlRemoveSurface(surfaceid);
+
+    static_cast<CicoSCWlWinMgrIF*>(data)->destroySurfaceCB(data, ico_window_mgr,
+                                                           surfaceid);
+//    ICO_TRA("CicoSCWlWinMgrIF::wlDestroySurfaceCB Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface configure callback
+ *  @brief   wayland display attribute callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
- *  @param [IN] node            surface node Id
- *  @param [IN] x               surface upper-left X coodinate
- *  @param [IN] y               surface upper-left Y coodinate
- *  @param [IN] width           surface width
- *  @param [IN] height          surface height
- *  @param [IN] hint            client request
- *                              (1=client request(not changed)/0=changed)
+ *  @param [in] data            user data(unused)
+ *  @param [in] wl_output       wayland wl_output interface
+ *  @param [in] x               display upper-left X coordinate
+ *  @param [in] y               display upper-left Y coordinate
+ *  @param [in] physical_width  display physical width
+ *  @param [in] physical_height display physical height
+ *  @param [in] subpixel        display sub pixel
+ *  @param [in] make            display maker
+ *  @param [in] model           display model
+ *  @param [in] transform       transform
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlConfigureCB(void                  *data,
-                                struct ico_window_mgr *ico_window_mgr,
-                                uint32_t              surfaceid,
-                                uint32_t              node,
-                                uint32_t              layer,
-                                int32_t               x,
-                                int32_t               y,
-                                int32_t               width,
-                                int32_t               height,
-                                int32_t               hint)
+CicoSCWlWinMgrIF::wlOutputGeometryCB(void             *data,
+                                     struct wl_output *wl_output,
+                                     int32_t          x,
+                                     int32_t          y,
+                                     int32_t          physical_width,
+                                     int32_t          physical_height,
+                                     int32_t          subpixel,
+                                     const char       *make,
+                                     const char       *model,
+                                     int32_t          transform)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlConfigureCB Enter");
+//    ICO_TRA("CicoSCWlWinMgrIF::wlOutputGeometryCB Enter");
 
     if (NULL == data) {
-        ICO_WRN("wlConfigureCB: data is null");
+        ICO_WRN("wlOutputGeometryCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->configureCB(data, ico_window_mgr,
-                                                      surfaceid, node, layer,
-                                                      x, y, width, height,
-                                                      hint);
-    ICO_DBG("CicoSCWlWinMgrIF::wlConfigureCB Leave");
+    static_cast<CicoSCWlWinMgrIF*>(data)->outputGeometryCB(data, wl_output,
+                                                           x, y,
+                                                           physical_width,
+                                                           physical_height,
+                                                           subpixel,
+                                                           make,
+                                                           model,
+                                                           transform);
+//    ICO_TRA("CicoSCWlWinMgrIF::wlOutputGeometryCB Leave");
 }
+
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface active callback(static func
+ *  @brief  wayland display mode callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] surfaceid       ico_window_mgr surface Id
- *  @param [IN] active          surface active
- *                              (1=active/0=not active)
+ *  @param [in] data        user data(unused)
+ *  @param [in] wl_output   wayland wl_output interface
+ *  @param [in] flags       flags
+ *  @param [in] width       display width
+ *  @param [in] height      display height
+ *  @param [in] refresh     display refresh rate
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlActiveCB(void                  *data,
-                             struct ico_window_mgr *ico_window_mgr,
-                             uint32_t              surfaceid,
-                             int32_t               active)
+CicoSCWlWinMgrIF::wlOutputModeCB(void             *data,
+                                 struct wl_output *wl_output,
+                                 uint32_t         flags,
+                                 int32_t          width,
+                                 int32_t          height,
+                                 int32_t          refresh)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlActiveCB Enter");
+//    ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Enter");
 
     if (NULL == data) {
-        ICO_WRN("wlActiveCB: data is null");
+        ICO_WRN("wlOutputGeometryCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->activeCB(data, ico_window_mgr,
-                                                   surfaceid, active);
-    ICO_DBG("CicoSCWlWinMgrIF::wlActiveCB Leave");
+    static_cast<CicoSCWlWinMgrIF*>(data)->outputModeCB(data, wl_output, flags,
+                                                       width, height, refresh);
+//    ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland layer visible callback(stati
+ *  @brief  wayland ivi-shell ivi-application protocol error callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] layer           layer Id
- *  @param [IN] visible         layer visible
- *                              (1=visible/0=unvisible/other=nochange)
+ *  @param [in] data            user data(unused)
+ *  @param [in] ivi_application wayland ivi-application interface
+ *  @param [in] error_code      error code
+ *  @param [in] error_text      error message
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlLayerVisibleCB(void                  *data,
-                                   struct ico_window_mgr *ico_window_mgr,
-                                   uint32_t              layer,
-                                   int32_t               visible)
+CicoSCWlWinMgrIF::wlIviAppErrorCB(void *data,
+                                 struct ivi_application *ivi_application,
+                                 int32_t error_code, const char *error_text)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlLayerVisibleCB Enter");
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviAppErrorCB: Enter(%d,%s)",
+            error_code, error_text ? error_text : "(null)");
 
     if (NULL == data) {
-        ICO_WRN("wlLayerVisibleCB: data is null");
+        ICO_WRN("CicoSCWlWinMgrIF::wlIviAppErrorCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->layerVisibleCB(data, ico_window_mgr,
-                                                         layer, visible);
-    ICO_DBG("CicoSCWlWinMgrIF::wlLayerVisibleCB Leave");
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviAppErrorCB: Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  query applicationsurface callback
+ *  @brief  wayland ivi-shell ivi-application protocol create wl_surface callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] appid           application Id
- *  @param [IN] suface          surface Id array
+ *  @param [in] data            user data(unused)
+ *  @param [in] ivi_application wayland ivi-application interface
+ *  @param [in] pid             application process id
+ *  @param [in] title           surface title name
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlAppSurfacesCB(void                  *data,
-                                  struct ico_window_mgr *ico_window_mgr,
-                                  const char            *appid,
-                                  struct wl_array       *surfaces)
+CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB(void *data,
+                                            struct ivi_application *ivi_application,
+                                            int32_t pid, const char *title)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlAppSurfacesCB Enter");
+    struct creation_surface_wait    *tp;
+    struct creation_surface_wait    *tp2;
+
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Enter(%d,<%s>)",
+            pid, title ? title : "(null)");
 
     if (NULL == data) {
-        ICO_WRN("wlAppSurfacesCB: data is null");
+        ICO_WRN("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave(data is null)");
+        return;
+    }
+    if (title == NULL)  {
+        ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave(no title)");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->appSurfacesCB(data, ico_window_mgr,
-                                                        appid, surfaces);
-    ICO_DBG("CicoSCWlWinMgrIF::wlAppSurfacesCB Leave");
+
+    // bind wl_surface to ivi_surface
+    tp = m_free_surface_creation;
+    if (tp)  {
+        m_free_surface_creation = tp->next;
+    }
+    else    {
+        tp = (struct creation_surface_wait *)malloc(sizeof(struct creation_surface_wait));
+        if (! tp)    {
+            ICO_ERR("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: out of memory");
+            return;
+        }
+        memset(tp, 0, sizeof(struct creation_surface_wait));
+    }
+    tp2 = m_wait_surface_creation;
+    tp->next = tp2;
+    m_wait_surface_creation = tp;
+    tp->pid = pid;
+    strncpy(tp->title, title, ICO_SYC_MAX_WINNAME_LEN-1);
+    tp->busy = SCWINMGR_GENIVI_BUSY_WAIT;
+    while (tp2)  {
+        if (tp2->busy != SCWINMGR_GENIVI_BUSY_NONE) break;
+        tp2 = tp2->next;
+    }
+    if (! tp2)   {
+        tp->busy = SCWINMGR_GENIVI_BUSY_REQSURF;
+        ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: "
+                "call ivi_controller_get_native_handle(%d,<%s>)", pid, title);
+        ivi_controller_get_native_handle(m_ivi_ctrl, pid, title);
+    }
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief   surface map event callback
+ *  @brief  wayland ivi-shell ivi-controller protocol create screen callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] event           event
- *  @param [IN] surfaceid       surface Id
- *  @param [IN] width           surface width
- *  @param [IN] height          surface height
- *  @param [IN] stride          surface buffer(frame buffer) stride
- *  @param [IN] format          surface buffer format
+ *  @param [in] data            user data(unused)
+ *  @param [in] ivi_controller  wayland ivi-controller interface
+ *  @param [in] id_screen       screen id
+ *  @param [in] screen          screen information
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlMapSurfaceCB(void                  *data,
-                                 struct ico_window_mgr *ico_window_mgr,
-                                 int32_t               event,
-                                 uint32_t              surfaceid,
-                                 uint32_t              type,
-                                 uint32_t              target,
-                                 int32_t               width,
-                                 int32_t               height,
-                                 int32_t               stride,
-                                 uint32_t              format)
+CicoSCWlWinMgrIF::wlIviCtrlScreenCB(void *data,
+                                    struct ivi_controller *ivi_controller,
+                                    uint32_t id_screen,
+                                    struct ivi_controller_screen *screen)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlMapSurfaceCB Enter");
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: Enter(%x)", id_screen);
 
     if (NULL == data) {
-        ICO_WRN("wlMapSurfaceCB: data is null");
+        ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->mapSurfaceCB(data, ico_window_mgr,
-                                                       event, surfaceid,
-                                                       type, target,
-                                                       width, height,
-                                                       stride, format);
-    ICO_DBG("CicoSCWlWinMgrIF::wlMapSurfaceCB Leave");
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief   wayland display attribute callback
+ *  @brief  wayland ivi-shell ivi-controller protocol create layer callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] wl_output       wayland wl_output interface
- *  @param [IN] x               display upper-left X coodinate
- *  @param [IN] y               display upper-left Y coodinate
- *  @param [IN] physical_width  display physical width
- *  @param [IN] physical_height display physical height
- *  @param [IN] subpixel        display sub pixcel
- *  @param [IN] make            display maker
- *  @param [IN] model           diaplay model
- *  @param [IN] transform       transform
+ *  @param [in] data            user data(unused)
+ *  @param [in] ivi_controller  wayland ivi-controller interface
+ *  @param [in] id_layer        layer id
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlOutputGeometryCB(void             *data,
-                                     struct wl_output *wl_output,
-                                     int32_t          x,
-                                     int32_t          y,
-                                     int32_t          physical_width,
-                                     int32_t          physical_height,
-                                     int32_t          subpixel,
-                                     const char       *make,
-                                     const char       *model,
-                                     int32_t          transform)
+CicoSCWlWinMgrIF::wlIviCtrlLayerCB(void *data,
+                                   struct ivi_controller *ivi_controller,
+                                   uint32_t id_layer)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlOutputGeometryCB Enter");
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: Enter(%x)", id_layer);
 
     if (NULL == data) {
-        ICO_WRN("wlOutputGeometryCB: data is null");
+        ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->outputGeometryCB(data, wl_output,
-                                                           x, y,
-                                                           physical_width,
-                                                           physical_height,
-                                                           subpixel,
-                                                           make,
-                                                           model,
-                                                           transform);
-    ICO_DBG("CicoSCWlWinMgrIF::wlOutputGeometryCB Leave");
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland display mode callback
+ *  @brief  wayland ivi-shell ivi-controller protocol create surface callback
  *
- *  @param [IN] data        user data(unused)
- *  @param [IN] wl_output   wayland wl_output interface
- *  @param [IN] flags       flags
- *  @param [IN] width       display width
- *  @param [IN] height      display height
- *  @param [IN] refresh     display refresh rate
+ *  @param [in] data            user data(unused)
+ *  @param [in] ivi_controller  wayland ivi-controller interface
+ *  @param [in] id_surface      surface id
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWlWinMgrIF::wlOutputModeCB(void             *data,
-                                 struct wl_output *wl_output,
-                                 uint32_t         flags,
-                                 int32_t          width,
-                                 int32_t          height,
-                                 int32_t          refresh)
+CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB(void *data,
+                                     struct ivi_controller *ivi_controller,
+                                     uint32_t id_surface)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlOutputModeCB Enter");
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: Enter(%x)", id_surface);
 
     if (NULL == data) {
-        ICO_WRN("wlOutputGeometryCB: data is null");
+        ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: data is null");
         return;
     }
-    static_cast<CicoSCWlWinMgrIF*>(data)->outputModeCB(data, wl_output, flags,
-                                                       width, height, refresh);
-    ICO_DBG("CicoSCWlWinMgrIF::wlOutputModeCB Leave");
+
+    static_cast<CicoSCWlWinMgrIF*>(data)->createSurfaceCB(data, ivi_controller, id_surface);
+
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland ivi-shell ivi-controller protocol error callback
+ *
+ *  @param [in] data            user data(unused)
+ *  @param [in] ivi_controller  wayland ivi-controller interface
+ *  @param [in] error_code      error code
+ *  @param [in] error_text      error message
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlIviCtrlErrorCB(void *data,
+                                   struct ivi_controller *ivi_controller,
+                                   int32_t object_id, int32_t object_type,
+                                   int32_t error_code, const char *error_text)
+{
+    struct creation_surface_wait    *tp;
+    struct creation_surface_wait    *tp2;
+
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: Enter(%d[%d],%d,<%s>)",
+            object_id, object_type, error_code, error_text ? error_text : "(null)");
+
+    if (NULL == data) {
+        ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: data is null");
+        return;
+    }
+
+    // search request wait
+    tp = m_wait_surface_creation;
+    tp2 = NULL;
+    while (tp)  {
+        if (tp->busy == SCWINMGR_GENIVI_BUSY_WAIT)  {
+            tp2 = tp;
+        }
+        else if (tp->busy != SCWINMGR_GENIVI_BUSY_NONE) {
+            tp->busy = SCWINMGR_GENIVI_BUSY_NONE;
+        }
+        tp = tp->next;
+    }
+    if (tp2 != NULL)    {
+        tp2->busy = SCWINMGR_GENIVI_BUSY_REQSURF;
+        ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: "
+                "call ivi_controller_get_native_handle(%d,<%s>)", tp2->pid, tp2->title);
+        ivi_controller_get_native_handle(m_ivi_ctrl, tp2->pid, tp2->title);
+    }
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland ivi-shell ivi-controller protocol error callback
+ *
+ *  @param [in] data            user data(unused)
+ *  @param [in] ivi_controller  wayland ivi-controller interface
+ *  @param [in] error_code      error code
+ *  @param [in] error_text      error message
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB(void *data,
+                                          struct ivi_controller *ivi_controller,
+                                          struct wl_surface *surface)
+{
+    uint32_t                        id_surface;
+    struct creation_surface_wait    *tp;
+    struct creation_surface_wait    *tp2;
+    struct creation_surface_wait    *bp;
+
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Enter(surf=%08x)", (int)surface);
+
+    if (NULL == data) {
+        ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(data is null)");
+        return;
+    }
+
+    // check same surface
+    tp = m_wait_surface_creation;
+    bp = NULL;
+    while (tp)  {
+        if (tp->busy == SCWINMGR_GENIVI_BUSY_REQSURF)   break;
+        bp = tp;
+        tp = tp->next;
+    }
+    if (! tp)   {
+        ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(no request)");
+        return;
+    }
+    if (tp->surface == surface) {
+        tp->busy = SCWINMGR_GENIVI_BUSY_NONE;
+        ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: winname change(%08x,<%s>)",
+                tp->id_surface, tp->title);
+        id_surface = tp->id_surface;
+        static_cast<CicoSCWlWinMgrIF*>(data)->updateWinnameCB(id_surface, tp->title);
+
+        // title change, delete old table
+        tp2 = m_wait_surface_creation;
+        bp = NULL;
+        while (tp2) {
+            if (tp2 != tp)  {
+                if (tp2->surface == surface)    {
+                    if (bp) {
+                        bp->next = tp2->next;
+                    }
+                    else    {
+                        m_wait_surface_creation = tp2->next;
+                    }
+                    tp2->next = m_free_surface_creation;
+                    m_free_surface_creation = tp2;
+                    tp2 = m_wait_surface_creation;
+                    bp = NULL;
+                    continue;
+                }
+            }
+            bp = tp2;
+            tp2 = tp2->next;
+        }
+    }
+    else    {
+        // create ivi-surface and bind to wl_surface
+        m_id_surface ++;
+        if (m_id_surface >= 0x00ffffff)     m_id_surface = 1;
+        id_surface = m_id_surface | 0x40000000;
+
+        ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: "
+                "call ivi_application_surface_create(%08x)", id_surface);
+        if (ivi_application_surface_create(m_ivi_app, id_surface, surface) == NULL) {
+            ICO_ERR("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: "
+                    "ivi_application_surface_create(%08x) Error", id_surface);
+            if (bp) {
+                bp->next = tp->next;
+            }
+            else    {
+                m_wait_surface_creation = tp->next;
+            }
+            tp->next = m_free_surface_creation;
+            m_free_surface_creation = tp;
+        }
+        else    {
+            tp->surface = surface;
+            tp->id_surface = id_surface;
+            tp->busy = SCWINMGR_GENIVI_BUSY_REQBIND;
+        }
+    }
+
+    // search request wait
+    tp = m_wait_surface_creation;
+    tp2 = NULL;
+    while (tp)  {
+        if (tp->busy == SCWINMGR_GENIVI_BUSY_WAIT)  {
+            tp2 = tp;
+        }
+        else if (tp->busy != SCWINMGR_GENIVI_BUSY_NONE) {
+            break;
+        }
+        tp = tp->next;
+    }
+    if ((tp == NULL) && (tp2 != NULL))  {
+        tp2->busy = SCWINMGR_GENIVI_BUSY_REQSURF;
+        ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: "
+                "call ivi_controller_get_native_handle(%d,<%s>)", tp2->pid, tp2->title);
+        ivi_controller_get_native_handle(m_ivi_ctrl, tp2->pid, tp2->title);
+    }
+    ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(id_surface=%08x)", id_surface);
 }
 // vim:set expandtab ts=4 sw=4: