+
+ 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);