2 * Copyright (c) 2013, 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;
54 m_listener.update_surface = wlUpdateSurfaceCB;
55 m_listener.destroy_surface = wlDestroySurfaceCB;
57 // genivi ivi_application listener
58 m_ivi_app_listener.error = wlIviAppErrorCB;
59 m_ivi_app_listener.wl_shell_info = wlIviAppNativeShellInfoCB;
61 // genivi ivi_controller listener
62 m_ivi_ctrl_listener.screen = wlIviCtrlScreenCB;
63 m_ivi_ctrl_listener.layer = wlIviCtrlLayerCB;
64 m_ivi_ctrl_listener.surface = wlIviCtrlSurfaceCB;
65 m_ivi_ctrl_listener.error = wlIviCtrlErrorCB;
66 m_ivi_ctrl_listener.native_handle = wlIviCtrlNativeHandleCB;
68 // wayland output listener
69 m_wlOutputListener.geometry = wlOutputGeometryCB;
70 m_wlOutputListener.mode = wlOutputModeCB;
73 //--------------------------------------------------------------------------
77 //--------------------------------------------------------------------------
78 CicoSCWlWinMgrIF::~CicoSCWlWinMgrIF()
82 //--------------------------------------------------------------------------
84 * @brief initialize ico_window_mgr interfaces
86 * @param [in] data user data
87 * @param [in] registry wayland registry
88 * @param [in] name wayland display id
89 * @parma [in] interface wayland interface name
90 * @parma [in] version wayland interface version number
92 //--------------------------------------------------------------------------
94 CicoSCWlWinMgrIF::initInterface(void *data,
95 struct wl_registry *registry,
97 const char *interface,
100 ICO_TRA("CicoSCWlWinMgrIF::initInterface Enter(interface=%s)", interface);
102 // check interface name
103 if (0 == strcmp(interface, ICO_WL_WIN_MGR_IF)) {
104 // get interface instance
105 ICO_DBG("called: wl_registry_bind");
106 void *wlProxy = wl_registry_bind(registry,
108 &ico_window_mgr_interface,
110 if (NULL == wlProxy) {
111 ICO_WRN("interface(%s) wl_registry_bind failed.",
113 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
118 m_winmgr = (struct ico_window_mgr *)wlProxy;
119 ico_window_mgr_add_listener(m_winmgr,
123 else if (0 == strcmp(interface, ICO_WL_IVI_APPLICATION_IF)) {
124 // get interface instance
125 ICO_DBG("called: wl_registry_bind for ivi_application");
126 void *wlProxy = wl_registry_bind(registry,
128 &ivi_application_interface,
130 if (NULL == wlProxy) {
131 ICO_WRN("interface(%s) wl_registry_bind failed.",
133 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
136 m_ivi_app = (struct ivi_application *)wlProxy;
137 ivi_application_add_listener(m_ivi_app,
141 else if (0 == strcmp(interface, ICO_WL_IVI_CONTROLLER_IF)) {
142 // get interface instance
143 ICO_DBG("called: wl_registry_bind for ivi_controller");
144 void *wlProxy = wl_registry_bind(registry,
146 &ivi_controller_interface,
148 if (NULL == wlProxy) {
149 ICO_WRN("interface(%s) wl_registry_bind failed.",
151 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
154 m_ivi_ctrl = (struct ivi_controller *)wlProxy;
155 ivi_controller_add_listener(m_ivi_ctrl,
156 &m_ivi_ctrl_listener,
159 else if (0 == strcmp(interface, ICO_WL_OUTPUT_IF)) {
160 // get interface instance
161 ICO_DBG("called: wl_registry_bind");
162 void *wlProxy = wl_registry_bind(registry,
164 &wl_output_interface,
166 if (NULL == wlProxy) {
167 ICO_WRN("interface(%s) wl_registry_bind failed.",
169 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(binding failed)");
173 m_wloutput = (struct wl_output*)wlProxy;
174 wl_output_add_listener(m_wloutput,
179 ICO_WRN("unmatch interface");
180 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave(unmatch interface)");
184 if((NULL != m_winmgr) && (NULL != m_wloutput)) {
185 m_initialized = true;
188 ICO_TRA("CicoSCWlWinMgrIF::initInterface Leave");
191 //--------------------------------------------------------------------------
193 * @brief wrapper function of ilm_layerAddSurface
195 * @param [in] surfaceid wayland surface id
196 * @param [in] layer layer id
197 * @param [in] oldlayer old layer id(if 0xffffffff, no old layer)
199 //--------------------------------------------------------------------------
201 CicoSCWlWinMgrIF::setWindowLayer(uint32_t surfaceid, uint32_t layer, uint32_t oldlayer)
203 // set window layer request to Multi Window Manager
204 ICO_DBG("CicoSCWlWinMgrIF::setWindowLayer: "
205 "surfaceid=0x%08X layer=%d->%d", surfaceid, oldlayer, layer);
207 if (oldlayer == layer) {
208 ICO_DBG("CicoSCWlWinMgrIF::setWindowLayer: new layer same as old, NOP");
212 // remove original layer
213 if (oldlayer <= 0x7fffffff) {
214 ICO_TRA("CicoSCWlWinMgrIF::setWindowLayer: remove surface %08x "
215 "from layer(%d)", surfaceid, oldlayer);
216 if (ilm_layerRemoveSurface(oldlayer, surfaceid) != ILM_SUCCESS) {
217 ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_layerRemoveSurface(%d,%08x) "
218 "Error", oldlayer, surfaceid);
220 // must need ilm_commitChanges() after ilm_layerRemoveSurface()
221 if (ilm_commitChanges() != ILM_SUCCESS) {
222 ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_commitChanges Error");
226 ICO_TRA("CicoSCWlWinMgrIF::setWindowLayer: surface %08x has no old layer(%d)",
227 surfaceid, oldlayer);
231 if (ilm_layerAddSurface(layer, surfaceid) != ILM_SUCCESS) {
232 ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_layerAddSurface(%d,%08x) Error",
235 if (ilm_commitChanges() != ILM_SUCCESS) {
236 ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_commitChanges Error");
240 //--------------------------------------------------------------------------
242 * @brief wrapper function of ilm_surfaceSetDestinationRectangle
244 * @param [in] surfaceid wayland surface id
245 * @param [in] layer number of layer
251 //--------------------------------------------------------------------------
253 CicoSCWlWinMgrIF::setPositionsize(uint32_t surfaceid, uint32_t node,
254 int32_t x, int32_t y, int32_t width, int32_t height)
256 // set position size request to Multi Window Manager
257 ICO_DBG("called: ilm_surfaceSetDestinationRectangle"
258 "(surfaceid=0x%08X node=%d x=%d y=%d w=%d h=%d)",
259 surfaceid, node, x, y, width, height);
261 if (ilm_surfaceSetDestinationRectangle(surfaceid, x, y, width, height)
263 ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_surfaceSetDestinationRectangle"
264 "(%08x,%d,%d,%d,%d) Error", surfaceid, x, y, width, height);
266 else if (ilm_surfaceSetSourceRectangle(surfaceid, 0, 0, width, height)
268 ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_surfaceSetSourceRectangle"
269 "(%08x,0,0,%d,%d) Error", surfaceid, width, height);
271 else if (ilm_commitChanges() != ILM_SUCCESS) {
272 ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_commitChanges() Error");
276 //--------------------------------------------------------------------------
278 * @brief wrapper function of ilm_surfaceSetVisibility
280 * @param [in] surfaceid wayland surface id
281 * @param [in] visible visible state
283 //--------------------------------------------------------------------------
285 CicoSCWlWinMgrIF::setVisible(uint32_t surfaceid, int32_t visible)
287 // set visible request to Multi Window Manager
288 ICO_DBG("called: ilm_surfaceSetVisibility(surfaceid=0x%08X visible=%d)",
290 if ((visible == ICO_SYC_WIN_VISIBLE_SHOW) || (visible == ICO_SYC_WIN_VISIBLE_HIDE)) {
291 ilm_surfaceSetVisibility(surfaceid, visible);
292 if (ilm_commitChanges() != ILM_SUCCESS) {
293 ICO_ERR("CicoSCWlWinMgrIF::setVisible: ilm_commitChanges() Error");
298 //--------------------------------------------------------------------------
300 * @brief wrapper function of ico_window_mgr_set_animation
302 * @param [in] surfaceid wayland surface id
303 * @param [in] type transition type
304 * @param [in] animation name of animation
305 * @param [in] time time of animation
307 //--------------------------------------------------------------------------
309 CicoSCWlWinMgrIF::setAnimation(uint32_t surfaceid, int32_t type,
310 const char *animation, int32_t time)
312 ICO_DBG("called: ico_window_mgr_set_animation"
313 "(surfaceid=0x%08X type=%d anima=%s time=%d)",
314 surfaceid, type, animation, time);
315 ico_window_mgr_set_animation(m_winmgr, surfaceid, type, animation, time);
318 //--------------------------------------------------------------------------
320 * @brief wrapper function of ilm_SetKeyboardFocusOn
322 * @param [in] surfaceid wayland surface id
323 * @param [in] active flags or active device(unused)
325 //--------------------------------------------------------------------------
327 CicoSCWlWinMgrIF::setActive(uint32_t surfaceid, int32_t active)
329 ICO_DBG("called: ilm_SetKeyboardFocusOn"
330 "(surfaceid=0x%08X active=%d)", surfaceid, active);
331 if ((ilm_SetKeyboardFocusOn(surfaceid) != ILM_SUCCESS) ||
332 (ilm_commitChanges() != ILM_SUCCESS)) {
333 ICO_ERR("CicoSCWlWinMgrIF::setActive ilm_SetKeyboardFocusOn(%08x) Error", surfaceid);
337 //--------------------------------------------------------------------------
339 * @brief wrapper function of ilm_layerSetVisibility
341 * @param [in] surfaceid wayland surface id
342 * @param [in] layer id of layer
343 * @param [in] visible visible state
345 //--------------------------------------------------------------------------
347 CicoSCWlWinMgrIF::setLayerVisible(uint32_t layer, int32_t visible)
349 ICO_DBG("called: ilm_layerSetVisibility"
350 "(layer=%d visible=%d)", layer, visible);
351 if ((ilm_layerSetVisibility(layer, visible) != ILM_SUCCESS) ||
352 (ilm_commitChanges() != ILM_SUCCESS)) {
353 ICO_ERR("CicoSCWlWinMgrIF::setLayerVisible ilm_layerSetVisibility(%d,%d) Error",
358 //--------------------------------------------------------------------------
360 * @brief wrapper function of ilm_takeSurfaceScreenshot
362 * @param [in] surface id of wayland surface
363 * @param [in] filepath surface image pixel file path
365 //--------------------------------------------------------------------------
367 CicoSCWlWinMgrIF::setmapGet(int surfaceid, const char *filepath)
369 ICO_DBG("called: ilm_takeSurfaceScreenshot(filepath=%s,, surface=0x%08x)",
370 filepath ? filepath : "(null)", surfaceid);
371 if ((ilm_takeSurfaceScreenshot(filepath, surfaceid) != ILM_SUCCESS) ||
372 (ilm_commitChanges() != ILM_SUCCESS)) {
373 ICO_ERR("CicoSCWlWinMgrIF::setmapGet ilm_takeSurfaceScreenshot(%s,%x) Error",
374 filepath ? filepath : "(null)", surfaceid);
378 //--------------------------------------------------------------------------
380 * @brief wrapper function of ico_window_mgr_map_surface
382 * @param [in] surface id of wayland surface
383 * @param [in] framerate interval of changed notify[frame per second]
384 * @param [in] filepath surface image pixel file path
386 //--------------------------------------------------------------------------
388 CicoSCWlWinMgrIF::mapSurface(uint32_t surfaceid, int32_t framerate, const char *filepath)
390 ICO_DBG("called: ico_window_mgr_map_surface(surfaceid=0x%08X framerate=%d file=%s)",
391 surfaceid, framerate, filepath ? filepath : "(null)");
392 // currently GENIVI genivi-shell not support contents change, so use ico_window_mgr
393 if ((filepath != NULL) && (*filepath != 0) && (*filepath != ' ')) {
394 ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate, filepath);
397 ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate, " ");
401 //--------------------------------------------------------------------------
403 * @brief wrapper function of ico_window_mgr_unmap_surface
405 * @param [in] surface id of wayland surface
407 //--------------------------------------------------------------------------
409 CicoSCWlWinMgrIF::unmapSurface(uint32_t surfaceid)
411 ICO_DBG("called: ico_window_mgr_unmap_surface"
412 "(surfaceid=0x%08X)", surfaceid);
413 // currently GENIVI genivi-shell not support contents change, so use ico_window_mgr
414 ico_window_mgr_unmap_surface(m_winmgr, surfaceid);
417 //--------------------------------------------------------------------------
419 * @brief get creation surface window name(title) and pid
421 * @param [in] id_surface surface id
422 * @param [out] pid application process id
424 //--------------------------------------------------------------------------
426 CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(uint32_t id_surface, int *pid)
428 struct creation_surface_wait *tp = m_wait_surface_creation;
431 if (tp->id_surface == id_surface) {
432 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(%x) pid=%d title=<%s>",
433 id_surface, tp->pid, tp->title);
439 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(%x) dose not exist", id_surface);
443 //--------------------------------------------------------------------------
445 * @brief remove surface window
447 * @param [in] id_surface surface id
449 //--------------------------------------------------------------------------
451 CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(uint32_t id_surface)
453 struct creation_surface_wait *tp = m_wait_surface_creation;
454 struct creation_surface_wait *bp = NULL;
457 if (tp->id_surface == id_surface) {
462 m_wait_surface_creation = tp->next;
464 tp->next = m_free_surface_creation;
465 m_free_surface_creation = tp;
467 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) removed", id_surface);
471 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) dose not exist", id_surface);
474 //--------------------------------------------------------------------------
476 * @brief wayland surface active callback
478 * @param [in] data user data(unused)
479 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
480 * @param [in] surfaceid ico_window_mgr surface Id
481 * @param [in] select select device(unused)
482 * (0=not active/1=pointer/2=touch)
484 //--------------------------------------------------------------------------
486 CicoSCWlWinMgrIF::activeCB(void *data,
487 struct ico_window_mgr *ico_window_mgr,
491 ICO_WRN("CicoSCWlWinMgrIF::activeCB called.");
494 //--------------------------------------------------------------------------
496 * @brief surface map event callback
498 * @param [in] data user data(unused)
499 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
500 * @param [in] event event
501 * @param [in] surfaceid surface Id
502 * @param [in] type surface buffer type(EGL buffer/Shared memory)
503 * @param [in] width surface width
504 * @param [in] height surface height
505 * @param [in] stride surface buffer(frame buffer) stride
506 * @param [in] format surface buffer format
508 //--------------------------------------------------------------------------
510 CicoSCWlWinMgrIF::mapSurfaceCB(void *data,
511 struct ico_window_mgr *ico_window_mgr,
520 ICO_WRN("CicoSCWlWinMgrIF::mapSurfaceCB called.");
523 //--------------------------------------------------------------------------
525 * @brief surface update event callback
527 * @param [in] data user data(unused)
528 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
529 * @param [in] surfaceid surface Id
530 * @param [in] visible visibility
531 * @param [in] srcwidth application buffer width
532 * @param [in] srcheight application buffer height
535 * @param [in] width width
536 * @param [in] height height
538 //--------------------------------------------------------------------------
540 CicoSCWlWinMgrIF::updateSurfaceCB(void *data,
541 struct ico_window_mgr *ico_window_mgr,
551 ICO_WRN("CicoSCWlWinMgrIF::updateSurfaceCB called.");
554 //--------------------------------------------------------------------------
556 * @brief wayland surface destroy callback
558 * @param [in] data user data(unused)
559 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
560 * @param [in] surfaceid surface Id
562 //--------------------------------------------------------------------------
564 CicoSCWlWinMgrIF::destroySurfaceCB(void *data,
565 struct ico_window_mgr *ico_window_mgr,
568 ICO_WRN("CicoSCWlWinMgrIF::destroySurfaceCB called.");
571 //--------------------------------------------------------------------------
573 * @brief wayland update surface name callback
575 * @param [in] surfaceid surface Id
576 * @param [in] winname surface name (title)
578 //--------------------------------------------------------------------------
580 CicoSCWlWinMgrIF::updateWinnameCB(uint32_t surfaceid,
583 ICO_WRN("CicoSCWlWinMgrIF::updateWinnameCB called.");
586 //--------------------------------------------------------------------------
588 * @brief wayland display attribute callback
590 * @param [in] data user data(unused)
591 * @param [in] wl_output wayland wl_output interface
592 * @param [in] x display upper-left X coordinate
593 * @param [in] y display upper-left Y coordinate
594 * @param [in] physical_width display physical width
595 * @param [in] physical_height display physical height
596 * @param [in] subpixel display sub pixel
597 * @param [in] make display maker
598 * @param [in] model display model
599 * @param [in] transform transform
601 //--------------------------------------------------------------------------
603 CicoSCWlWinMgrIF::outputGeometryCB(void *data,
604 struct wl_output *wl_output,
607 int32_t physical_width,
608 int32_t physical_height,
614 ICO_WRN("CicoSCWlWinMgrIF::outputGeometryCB called.");
617 //--------------------------------------------------------------------------
619 * @brief wayland display mode callback
621 * @param [in] data user data(unused)
622 * @param [in] wl_output wayland wl_output interface
623 * @param [in] flags flags
624 * @param [in] width display width
625 * @param [in] height display height
626 * @param [in] refresh display refresh rate
628 //--------------------------------------------------------------------------
630 CicoSCWlWinMgrIF::outputModeCB(void *data,
631 struct wl_output *wl_output,
637 ICO_WRN("CicoSCWlWinMgrIF::outputModeCB called.");
640 //--------------------------------------------------------------------------
642 * @brief wayland genivi ivi-surface create callback
644 * @param [in] data user data(unused)
645 * @param [in] ivi_controller wayland ivi-controller plugin interface
646 * @param [in] id_surface surface id
648 //--------------------------------------------------------------------------
650 CicoSCWlWinMgrIF::createSurfaceCB(void *data,
651 struct ivi_controller *ivi_controller,
654 ICO_WRN("CicoSCWlWinMgrIF::createSurfaceCB called.");
657 //==========================================================================
659 //==========================================================================
661 //--------------------------------------------------------------------------
663 * @brief wayland surface active callback
665 * @param [in] data user data(unused)
666 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
667 * @param [in] surfaceid ico_window_mgr surface Id
668 * @param [in] select select device(unused)
669 * (0=not active/1=pointer/2=touch)
671 //--------------------------------------------------------------------------
673 CicoSCWlWinMgrIF::wlActiveCB(void *data,
674 struct ico_window_mgr *ico_window_mgr,
678 // ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Enter");
681 ICO_WRN("wlActiveCB: data is null");
684 static_cast<CicoSCWlWinMgrIF*>(data)->activeCB(data, ico_window_mgr,
686 // ICO_TRA("CicoSCWlWinMgrIF::wlActiveCB Leave");
689 //--------------------------------------------------------------------------
691 * @brief surface map event callback
693 * @param [in] data user data
694 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
695 * @param [in] event event
696 * @param [in] surfaceid surface Id
697 * @param [IN] type buffer type(fixed ICO_WINDOW_MGR_MAP_TYPE_EGL)
698 * @param [in] width surface width
699 * @param [in] height surface height
700 * @param [in] stride surface buffer(frame buffer) stride
701 * @param [in] format surface buffer format
703 //--------------------------------------------------------------------------
705 CicoSCWlWinMgrIF::wlMapSurfaceCB(void *data,
706 struct ico_window_mgr *ico_window_mgr,
715 // ICO_TRA("CicoSCWlWinMgrIF::wlMapSurfaceCB Enter");
718 ICO_WRN("wlMapSurfaceCB: data is null");
721 static_cast<CicoSCWlWinMgrIF*>(data)->mapSurfaceCB(data, ico_window_mgr,
726 // ICO_TRA("CicoSCWlWinMgrIF::wlMapSurfaceCB Leave");
729 //--------------------------------------------------------------------------
731 * @brief surface update event callback
733 * @param [in] data user data
734 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
735 * @param [in] surfaceid surface Id
736 * @param [in] visible visibility
737 * @param [in] srcwidth application buffer width
738 * @param [in] srcheight application buffer height
741 * @param [in] width width
742 * @param [in] height height
744 //--------------------------------------------------------------------------
746 CicoSCWlWinMgrIF::wlUpdateSurfaceCB(void *data,
747 struct ico_window_mgr *ico_window_mgr,
757 // ICO_TRA("CicoSCWlWinMgrIF::wlUpdateSurfaceCB Enter");
760 ICO_WRN("wlUpdateSurfaceCB: data is null");
763 static_cast<CicoSCWlWinMgrIF*>(data)->updateSurfaceCB(data, ico_window_mgr,
766 x, y, width, height);
767 // ICO_TRA("CicoSCWlWinMgrIF::wlUpdateSurfaceCB Leave");
770 //--------------------------------------------------------------------------
772 * @brief surface destroy event callback
774 * @param [in] data user data
775 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
776 * @param [in] surfaceid surface Id
778 //--------------------------------------------------------------------------
780 CicoSCWlWinMgrIF::wlDestroySurfaceCB(void *data,
781 struct ico_window_mgr *ico_window_mgr,
784 // ICO_TRA("CicoSCWlWinMgrIF::wlDestroySurfaceCB Enter");
787 ICO_WRN("wlDestroySurfaceCB: data is null");
790 wlIviCtrlRemoveSurface(surfaceid);
792 static_cast<CicoSCWlWinMgrIF*>(data)->destroySurfaceCB(data, ico_window_mgr,
794 // ICO_TRA("CicoSCWlWinMgrIF::wlDestroySurfaceCB Leave");
797 //--------------------------------------------------------------------------
799 * @brief wayland display attribute callback
801 * @param [in] data user data(unused)
802 * @param [in] wl_output wayland wl_output interface
803 * @param [in] x display upper-left X coordinate
804 * @param [in] y display upper-left Y coordinate
805 * @param [in] physical_width display physical width
806 * @param [in] physical_height display physical height
807 * @param [in] subpixel display sub pixel
808 * @param [in] make display maker
809 * @param [in] model display model
810 * @param [in] transform transform
812 //--------------------------------------------------------------------------
814 CicoSCWlWinMgrIF::wlOutputGeometryCB(void *data,
815 struct wl_output *wl_output,
818 int32_t physical_width,
819 int32_t physical_height,
825 // ICO_TRA("CicoSCWlWinMgrIF::wlOutputGeometryCB Enter");
828 ICO_WRN("wlOutputGeometryCB: data is null");
831 static_cast<CicoSCWlWinMgrIF*>(data)->outputGeometryCB(data, wl_output,
839 // ICO_TRA("CicoSCWlWinMgrIF::wlOutputGeometryCB Leave");
842 //--------------------------------------------------------------------------
844 * @brief wayland display mode callback
846 * @param [in] data user data(unused)
847 * @param [in] wl_output wayland wl_output interface
848 * @param [in] flags flags
849 * @param [in] width display width
850 * @param [in] height display height
851 * @param [in] refresh display refresh rate
853 //--------------------------------------------------------------------------
855 CicoSCWlWinMgrIF::wlOutputModeCB(void *data,
856 struct wl_output *wl_output,
862 // ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Enter");
865 ICO_WRN("wlOutputGeometryCB: data is null");
868 static_cast<CicoSCWlWinMgrIF*>(data)->outputModeCB(data, wl_output, flags,
869 width, height, refresh);
870 // ICO_TRA("CicoSCWlWinMgrIF::wlOutputModeCB Leave");
873 //--------------------------------------------------------------------------
875 * @brief wayland ivi-shell ivi-application protocol error callback
877 * @param [in] data user data(unused)
878 * @param [in] ivi_application wayland ivi-application interface
879 * @param [in] error_code error code
880 * @param [in] error_text error message
882 //--------------------------------------------------------------------------
884 CicoSCWlWinMgrIF::wlIviAppErrorCB(void *data,
885 struct ivi_application *ivi_application,
886 int32_t error_code, const char *error_text)
888 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppErrorCB: Enter(%d,%s)",
889 error_code, error_text ? error_text : "(null)");
892 ICO_WRN("CicoSCWlWinMgrIF::wlIviAppErrorCB: data is null");
895 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppErrorCB: Leave");
898 //--------------------------------------------------------------------------
900 * @brief wayland ivi-shell ivi-application protocol create wl_surface callback
902 * @param [in] data user data(unused)
903 * @param [in] ivi_application wayland ivi-application interface
904 * @param [in] pid application process id
905 * @param [in] title surface title name
907 //--------------------------------------------------------------------------
909 CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB(void *data,
910 struct ivi_application *ivi_application,
911 int32_t pid, const char *title)
913 struct creation_surface_wait *tp;
914 struct creation_surface_wait *tp2;
916 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Enter(%d,<%s>)",
917 pid, title ? title : "(null)");
920 ICO_WRN("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave(data is null)");
924 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave(no title)");
928 // bind wl_surface to ivi_surface
929 tp = m_free_surface_creation;
931 m_free_surface_creation = tp->next;
934 tp = (struct creation_surface_wait *)malloc(sizeof(struct creation_surface_wait));
936 ICO_ERR("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: out of memory");
939 memset(tp, 0, sizeof(struct creation_surface_wait));
941 tp2 = m_wait_surface_creation;
943 m_wait_surface_creation = tp;
945 strncpy(tp->title, title, ICO_SYC_MAX_WINNAME_LEN-1);
946 tp->busy = SCWINMGR_GENIVI_BUSY_WAIT;
948 if (tp2->busy != SCWINMGR_GENIVI_BUSY_NONE) break;
952 tp->busy = SCWINMGR_GENIVI_BUSY_REQSURF;
953 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: "
954 "call ivi_controller_get_native_handle(%d,<%s>)", pid, title);
955 ivi_controller_get_native_handle(m_ivi_ctrl, pid, title);
957 ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave");
960 //--------------------------------------------------------------------------
962 * @brief wayland ivi-shell ivi-controller protocol create screen callback
964 * @param [in] data user data(unused)
965 * @param [in] ivi_controller wayland ivi-controller interface
966 * @param [in] id_screen screen id
967 * @param [in] screen screen information
969 //--------------------------------------------------------------------------
971 CicoSCWlWinMgrIF::wlIviCtrlScreenCB(void *data,
972 struct ivi_controller *ivi_controller,
974 struct ivi_controller_screen *screen)
976 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: Enter(%x)", id_screen);
979 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: data is null");
982 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlScreenCB: Leave");
985 //--------------------------------------------------------------------------
987 * @brief wayland ivi-shell ivi-controller protocol create layer callback
989 * @param [in] data user data(unused)
990 * @param [in] ivi_controller wayland ivi-controller interface
991 * @param [in] id_layer layer id
993 //--------------------------------------------------------------------------
995 CicoSCWlWinMgrIF::wlIviCtrlLayerCB(void *data,
996 struct ivi_controller *ivi_controller,
999 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: Enter(%x)", id_layer);
1002 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: data is null");
1005 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlLayerCB: Leave");
1008 //--------------------------------------------------------------------------
1010 * @brief wayland ivi-shell ivi-controller protocol create surface callback
1012 * @param [in] data user data(unused)
1013 * @param [in] ivi_controller wayland ivi-controller interface
1014 * @param [in] id_surface surface id
1016 //--------------------------------------------------------------------------
1018 CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB(void *data,
1019 struct ivi_controller *ivi_controller,
1020 uint32_t id_surface)
1022 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: Enter(%x)", id_surface);
1025 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: data is null");
1029 static_cast<CicoSCWlWinMgrIF*>(data)->createSurfaceCB(data, ivi_controller, id_surface);
1031 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlSurfaceCB: Leave");
1034 //--------------------------------------------------------------------------
1036 * @brief wayland ivi-shell ivi-controller protocol error callback
1038 * @param [in] data user data(unused)
1039 * @param [in] ivi_controller wayland ivi-controller interface
1040 * @param [in] error_code error code
1041 * @param [in] error_text error message
1043 //--------------------------------------------------------------------------
1045 CicoSCWlWinMgrIF::wlIviCtrlErrorCB(void *data,
1046 struct ivi_controller *ivi_controller,
1047 int32_t object_id, int32_t object_type,
1048 int32_t error_code, const char *error_text)
1050 struct creation_surface_wait *tp;
1051 struct creation_surface_wait *tp2;
1053 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: Enter(%d[%d],%d,<%s>)",
1054 object_id, object_type, error_code, error_text ? error_text : "(null)");
1057 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: data is null");
1061 // search request wait
1062 tp = m_wait_surface_creation;
1065 if (tp->busy == SCWINMGR_GENIVI_BUSY_WAIT) {
1068 else if (tp->busy != SCWINMGR_GENIVI_BUSY_NONE) {
1069 tp->busy = SCWINMGR_GENIVI_BUSY_NONE;
1074 tp2->busy = SCWINMGR_GENIVI_BUSY_REQSURF;
1075 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: "
1076 "call ivi_controller_get_native_handle(%d,<%s>)", tp2->pid, tp2->title);
1077 ivi_controller_get_native_handle(m_ivi_ctrl, tp2->pid, tp2->title);
1079 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlErrorCB: Leave");
1082 //--------------------------------------------------------------------------
1084 * @brief wayland ivi-shell ivi-controller protocol error callback
1086 * @param [in] data user data(unused)
1087 * @param [in] ivi_controller wayland ivi-controller interface
1088 * @param [in] error_code error code
1089 * @param [in] error_text error message
1091 //--------------------------------------------------------------------------
1093 CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB(void *data,
1094 struct ivi_controller *ivi_controller,
1095 struct wl_surface *surface)
1097 uint32_t id_surface;
1098 struct creation_surface_wait *tp;
1099 struct creation_surface_wait *tp2;
1100 struct creation_surface_wait *bp;
1102 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Enter(surf=%08x)", (int)surface);
1105 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(data is null)");
1109 // check same surface
1110 tp = m_wait_surface_creation;
1113 if (tp->busy == SCWINMGR_GENIVI_BUSY_REQSURF) break;
1118 ICO_WRN("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(no request)");
1121 if (tp->surface == surface) {
1122 tp->busy = SCWINMGR_GENIVI_BUSY_NONE;
1123 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: winname change(%08x,<%s>)",
1124 tp->id_surface, tp->title);
1125 id_surface = tp->id_surface;
1126 static_cast<CicoSCWlWinMgrIF*>(data)->updateWinnameCB(id_surface, tp->title);
1128 // title change, delete old table
1129 tp2 = m_wait_surface_creation;
1133 if (tp2->surface == surface) {
1135 bp->next = tp2->next;
1138 m_wait_surface_creation = tp2->next;
1140 tp2->next = m_free_surface_creation;
1141 m_free_surface_creation = tp2;
1142 tp2 = m_wait_surface_creation;
1152 // create ivi-surface and bind to wl_surface
1154 if (m_id_surface >= 0x00ffffff) m_id_surface = 1;
1155 id_surface = m_id_surface | 0x40000000;
1157 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: "
1158 "call ivi_application_surface_create(%08x)", id_surface);
1159 if (ivi_application_surface_create(m_ivi_app, id_surface, surface) == NULL) {
1160 ICO_ERR("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: "
1161 "ivi_application_surface_create(%08x) Error", id_surface);
1163 bp->next = tp->next;
1166 m_wait_surface_creation = tp->next;
1168 tp->next = m_free_surface_creation;
1169 m_free_surface_creation = tp;
1172 tp->surface = surface;
1173 tp->id_surface = id_surface;
1174 tp->busy = SCWINMGR_GENIVI_BUSY_REQBIND;
1178 // search request wait
1179 tp = m_wait_surface_creation;
1182 if (tp->busy == SCWINMGR_GENIVI_BUSY_WAIT) {
1185 else if (tp->busy != SCWINMGR_GENIVI_BUSY_NONE) {
1190 if ((tp == NULL) && (tp2 != NULL)) {
1191 tp2->busy = SCWINMGR_GENIVI_BUSY_REQSURF;
1192 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: "
1193 "call ivi_controller_get_native_handle(%d,<%s>)", tp2->pid, tp2->title);
1194 ivi_controller_get_native_handle(m_ivi_ctrl, tp2->pid, tp2->title);
1196 ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlNativeHandleCB: Leave(id_surface=%08x)", id_surface);
1198 // vim:set expandtab ts=4 sw=4: