2 * Copyright (c) 2013-2014, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 //==========================================================================
12 * @file CicoSCWlWinMgrIF.cpp
14 * @brief This file implementation of CicoSCWlInputMgrIF class
16 //==========================================================================
20 #include <sys/types.h>
24 #include "ico_syc_type.h"
25 #include "CicoSCWlWinMgrIF.h"
27 #include "CicoSystemConfig.h"
29 #include "CicoSCWindowController.h"
31 //==========================================================================
33 //==========================================================================
34 struct ico_window_mgr *CicoSCWlWinMgrIF::m_winmgr = NULL;
35 struct ivi_application *CicoSCWlWinMgrIF::m_ivi_app = NULL;
36 struct ivi_controller *CicoSCWlWinMgrIF::m_ivi_ctrl = NULL;
37 struct wl_output *CicoSCWlWinMgrIF::m_wloutput = NULL;
39 int CicoSCWlWinMgrIF::m_id_surface = 0;
41 struct creation_surface_wait *CicoSCWlWinMgrIF::m_wait_surface_creation = NULL;
42 struct creation_surface_wait *CicoSCWlWinMgrIF::m_free_surface_creation = NULL;
44 //--------------------------------------------------------------------------
46 * @brief default constructor
48 //--------------------------------------------------------------------------
49 CicoSCWlWinMgrIF::CicoSCWlWinMgrIF()
51 // ico_window_mgr listener
52 m_listener.window_active = wlActiveCB;
53 m_listener.map_surface = wlMapSurfaceCB;
55 // genivi ivi_application listener
56 m_ivi_app_listener.error = wlIviAppErrorCB;
57 m_ivi_app_listener.wl_shell_info = wlIviAppNativeShellInfoCB;
59 // genivi ivi_controller listener
60 m_ivi_ctrl_listener.screen = wlIviCtrlScreenCB;
61 m_ivi_ctrl_listener.layer = wlIviCtrlLayerCB;
62 m_ivi_ctrl_listener.surface = wlIviCtrlSurfaceCB;
63 m_ivi_ctrl_listener.error = wlIviCtrlErrorCB;
64 m_ivi_ctrl_listener.native_handle = wlIviCtrlNativeHandleCB;
66 // wayland output listener
67 m_wlOutputListener.geometry = wlOutputGeometryCB;
68 m_wlOutputListener.mode = wlOutputModeCB;
71 //--------------------------------------------------------------------------
75 //--------------------------------------------------------------------------
76 CicoSCWlWinMgrIF::~CicoSCWlWinMgrIF()
80 //--------------------------------------------------------------------------
82 * @brief initialize ico_window_mgr interfaces
84 * @param [in] data user data
85 * @param [in] registry wayland registry
86 * @param [in] name wayland display id
87 * @parma [in] interface wayland interface name
88 * @parma [in] version wayland interface version number
90 //--------------------------------------------------------------------------
92 CicoSCWlWinMgrIF::initInterface(void *data,
93 struct wl_registry *registry,
95 const char *interface,
98 ICO_TRA("CicoSCWlWinMgrIF::initInterface Enter(interface=%s)", interface);
100 // check interface name
101 if (0 == strcmp(interface, ICO_WL_WIN_MGR_IF)) {
102 // get interface instance
103 ICO_DBG("called: wl_registry_bind");
104 void *wlProxy = wl_registry_bind(registry,
106 &ico_window_mgr_interface,
108 if (NULL == wlProxy) {
109 ICO_WRN("interface(%s) wl_registry_bind failed.",
111 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
116 m_winmgr = (struct ico_window_mgr *)wlProxy;
117 ico_window_mgr_add_listener(m_winmgr,
121 else if (0 == strcmp(interface, ICO_WL_IVI_APPLICATION_IF)) {
122 // get interface instance
123 ICO_DBG("called: wl_registry_bind for ivi_application");
124 void *wlProxy = wl_registry_bind(registry,
126 &ivi_application_interface,
128 if (NULL == wlProxy) {
129 ICO_WRN("interface(%s) wl_registry_bind failed.",
131 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
134 m_ivi_app = (struct ivi_application *)wlProxy;
135 ivi_application_add_listener(m_ivi_app,
139 else if (0 == strcmp(interface, ICO_WL_IVI_CONTROLLER_IF)) {
140 // get interface instance
141 ICO_DBG("called: wl_registry_bind for ivi_controller");
142 void *wlProxy = wl_registry_bind(registry,
144 &ivi_controller_interface,
146 if (NULL == wlProxy) {
147 ICO_WRN("interface(%s) wl_registry_bind failed.",
149 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
152 m_ivi_ctrl = (struct ivi_controller *)wlProxy;
153 ivi_controller_add_listener(m_ivi_ctrl,
154 &m_ivi_ctrl_listener,
157 else if (0 == strcmp(interface, ICO_WL_OUTPUT_IF)) {
158 // get interface instance
159 ICO_DBG("called: wl_registry_bind");
160 void *wlProxy = wl_registry_bind(registry,
162 &wl_output_interface,
164 if (NULL == wlProxy) {
165 ICO_WRN("interface(%s) wl_registry_bind failed.",
167 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
171 m_wloutput = (struct wl_output*)wlProxy;
172 wl_output_add_listener(m_wloutput,
177 ICO_WRN("unmatch interface");
178 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(unmatch interface)");
182 if((NULL != m_winmgr) && (NULL != m_wloutput)) {
183 m_initialized = true;
186 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave");
189 //--------------------------------------------------------------------------
191 * @brief wrapper function of ilm_layerAddSurface
193 * @param [in] surfaceid wayland surface id
194 * @param [in] layer layer id
195 * @param [in] oldlayer old layer id(if 0xffffffff, no old layer)
197 //--------------------------------------------------------------------------
199 CicoSCWlWinMgrIF::setWindowLayer(uint32_t surfaceid, uint32_t layer, uint32_t oldlayer)
201 // set window layer request to Multi Window Manager
202 ICO_DBG("CicoSCWlWinMgrIF::setWindowLayer: "
203 "surfaceid=0x%08X layer=%d->%d", surfaceid, oldlayer, layer);
205 // remove original layer
206 if (oldlayer <= 0x7fffffff) {
207 ICO_TRA("CicoSCWlWinMgrIF::setWindowLayer: remove surface %08x "
208 "from layer(%d)", surfaceid, oldlayer);
209 (void) ilm_layerRemoveSurface(oldlayer, surfaceid);
212 ICO_TRA("CicoSCWlWinMgrIF::setWindowLayer: surface %08x has no old layer(%d)",
213 surfaceid, oldlayer);
217 if (ilm_layerAddSurface(layer, surfaceid) != ILM_SUCCESS) {
218 ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_layerAddSurface(%d,%08x) Error",
221 if (ilm_commitChanges() != ILM_SUCCESS) {
222 ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_commitChanges Error");
226 //--------------------------------------------------------------------------
228 * @brief wrapper function of ilm_surfaceSetDestinationRectangle
230 * @param [in] surfaceid wayland surface id
231 * @param [in] layer number of layer
236 * @param [in] flags (unused)
238 //--------------------------------------------------------------------------
240 CicoSCWlWinMgrIF::setPositionsize(uint32_t surfaceid, uint32_t node,
241 int32_t x, int32_t y, int32_t width,
242 int32_t height, int32_t flags)
244 // set position size request to Multi Window Manager
245 ICO_DBG("called: ilm_surfaceSetDestinationRectangle"
246 "(surfaceid=0x%08X node=%d x=%d y=%d w=%d h=%d flags=%d)",
247 surfaceid, node, x, y, width, height, flags);
248 if ((ilm_surfaceSetDestinationRectangle(surfaceid, x, y, width, height)
250 (ilm_commitChanges() != ILM_SUCCESS)) {
251 ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_surfaceSetDestinationRectangle"
252 "(%08x,%d,%d,%d,%d) Error",
253 surfaceid, x, y, width, height);
257 //--------------------------------------------------------------------------
259 * @brief wrapper function of ilm_surfaceSetVisibility
261 * @param [in] surfaceid wayland surface id
262 * @param [in] visible visible state
263 * @param [in] raise raise state
264 * @param [in] flags (unused)
266 //--------------------------------------------------------------------------
268 CicoSCWlWinMgrIF::setVisible(uint32_t surfaceid, int32_t visible,
269 int32_t raise, int32_t flags)
271 // set visible request to Multi Window Manager
272 ICO_DBG("called: ilm_surfaceSetVisibility"
273 "(surfaceid=0x%08X visible=%d raise=%d anima=%d)",
274 surfaceid, visible, raise, flags);
275 if ((visible == ICO_SYC_WIN_VISIBLE_SHOW) || (visible == ICO_SYC_WIN_VISIBLE_HIDE)) {
276 ilm_surfaceSetVisibility(surfaceid, visible);
278 if ((raise == ICO_SYC_WIN_RAISE_RAISE) || (raise == ICO_SYC_WIN_RAISE_LOWER)) {
279 // TODO: need raise/lower control
281 if (ilm_commitChanges() != ILM_SUCCESS) {
282 ICO_ERR("CicoSCWlWinMgrIF::setVisible: ilm_commitChanges() Error");
286 //--------------------------------------------------------------------------
288 * @brief wrapper function of ico_window_mgr_set_animation
290 * @param [in] surfaceid wayland surface id
291 * @param [in] type transition type
292 * @param [in] animation name of animation
293 * @param [in] time time of animation
295 //--------------------------------------------------------------------------
297 CicoSCWlWinMgrIF::setAnimation(uint32_t surfaceid, int32_t type,
298 const char *animation, int32_t time)
300 ICO_DBG("called: ico_window_mgr_set_animation"
301 "(surfaceid=0x%08X type=%d anima=%s time=%d)",
302 surfaceid, type, animation, time);
303 ico_window_mgr_set_animation(m_winmgr, surfaceid, type, animation, time);
306 //--------------------------------------------------------------------------
308 * @brief wrapper function of ilm_SetKeyboardFocusOn
310 * @param [in] surfaceid wayland surface id
311 * @param [in] active flags or active device(unused)
313 //--------------------------------------------------------------------------
315 CicoSCWlWinMgrIF::setActive(uint32_t surfaceid, int32_t active)
317 ICO_DBG("called: ilm_SetKeyboardFocusOn"
318 "(surfaceid=0x%08X active=%d)", surfaceid, active);
319 if ((ilm_SetKeyboardFocusOn(surfaceid) != ILM_SUCCESS) ||
320 (ilm_commitChanges() != ILM_SUCCESS)) {
321 ICO_ERR("CicoSCWlWinMgrIF::setActive ilm_SetKeyboardFocusOn(%08x) Error", surfaceid);
325 //--------------------------------------------------------------------------
327 * @brief wrapper function of ilm_layerSetVisibility
329 * @param [in] surfaceid wayland surface id
330 * @param [in] layer id of layer
331 * @param [in] visible visible state
333 //--------------------------------------------------------------------------
335 CicoSCWlWinMgrIF::setLayerVisible(uint32_t layer, int32_t visible)
337 ICO_DBG("called: ilm_layerSetVisibility"
338 "(layer=%d visible=%d)", layer, visible);
339 if ((ilm_layerSetVisibility(layer, visible) != ILM_SUCCESS) ||
340 (ilm_commitChanges() != ILM_SUCCESS)) {
341 ICO_ERR("CicoSCWlWinMgrIF::setLayerVisible ilm_layerSetVisibility(%d,%d) Error",
346 //--------------------------------------------------------------------------
348 * @brief wrapper function of ilm_takeSurfaceScreenshot
350 * @param [in] surface id of wayland surface
351 * @param [in] filepath surface image pixel file path
353 //--------------------------------------------------------------------------
355 CicoSCWlWinMgrIF::setmapGet(int surfaceid, const char *filepath)
357 ICO_DBG("called: ilm_takeSurfaceScreenshot(filepath=%s,, surface=0x%08x)",
358 filepath ? filepath : "(null)", surfaceid);
359 if ((ilm_takeSurfaceScreenshot(filepath, surfaceid) != ILM_SUCCESS) ||
360 (ilm_commitChanges() != ILM_SUCCESS)) {
361 ICO_ERR("CicoSCWlWinMgrIF::setmapGet ilm_takeSurfaceScreenshot(%s,%x) Error",
362 filepath ? filepath : "(null)", surfaceid);
366 //--------------------------------------------------------------------------
368 * @brief wrapper function of ico_window_mgr_map_surface
370 * @param [in] surface id of wayland surface
371 * @param [in] framerate interval of changed notify[frame per second]
372 * @param [in] filepath surface image pixel file path
374 //--------------------------------------------------------------------------
376 CicoSCWlWinMgrIF::mapSurface(uint32_t surfaceid, int32_t framerate, const char *filepath)
378 ICO_DBG("called: ico_window_mgr_map_surface(surfaceid=0x%08X framerate=%d file=%s)",
379 surfaceid, framerate, filepath ? filepath : "(null)");
380 // currently GENIVI genivi-shell not support contents change, so use ico_window_mgr
381 if ((filepath != NULL) && (*filepath != 0) && (*filepath != ' ')) {
382 ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate, filepath);
385 ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate, " ");
389 //--------------------------------------------------------------------------
391 * @brief wrapper function of ico_window_mgr_unmap_surface
393 * @param [in] surface id of wayland surface
395 //--------------------------------------------------------------------------
397 CicoSCWlWinMgrIF::unmapSurface(uint32_t surfaceid)
399 ICO_DBG("called: ico_window_mgr_unmap_surface"
400 "(surfaceid=0x%08X)", surfaceid);
401 // currently GENIVI genivi-shell not support contents change, so use ico_window_mgr
402 ico_window_mgr_unmap_surface(m_winmgr, surfaceid);
405 //--------------------------------------------------------------------------
407 * @brief get creation surface window name(title) and pid
409 * @param [in] id_surface surface id
410 * @param [out] pid application process id
412 //--------------------------------------------------------------------------
414 CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(uint32_t id_surface, int *pid)
416 struct creation_surface_wait *tp = m_wait_surface_creation;
419 if (tp->id_surface == id_surface) {
420 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(%x) pid=%d title=<%s>",
421 id_surface, tp->pid, tp->title);
427 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(%x) dose not exist", id_surface);
431 //--------------------------------------------------------------------------
433 * @brief remove surface window
435 * @param [in] id_surface surface id
437 //--------------------------------------------------------------------------
439 CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(uint32_t id_surface)
441 struct creation_surface_wait *tp = m_wait_surface_creation;
442 struct creation_surface_wait *bp = NULL;
445 if (tp->id_surface == id_surface) {
450 m_wait_surface_creation = tp->next;
452 tp->next = m_free_surface_creation;
453 m_free_surface_creation = tp;
455 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) removed", id_surface);
459 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) dose not exist", id_surface);
462 //--------------------------------------------------------------------------
464 * @brief wayland surface active callback
466 * @param [in] data user data(unused)
467 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
468 * @param [in] surfaceid ico_window_mgr surface Id
469 * @param [in] select select device(unused)
470 * (0=not active/1=pointer/2=touch)
472 //--------------------------------------------------------------------------
474 CicoSCWlWinMgrIF::activeCB(void *data,
475 struct ico_window_mgr *ico_window_mgr,
479 ICO_WRN("CicoSCWlWinMgrIF::activeCB called.");
482 //--------------------------------------------------------------------------
484 * @brief surface map event callback
486 * @param [in] data user data(unused)
487 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
488 * @param [in] event event
489 * @param [in] surfaceid surface Id
490 * @param [in] type surface buffer type(EGL buffer/Shared memory)
491 * @param [in] width surface width
492 * @param [in] height surface height
493 * @param [in] stride surface buffer(frame buffer) stride
494 * @param [in] format surface buffer format
496 //--------------------------------------------------------------------------
498 CicoSCWlWinMgrIF::mapSurfaceCB(void *data,
499 struct ico_window_mgr *ico_window_mgr,
508 ICO_WRN("CicoSCWlWinMgrIF::mapSurfaceCB called.");
511 //--------------------------------------------------------------------------
513 * @brief wayland display attribute callback
515 * @param [in] data user data(unused)
516 * @param [in] wl_output wayland wl_output interface
517 * @param [in] x display upper-left X coordinate
518 * @param [in] y display upper-left Y coordinate
519 * @param [in] physical_width display physical width
520 * @param [in] physical_height display physical height
521 * @param [in] subpixel display sub pixel
522 * @param [in] make display maker
523 * @param [in] model display model
524 * @param [in] transform transform
526 //--------------------------------------------------------------------------
528 CicoSCWlWinMgrIF::outputGeometryCB(void *data,
529 struct wl_output *wl_output,
532 int32_t physical_width,
533 int32_t physical_height,
539 ICO_WRN("CicoSCWlWinMgrIF::outputGeometryCB called.");
542 //--------------------------------------------------------------------------
544 * @brief wayland display mode callback
546 * @param [in] data user data(unused)
547 * @param [in] wl_output wayland wl_output interface
548 * @param [in] flags flags
549 * @param [in] width display width
550 * @param [in] height display height
551 * @param [in] refresh display refresh rate
553 //--------------------------------------------------------------------------
555 CicoSCWlWinMgrIF::outputModeCB(void *data,
556 struct wl_output *wl_output,
562 ICO_WRN("CicoSCWlWinMgrIF::outputModeCB called.");
565 //--------------------------------------------------------------------------
567 * @brief wayland genivi ivi-surface create callback
569 * @param [in] data user data(unused)
570 * @param [in] ivi_controller wayland ivi-controller plugin interface
571 * @param [in] id_surface surface id
573 //--------------------------------------------------------------------------
575 CicoSCWlWinMgrIF::createSurfaceCB(void *data,
576 struct ivi_controller *ivi_controller,
579 ICO_WRN("CicoSCWlWinMgrIF::createSurfaceCB called.");
582 //==========================================================================
584 //==========================================================================
586 //--------------------------------------------------------------------------
588 * @brief wayland surface active callback
590 * @param [in] data user data(unused)
591 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
592 * @param [in] surfaceid ico_window_mgr surface Id
593 * @param [in] select select device(unused)
594 * (0=not active/1=pointer/2=touch)
596 //--------------------------------------------------------------------------
598 CicoSCWlWinMgrIF::wlActiveCB(void *data,
599 struct ico_window_mgr *ico_window_mgr,
603 // ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Enter");
606 ICO_WRN("wlActiveCB: data is null");
609 static_cast<CicoSCWlWinMgrIF*>(data)->activeCB(data, ico_window_mgr,
611 // ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Leave");
614 //--------------------------------------------------------------------------
616 * @brief surface map event callback
618 * @param [in] data user data
619 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
620 * @param [in] event event
621 * @param [in] surfaceid surface Id
622 * @param [IN] type buffer type(fixed ICO_WINDOW_MGR_MAP_TYPE_EGL)
623 * @param [in] width surface width
624 * @param [in] height surface height
625 * @param [in] stride surface buffer(frame buffer) stride
626 * @param [in] format surface buffer format
628 //--------------------------------------------------------------------------
630 CicoSCWlWinMgrIF::wlMapSurfaceCB(void *data,
631 struct ico_window_mgr *ico_window_mgr,
640 // ICO_TRA("CicoSCWlWinMgrIF::wlMapSurfaceCB Enter");
643 ICO_WRN("wlMapSurfaceCB: data is null");
646 static_cast<CicoSCWlWinMgrIF*>(data)->mapSurfaceCB(data, ico_window_mgr,
651 // ICO_TRA("CicoSCWlWinMgrIF::wlMapSurfaceCB Leave");
654 //--------------------------------------------------------------------------
656 * @brief wayland display attribute callback
658 * @param [in] data user data(unused)
659 * @param [in] wl_output wayland wl_output interface
660 * @param [in] x display upper-left X coordinate
661 * @param [in] y display upper-left Y coordinate
662 * @param [in] physical_width display physical width
663 * @param [in] physical_height display physical height
664 * @param [in] subpixel display sub pixel
665 * @param [in] make display maker
666 * @param [in] model display model
667 * @param [in] transform transform
669 //--------------------------------------------------------------------------
671 CicoSCWlWinMgrIF::wlOutputGeometryCB(void *data,
672 struct wl_output *wl_output,
675 int32_t physical_width,
676 int32_t physical_height,
682 // ICO_TRA("CicoSCWlWinMgrIF::wlOutputGeometryCB Enter");
685 ICO_WRN("wlOutputGeometryCB: data is null");
688 static_cast<CicoSCWlWinMgrIF*>(data)->outputGeometryCB(data, wl_output,
696 // ICO_TRA("CicoSCWlWinMgrIF::wlOutputGeometryCB Leave");
699 //--------------------------------------------------------------------------
701 * @brief wayland display mode callback
703 * @param [in] data user data(unused)
704 * @param [in] wl_output wayland wl_output interface
705 * @param [in] flags flags
706 * @param [in] width display width
707 * @param [in] height display height
708 * @param [in] refresh display refresh rate
710 //--------------------------------------------------------------------------
712 CicoSCWlWinMgrIF::wlOutputModeCB(void *data,
713 struct wl_output *wl_output,
719 // ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Enter");
722 ICO_WRN("wlOutputGeometryCB: data is null");
725 static_cast<CicoSCWlWinMgrIF*>(data)->outputModeCB(data, wl_output, flags,
726 width, height, refresh);
727 // ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Leave");
730 //--------------------------------------------------------------------------
732 * @brief wayland ivi-shell ivi-application protocol error callback
734 * @param [in] data user data(unused)
735 * @param [in] ivi_application wayland ivi-application interface
736 * @param [in] error_code error code
737 * @param [in] error_text error message
739 //--------------------------------------------------------------------------
741 CicoSCWlWinMgrIF::wlIviAppErrorCB(void *data,
742 struct ivi_application *ivi_application,
743 int32_t error_code, const char *error_text)
745 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppErrorCB: Enter(%d,%s)",
746 error_code, error_text ? error_text : "(null)");
749 ICO_WRN("CicoSCWlWinMgrIF::wlIviAppErrorCB: data is null");
752 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppErrorCB: Leave");
755 //--------------------------------------------------------------------------
757 * @brief wayland ivi-shell ivi-application protocol create wl_surface callback
759 * @param [in] data user data(unused)
760 * @param [in] ivi_application wayland ivi-application interface
761 * @param [in] pid application process id
762 * @param [in] title surface title name
764 //--------------------------------------------------------------------------
766 CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB(void *data,
767 struct ivi_application *ivi_application,
768 int32_t pid, const char *title)
770 struct creation_surface_wait *tp;
771 struct creation_surface_wait *bp;
774 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Enter(%d,<%s>)",
775 pid, title ? title : "(null)");
778 ICO_WRN("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: data is null");
782 // bind wl_surface to ivi_surface
783 ivi_controller_get_native_handle(m_ivi_ctrl, pid, title ? title : "");
785 // save pid and title(window name)
786 nowtime = (time(NULL) >> 2) & 0x3fffffff;
787 tp = m_wait_surface_creation;
789 if ((tp->pid == pid) && (tp->title[0] == 0)) break;
793 tp = m_free_surface_creation;
795 m_free_surface_creation = tp->next;
798 tp = m_wait_surface_creation;
801 if (((nowtime >= tp->create_time)
802 && ((nowtime - tp->create_time) > 15)) ||
803 ((nowtime < tp->create_time)
804 && ((nowtime + 0x40000000 - tp->create_time) > 15))) {
809 m_wait_surface_creation = tp->next;
817 tp = (struct creation_surface_wait *)
818 malloc(sizeof(struct creation_surface_wait));
820 ICO_ERR("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: out of memory");
825 memset(tp, 0, sizeof(struct creation_surface_wait));
826 tp->next = m_wait_surface_creation;
827 m_wait_surface_creation = tp;
830 strncpy(tp->title, title, ICO_SYC_MAX_WINNAME_LEN-1);
831 tp->create_time = nowtime;
833 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave");
836 //--------------------------------------------------------------------------
838 * @brief wayland ivi-shell ivi-controller protocol create screen callback
840 * @param [in] data user data(unused)
841 * @param [in] ivi_controller wayland ivi-controller interface
842 * @param [in] id_screen screen id
843 * @param [in] screen screen information
845 //--------------------------------------------------------------------------
847 CicoSCWlWinMgrIF::wlIviCtrlScreenCB(void *data,
848 struct ivi_controller *ivi_controller,
850 struct ivi_controller_screen *screen)
852 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: Enter(%x)", id_screen);
855 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: data is null");
858 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: Leave");
861 //--------------------------------------------------------------------------
863 * @brief wayland ivi-shell ivi-controller protocol create layer callback
865 * @param [in] data user data(unused)
866 * @param [in] ivi_controller wayland ivi-controller interface
867 * @param [in] id_layer layer id
869 //--------------------------------------------------------------------------
871 CicoSCWlWinMgrIF::wlIviCtrlLayerCB(void *data,
872 struct ivi_controller *ivi_controller,
875 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: Enter(%x)", id_layer);
878 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: data is null");
881 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: Leave");
884 //--------------------------------------------------------------------------
886 * @brief wayland ivi-shell ivi-controller protocol create surface callback
888 * @param [in] data user data(unused)
889 * @param [in] ivi_controller wayland ivi-controller interface
890 * @param [in] id_surface surface id
892 //--------------------------------------------------------------------------
894 CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB(void *data,
895 struct ivi_controller *ivi_controller,
898 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: Enter(%x)", id_surface);
901 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: data is null");
905 static_cast<CicoSCWlWinMgrIF*>(data)->createSurfaceCB(data, ivi_controller, id_surface);
907 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: Leave");
910 //--------------------------------------------------------------------------
912 * @brief wayland ivi-shell ivi-controller protocol error callback
914 * @param [in] data user data(unused)
915 * @param [in] ivi_controller wayland ivi-controller interface
916 * @param [in] error_code error code
917 * @param [in] error_text error message
919 //--------------------------------------------------------------------------
921 CicoSCWlWinMgrIF::wlIviCtrlErrorCB(void *data,
922 struct ivi_controller *ivi_controller,
923 int32_t object_id, int32_t object_type,
924 int32_t error_code, const char *error_text)
926 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: Enter(%d[%d],%d,<%s>)",
927 object_id, object_type, error_code, error_text ? error_text : "(null)");
930 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: data is null");
933 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: Leave");
936 //--------------------------------------------------------------------------
938 * @brief wayland ivi-shell ivi-controller protocol error callback
940 * @param [in] data user data(unused)
941 * @param [in] ivi_controller wayland ivi-controller interface
942 * @param [in] error_code error code
943 * @param [in] error_text error message
945 //--------------------------------------------------------------------------
947 CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB(void *data,
948 struct ivi_controller *ivi_controller,
949 struct wl_surface *surface)
952 struct creation_surface_wait *tp;
954 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Enter(surface=%08x)", (int)surface);
957 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: data is null");
961 // check same surface
962 tp = m_wait_surface_creation;
964 if (tp->surface == surface) {
965 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(same surface)");
971 // create ivi-surface and bind to wl_surface
973 if (m_id_surface >= 0x00ffffff) m_id_surface = 1;
974 id_surface = m_id_surface | 0x40000000;
976 if (ivi_application_surface_create(m_ivi_app, id_surface, surface) == NULL) {
977 ICO_ERR("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: "
978 "ivi_application_surface_create(%x) Error", id_surface);
979 if (m_wait_surface_creation) {
980 tp = m_wait_surface_creation;
981 m_wait_surface_creation = tp->next;
982 tp->next = m_free_surface_creation;
983 m_free_surface_creation = tp;
987 tp = m_wait_surface_creation;
989 if (tp->id_surface == 0) {
990 tp->id_surface = id_surface;
991 tp->surface = surface;
997 ICO_ERR("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: waiting surface dose not exist");
1000 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(id_surface=%08x)", id_surface);
1002 // vim:set expandtab ts=4 sw=4: