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 CicoSCWindowController.cpp
14 * @brief This file implementation of CicoSCWindowController class
16 //==========================================================================
24 #include <sys/types.h>
25 #include <sys/ioctl.h>
34 #include "CicoSCWindow.h"
35 #include "CicoSCWayland.h"
36 #include "CicoSCWindowController.h"
39 #include "CicoSystemConfig.h"
41 #include "CicoSCDisplay.h"
42 #include "CicoSCLayer.h"
43 #include "CicoSCDisplayZone.h"
44 #include "ico_syc_error.h"
45 #include "ico_syc_type.h"
46 #include "ico_syc_winctl.h"
47 #include "CicoSCCommand.h"
48 #include "ico_syc_msg_cmd_def.h"
49 #include "CicoSCServer.h"
50 #include "CicoSCMessage.h"
51 #include "CicoSCMessageRes.h"
52 #include "CicoSCLifeCycleController.h"
53 #include "CicoSCResourceManager.h"
55 //==========================================================================
56 // private static variable
57 //==========================================================================
58 CicoSCWindowController* CicoSCWindowController::ms_myInstance = NULL;
60 struct ico_sc_win_check_t* CicoSCWindowController::win_check_timer = NULL;
61 struct ico_sc_win_check_t* CicoSCWindowController::win_check_free = NULL;
63 //==========================================================================
64 // static function for Ecore timer
65 //==========================================================================
66 static Ecore_Timer* g_SCWindowChecker = 0;
67 static struct timeval g_lasttime = { 0, 0 };
68 static int g_hightimer = 0;
70 //--------------------------------------------------------------------------
72 * @brief get instance of CicoSCWindowController
74 * @return instance of CicoSCWindowController
76 //--------------------------------------------------------------------------
77 CicoSCWindowController*
78 CicoSCWindowController::getInstance(void)
80 if (NULL == ms_myInstance) {
81 ms_myInstance = new CicoSCWindowController();
86 //--------------------------------------------------------------------------
88 * @brief default constructor
90 //--------------------------------------------------------------------------
91 CicoSCWindowController::CicoSCWindowController()
92 : m_resMgr(NULL), m_physicalDisplayTotal(0)
94 CicoSCWayland* wayland = CicoSCWayland::getInstance();
95 wayland->getInstance()->addWaylandIF(ICO_WL_IVI_CONTROLLER_IF, this);
96 #ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */
97 wayland->getInstance()->addWaylandIF(ICO_WL_IVI_APPLICATION_IF, this);
98 #endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */
99 wayland->getInstance()->addWaylandIF(ICO_WL_OUTPUT_IF, this);
102 CicoSCWindowController::ms_myInstance = this;
104 g_SCWindowChecker = ecore_timer_add(((double)ICO_SC_WINCHK_TIMER_BASE_L)/1000.0,
105 ico_SCWindowChecker, this);
108 //--------------------------------------------------------------------------
112 //--------------------------------------------------------------------------
113 CicoSCWindowController::~CicoSCWindowController()
115 CicoSCWindowController::ms_myInstance = NULL;
118 //--------------------------------------------------------------------------
120 * @brief initialize display and window database
122 //--------------------------------------------------------------------------
124 CicoSCWindowController::initDB(void)
126 ICO_TRA("CicoSCWindowController::initDB: Enter");
128 const vector<CicoSCDisplayConf*>& displayList =
129 CicoSystemConfig::getInstance()->getDisplayConfList();
130 vector<CicoSCDisplayConf*>::const_iterator itr;
131 itr = displayList.begin();
132 for (; itr != displayList.end(); ++itr) {
133 CicoSCDisplay *display = new CicoSCDisplay();
134 display->displayid = (*itr)->id;
135 display->type = (*itr)->type;
136 display->nodeid = (*itr)->node;
137 display->displayno = (*itr)->no;
138 display->width = (*itr)->width;
139 display->height = (*itr)->height;
140 display->name = (*itr)->name;
142 vector<CicoSCLayerConf*>::const_iterator itr2;
143 itr2 = (*itr)->layerConfList.begin();
144 for (; itr2 != (*itr)->layerConfList.end(); ++itr2) {
145 CicoSCLayer *layer = new CicoSCLayer();
146 layer->layerid = (*itr2)->id;
147 layer->type = (*itr2)->type;
148 layer->width = display->width;
149 layer->height = display->height;
150 layer->displayid = display->displayid;
151 layer->menuoverlap = (*itr2)->menuoverlap;
152 display->layerList.push_back(layer);
155 vector<CicoSCDisplayZoneConf*>::const_iterator itr3;
156 itr3 = (*itr)->zoneConfList.begin();
157 for (; itr3 != (*itr)->zoneConfList.end(); ++itr3) {
158 CicoSCDisplayZone *zone = new CicoSCDisplayZone();
159 zone->zoneid = (*itr3)->id;
160 zone->x = (*itr3)->x;
161 zone->y = (*itr3)->y;
162 zone->width = (*itr3)->w;
163 zone->height = (*itr3)->h;
164 zone->fullname = (*itr3)->fullname;
165 zone->aspectFixed = (*itr3)->aspectFixed;
166 zone->aspectAlignLeft = (*itr3)->aspectAlignLeft;
167 zone->aspectAlignRight = (*itr3)->aspectAlignRight;
168 zone->aspectAlignTop = (*itr3)->aspectAlignTop;
169 zone->aspectAlignBottom = (*itr3)->aspectAlignBottom;
170 display->zoneList[zone->zoneid] = zone;
173 m_displayList.push_back(display);
176 ICO_TRA("CicoSCWindowController::initDB: Leave");
180 //--------------------------------------------------------------------------
182 * @brief set resource manager instance
184 * @param [in] resMgr resource manager instance
186 //--------------------------------------------------------------------------
188 CicoSCWindowController::setResourceManager(CicoSCResourceManager *resMgr)
193 //--------------------------------------------------------------------------
195 * @brief show a target window
197 * @param [in] surfaceid wayland surface id
198 * @param [in] animation animation name
199 * @param [in] animationTime animation time
201 * @return ICO_SYC_EOK on success, other on error
202 * @retval ICO_SYC_EOK success
203 * @retval ICO_SYC_ESRCH error(not initialized)
204 * @retval ICO_SYC_ENOENT error(not exist)
206 //--------------------------------------------------------------------------
208 CicoSCWindowController::show(int surfaceid,
209 const char *animation,
212 int type = animationTime & ICO_SYC_WIN_SURF_FLAGS;
213 animationTime &= ~ICO_SYC_WIN_SURF_FLAGS;
215 ICO_TRA("CicoSCWindowController::show Enter"
216 "(surfaceid=%08x animation=%s type=%x animationTime=%d)",
217 surfaceid, animation, type, animationTime);
219 // find window information in window list
220 CicoSCWindow *window = findWindow(surfaceid);
221 if (NULL == window) {
222 ICO_WRN("not found window information");
223 ICO_TRA("CicoSCWindowController::show Leave(ENOENT)");
224 return ICO_SYC_ENOENT;
227 // update visible attr
228 window->visible = true;
230 // update current displayed window at display zone
231 CicoSCDisplayZone* zone = (CicoSCDisplayZone*)findDisplayZone(window->zoneid);
233 CicoSCLayer *layer = findLayer(window->displayid, window->layerid);
234 if ((NULL != layer) && (layer->type == ICO_LAYER_TYPE_APPLICATION)) {
235 ICO_DBG("Entry display zone[%d] current displayed window"
237 zone->zoneid, window->surfaceid, window->appid.c_str());
238 zone->displayedWindow = window;
242 // set animation request
243 int raiseFlag = ICO_SYC_WIN_RAISE_NOCHANGE;
244 if (type & ICO_SYC_WIN_SURF_RAISE) {
245 raiseFlag = ICO_SYC_WIN_RAISE_RAISE;
247 else if (type & ICO_SYC_WIN_SURF_LOWER) {
248 raiseFlag = ICO_SYC_WIN_RAISE_LOWER;
250 else if (((type & ICO_SYC_WIN_SURF_NOCHANGE) == 0) &&
251 (false == window->raise)) {
252 raiseFlag = ICO_SYC_WIN_RAISE_RAISE;
254 if ((animationTime > 0) && (NULL != animation) &&
255 (animation[0] != '\0') && (strcasecmp(animation, "none") != 0)) {
257 setWindowAnimation(window, ICO_SC_WINANIMA_SHOW, animation, animationTime);
261 resetWindowAnimation(window);
264 // set raise/lower request (if need)
265 if (raiseFlag != ICO_SYC_WIN_RAISE_NOCHANGE) {
266 raiselower(window, (raiseFlag == ICO_SYC_WIN_RAISE_RAISE));
269 // set visible request
270 CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_SYC_WIN_VISIBLE_SHOW);
273 CicoSCWayland::getInstance()->flushDisplay();
275 ICO_TRA("CicoSCWindowController::show Leave(EOK)");
279 //--------------------------------------------------------------------------
281 * @brief raise/lower a target window
283 * @param [in] window target window
284 * @param [in] raise raise(true)/lower(false)
288 //--------------------------------------------------------------------------
290 CicoSCWindowController::raiselower(CicoSCWindow *window, bool raise)
292 ICO_TRA("CicoSCWindowController::raiselower(%08x,%d)", window->surfaceid, raise);
294 window->raise = raise;
296 CicoSCLayer* layer = findLayer(window->displayid, window->layerid);
298 ICO_ERR("CicoSCWindowController::raiselower: surface.%08x has no layer(%d)",
299 window->surfaceid, window->layerid);
302 if ((raise) && (layer->is_topSurface(window->surfaceid))) {
303 ICO_DBG("CicoSCWindowController::raiselower %08x raise but top",
306 else if ((! raise) && (layer->is_buttomSurface(window->surfaceid))) {
307 ICO_DBG("CicoSCWindowController::raiselower %08x lower but buttom",
311 layer->addSurface(window->surfaceid, raise);
314 const int *surfs = layer->getSurfaces(&nsurf);
315 ICO_TRA("CicoSCWindowControllerCicoSCWindowController layer.%d %d.%x %x %x %x",
316 window->layerid, nsurf, surfs[0], surfs[1], surfs[2], surfs[3]);
318 ICO_TRA("CicoSCWindowControllerCicoSCWindowController .%x %x %x %x",
319 surfs[4], surfs[5], surfs[6], surfs[7]);
321 if (ilm_layerSetRenderOrder(window->layerid, (t_ilm_layer *)surfs, nsurf)
323 ICO_ERR("CicoSCWindowController::raiselower "
324 "ilm_layerSetRenderOrder(%d,,%d) Error", window->layerid, nsurf);
329 //--------------------------------------------------------------------------
331 * @brief hide a target window
333 * @param [in] surfaceid wayland surface id
334 * @param [in] animation animation name
335 * @param [in] animationTime animation time
337 * @return ICO_SYC_EOK on success, other on error
338 * @retval ICO_SYC_EOK success
339 * @retval ICO_SYC_ESRCH error(not initialized)
340 * @retval ICO_SYC_ENOENT error(not exist)
342 //--------------------------------------------------------------------------
344 CicoSCWindowController::hide(int surfaceid,
345 const char *animation,
348 int type = animationTime & ICO_SYC_WIN_SURF_FLAGS;
349 animationTime &= ~ICO_SYC_WIN_SURF_FLAGS;
351 ICO_TRA("CicoSCWindowController::hide Enter"
352 "(surfaceid=%08x animation=%s type=%x animationTime=%d)",
353 surfaceid, animation, type, animationTime);
355 // find window information in window list
356 CicoSCWindow *window = findWindow(surfaceid);
357 if (NULL == window) {
358 ICO_WRN("not found window information");
359 ICO_TRA("CicoSCWindowController::hide Leave(ENOENT)");
360 return ICO_SYC_ENOENT;
363 if (false == window->visible) {
364 ICO_DBG("already hide state");
365 ICO_TRA("CicoSCWindowController::hide Leave(EOK)");
369 // update window attr
370 window->visible = false;
372 // update current displayed window at display zone
373 CicoSCDisplayZone* zone = (CicoSCDisplayZone*)findDisplayZone(window->zoneid);
375 CicoSCLayer *layer = findLayer(window->displayid, window->layerid);
376 if ((NULL != layer) && (layer->type == ICO_LAYER_TYPE_APPLICATION) &&
377 (getDisplayedWindow(zone->zoneid) == surfaceid)) {
378 ICO_DBG("Exit display zone[%d] current displayed window"
380 zone->zoneid, window->surfaceid, window->appid.c_str());
381 zone->displayedWindow = NULL;
385 if ((animationTime > 0) && (NULL != animation) &&
386 (animation[0] != '\0') && (strcasecmp(animation, "none") != 0)) {
388 setWindowAnimation(window, ICO_SC_WINANIMA_HIDE, animation, animationTime);
392 resetWindowAnimation(window);
393 CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_SYC_WIN_VISIBLE_HIDE);
397 CicoSCWayland::getInstance()->flushDisplay();
399 ICO_TRA("CicoSCWindowController::hide Leave(EOK)");
403 //--------------------------------------------------------------------------
405 * @brief resize window(surface) size
407 * @param [in] surfaceid wayland surface id
408 * @param [in] w window width
409 * @param [in] h window height
410 * @param [in] animation animation name
411 * @param [in] animationTime animation time
413 * @return ICO_SYC_EOK on success, other on error
414 * @retval ICO_SYC_EOK success
415 * @retval ICO_SYC_ESRCH error(not initialized)
416 * @retval ICO_SYC_ENOENT error(window dose not exist)
418 //--------------------------------------------------------------------------
420 CicoSCWindowController::resize(int surfaceid,
423 const char *animation,
426 int type = animationTime & ICO_SYC_WIN_SURF_FLAGS;
427 animationTime &= ~ICO_SYC_WIN_SURF_FLAGS;
429 ICO_TRA("CicoSCWindowController::resize Enter"
430 "(surfaceid=%08x h=%d w=%d animation=%s type=%x animationTime=%d)",
431 surfaceid, w, h, animation, type, animationTime);
433 // find window information in window list
434 CicoSCWindow *window = findWindow(surfaceid);
435 if (NULL == window) {
436 ICO_WRN("not found window information");
437 ICO_TRA("CicoSCWindowController::resize Leave(ENOENT)");
438 return ICO_SYC_ENOENT;
441 // set visible request
444 CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, window->nodeid,
445 window->x, window->y, w, h);
448 CicoSCWayland::getInstance()->flushDisplay();
450 ICO_TRA("CicoSCWindowController::resize Leave(EOK)");
454 //--------------------------------------------------------------------------
456 * @brief move window(surface) position
458 * @param [in] surfaceid wayland surface id
459 * @param [in] nodeid node id
460 * @param [in] x window width
461 * @param [in] y window height
462 * @param [in] animation animation name
463 * @param [in] animationTime animation time
465 * @return ICO_SYC_EOK on success, other on error
466 * @retval ICO_SYC_EOK success
467 * @retval ICO_SYC_ESRCH error(not initialized)
468 * @retval ICO_SYC_ENOENT error(window dose not exist)
470 //--------------------------------------------------------------------------
472 CicoSCWindowController::move(int surfaceid,
476 const char *animation,
479 int type = animationTime & ICO_SYC_WIN_SURF_FLAGS;
480 animationTime &= ~ICO_SYC_WIN_SURF_FLAGS;
482 ICO_TRA("CicoSCWindowController::move Enter"
483 "(surfaceid=%08x nodeid=%d x=%d y=%d "
484 "animation=%s type=%x animationTime=%d)",
485 surfaceid, nodeid, x, y, animation, type, animationTime);
487 // find window information in window list
488 CicoSCWindow *window = findWindow(surfaceid);
489 if (NULL == window) {
490 ICO_WRN("CicoSCWindowController::move not found window(%08x)", surfaceid);
491 ICO_TRA("CicoSCWindowController::move Leave(ENOENT)");
492 return ICO_SYC_ENOENT;
495 if (nodeid >= (int)m_physicalDisplayTotal) {
496 ICO_WRN("CicoSCWindowController::move not found node(%d)", nodeid);
497 ICO_TRA("CicoSCWindowController::move Leave(ENOENT)");
498 return ICO_SYC_ENOENT;
501 int moveNodeId = ICO_SYC_WIN_NOCHANGE;
506 // set visible request
509 CicoSCWlWinMgrIF::setPositionsize(window->surfaceid,
511 window->width, window->height);
514 CicoSCWayland::getInstance()->flushDisplay();
516 ICO_TRA("CicoSCWindowController::move Leave(EOK)");
520 //--------------------------------------------------------------------------
522 * @brief raise window(surface)
524 * @param [in] surfaceid wayland surface id
525 * @param [in] animation animation name
526 * @param [in] animationTime animation time
528 * @return ICO_SYC_EOK on success, other on error
529 * @retval ICO_SYC_EOK success
530 * @retval ICO_SYC_ESRCH error(not initialized)
531 * @retval ICO_SYC_ENOENT error(layer dose not exist)
533 //--------------------------------------------------------------------------
535 CicoSCWindowController::raise(int surfaceid,
536 const char *animation,
539 int type = animationTime & ICO_SYC_WIN_SURF_FLAGS;
540 animationTime &= ~ICO_SYC_WIN_SURF_FLAGS;
542 ICO_TRA("CicoSCWindowController::raise Enter"
543 "(surfaceid=%08x animation=%s type=%x animationTime=%d)",
544 surfaceid, animation, type, animationTime);
546 // find window information in window list
547 CicoSCWindow *window = findWindow(surfaceid);
548 if (NULL == window) {
549 ICO_WRN("not found window information");
550 ICO_TRA("CicoSCWindowController::raise Leave(ENOENT)");
551 return ICO_SYC_ENOENT;
555 raiselower(window, true);
556 if (ilm_commitChanges() != ILM_SUCCESS) {
557 ICO_ERR("CicoSCWindowController::raise ilm_commitChanges() Error");
561 CicoSCWayland::getInstance()->flushDisplay();
563 ICO_TRA("CicoSCWindowController::raise Leave(EOK)");
567 //--------------------------------------------------------------------------
569 * @brief set window(surface) geometry
571 * @param [in] surfaceid wayland surface id
572 * @param [in] nodeid node id
573 * @param [in] layerid layer id
574 * @param [in] x window x position
575 * @param [in] y window y position
576 * @param [in] w window width
577 * @param [in] h window height
578 * @param [in] resizeAnimation resize animation name
579 * @param [in] resizeAnimationTime resize animation time
580 * @param [in] moveAnimation move animation name
581 * @param [in] moveanimationTime move animation time
583 * @return ICO_SYC_EOK on success, other on error
584 * @retval ICO_SYC_EOK success
585 * @retval ICO_SYC_ESRCH error(not initialized)
586 * @retval ICO_SYC_ENOENT error(window dose not exist)
588 //--------------------------------------------------------------------------
590 CicoSCWindowController::setGeometry(int surfaceid,
597 const char *resizeAnimation,
598 int resizeAnimationTime,
599 const char *moveAnimation,
600 int moveAnimationTime)
602 ICO_TRA("CicoSCWindowController::setGeometry Enter"
603 "(surfaceid=%08x nodeid=%d layerid=%d x=%d y=%d w=%d h=%d "
604 "resizeAnimation=%s resizeAnimationTime=%d "
605 "moveAnimation=%s moveAnimationTime=%d)",
606 surfaceid, nodeid, layerid, x, y, w, h,
607 resizeAnimation, resizeAnimationTime,
608 moveAnimation, moveAnimationTime);
610 // find window information in window list
611 CicoSCWindow *window = findWindow(surfaceid);
612 if (NULL == window) {
613 ICO_WRN("CicoSCWindowController::setGeometry not found window(%08x)", surfaceid);
614 ICO_TRA("CicoSCWindowController::setGeometry Leave(ENOENT)");
615 return ICO_SYC_ENOENT;
618 if (nodeid >= (int)m_physicalDisplayTotal) {
619 ICO_WRN("CicoSCWindowController::setGeometry not found node(%d)", nodeid);
620 ICO_TRA("CicoSCWindowController::setGeometry Leave(ENOENT)");
621 return ICO_SYC_ENOENT;
624 int moveNodeId = ICO_SYC_WIN_NOCHANGE;
629 moveNodeId = window->nodeid;
632 if (m_physicalDisplayTotal <= (unsigned int)moveNodeId) {
633 ICO_WRN("nodeid(%d) is over physical display total(%d)",
634 m_physicalDisplayTotal, nodeid);
635 ICO_TRA("CicoSCWindowController::setGeometry Leave(EINVAL)");
636 return ICO_SYC_EINVAL;
639 int moveX = window->x;
645 int moveY = window->y;
651 int moveW = window->width;
657 int moveH = window->height;
665 setWindowLayer(window->surfaceid, layerid);
668 // update window attr
669 window->nodeid = moveNodeId;
671 // set visible request
672 CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, moveNodeId,
673 moveX, moveY, moveW, moveH);
676 CicoSCWayland::getInstance()->flushDisplay();
678 ICO_TRA("CicoSCWindowController::setGeometry Leave(EOK)");
682 //--------------------------------------------------------------------------
684 * @brief set window(surface) geometry
686 * @param [in] surfaceid wayland surface id
687 * @param [in] layerid layer id
688 * @param [in] nodeid node id
689 * @param [in] zone display zone name
690 * @param [in] resizeAnimation resize animation name
691 * @param [in] resizeAnimationTime resize animation time
692 * @param [in] moveAnimation move animation name
693 * @param [in] moveanimationTime move animation time
695 * @return ICO_SYC_EOK on success, other on error
696 * @retval ICO_SYC_EOK success
697 * @retval ICO_SYC_ESRCH error(not initialized)
698 * @retval ICO_SYC_ENOENT error(window dose not exist)
699 * @retval ICO_SYC_EINVAL error(zone is null, zone name is invalid)
701 //--------------------------------------------------------------------------
703 CicoSCWindowController::setGeometry(int surfaceid,
706 const char *resizeAnimation,
707 int resizeAnimationTime,
708 const char *moveAnimation,
709 int moveAnimationTime)
711 ICO_TRA("CicoSCWindowController::setGeometry Enter"
712 "(surfaceid=%08x zone=%s layerid=%d "
713 "resizeAnimation=%s resizeAnimationTime=%d "
714 "moveAnimation=%s moveAnimationTime=%d)",
715 surfaceid, zone, layerid,
716 resizeAnimation, resizeAnimationTime,
717 moveAnimation, moveAnimationTime);
719 // find window information in window list
720 CicoSCWindow *window = findWindow(surfaceid);
721 if (NULL == window) {
722 ICO_WRN("CicoSCWindowController::setGeometry not found window(%08x)", surfaceid);
723 ICO_TRA("CicoSCWindowController::setGeometry Leave(ENOENT)");
724 return ICO_SYC_ENOENT;
727 // find zone information
728 if ((NULL == zone) || ('\0' == zone[0])) {
729 ICO_WRN("zone value is invalid");
730 ICO_TRA("CicoSCWindowController::setGeometry Leave(EINVAL)");
731 return ICO_SYC_EINVAL;
734 vector<CicoSCDisplay*>::iterator itr;
735 itr = m_displayList.begin();
736 CicoSCDisplayZone* dispzone = NULL;
738 for (; itr != m_displayList.end(); ++itr) {
739 dispzone = (*itr)->findDisplayZonebyFullName(zone);
740 if (NULL != dispzone) {
741 displayno = (*itr)->displayno;
745 if (NULL == dispzone) {
746 ICO_WRN("display zone name(%s) is invalid.", zone);
747 ICO_TRA("CicoSCWindowController::setGeometry Leave(EINVAL)");
748 return ICO_SYC_EINVAL;
750 if (m_physicalDisplayTotal <= (unsigned int)displayno) {
751 ICO_WRN("nodeid(%d) is over physical display total(%d)",
752 m_physicalDisplayTotal, displayno);
753 ICO_TRA("CicoSCWindowController::setGeometry Leave(EINVAL)");
754 return ICO_SYC_EINVAL;
757 if (window->zoneid != dispzone->zoneid) {
758 // update current displayed window at display zone
759 CicoSCDisplayZone* olddispzone = (CicoSCDisplayZone*)findDisplayZone(window->zoneid);
760 if (NULL != olddispzone) {
761 CicoSCLayer *layer = findLayer(window->displayid, window->layerid);
762 if ((NULL != layer) &&
763 (layer->type == ICO_LAYER_TYPE_APPLICATION) &&
764 (getDisplayedWindow(olddispzone->zoneid) == surfaceid)) {
765 ICO_DBG("Exit display zone[%d] current displayed window"
767 olddispzone->zoneid, window->surfaceid,
768 window->appid.c_str());
769 olddispzone->displayedWindow = NULL;
773 CicoSCLayer *layer = findLayer(displayno, window->layerid);
774 if ((NULL != layer) && (layer->type == ICO_LAYER_TYPE_APPLICATION)) {
775 ICO_DBG("Entry display zone[%d] current displayed window"
777 dispzone->zoneid, window->surfaceid, window->appid.c_str());
778 dispzone->displayedWindow = window;
782 // update window attr
783 window->zoneid = dispzone->zoneid;
784 window->zone = dispzone->fullname;
785 setAttributes(window->surfaceid);
787 int ret = setGeometry(surfaceid, displayno, layerid,
788 dispzone->x, dispzone->y,
789 dispzone->width, dispzone->height,
790 resizeAnimation, resizeAnimationTime,
791 moveAnimation, moveAnimationTime);
793 ICO_TRA("CicoSCWindowController::setGeometry Leave(EOK)");
797 //--------------------------------------------------------------------------
799 * @brief lower window(surface)
801 * @param [in] surfaceid wayland surface id
802 * @param [in] animation animation name
803 * @param [in] animationTime animation time
805 * @return ICO_SYC_EOK on success, other on error
806 * @retval ICO_SYC_EOK success
807 * @retval ICO_SYC_ESRCH error(not initialized)
808 * @retval ICO_SYC_ENOENT error(layer dose not exist)
810 //--------------------------------------------------------------------------
812 CicoSCWindowController::lower(int surfaceid,
813 const char *animation,
816 int type = animationTime & ICO_SYC_WIN_SURF_FLAGS;
817 animationTime &= ~ICO_SYC_WIN_SURF_FLAGS;
819 ICO_TRA("CicoSCWindowController::lower Enter"
820 "(surfaceid=08x animation=%s type=%x animationTime=%d)",
821 surfaceid, animation, type, animationTime);
823 // find window information in window list
824 CicoSCWindow *window = findWindow(surfaceid);
825 if (NULL == window) {
826 ICO_WRN("not found window information");
827 ICO_TRA("CicoSCWindowController::lower Leave(ENOENT)");
828 return ICO_SYC_ENOENT;
832 raiselower(window, false);
833 if (ilm_commitChanges() != ILM_SUCCESS) {
834 ICO_ERR("CicoSCWindowController::lower ilm_commitChanges() Error");
838 CicoSCWayland::getInstance()->flushDisplay();
840 ICO_TRA("CicoSCWindowController::lower Leave(EOK)");
844 //--------------------------------------------------------------------------
846 * @brief set window layer
848 * @param [in] surfaceid wayland surface id
849 * @param [in] layer layer id
851 * @return ICO_SYC_EOK on success, other on error
852 * @retval ICO_SYC_EOK success
853 * @retval ICO_SYC_ESRCH error(not initialized)
854 * @retval ICO_SYC_ENOENT error(window or layer dose not exist)
856 //--------------------------------------------------------------------------
858 CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
860 ICO_TRA("CicoSCWindowController::setWindowLayer Enter"
861 "(surfaceid=%08x layerid=%x)", surfaceid, layerid);
863 // find window information in window list
864 CicoSCWindow* window = findWindow(surfaceid);
865 if (NULL == window) {
866 ICO_WRN("not found window information");
867 ICO_TRA("CicoSCWindowController::setWindowLayer Leave(ENOENT)");
868 return ICO_SYC_ENOENT;
870 if (window->layerid == layerid) {
871 ICO_TRA("CicoSCWindowController::setWindowLayer Leave(same layer %d)", layerid);
875 // find new layer information in layer list
876 CicoSCLayer* layer = findLayer(window->displayid, layerid);
878 ICO_TRA("CicoSCWindowController::setWindowLayer Leave(ENOENT[disp=%d,layer=%d])",
879 window->displayid, layerid);
880 return ICO_SYC_ENOENT;
883 // find old layer information and remove surface if need
884 CicoSCLayer* oldlayer = findLayer(window->displayid, window->layerid);
886 if (ilm_layerRemoveSurface(window->layerid, window->surfaceid) != ILM_SUCCESS) {
887 ICO_ERR("CicoSCWindowController::setWindowLayer ilm_layerRemoveSurface(%d,%08x)"
888 " Error", window->layerid, window->surfaceid);
890 // must need ilm_commitChanges() after ilm_layerRemoveSurface()
891 if (ilm_commitChanges() != ILM_SUCCESS) {
892 ICO_ERR("CicoSCWindowController::setWindowLayer ilm_commitChanges Error");
895 oldlayer->removeSurface(window->surfaceid);
897 const int *oldsurfs = oldlayer->getSurfaces(&noldsurf);
898 if (ilm_layerSetRenderOrder(window->layerid, (t_ilm_layer *)oldsurfs, noldsurf)
900 ICO_ERR("CicoSCWindowController::setWindowLayer "
901 "ilm_layerSetRenderOrder(%d,,%d) Error", window->layerid, noldsurf);
903 if (ilm_commitChanges() != ILM_SUCCESS) {
904 ICO_ERR("CicoSCWindowController::setWindowLayer ilm_commitChanges Error");
908 // update window attr
909 window->layerid = layerid;
911 // set window layer request
912 if (ilm_layerAddSurface(window->layerid, window->surfaceid) != ILM_SUCCESS) {
913 ICO_ERR("CicoSCWindowController::setWindowLayer ilm_layerAddSurface(%d,%08x) Error",
914 window->layerid, window->surfaceid);
916 if (ilm_commitChanges() != ILM_SUCCESS) {
917 ICO_ERR("CicoSCWindowController::setWindowLayer ilm_commitChanges() Error");
920 // add surface to new layer
921 layer->addSurface(window->surfaceid, true);
923 const int *surfs = layer->getSurfaces(&nsurf);
924 if (ilm_layerSetRenderOrder(window->layerid, (t_ilm_layer *)surfs, nsurf)
926 ICO_ERR("CicoSCWindowController::setWindowLayer "
927 "ilm_layerSetRenderOrder(%d,,%d) Error", window->layerid, nsurf);
929 if (ilm_commitChanges() != ILM_SUCCESS) {
930 ICO_ERR("CicoSCWindowController::setWindowLayer ilm_commitChanges() Error");
934 CicoSCWayland::getInstance()->flushDisplay();
936 ICO_TRA("CicoSCWindowController::setWindowLayer Leave(EOK)");
940 //--------------------------------------------------------------------------
944 * @param [in] displayid display id
945 * @param [in] layerid layer id
947 * @return ICO_SYC_EOK on success, other on error
948 * @retval ICO_SYC_EOK success
949 * @retval ICO_SYC_ESRCH error(not initialized)
950 * @retval ICO_SYC_ENOENT error(layer dose not exist)
952 //--------------------------------------------------------------------------
954 CicoSCWindowController::showLayer(int displayid, int layerid)
956 ICO_TRA("CicoSCWindowController::showLayer Enter"
957 "(displayid=%d layerid=%d)", displayid, layerid);
959 // find layer information in layer list
960 CicoSCLayer* layer = findLayer(displayid, layerid);
962 ICO_WRN("not found layer information");
963 ICO_TRA("CicoSCWindowController::showLayer Leave(ENOENT)");
964 return ICO_SYC_ENOENT;
967 CicoSCWlWinMgrIF::setLayerVisible(layerid, ICO_SYC_LAYER_VISIBLE_SHOW);
970 CicoSCWayland::getInstance()->flushDisplay();
972 ICO_TRA("CicoSCWindowController::showLayer Leave(EOK)");
976 //--------------------------------------------------------------------------
980 * @param [in] displayid display id
981 * @param [in] layerid layer id
983 * @return ICO_SYC_EOK on success, other on error
984 * @retval ICO_SYC_EOK success
985 * @retval ICO_SYC_ESRCH error(not initialized)
986 * @retval ICO_SYC_ENOENT error(layer dose not exist)
988 //--------------------------------------------------------------------------
990 CicoSCWindowController::hideLayer(int displayid, int layerid)
992 ICO_TRA("CicoSCWindowController::hideLayer Enter(displayid=%d layerid=%d)",
995 // find layer information in layer list
996 CicoSCLayer* layer = findLayer(displayid, layerid);
998 ICO_WRN("not found layer information");
999 ICO_TRA("CicoSCWindowController::hideLayer Leave(ENOENT)");
1000 return ICO_SYC_ENOENT;
1003 CicoSCWlWinMgrIF::setLayerVisible(layerid, ICO_SYC_LAYER_VISIBLE_HIDE);
1006 CicoSCWayland::getInstance()->flushDisplay();
1008 ICO_TRA("CicoSCWindowController::hideLayer Leave(EOK)");
1012 //--------------------------------------------------------------------------
1014 * @brief active window(surface)
1016 * @param [in] surfaceid wayland surface id
1017 * @param [in] target target(pointer and/or keyboard)
1019 * @return ICO_SYC_EOK on success, other on error
1020 * @retval ICO_SYC_EOK success
1021 * @retval ICO_SYC_ESRCH error(not initialized)
1022 * @retval ICO_SYC_ENOENT error(layer dose not exist)
1024 //--------------------------------------------------------------------------
1026 CicoSCWindowController::active(int surfaceid, int target)
1028 CicoSCWindow *window = NULL;
1030 ICO_TRA("CicoSCWindowController::active Enter"
1031 "(surfaceid=%08x, target=%08x)", surfaceid, target);
1033 // find window information in window list
1035 window = findWindow(surfaceid);
1036 if (NULL == window) {
1037 ICO_WRN("not found window information");
1038 ICO_TRA("CicoSCWindowController::active Leave(ENOENT)");
1039 return ICO_SYC_ENOENT;
1047 // set active request
1048 CicoSCWlWinMgrIF::setActive(surfaceid, target);
1051 CicoSCWayland::getInstance()->flushDisplay();
1053 // update visible attr
1055 window->raise = true;
1058 // update active window
1059 map<unsigned int, CicoSCWindow*>::iterator itr;
1060 itr = m_windowList.begin();
1061 for (; itr != m_windowList.end(); ++itr) {
1062 CicoSCWindow* window = itr->second;
1063 if ((surfaceid != 0) && (window->surfaceid == surfaceid)) {
1064 window->active = target;
1071 window->active &= ~target;
1076 ICO_TRA("CicoSCWindowController::active Leave(EOK)");
1080 //--------------------------------------------------------------------------
1082 * @brief set surface map get
1084 * @param [in] surfaceid wayland surface id
1085 * @param [in] filepath surface image pixel file path
1087 * @return ICO_SYC_EOK on success, other on error(currently EOK only)
1088 * @retval ICO_SYC_EOK success
1090 //--------------------------------------------------------------------------
1092 CicoSCWindowController::setmapGet(int surfaceid, const char *filepath)
1094 ICO_TRA("CicoSCWindowController::setmapGet Enter");
1096 CicoSCWlWinMgrIF::setmapGet(surfaceid, filepath);
1097 CicoSCWayland::getInstance()->flushDisplay();
1099 ICO_TRA("CicoSCWindowController::setmapGet Leave(EOK)");
1103 //--------------------------------------------------------------------------
1105 * @brief map surface
1107 * @param [in] surfaceid wayland surface id
1108 * @param [in] framerate surface change frame rate(frames par sec)
1109 * @param [in] filepath surface image pixel file path
1111 * @return ICO_SYC_EOK on success, other on error
1112 * @retval ICO_SYC_EOK success
1113 * @retval ICO_SYC_ESRCH error(not initialized)
1114 * @retval ICO_SYC_ENOENT error(layer dose not exist)
1116 //--------------------------------------------------------------------------
1118 CicoSCWindowController::mapSurface(int surfaceid, int framerate, const char *filepath)
1120 ICO_TRA("CicoSCWindowController::mapSurface Enter(%08x,%d,%s)",
1121 surfaceid, framerate, filepath ? filepath : "(null)");
1123 // find window information in window list
1124 CicoSCWindow *window = findWindow(surfaceid);
1125 if (NULL == window) {
1126 ICO_WRN("not found window information");
1127 ICO_TRA("CicoSCWindowController::mapSurface Leave(ENOENT)");
1128 return ICO_SYC_ENOENT;
1131 setWindowMap(window, framerate, filepath);
1133 ICO_TRA("CicoSCWindowController::mapSurface Leave(EOK)");
1137 //--------------------------------------------------------------------------
1139 * @brief unmap surface
1141 * @param [in] surfaceid wayland surface id
1143 * @return ICO_SYC_EOK on success, other on error
1144 * @retval ICO_SYC_EOK success
1145 * @retval ICO_SYC_ESRCH error(not initialized)
1146 * @retval ICO_SYC_ENOENT error(layer dose not exist)
1148 //--------------------------------------------------------------------------
1150 CicoSCWindowController::unmapSurface(int surfaceid)
1152 ICO_TRA("CicoSCWindowController::unmapSurface Enter(%08x)", surfaceid);
1154 // find window information in window list
1155 CicoSCWindow *window = findWindow(surfaceid);
1156 if (NULL == window) {
1157 ICO_WRN("not found window information");
1158 ICO_TRA("CicoSCWindowController::unmapSurface Leave(ENOENT)");
1159 return ICO_SYC_ENOENT;
1162 resetWindowMap(surfaceid);
1164 ICO_TRA("CicoSCWindowController::unmapSurface Leave(EOK)");
1168 //--------------------------------------------------------------------------
1170 * @brief get displayed window by display zone id
1172 * @param [in] zoneid display zone id
1174 * @return surface id on success, -1 on not displayed
1176 //--------------------------------------------------------------------------
1178 CicoSCWindowController::getDisplayedWindow(int zoneid)
1180 const CicoSCDisplayZone* zone = findDisplayZone(zoneid);
1185 if (NULL == zone->displayedWindow) {
1189 return zone->displayedWindow->surfaceid;
1192 //--------------------------------------------------------------------------
1194 * @brief set surface attributes
1196 * @param [in] surfaceid surface id
1198 * @retval ICO_SYC_EOK success
1199 * @retval ICO_SYC_ESRCH error(not initialized)
1200 * @retval ICO_SYC_ENOENT error(layer dose not exist)
1202 //--------------------------------------------------------------------------
1204 CicoSCWindowController::setAttributes(int surfaceid)
1206 ICO_TRA("CicoSCWindowController::setAttributes Enter(surfaceid=%08x)", surfaceid);
1208 // find window information in window list
1209 CicoSCWindow *window = findWindow(surfaceid);
1210 if (NULL == window) {
1211 ICO_WRN("not found window information");
1212 ICO_TRA("CicoSCWindowController::setAttributes Leave(ENOENT)");
1213 return ICO_SYC_ENOENT;
1217 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1219 ICO_WRN("not found zone information");
1220 ICO_TRA("CicoSCWindowController::setAttributes Leave(ENOENT)");
1221 return ICO_SYC_ENOENT;
1224 uint32_t attributes = 0;
1225 if (true == zone->aspectFixed) {
1226 attributes |= ICO_SYC_WIN_ASPECT_FIXED;
1227 if (true == zone->aspectAlignLeft) {
1228 attributes |= ICO_SYC_WIN_ASPECT_ALIGN_LEFT;
1230 if (true == zone->aspectAlignRight) {
1231 attributes |= ICO_SYC_WIN_ASPECT_ALIGN_RIGHT;
1233 if (true == zone->aspectAlignTop) {
1234 attributes |= ICO_SYC_WIN_ASPECT_ALIGN_TOP;
1236 if (true == zone->aspectAlignBottom) {
1237 attributes |= ICO_SYC_WIN_ASPECT_ALIGN_BOTTOM;
1240 ICO_TRA("CicoSCWindowController::setAttributes Leave(EOK)");
1244 //--------------------------------------------------------------------------
1246 * @brief wayland surface active callback
1248 * @param [in] data user data(unused)
1249 * @param [in] surfaceid surface Id
1250 * @param [in] select select device(unused)
1251 * (0=not active/1=pointer/2=touch)
1253 //--------------------------------------------------------------------------
1255 CicoSCWindowController::activeCB(void *data,
1259 ICO_TRA("CicoSCWindowController::activeCB Enter(surfaceid=%08x select=%d)",
1262 CicoSCWindow *window = findWindow(surfaceid);
1263 if (NULL == window) {
1264 ICO_WRN("not found window information");
1265 ICO_TRA("CicoSCWindowController::activeCB Leave(not found window)");
1270 ICO_TRA("CicoSCWindowController::activeCB Leave(not active)");
1274 if (0 != window->active) {
1275 ICO_TRA("CicoSCWindowController::activeCB Leave(already active)");
1280 CicoSCMessage *message = new CicoSCMessage();
1281 message->addRootObject("command", MSG_CMD_CHANGE_ACTIVE);
1282 message->addRootObject("appid", window->appid);
1283 message->addRootObject("pid", window->pid);
1284 message->addArgObject("surface", window->surfaceid);
1285 message->addArgObject("winname", window->name);
1286 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1288 ICO_TRA("CicoSCWindowController::activeCB Leave");
1291 //--------------------------------------------------------------------------
1293 * @brief surface map event callback
1295 * @param [in] event event
1296 * @param [in] surfaceid surface Id
1297 * @param [in] type surface type (EGL buffer/Shared memory)
1298 * @param [in] width surface width
1299 * @param [in] height surface height
1300 * @param [in] stride surface buffer(frame buffer) stride
1301 * @param [in] format surface buffer format
1303 //--------------------------------------------------------------------------
1305 CicoSCWindowController::mapSurfaceCB(int32_t event,
1315 ICO_TRA("CicoSCWindowController::mapSurfaceCB Enter(ev=%d surf=%d[%x] w/h=%d/%d)",
1316 event, surfaceid, surfaceid, width, height);
1318 CicoSCWindow *window = findWindow(surfaceid);
1319 if (NULL == window) {
1320 ICO_TRA("CicoSCWindowController::mapSurfaceCB Leave(NOENT)");
1324 // convert event to command
1326 case ICO_SC_WINCHK_MAP_SURFACE_EVENT_MAP:
1327 case ICO_SC_WINCHK_MAP_SURFACE_EVENT_CONTENTS:
1328 command = MSG_CMD_MAP_THUMB;
1330 case ICO_SC_WINCHK_MAP_SURFACE_EVENT_UNMAP:
1331 command = MSG_CMD_UNMAP_THUMB;
1334 ICO_TRA("CicoSCWindowController::mapSurfaceCB Leave(Unknown event(%d))", event);
1339 CicoSCMessage *message = new CicoSCMessage();
1340 message->addRootObject("command", command);
1341 message->addRootObject("appid", window->appid);
1342 message->addArgObject("surface", window->surfaceid);
1343 message->addArgObject("attr", type);
1344 message->addArgObject("width", width);
1345 message->addArgObject("height", height);
1346 message->addArgObject("stride", stride);
1347 message->addArgObject("format", format);
1348 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1350 ICO_TRA("CicoSCWindowController::mapSurfaceCB Leave");
1353 //--------------------------------------------------------------------------
1355 * @brief surface update event callback from GENIVI-LM
1357 * @param [in] surfaceid surface Id
1358 * @param [in] surfprop surface Properties
1359 * @param [in] maek attribute change mask bits(unused)
1361 //--------------------------------------------------------------------------
1363 CicoSCWindowController::wlGeniviSurfaceNotification(t_ilm_surface surfaceid,
1364 struct ilmSurfaceProperties *surfprop,
1365 t_ilm_notification_mask mask)
1367 ICO_TRA("CicoSCWindowController::wlGeniviSurfaceNotification(%d(%x),,%x)",
1368 surfaceid, surfaceid, mask);
1370 if (mask & (ILM_NOTIFICATION_VISIBILITY | ILM_NOTIFICATION_SOURCE_RECT |
1371 ILM_NOTIFICATION_DEST_RECT)) {
1372 CicoSCWindowController::getInstance()->
1373 updateSurfaceCB((uint32_t)surfaceid, surfprop);
1375 else if (mask & ILM_NOTIFICATION_CONTENT_REMOVED) {
1376 CicoSCWindowController::getInstance()->
1377 destroySurfaceCB((uint32_t)surfaceid);
1381 //--------------------------------------------------------------------------
1383 * @brief surface update event callback
1385 * @param [in] surfaceid surface Id
1386 * @param [in] surfprop surface Properties
1388 //--------------------------------------------------------------------------
1390 CicoSCWindowController::updateSurfaceCB(uint32_t surfaceid,
1391 struct ilmSurfaceProperties *surfprop)
1393 ICO_TRA("CicoSCWindowController::updateSurfaceCB: Enter"
1394 "(%08x pid=%d v=%d,x/y=%d/%d,w/h=%d/%d->%d/%d)",
1395 surfaceid, surfprop->creatorPid, surfprop->visibility,
1396 surfprop->destX, surfprop->destY,
1397 surfprop->sourceWidth, surfprop->sourceHeight,
1398 surfprop->destWidth, surfprop->destHeight);
1400 CicoSCWindow *window = findWindow(surfaceid);
1401 if (NULL == window) {
1402 ICO_WRN("CicoSCWindowController::updateSurfaceCB: not found window(%08x)",
1404 ICO_TRA("CicoSCWindowController::updateSurfaceCB: Leave");
1409 window->visible = surfprop->visibility;
1410 window->srcwidth = surfprop->sourceWidth;
1411 window->srcheight = surfprop->sourceHeight;
1412 window->x = surfprop->destX;
1413 window->y = surfprop->destY;
1414 window->width = surfprop->destWidth;
1415 window->height = surfprop->destHeight;
1416 window->nodeid = window->layerid / ICO_SC_LAYERID_SCREENBASE;
1418 // notify to homescreen
1419 CicoSCMessage *message = new CicoSCMessage();
1420 message->addRootObject("command", MSG_CMD_CHANGE_ATTR);
1421 message->addRootObject("appid", window->appid);
1422 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1424 message->addArgObject("zone", zone->fullname);
1427 message->addArgObject("zone", "");
1429 message->addArgObject("surface", window->surfaceid);
1430 message->addArgObject("winname", window->name);
1431 message->addArgObject("node", window->nodeid);
1432 message->addArgObject("layer", window->layerid);
1433 message->addArgObject("pos_x", window->x);
1434 message->addArgObject("pos_y", window->y);
1435 message->addArgObject("width", window->width);
1436 message->addArgObject("height", window->height);
1437 message->addArgObject("raise", window->raise ? 1 : 0);
1438 message->addArgObject("visible", window->visible ? 1 : 0);
1439 message->addArgObject("active", window->active ? 1 : 0);
1440 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1442 ICO_TRA("CicoSCWindowController::updateSurfaceCB: Leave");
1445 //--------------------------------------------------------------------------
1447 * @brief wayland surface destroy callback
1449 * @param [in] surfaceid surface Id
1451 //--------------------------------------------------------------------------
1453 CicoSCWindowController::destroySurfaceCB(uint32_t surfaceid)
1455 ICO_TRA("CicoSCWindowController::destroySurfaceCB: Enter(%08x)", surfaceid);
1457 CicoSCWindow *window = findWindow(surfaceid);
1458 if (NULL == window) {
1459 ICO_WRN("not found window(%08x)", surfaceid);
1460 ICO_TRA("CicoSCWindowController::destroySurfaceCB Leave");
1464 // remove window check
1465 CicoSCWindowController::windowCheckerRemove(surfaceid);
1467 // delete surface from layer
1468 CicoSCLayer* layer = findLayer(window->displayid, window->layerid);
1469 if (NULL == layer) {
1470 ICO_TRA("CicoSCWindowController::destroySurfaceCB: surf.%08x not exist in layer.%d",
1471 surfaceid, window->layerid);
1474 layer->removeSurface(surfaceid);
1478 CicoSCMessage *message = new CicoSCMessage();
1479 message->addRootObject("command", MSG_CMD_DESTROY);
1480 message->addRootObject("appid", window->appid);
1481 message->addRootObject("pid", window->pid);
1482 message->addArgObject("surface", window->surfaceid);
1483 message->addArgObject("winname", window->name);
1484 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1486 // TODO delete window in application
1487 if (NULL != m_resMgr) {
1489 CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
1491 cmd.cmdid = MSG_CMD_DESTORY_RES;
1492 cmd.appid = window->appid;
1493 cmd.pid = window->pid;
1496 opt->dispres = true;
1497 opt->winname = window->name;
1498 opt->surfaceid = window->surfaceid;
1501 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1503 opt->dispzone = zone->fullname;
1506 opt->soundres = true;
1507 opt->soundname = window->appid;
1509 CicoSystemConfig *sysconf = CicoSystemConfig::getInstance();
1510 const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
1511 if (NULL != defconf) {
1512 const CicoSCSoundZoneConf *zoneconf =
1513 sysconf->findSoundZoneConfbyId(defconf->soundzone);
1514 if (NULL != zoneconf) {
1515 opt->soundzone = zoneconf->fullname;
1518 m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
1520 // delete window in list
1521 m_windowList.erase(window->surfaceid);
1524 ICO_TRA("CicoSCWindowController::destroySurfaceCB: Leave");
1527 //--------------------------------------------------------------------------
1529 * @brief wayland update surface name callback
1531 * @param [in] surfaceid surface Id
1532 * @param [in] winname surface name (title)
1534 //--------------------------------------------------------------------------
1536 CicoSCWindowController::updateWinnameCB(uint32_t surfaceid,
1537 const char *winname)
1539 ICO_TRA("CicoSCWindowController::updateWinnameCB: Enter(%08x,<%s>)",
1540 surfaceid, winname ? winname : "(null)");
1542 CicoSCWindow *window = findWindow(surfaceid);
1543 if (NULL == window) {
1544 ICO_WRN("CicoSCWindowController::updateWinnameCB: not found window(%08x)",
1546 ICO_TRA("CicoSCWindowController::updateWinnameCB Leave");
1550 window->name = winname;
1553 CicoSCMessage *message = new CicoSCMessage();
1554 message->addRootObject("command", MSG_CMD_NAME);
1555 message->addRootObject("appid", window->appid);
1556 message->addRootObject("pid", window->pid);
1557 message->addArgObject("surface", window->surfaceid);
1558 message->addArgObject("winname", window->name);
1559 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1561 ICO_TRA("CicoSCWindowController::updateWinnameCB: Leave");
1564 //--------------------------------------------------------------------------
1566 * @brief wayland display attribute callback
1568 * @param [in] data user data(unused)
1569 * @param [in] wl_output wayland wl_output interface
1570 * @param [in] x display upper-left X coordinate
1571 * @param [in] y display upper-left Y coordinate
1572 * @param [in] physical_width display physical width
1573 * @param [in] physical_height display physical height
1574 * @param [in] subpixel display sub pixel
1575 * @param [in] make display maker
1576 * @param [in] model display model
1577 * @param [in] transform transform
1579 //--------------------------------------------------------------------------
1581 CicoSCWindowController::outputGeometryCB(void *data,
1582 struct wl_output *wl_output,
1585 int32_t physical_width,
1586 int32_t physical_height,
1592 ICO_TRA("CicoSCWindowController::outputGeometryCB Enter"
1593 "(x=%d y=%d physical_width=%d physical_height=%d "
1594 "subpixel=%d make=%s model=%s transform=%d)",
1595 x, y, physical_width, physical_height,
1596 subpixel, make, model, transform);
1598 ++ m_physicalDisplayTotal;
1599 if (0 == m_displayList.size()) {
1600 ICO_TRA("CicoSCWindowController::outputGeometryCB Leave"
1601 "(display is zero)");
1605 if (m_displayList.size() < m_physicalDisplayTotal) {
1606 ICO_TRA("CicoSCWindowController::outputGeometryCB Leave"
1607 "(display total unmatch)");
1611 CicoSCDisplay* display = m_displayList.at(m_physicalDisplayTotal-1);
1612 switch (transform) {
1613 case WL_OUTPUT_TRANSFORM_90:
1614 case WL_OUTPUT_TRANSFORM_270:
1615 case WL_OUTPUT_TRANSFORM_FLIPPED_90:
1616 case WL_OUTPUT_TRANSFORM_FLIPPED_270:
1617 display->pWidth = physical_height;
1618 display->pHeight = physical_width;
1619 display->orientation = CicoSCDisplay::ORIENTATION_VERTICAL;
1621 case WL_OUTPUT_TRANSFORM_NORMAL:
1622 case WL_OUTPUT_TRANSFORM_180:
1623 case WL_OUTPUT_TRANSFORM_FLIPPED:
1624 case WL_OUTPUT_TRANSFORM_FLIPPED_180:
1626 display->pWidth = physical_width;
1627 display->pHeight = physical_height;
1628 display->orientation = CicoSCDisplay::ORIENTATION_HORIZONTAL;
1633 ICO_TRA("CicoSCWindowController::outputGeometryCB Leave");
1636 //--------------------------------------------------------------------------
1638 * @brief wayland display mode callback
1640 * @param [in] data user data(unused)
1641 * @param [in] wl_output wayland wl_output interface
1642 * @param [in] flags flags
1643 * @param [in] width display width
1644 * @param [in] height display height
1645 * @param [in] refresh display refresh rate
1647 //--------------------------------------------------------------------------
1649 CicoSCWindowController::outputModeCB(void *data,
1650 struct wl_output *wl_output,
1656 ICO_TRA("CicoSCWindowController::outputModeCB Enter"
1657 "(flags=%d width=%d height=%d refresh=%d)",
1658 flags, width, height, refresh);
1660 if (0 == m_displayList.size()) {
1661 ICO_TRA("CicoSCWindowController::outputModeCB Leave(display is zero)");
1665 CicoSCDisplay* display = m_displayList.at(0);
1666 if (flags & WL_OUTPUT_MODE_CURRENT) {
1667 if (display->orientation == CicoSCDisplay::ORIENTATION_VERTICAL) {
1668 display->pWidth = height;
1669 display->pHeight = width;
1672 display->pWidth = width;
1673 display->pHeight = height;
1678 ICO_TRA("CicoSCWindowController::outputModeCB Leave");
1681 //--------------------------------------------------------------------------
1683 * @brief wayland genivi ivi-shell surface create callback
1685 * @param [in] data user data
1686 * @param [in] ivi_controller wayland ivi-controller plugin interface
1687 * @param [in] id_surface surface id
1689 //--------------------------------------------------------------------------
1691 CicoSCWindowController::createSurfaceCB(void *data,
1692 struct ivi_controller *ivi_controller,
1693 uint32_t id_surface)
1695 struct ilmSurfaceProperties SurfaceProperties;
1697 ICO_TRA("CicoSCWindowController::createSurfaceCB Enter"
1698 "(surfaceid=%08x)", id_surface);
1700 if (ilm_getPropertiesOfSurface(id_surface, &SurfaceProperties) != ILM_SUCCESS) {
1701 ICO_ERR("CicoSCWindowController::createSurfaceCB: ilm_getPropertiesOfSurface(%x) Error",
1705 ICO_TRA("createSurfaceCB: surface=%d(0x%08x) pid=%d w/h=%d/%d(%d/%d)->%d/%d",
1706 id_surface, id_surface, SurfaceProperties.creatorPid,
1707 SurfaceProperties.sourceWidth, SurfaceProperties.sourceHeight,
1708 SurfaceProperties.origSourceWidth, SurfaceProperties.origSourceHeight,
1709 SurfaceProperties.destWidth, SurfaceProperties.destHeight);
1711 #if 1 /* 2014/08/20 workaround, SurfaceProperties.creatorPid not set */
1712 if (SurfaceProperties.creatorPid == 0) {
1713 SurfaceProperties.creatorPid = (id_surface - 6000) / 100;
1714 ICO_WRN("createSurfaceCB: surface=%d(0x%08x) pid is Zero, workaround to %d",
1715 id_surface, id_surface, SurfaceProperties.creatorPid);
1719 CicoSCWindow* window = new CicoSCWindow();
1720 window->surfaceid = id_surface;
1722 window->pid = SurfaceProperties.creatorPid;
1723 window->displayid = 0; // currently fixed 0
1724 window->raise = 1; // created surface is top of layer
1725 window->srcwidth = SurfaceProperties.sourceWidth;
1726 window->srcheight = SurfaceProperties.sourceHeight;
1727 window->width = SurfaceProperties.destWidth;
1728 window->height = SurfaceProperties.destHeight;
1729 window->layerid = 0;
1731 #ifdef GENIVI_WL_SHELL_INFO /* GENIVI-LM is supporting the wl_shell_info */
1732 const char *title = CicoSCWlWinMgrIF::wlIviCtrlGetSurfaceWaiting(id_surface, &pid);
1735 window->name = title;
1739 ICO_WRN("Could not find window title!");
1741 #endif /*GENIVI_WL_SHELL_INFO*/ /* GENIVI-LM is supporting the wl_shell_info */
1743 CicoSCLifeCycleController* appctrl;
1744 appctrl = CicoSCLifeCycleController::getInstance();
1745 const CicoAilItems* ailItem = NULL;
1746 const CicoAulItems* aulitem = appctrl->findAUL(window->pid);
1747 if (NULL == aulitem) {
1748 /* client does not exist in AppCore, search parent process */
1749 ICO_DBG("application information not found. search parent process");
1752 int cpid = window->pid;
1756 char procpath[PATH_MAX];
1758 while ((cpid > 1) && (aulitem == NULL)) {
1759 snprintf(procpath, sizeof(procpath)-1, "/proc/%d/status", cpid);
1761 fd = open(procpath, O_RDONLY);
1764 size = read(fd, procpath, sizeof(procpath));
1767 if (size <= 0) break;
1768 ppid_line = strstr(procpath, "PPid");
1770 if (ppid_line == NULL) break;
1772 sscanf(ppid_line, "PPid: %d", &ppid);
1773 if (ppid <= 1) break;
1774 ICO_DBG("application pid=%d parent=%d", cpid, ppid);
1776 aulitem = appctrl->findAUL(cpid);
1779 if (NULL != aulitem) {
1780 window->appid = aulitem->m_appid;
1781 ICO_DBG("appid=%s", window->appid.c_str());
1782 ailItem = appctrl->findAIL(window->appid.c_str());
1784 window->layerid = ailItem->m_layer;
1785 window->zoneid = ailItem->m_displayZone;
1786 window->nodeid = ailItem->m_nodeID;
1787 if ((window->displayid >= 0) && (window->zoneid >= 0)) {
1789 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1791 window->zone = zone->fullname;
1792 window->x = zone->x;
1793 window->y = zone->y;
1794 window->width = zone->width;
1795 window->height = zone->height;
1801 ICO_WRN("ail item not found.");
1802 ICO_TRA("CicoSCWindowController::createSurfaceCB Leave(ENOENT)");
1806 if (ilm_surfaceSetDestinationRectangle(window->surfaceid, window->x, window->y,
1807 window->width, window->height) != ILM_SUCCESS) {
1808 ICO_ERR("CicoSCWindowController::createSurfaceCB "
1809 "ilm_surfaceSetDestinationRectangle(%08x) Error", window->surfaceid);
1811 else if (ilm_surfaceSetSourceRectangle(window->surfaceid, 0, 0,
1812 window->width, window->height) != ILM_SUCCESS) {
1813 ICO_ERR("CicoSCWindowController::createSurfaceCB "
1814 "ilm_surfaceSetSourceRectangle(%08x) Error", window->surfaceid);
1816 else if (ilm_surfaceSetOrientation(window->surfaceid, ILM_ZERO) != ILM_SUCCESS) {
1817 ICO_ERR("CicoSCWindowController::createSurfaceCB "
1818 "ilm_surfaceSetOrientation(%08x) Error", window->surfaceid);
1820 else if (ilm_commitChanges() != ILM_SUCCESS) {
1821 ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_commitChanges() Error");
1824 CicoSCLayer *layer = findLayer(window->displayid, window->layerid);
1826 if (ilm_layerAddSurface(window->layerid, window->surfaceid) != ILM_SUCCESS) {
1827 ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_layerAddSurface(%d,%08x) "
1828 "Error", window->layerid, window->surfaceid);
1830 if (ilm_commitChanges() != ILM_SUCCESS) {
1831 ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_commitChanges() Error");
1834 layer->addSurface(window->surfaceid, true);
1836 const int *surfs = layer->getSurfaces(&nsurf);
1837 if (ilm_layerSetRenderOrder(window->layerid, (t_ilm_layer *)surfs, nsurf)
1839 ICO_ERR("CicoSCWindowController::createSurfaceCB: "
1840 "ilm_layerSetRenderOrder(%d,,%d) Error", window->layerid, nsurf);
1842 if (ilm_commitChanges() != ILM_SUCCESS) {
1843 ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_commitChanges() Error");
1846 // must set surfaceOpacity after surfcaeAddLayer
1847 if (ilm_surfaceSetOpacity(window->surfaceid , (t_ilm_float)1.0f) != ILM_SUCCESS) {
1848 ICO_ERR("CicoSCWindowController::createSurfaceCB "
1849 "ilm_surfaceSetOpacity(%08x) Error", window->surfaceid);
1851 else if (ilm_commitChanges() != ILM_SUCCESS) {
1852 ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_commitChanges() Error");
1855 appctrl->enterAUL(window->appid.c_str(), window->pid, window);
1857 // dump log window information
1860 m_windowList[window->surfaceid] = window;
1862 // set surface attributes
1863 setAttributes(window->surfaceid);
1866 CicoSCMessage *message = new CicoSCMessage();
1867 message->addRootObject("command", MSG_CMD_CREATE);
1868 message->addRootObject("appid", window->appid);
1869 message->addRootObject("pid", window->pid);
1870 message->addArgObject("surface", window->surfaceid);
1871 message->addArgObject("winname", window->name);
1872 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1874 if (0 == window->appid.compare(ICO_SC_APPID_DEFAULT_ONS)) {
1875 CicoSCMessageRes *msgOS = new CicoSCMessageRes();
1876 msgOS->addRootObject("command", MSG_CMD_WINDOW_ID_RES);
1877 msgOS->addRootObject("appid", window->appid);
1878 msgOS->addRootObject("pid", window->pid);
1879 msgOS->addWinObject(MSG_PRMKEY_ECU, "");
1880 msgOS->addWinObject(MSG_PRMKEY_DISPLAY, "");
1881 msgOS->addWinObject(MSG_PRMKEY_LAYER, "");
1882 msgOS->addWinObject(MSG_PRMKEY_LAYOUT, "");
1883 msgOS->addWinObject(MSG_PRMKEY_AREA, "");
1884 msgOS->addWinObject(MSG_PRMKEY_DISPATCHAPP, "");
1885 msgOS->addWinObject(MSG_PRMKEY_ROLE, window->name);
1886 msgOS->addWinObject(MSG_PRMKEY_RESOURCEID, window->surfaceid);
1887 CicoSCServer::getInstance()->sendMessage(window->appid,
1888 (CicoSCMessage*)msgOS);
1891 if (NULL != m_resMgr) {
1893 CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
1895 cmd.cmdid = MSG_CMD_CREATE_RES;
1896 cmd.appid = window->appid;
1897 cmd.pid = window->pid;
1900 opt->dispres = true;
1901 opt->winname = window->name;
1902 opt->surfaceid = window->surfaceid;
1905 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1907 opt->dispzone = zone->fullname;
1911 opt->soundres = true;
1912 opt->soundname = window->appid;
1914 CicoSystemConfig *sysconf = CicoSystemConfig::getInstance();
1915 const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
1916 if (NULL != defconf) {
1917 const CicoSCSoundZoneConf *zoneconf =
1918 sysconf->findSoundZoneConfbyId(defconf->soundzone);
1919 if (NULL != zoneconf) {
1920 opt->soundzone = zoneconf->fullname;
1924 m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
1927 show(window->surfaceid, NULL, 0);
1930 // set surface change notification
1931 if (ilm_surfaceAddNotification(window->surfaceid, wlGeniviSurfaceNotification)
1933 ICO_ERR("CicoSCWindowController::createSurfaceCB "
1934 "ilm_surfaceAddNotification(%08x) Error", window->surfaceid);
1937 ICO_TRA("CicoSCWindowController::createSurfaceCB Leave");
1940 //--------------------------------------------------------------------------
1942 * @brief genivi ivi-shell layer propaty callback
1944 * @param [in] layer layer id
1945 * @param [in] LayerProperties layer properties
1946 * @param [in] mask change properties
1948 //--------------------------------------------------------------------------
1950 CicoSCWindowController::wlGeniviLayerNotification(t_ilm_layer layer,
1951 struct ilmLayerProperties *LayerProperties,
1952 t_ilm_notification_mask mask)
1954 ICO_TRA("CicoSCWindowController::wlGeniviLayerNotification Enter(%x,,%x)", layer, mask);
1956 if (mask & ILM_NOTIFICATION_VISIBILITY) {
1957 // change layer visibility, send message to HomeScreen
1958 CicoSCMessage *message = new CicoSCMessage();
1959 message->addRootObject("command", MSG_CMD_CHANGE_LAYER_ATTR);
1960 message->addRootObject("appid", "");
1961 message->addArgObject("layer", layer);
1962 message->addArgObject("visible", LayerProperties->visibility ? 1 : 0);
1963 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1965 ICO_TRA("CicoSCWindowController::wlGeniviLayerNotification Leave");
1968 //--------------------------------------------------------------------------
1970 * @brief setup Genivi ivi-shell layer managerment system finctions
1974 //--------------------------------------------------------------------------
1976 CicoSCWindowController::initializeGeniviLMS(void)
1978 t_ilm_uint NumberOfScreens = 0;
1979 t_ilm_layer *pLayerId, *ppLayerId;
1980 t_ilm_int LayerNumber;
1981 t_ilm_uint *pScreenIds;
1982 struct ilmScreenProperties ScreenProperties;
1983 int idxs, idx1, idx2;
1984 int DisplayId, LayerId;
1985 const CicoSCDisplayConf *DisplayConf;
1986 const CicoSCLayerConf *LayerConf;
1988 // get all screen id
1989 if ((ilm_getScreenIDs(&NumberOfScreens, &pScreenIds) != ILM_SUCCESS) ||
1990 (NumberOfScreens <= 0)) {
1991 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
1992 "ilm_getScreenIDs() Error(num=%d)", NumberOfScreens);
1995 ICO_TRA("initializeGeniviLMS: Screens=%d.%x %x", NumberOfScreens, pScreenIds[0],
1996 NumberOfScreens >= 2 ? pScreenIds[1] : 0);
1997 if ((int)NumberOfScreens > CicoSystemConfig::getInstance()->getNumberofDisplay()) {
1998 ICO_WRN("CicoSCWindowController::initializeGeniviLMS # of screens physical=%d config=%d",
1999 NumberOfScreens, CicoSystemConfig::getInstance()->getNumberofDisplay());
2000 NumberOfScreens = (t_ilm_uint)CicoSystemConfig::getInstance()->getNumberofDisplay();
2002 #if 1 /* At present, GENIVI (ivi-controller) is processing only one Display */
2003 for (idxs = (int)NumberOfScreens - 1; idxs >= 0; idxs--)
2005 for (idxs = 0; idxs < (int)NumberOfScreens; idxs++)
2008 if (ilm_getPropertiesOfScreen(pScreenIds[idxs], &ScreenProperties) != ILM_SUCCESS) {
2009 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2010 "ilm_getPropertiesOfScreen(%d.%x) Error", idxs, pScreenIds[idxs]);
2013 // It is referred to as Center when there is only one display
2014 if (NumberOfScreens == 1) {
2015 DisplayId = CicoSystemConfig::getInstance()->getDisplayIdbyType(ICO_NODETYPE_CENTER);
2018 DisplayId = CicoSystemConfig::getInstance()->getDisplayIdbyNo((int)pScreenIds[idxs]);
2020 ICO_TRA("CicoSCWindowController::initializeGeniviLMS: "
2021 "Screen[%d.%x] w/h=%d/%d layers=%d DisplayId=%d",
2022 idxs, pScreenIds[idxs], ScreenProperties.screenWidth,
2023 ScreenProperties.screenHeight, ScreenProperties.layerCount, DisplayId);
2025 if ((DisplayId < 0) ||
2026 ((DisplayConf = CicoSystemConfig::getInstance()->findDisplayConfbyId(DisplayId))
2028 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2029 "ScreenId.%x not found", pScreenIds[idxs]);
2032 // set genivi layers
2033 for (idx1 = 0; ; idx1++) {
2034 LayerConf = CicoSystemConfig::getInstance()->
2035 findLayerConfbyIdx(DisplayId, idx1);
2036 if (! LayerConf) break;
2038 pLayerId = (t_ilm_layer *)malloc(sizeof(t_ilm_layer) * idx1);
2039 ppLayerId = pLayerId;
2042 for (idx1 = 0; ; idx1++) {
2043 LayerConf = CicoSystemConfig::getInstance()->
2044 findLayerConfbyIdx(DisplayId, idx1);
2045 if (! LayerConf) break;
2047 LayerId = LayerConf->id + DisplayId * ICO_SC_LAYERID_SCREENBASE;
2048 for (idx2 = 0; idx2 < LayerNumber; idx2++) {
2049 if (LayerId == (int)pLayerId[idx2]) break;
2051 if (idx2 < LayerNumber) {
2052 ICO_TRA("CicoSCWindowController::initializeGeniviLMS: "
2053 "layer.%d exist, Skip", LayerId);
2057 if (ilm_layerCreateWithDimension((t_ilm_layer *)&LayerId,
2058 DisplayConf->width, DisplayConf->height) != ILM_SUCCESS) {
2059 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2060 "ilm_layerCreateWithDimension(%d,%d,%d) Error",
2061 LayerId, DisplayConf->width, DisplayConf->height);
2063 else if (ilm_commitChanges() != ILM_SUCCESS) {
2064 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2065 "ilm_commitChanges() Error");
2067 else if (ilm_layerSetOpacity(LayerId, (t_ilm_float)1.0f) != ILM_SUCCESS) {
2068 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2069 "ilm_layerSetOpacity(%d) Error", LayerId);
2071 else if (ilm_layerSetSourceRectangle(LayerId, 0, 0,
2072 DisplayConf->width, DisplayConf->height) != ILM_SUCCESS) {
2073 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2074 "ilm_layerSetSourceRectangle(%d) Error", LayerId);
2076 else if (ilm_layerSetDestinationRectangle(LayerId, 0, 0,
2077 DisplayConf->width, DisplayConf->height) != ILM_SUCCESS) {
2078 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2079 "ilm_layerSetDestinationRectangle(%d) Error", LayerId);
2081 else if (ilm_layerSetOrientation(LayerId, ILM_ZERO) != ILM_SUCCESS) {
2082 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2083 "ilm_layerSetOrientation(%d) Error", LayerId);
2086 if (ilm_commitChanges() != ILM_SUCCESS) {
2087 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2088 "ilm_commitChanges() Error");
2090 // SystemController default is layer visible
2091 if ((ilm_layerSetVisibility(LayerId, 1) != ILM_SUCCESS) ||
2092 (ilm_commitChanges() != ILM_SUCCESS)) {
2093 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2094 "ilm_layerSetVisibility() Error");
2096 ICO_TRA("initializeGeniviLMS: layer=%d created(%d,%d)",
2097 LayerId, DisplayConf->width, DisplayConf->height);
2098 *ppLayerId = LayerId;
2103 if (LayerNumber > 0) {
2104 ICO_TRA("initializeGeniviLMS: layers %d.%d %d %d %d set to screen %x",
2105 LayerNumber, pLayerId[0], pLayerId[1], pLayerId[2], pLayerId[3],
2107 if (ilm_displaySetRenderOrder(pScreenIds[idxs], pLayerId, LayerNumber)
2109 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2110 "ilm_displaySetRenderOrder(%d) Error", LayerNumber);
2112 else if (ilm_commitChanges() != ILM_SUCCESS) {
2113 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2114 "ilm_commitChanges() Error");
2116 ppLayerId = pLayerId;
2117 for (idx2 = 0; idx2 < LayerNumber; idx2++) {
2118 if (ilm_layerAddNotification(*ppLayerId, wlGeniviLayerNotification)
2120 ICO_ERR("CicoSCWindowController::initializeGeniviLMS "
2121 "ilm_layerAddNotification(%d) Error", *ppLayerId);
2132 //==========================================================================
2134 //==========================================================================
2136 //--------------------------------------------------------------------------
2138 * @brief find window object by surfaceid
2140 * @param [in] surfaceid wayland surface id
2142 //--------------------------------------------------------------------------
2144 CicoSCWindowController::findWindow(int surfaceid)
2146 map<unsigned int, CicoSCWindow*>::iterator itr;
2147 itr = m_windowList.find(surfaceid);
2148 if (m_windowList.end() == itr) {
2149 ICO_TRA("not found window object. surfaceid=%08x", surfaceid);
2156 //--------------------------------------------------------------------------
2158 * @brief find window object by surfaceid
2160 * @param [in] surfaceid wayland surface id
2162 //--------------------------------------------------------------------------
2164 CicoSCWindowController::findLayer(int displayid, int layerid)
2166 vector<CicoSCDisplay*>::iterator itr;
2167 itr = m_displayList.begin();
2168 for (; itr != m_displayList.end(); ++itr) {
2169 if ((*itr)->displayid != displayid) {
2172 vector<CicoSCLayer*>::iterator itr2;
2173 itr2 = (*itr)->layerList.begin();
2174 for (; itr2 != (*itr)->layerList.end(); ++itr2) {
2175 if ((*itr2)->layerid == layerid) {
2183 //--------------------------------------------------------------------------
2185 * @brief find display zone by id
2187 //--------------------------------------------------------------------------
2188 const CicoSCDisplayZone *
2189 CicoSCWindowController::findDisplayZone(int zoneid)
2191 vector<CicoSCDisplay*>::iterator itr;
2192 itr = m_displayList.begin();
2193 for (; itr != m_displayList.end(); ++itr) {
2194 std::map<unsigned int, CicoSCDisplayZone*>::iterator itr2;
2195 itr2 = (*itr)->zoneList.find(zoneid);
2196 if ((*itr)->zoneList.end() != itr2) {
2197 return itr2->second;
2203 //--------------------------------------------------------------------------
2205 * @brief handle command
2207 * @param [in] cmd control command
2209 //--------------------------------------------------------------------------
2211 CicoSCWindowController::handleCommand(const CicoSCCommand * cmd)
2213 // ICO_TRA("CicoSCWindowController::handleCommand Enter(%d)", cmd->cmdid);
2215 CicoSCCmdWinCtrlOpt *opt = static_cast<CicoSCCmdWinCtrlOpt*>(cmd->opt);
2217 switch (cmd->cmdid) {
2219 ICO_DBG("command: MSG_CMD_SHOW");
2220 if (opt->animationTime & ICO_SYC_WIN_SURF_NORESCTL) {
2221 /* show command but not resource control (for HomeScreen) */
2222 (void)show(opt->surfaceid,
2223 opt->animation.c_str(),
2224 opt->animationTime);
2227 /* show command (normal) */
2228 (void)notifyResourceManager(opt->surfaceid,
2231 opt->animation.c_str(),
2232 opt->animationTime);
2236 ICO_DBG("command: MSG_CMD_HIDE");
2237 (void)hide(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
2241 ICO_DBG("command: MSG_CMD_MOVE");
2242 CicoSCWindow *window = findWindow(opt->surfaceid);
2243 if (NULL == window) {
2246 if (true == opt->zone.empty()) {
2247 (void)setGeometry(opt->surfaceid, opt->nodeid, opt->layerid,
2248 opt->x, opt->y, opt->width, opt->height,
2249 opt->animation.c_str(), opt->animationTime,
2250 opt->animation.c_str(), opt->animationTime);
2252 else if (opt->zone == window->zone) {
2253 (void)setGeometry(opt->surfaceid, opt->zone.c_str(), opt->layerid,
2254 opt->animation.c_str(), opt->animationTime,
2255 opt->animation.c_str(), opt->animationTime);
2258 (void)notifyResourceManager(opt->surfaceid,
2261 opt->animation.c_str(),
2262 opt->animationTime);
2266 case MSG_CMD_CHANGE_ACTIVE:
2267 ICO_DBG("command: MSG_CMD_CHANGE_ACTIVE");
2268 (void)active(opt->surfaceid, opt->active);
2270 case MSG_CMD_CHANGE_LAYER:
2271 ICO_DBG("command: MSG_CMD_CHANGE_LAYER");
2272 (void)setWindowLayer(opt->surfaceid, opt->layerid);
2274 case MSG_CMD_MAP_GET:
2275 ICO_DBG("command: MSG_CMD_MAP_GET");
2276 (void)setmapGet(opt->surfaceid, opt->animation.c_str());
2278 case MSG_CMD_MAP_THUMB:
2279 ICO_DBG("command: MSG_CMD_MAP_THUMB");
2280 (void)mapSurface(opt->surfaceid, opt->framerate, opt->animation.c_str());
2282 case MSG_CMD_UNMAP_THUMB:
2283 ICO_DBG("command: MSG_CMD_UNMAP_THUMB");
2284 (void)unmapSurface(opt->surfaceid);
2286 case MSG_CMD_SHOW_LAYER:
2287 ICO_DBG("command: MSG_CMD_SHOW_LAYER");
2288 (void)showLayer(opt->displayid, opt->layerid);
2290 case MSG_CMD_HIDE_LAYER:
2291 ICO_DBG("command: MSG_CMD_HIDE_LAYER");
2292 (void)hideLayer(opt->displayid, opt->layerid);
2295 ICO_WRN("command: Unknown(0x%08x)", cmd->cmdid);
2299 // ICO_TRA("CicoSCWindowController::handleCommand Leave");
2303 CicoSCWindowController::notifyResourceManager(int surfaceid,
2306 const char *animation,
2309 ICO_TRA("CicoSCWindowController::notifyResourceManager Enter"
2310 "(surfaceid=%08x zone=%s layerid=%d "
2311 "animation=%s animationTime=%d)",
2312 surfaceid, zone, layerid, animation, animationTime);
2314 // find window information in window list
2315 CicoSCWindow *window = findWindow(surfaceid);
2316 if (NULL == window) {
2317 ICO_WRN("not found window information");
2318 ICO_TRA("CicoSCWindowController::notifyResourceManager Leave(ENOENT)");
2319 return ICO_SYC_ENOENT;
2323 CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
2325 cmd.cmdid = MSG_CMD_ACQUIRE_RES;
2326 cmd.appid = window->appid;
2327 cmd.pid = window->pid;
2330 opt->dispres = true;
2331 opt->winname = window->name;
2332 opt->layerid = layerid;
2333 opt->surfaceid = window->surfaceid;
2334 opt->animation = animation ? animation : "";
2335 opt->animationTime = animationTime;
2338 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
2340 opt->dispzone = zone->fullname;
2343 ICO_WRN("not found zone information");
2344 ICO_TRA("CicoSCWindowController::notifyResourceManager Leave(ENOENT)");
2345 return ICO_SYC_ENOENT;
2349 opt->dispzone = zone;
2352 opt->soundres = true;
2353 opt->soundname = window->appid;
2355 CicoSystemConfig *sysconf = CicoSystemConfig::getInstance();
2356 const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
2357 if (NULL != defconf) {
2358 const CicoSCSoundZoneConf *zoneconf =
2359 sysconf->findSoundZoneConfbyId(defconf->soundzone);
2360 if (NULL != zoneconf) {
2361 opt->soundzone = zoneconf->fullname;
2366 m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
2368 ICO_TRA("CicoSCWindowController::notifyResourceManager Leave(EOK)");
2373 CicoSCWindowController::findWindowObj(int32_t pid, uint32_t surfaceid) const
2375 const CicoSCWindow* r = NULL;
2376 map<unsigned int, CicoSCWindow*>::const_iterator itr = m_windowList.begin();
2377 for (; itr != m_windowList.end(); ++itr) {
2378 const CicoSCWindow* tmp = itr->second;
2379 if ((pid == tmp->pid) && (surfaceid == (uint32_t)tmp->surfaceid)) {
2381 break; // break of for itr
2384 ICO_TRA("return %x", r);
2388 const CicoSCResourceManager*
2389 CicoSCWindowController::getResourceManager(void) const
2394 //--------------------------------------------------------------------------
2396 * @brief Window Check Timer
2397 * @param data this object
2399 //--------------------------------------------------------------------------
2401 CicoSCWindowController::ico_SCWindowChecker(void *data)
2403 struct ico_sc_win_check_t *tp, *bp;
2404 struct timeval curtime;
2413 gettimeofday(&curtime, NULL);
2415 if ((curtime.tv_sec < g_lasttime.tv_sec) ||
2416 ((curtime.tv_sec - g_lasttime.tv_sec) > 2)) {
2417 ntime = ICO_SC_WINCHK_TIMER_BASE;
2421 ntime = (curtime.tv_sec - g_lasttime.tv_sec) * 1000;
2422 if (curtime.tv_usec >= g_lasttime.tv_usec) {
2423 ntime += (curtime.tv_usec - g_lasttime.tv_usec) / 1000;
2426 ntime += ((1000000 + curtime.tv_usec - g_lasttime.tv_usec) / 1000) - 1000;
2429 tp = CicoSCWindowController::win_check_timer;
2434 tp->lapsed += ntime;
2435 tp->timeout += ntime;
2436 if (tp->function != ICO_SC_WINCHK_CONTENTS_CHECK) {
2440 if (tp->timeout >= tp->cycle) {
2443 tp->timeout -= tp->cycle;
2444 } while (tp->timeout > 0);
2446 switch (tp->function) {
2447 case ICO_SC_WINCHK_CONTENTS_CHECK: /* check contents change */
2448 if (tp->state == ICO_SC_WINCONT_CHECK) {
2449 // GENIVI-LM 1.6.0 not support contents change event
2450 // get surface image form GENIVI-LM
2451 ICO_DBG("CicoSCWindowController::ico_SCWindowChecker "
2452 "call ilm_takeSurfaceScreenshot %d[%x]",
2453 tp->surfaceid, tp->surfaceid);
2454 getInstance()->setmapGet(tp->surfaceid, tp->u.cont.path);
2455 tp->state = ICO_SC_WINCONT_WAITFILE;
2456 tp->time = ICO_SC_WINCHK_TIMER_BASE;
2457 tp->cycle = ICO_SC_WINCHK_TIMER_BASE;
2461 struct stat stat_buf;
2463 if (stat(tp->u.cont.path, &stat_buf) >= 0) {
2464 tp->state = ICO_SC_WINCONT_CHECK;
2465 tp->time = ICO_SC_WINCHK_CONTENTS_TIME;
2466 tp->cycle = ICO_SC_WINCHK_CONTENTS_TIME;
2469 getInstance()->mapSurfaceCB(ICO_SC_WINCHK_MAP_SURFACE_EVENT_MAP,
2471 tp->u.cont.width, tp->u.cont.height,
2472 tp->u.cont.width * 4, 0);
2477 case ICO_SC_WINCHK_ANIMA_FADE: /* fade animation */
2478 par = ((tp->lapsed * 100 / tp->time) / 3) * 3;
2479 if (par == tp->par) break;
2481 if (par < 0) par = 0;
2484 if (ilm_surfaceSetOpacity(tp->surfaceid, 1.0) != ILM_SUCCESS) {
2485 ICO_ERR("CicoSCWindowController::ico_SCWindowChecker "
2486 "ilm_surfaceSetOpacity Error %d[%x]",
2487 tp->surfaceid, tp->surfaceid);
2489 if (tp->state != ICO_SC_WINANIMA_SHOW) {
2490 if (ilm_surfaceSetVisibility(tp->surfaceid, 0) != ILM_SUCCESS) {
2491 ICO_ERR("CicoSCWindowController::ico_SCWindowChecker "
2492 "ilm_surfaceSetVisibility Error %d[%x]",
2493 tp->surfaceid, tp->surfaceid);
2499 if (tp->state == ICO_SC_WINANIMA_SHOW) {
2500 rate = ((double)par) / 100.0;
2503 rate = ((double)(100 - par)) / 100.0;
2505 if (ilm_surfaceSetOpacity(tp->surfaceid, rate) != ILM_SUCCESS) {
2506 ICO_ERR("CicoSCWindowController::ico_SCWindowChecker "
2507 "ilm_surfaceSetOpacity Error %d[%x]",
2508 tp->surfaceid, tp->surfaceid);
2514 case ICO_SC_WINCHK_ANIMA_SLIDETOTOP: /* slide totop animation */
2515 case ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM: /* slide totop animation */
2516 case ICO_SC_WINCHK_ANIMA_SLIDETOLEFT: /* slide totop animation */
2517 case ICO_SC_WINCHK_ANIMA_SLIDETORIGHT: /* slide totop animation */
2518 par = ((tp->lapsed * 100 / tp->time) / 3) * 3;
2519 if (par == tp->par) break;
2521 if (par < 0) par = 0;
2524 if (tp->state != ICO_SC_WINANIMA_SHOW) {
2525 if (ilm_surfaceSetVisibility(tp->surfaceid, 0) != ILM_SUCCESS) {
2526 ICO_ERR("CicoSCWindowController::ico_SCWindowChecker "
2527 "ilm_surfaceSetVisibility Error %d[%x]",
2528 tp->surfaceid, tp->surfaceid);
2536 if (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOTOP) {
2538 if (tp->state == ICO_SC_WINANIMA_SHOW) {
2539 y = tp->u.anim.screen_height -
2540 (tp->u.anim.screen_height - tp->u.anim.y) * par / 100;
2544 (tp->u.anim.screen_height - tp->u.anim.y) * par / 100;
2547 else if (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM) {
2549 if (tp->state == ICO_SC_WINANIMA_SHOW) {
2550 y = (-tp->u.anim.height) +
2551 (tp->u.anim.y + tp->u.anim.height) * par / 100;
2555 (tp->u.anim.height + tp->u.anim.y) * par / 100;
2558 else if (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOLEFT) {
2560 if (tp->state == ICO_SC_WINANIMA_SHOW) {
2561 x = tp->u.anim.screen_width -
2562 (tp->u.anim.screen_width - tp->u.anim.x) * par / 100;
2566 (tp->u.anim.screen_width - tp->u.anim.x) * par / 100;
2571 if (tp->state == ICO_SC_WINANIMA_SHOW) {
2572 x = (-tp->u.anim.width) +
2573 (tp->u.anim.x + tp->u.anim.width) * par / 100;
2577 (tp->u.anim.x + tp->u.anim.width) * par / 100;
2581 if (ilm_surfaceSetDestinationRectangle(tp->surfaceid, x, y,
2582 tp->u.anim.width, tp->u.anim.height)
2584 ICO_ERR("CicoSCWindowController::ico_SCWindowChecker "
2585 "ilm_surfaceSetDestinationRectangle Error %d[%x]",
2586 tp->surfaceid, tp->surfaceid);
2596 CicoSCWindowController::win_check_timer = tp;
2599 bp->next = tp->next;
2600 tp->next = CicoSCWindowController::win_check_free;
2601 CicoSCWindowController::win_check_free = tp;
2611 if (ilm_commitChanges() != ILM_SUCCESS) {
2612 ICO_ERR("CicoSCWindowController::ico_SCWindowChecker "
2613 "ilm_commitChanges Error");
2616 g_lasttime = curtime;
2617 if (((htimer == 0) && (g_hightimer != 0)) ||
2618 ((htimer != 0) && (g_hightimer == 0))) {
2619 // change timer speed
2620 g_hightimer = 1 - g_hightimer;
2622 ecore_timer_interval_set(g_SCWindowChecker,
2623 ((double)(g_hightimer ?
2624 ICO_SC_WINCHK_TIMER_BASE : ICO_SC_WINCHK_TIMER_BASE_L)) / 1000.0);
2626 return ECORE_CALLBACK_RENEW;
2629 //--------------------------------------------------------------------------
2631 * @brief window checker destroy surface
2632 * @param surfaceid surface id
2634 //--------------------------------------------------------------------------
2636 CicoSCWindowController::windowCheckerRemove(uint32_t surfaceid)
2638 struct ico_sc_win_check_t *tp, *bp, *fp;
2640 ICO_TRA("CicoSCWindowController::windowCheckerRemove: Enter %d[%x]",
2641 surfaceid, surfaceid);
2643 resetWindowMap(surfaceid);
2645 tp = CicoSCWindowController::win_check_timer;
2648 if (tp->surfaceid == surfaceid) {
2649 // delete check target
2650 if (tp->function == ICO_SC_WINCHK_CONTENTS_CHECK) {
2651 ICO_DBG("CicoSCWindowController::windowCheckerRemove: Remove Thumbnail %d",
2658 CicoSCWindowController::win_check_timer = tp;
2661 bp->next = tp->next;
2664 fp->next = CicoSCWindowController::win_check_free;
2665 CicoSCWindowController::win_check_free = fp;
2672 ICO_TRA("CicoSCWindowController::windowCheckerRemove: Leave");
2675 //--------------------------------------------------------------------------
2677 * @brief window checker set animation
2678 * @param window window object
2679 * @param show show/hide
2680 * @param animation animation name
2681 * @param time animation time(ms)
2683 //--------------------------------------------------------------------------
2685 CicoSCWindowController::setWindowAnimation(CicoSCWindow *window,
2686 int show, const char *animation, int time)
2688 struct ico_sc_win_check_t *tp, *bp;
2689 uint32_t surfaceid = window->surfaceid;
2691 ICO_TRA("CicoSCWindowController::setWindowAnimation: Enter %d[%x] %d <%s> %d",
2692 surfaceid, surfaceid, show, animation, time);
2694 tp = CicoSCWindowController::win_check_timer;
2697 if ((tp->surfaceid == surfaceid) &&
2698 ((tp->function == ICO_SC_WINCHK_ANIMA_FADE) ||
2699 (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOTOP) ||
2700 (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM) ||
2701 (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOLEFT) ||
2702 (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETORIGHT))) {
2703 // same surface target
2710 tp = CicoSCWindowController::win_check_free;
2712 CicoSCWindowController::win_check_free = tp->next;
2715 tp = (struct ico_sc_win_check_t *)malloc(sizeof(struct ico_sc_win_check_t));
2717 ICO_ERR("CicoSCWindowController::setWindowAnimation: Out of Memory");
2721 memset(tp, 0, sizeof(struct ico_sc_win_check_t));
2726 CicoSCWindowController::win_check_timer = tp;
2730 tp->surfaceid = surfaceid;
2734 tp->timeout = ICO_SC_WINCHK_ANIMATION_TIME;
2735 tp->cycle = ICO_SC_WINCHK_ANIMATION_TIME;
2736 if ((strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE) == 0) ||
2737 (strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE_TOTOP) == 0)) {
2738 tp->function = ICO_SC_WINCHK_ANIMA_SLIDETOTOP;
2740 else if (strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE_TOBUTTOM) == 0) {
2741 tp->function = ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM;
2743 else if (strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE_TOLEFT) == 0) {
2744 tp->function = ICO_SC_WINCHK_ANIMA_SLIDETOLEFT;
2746 else if (strcasecmp(animation, ICO_SYC_WIN_ANIMATION_SLIDE_TORIGHT) == 0) {
2747 tp->function = ICO_SC_WINCHK_ANIMA_SLIDETORIGHT;
2750 tp->function = ICO_SC_WINCHK_ANIMA_FADE;
2753 tp->u.anim.x = window->x;
2754 tp->u.anim.y = window->y;
2755 tp->u.anim.width = window->width;
2756 tp->u.anim.height = window->height;
2757 tp->u.anim.screen_width = 1080;
2758 tp->u.anim.screen_height = 1920;
2760 vector<CicoSCDisplay*>::iterator itr;
2761 itr = m_displayList.begin();
2762 for (; itr != m_displayList.end(); ++itr) {
2763 if ((*itr)->displayid == window->displayid) {
2764 tp->u.anim.screen_width = (*itr)->pWidth;
2765 tp->u.anim.screen_height = (*itr)->pHeight;
2769 (void) CicoSCWindowController::ico_SCWindowChecker(NULL);
2771 ICO_TRA("CicoSCWindowController::setWindowAnimation: Leave");
2774 //--------------------------------------------------------------------------
2776 * @brief window checker reset animation
2777 * @param window window object
2779 //--------------------------------------------------------------------------
2781 CicoSCWindowController::resetWindowAnimation(CicoSCWindow *window)
2783 struct ico_sc_win_check_t *tp, *bp;
2784 uint32_t surfaceid = window->surfaceid;
2786 ICO_TRA("CicoSCWindowController::resetWindowAnimation: Enter %d[%x]",
2787 surfaceid, surfaceid);
2789 tp = CicoSCWindowController::win_check_timer;
2792 if ((tp->surfaceid == surfaceid) &&
2793 ((tp->function == ICO_SC_WINCHK_ANIMA_FADE) ||
2794 (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOTOP) ||
2795 (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOBUTTOM) ||
2796 (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETOLEFT) ||
2797 (tp->function == ICO_SC_WINCHK_ANIMA_SLIDETORIGHT))) {
2798 // delete surface target
2799 if (ilm_surfaceSetOpacity(tp->surfaceid, 1.0) != ILM_SUCCESS) {
2800 ICO_ERR("CicoSCWindowController::resetWindowAnimation "
2801 "ilm_surfaceSetOpacity Error %d[%x]",
2802 tp->surfaceid, tp->surfaceid);
2804 if (ilm_surfaceSetDestinationRectangle(tp->surfaceid,
2805 tp->u.anim.x, tp->u.anim.y,
2806 tp->u.anim.width, tp->u.anim.height)
2808 ICO_ERR("CicoSCWindowController::resetWindowAnimation "
2809 "ilm_surfaceSetDestinationRectangle Error %d[%x]",
2810 tp->surfaceid, tp->surfaceid);
2812 if (ilm_surfaceSetVisibility(tp->surfaceid,
2813 (tp->state == ICO_SC_WINANIMA_SHOW) ? 1 : 0) != ILM_SUCCESS) {
2814 ICO_ERR("CicoSCWindowController::resetWindowAnimation "
2815 "ilm_surfaceSetVisibility Error %d[%x]",
2816 tp->surfaceid, tp->surfaceid);
2818 if (ilm_commitChanges() != ILM_SUCCESS) {
2819 ICO_ERR("CicoSCWindowController::resetWindowAnimation "
2820 "ilm_commitChanges Error");
2823 CicoSCWindowController::win_check_timer = tp->next;
2826 bp->next = tp->next;
2828 tp->next = CicoSCWindowController::win_check_free;
2829 CicoSCWindowController::win_check_free = tp;
2835 ICO_TRA("CicoSCWindowController::resetWindowAnimation: Leave");
2838 //--------------------------------------------------------------------------
2840 * @brief window checker set map
2841 * @param window window object
2842 * @param framerate frame rate(frames/sec or -1)
2843 * @param filepath surface image file path
2845 //--------------------------------------------------------------------------
2847 CicoSCWindowController::setWindowMap(CicoSCWindow *window,
2848 int framerate, const char *filepath)
2850 struct ico_sc_win_check_t *tp, *bp;
2851 uint32_t surfaceid = window->surfaceid;
2853 ICO_TRA("CicoSCWindowController::setWindowMap: Enter %d[%x],%d,<%s>",
2854 surfaceid, surfaceid, framerate, filepath);
2856 tp = CicoSCWindowController::win_check_timer;
2859 if ((tp->surfaceid == surfaceid) &&
2860 (tp->function == ICO_SC_WINCHK_CONTENTS_CHECK)) {
2861 // same surface target
2868 tp = CicoSCWindowController::win_check_free;
2870 CicoSCWindowController::win_check_free = tp->next;
2873 tp = (struct ico_sc_win_check_t *)malloc(sizeof(struct ico_sc_win_check_t));
2875 ICO_ERR("CicoSCWindowController::setWindowMap: Out of Memory");
2879 memset(tp, 0, sizeof(struct ico_sc_win_check_t));
2884 CicoSCWindowController::win_check_timer = tp;
2887 tp->function = ICO_SC_WINCHK_CONTENTS_CHECK;
2888 tp->surfaceid = surfaceid;
2889 if (framerate <= 0) {
2893 tp->cycle = 1000/framerate;
2899 strncpy(tp->u.cont.path, filepath, ICO_SYC_MAX_LEN-1);
2900 tp->state = ICO_SC_WINCONT_CHECK;
2901 tp->u.cont.x = window->x;
2902 tp->u.cont.y = window->y;
2903 tp->u.cont.width = window->width;
2904 tp->u.cont.height = window->height;
2906 (void) CicoSCWindowController::ico_SCWindowChecker(NULL);
2908 ICO_TRA("CicoSCWindowController::setWindowMap: Leave");
2911 //--------------------------------------------------------------------------
2913 * @brief window checker reset map
2914 * @param surfaceid surface id
2916 //--------------------------------------------------------------------------
2918 CicoSCWindowController::resetWindowMap(uint32_t surfaceid)
2920 struct ico_sc_win_check_t *tp, *bp;
2922 ICO_TRA("CicoSCWindowController::resetWindowMap: Enter %d[%x]",
2923 surfaceid, surfaceid);
2925 tp = CicoSCWindowController::win_check_timer;
2928 if ((tp->surfaceid == surfaceid) &&
2929 (tp->function == ICO_SC_WINCHK_CONTENTS_CHECK)) {
2931 CicoSCWindowController::win_check_timer = tp->next;
2934 bp->next = tp->next;
2936 tp->next = CicoSCWindowController::win_check_free;
2937 CicoSCWindowController::win_check_free = tp;
2944 mapSurfaceCB(ICO_SC_WINCHK_MAP_SURFACE_EVENT_UNMAP,
2945 tp->surfaceid, 0, tp->u.cont.width, tp->u.cont.height,
2946 tp->u.cont.width * 4, 0);
2948 ICO_TRA("CicoSCWindowController::resetWindowMap: Leave");
2950 // vim:set expandtab ts=4 sw=4: