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/ioctl.h>
30 #include "CicoSCWindow.h"
31 #include "CicoSCWayland.h"
32 #include "CicoSCWindowController.h"
35 #include "CicoSCSystemConfig.h"
36 #include "CicoSCConf.h"
37 #include "CicoSCDisplay.h"
38 #include "CicoSCLayer.h"
39 #include "CicoSCDisplayZone.h"
40 #include "ico_syc_error.h"
41 #include "ico_syc_type.h"
42 #include "ico_syc_winctl.h"
43 #include "CicoSCCommand.h"
44 #include "ico_syc_msg_cmd_def.h"
45 #include "CicoSCServer.h"
46 #include "CicoSCMessage.h"
47 #include "CicoSCLifeCycleController.h"
48 #include "CicoSCResourceManager.h"
50 //--------------------------------------------------------------------------
52 * @brief default constructor
54 //--------------------------------------------------------------------------
55 CicoSCWindowController::CicoSCWindowController()
56 : m_resMgr(NULL), m_physicalDisplayTotal(0)
58 CicoSCWayland* wayland = CicoSCWayland::getInstance();
59 wayland->getInstance()->addWaylandIF(ICO_WL_WIN_MGR_IF, this);
60 wayland->getInstance()->addWaylandIF(ICO_WL_OUTPUT_IF, this);
64 //--------------------------------------------------------------------------
68 //--------------------------------------------------------------------------
69 CicoSCWindowController::~CicoSCWindowController()
73 //--------------------------------------------------------------------------
75 * @brief initialize display and window database
77 //--------------------------------------------------------------------------
79 CicoSCWindowController::initDB(void)
81 ICO_DBG("CicoSCWindowController::initDB: Enter");
83 const vector<CicoSCDisplayConf*>& displayList =
84 CicoSCSystemConfig::getInstance()->getDisplayConfList();
85 vector<CicoSCDisplayConf*>::const_iterator itr;
86 itr = displayList.begin();
87 for (; itr != displayList.end(); ++itr) {
88 CicoSCDisplay *display = new CicoSCDisplay();
89 display->displayid = (*itr)->id;
90 display->type = (*itr)->type;
91 display->nodeid = (*itr)->node;
92 display->displayno = (*itr)->no;
93 display->width = (*itr)->width;
94 display->height = (*itr)->height;
95 display->inch = (*itr)->inch;
96 display->name = (*itr)->name;
98 vector<CicoSCLayerConf*>::const_iterator itr2;
99 itr2 = (*itr)->layerConfList.begin();
100 for (; itr2 != (*itr)->layerConfList.end(); ++itr2) {
101 CicoSCLayer *layer = new CicoSCLayer();
102 layer->layerid = (*itr2)->id;
103 layer->type = (*itr2)->type;
104 layer->width = display->width;
105 layer->height = display->height;
106 layer->displayid = display->displayid;
107 layer->menuoverlap = (*itr2)->menuoverlap;
108 display->layerList.push_back(layer);
111 vector<CicoSCDisplayZoneConf*>::const_iterator itr3;
112 itr3 = (*itr)->zoneConfList.begin();
113 for (; itr3 != (*itr)->zoneConfList.end(); ++itr3) {
114 CicoSCDisplayZone *zone = new CicoSCDisplayZone();
115 zone->zoneid = (*itr3)->id;
116 zone->x = (*itr3)->x;
117 zone->y = (*itr3)->y;
118 zone->width = (*itr3)->w;
119 zone->height = (*itr3)->h;
120 zone->fullname = (*itr3)->fullname;
121 display->zoneList[zone->zoneid] = zone;
124 m_displayList.push_back(display);
127 ICO_DBG("CicoSCWindowController::initDB: Leave");
131 //--------------------------------------------------------------------------
133 * @brief set resource manager instance
135 * @param [in] resMgr resource manager instance
137 //--------------------------------------------------------------------------
139 CicoSCWindowController::setResourceManager(CicoSCResourceManager *resMgr)
144 //--------------------------------------------------------------------------
146 * @brief show a target window
148 * @param [in] surfaceid wayland surface id
149 * @param [in] animation animation name
150 * @param [in] animationTime animation time
152 * @return ICO_SYC_EOK on success, other on error
153 * @retval ICO_SYC_EOK success
154 * @retval ICO_SYC_ESRCH error(not initialized)
155 * @retval ICO_SYC_ENOENT error(not exist)
157 //--------------------------------------------------------------------------
159 CicoSCWindowController::show(int surfaceid,
160 const char *animation,
163 ICO_DBG("CicoSCWindowController::show Enter"
164 "(surfaceid=0x%08X animation=%s animationTime=%d)",
165 surfaceid, animation, animationTime);
167 // find window information in window list
168 CicoSCWindow *window = findWindow(surfaceid);
169 if (NULL == window) {
170 ICO_WRN("CicoSCWindowController::show Leave(ENOENT)");
171 return ICO_SYC_ENOENT;
174 // update visible attr
175 window->visible = true;
177 // set animation request to Multi Window Manager
178 int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
179 int raiseFlag = ICO_WINDOW_MGR_V_NOCHANGE;
180 if (animationTime & ICO_SYC_WIN_SURF_RAISE) {
181 raiseFlag = ICO_WINDOW_MGR_RAISE_RAISE;
182 window->raise = true;
184 else if (animationTime & ICO_SYC_WIN_SURF_LOWER) {
185 raiseFlag = ICO_WINDOW_MGR_RAISE_LOWER;
186 window->raise = false;
188 else if (((animationTime & ICO_SYC_WIN_SURF_NOCHANGE) == 0) &&
189 (false == window->raise)) {
190 raiseFlag = ICO_WINDOW_MGR_RAISE_RAISE;
191 window->raise = true;
193 if ((NULL != animation) && (animation[0] != '\0')) {
194 // set animation request to Multi Window Manager
195 CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
196 ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
197 animation, animationTime & ~ICO_SYC_WIN_SURF_FLAGS);
198 animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
201 // set visible request to Multi Window Manager
202 CicoSCWlWinMgrIF::setVisible(window->surfaceid,
203 ICO_WINDOW_MGR_VISIBLE_SHOW,
204 raiseFlag, animaFlag);
207 CicoSCWayland::getInstance()->flushDisplay();
209 ICO_DBG("CicoSCWindowController::show Leave(EOK)");
213 //--------------------------------------------------------------------------
215 * @brief hide a target window
217 * @param [in] surfaceid wayland surface id
218 * @param [in] animation animation name
219 * @param [in] animationTime animation time
221 * @return ICO_SYC_EOK on success, other on error
222 * @retval ICO_SYC_EOK success
223 * @retval ICO_SYC_ESRCH error(not initialized)
224 * @retval ICO_SYC_ENOENT error(not exist)
226 //--------------------------------------------------------------------------
228 CicoSCWindowController::hide(int surfaceid,
229 const char *animation,
232 ICO_DBG("CicoSCWindowController::hide Enter"
233 "(surfaceid=0x%08X animation=%s animationTime=%d)",
234 surfaceid, animation, animationTime);
236 // find window information in window list
237 CicoSCWindow *window = findWindow(surfaceid);
238 if (NULL == window) {
239 ICO_WRN("CicoSCWindowController::hide Leave(ENOENT)");
240 return ICO_SYC_ENOENT;
243 // update window attr
244 window->visible = false;
246 // set animation request to Multi Window Manager
247 int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
248 if ((NULL != animation) && (animation[0] != '\0')) {
249 CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
250 ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE,
251 animation, animationTime & ~ICO_SYC_WIN_SURF_FLAGS);
252 animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
255 // set visible request to Multi Window Manager
256 CicoSCWlWinMgrIF::setVisible(window->surfaceid,
257 ICO_WINDOW_MGR_VISIBLE_HIDE,
258 ICO_WINDOW_MGR_V_NOCHANGE, animaFlag);
261 CicoSCWayland::getInstance()->flushDisplay();
263 ICO_DBG("CicoSCWindowController::hide Leave(EOK)");
267 //--------------------------------------------------------------------------
269 * @brief resize window(surface) size
271 * @param [in] surfaceid wayland surface id
272 * @param [in] w window width
273 * @param [in] h window height
274 * @param [in] animation animation name
275 * @param [in] animationTime animation time
277 * @return ICO_SYC_EOK on success, other on error
278 * @retval ICO_SYC_EOK success
279 * @retval ICO_SYC_ESRCH error(not initialized)
280 * @retval ICO_SYC_ENOENT error(window dose not exist)
282 //--------------------------------------------------------------------------
284 CicoSCWindowController::resize(int surfaceid,
287 const char *animation,
290 ICO_DBG("CicoSCWindowController::resize Enter"
291 "(surfaceid=0x%08X h=%d w=%d animation=%s animationTime=%d)",
292 surfaceid, w, h, animation, animationTime);
294 // find window information in window list
295 CicoSCWindow *window = findWindow(surfaceid);
296 if (NULL == window) {
297 ICO_WRN("CicoSCWindowController::resize Leave(ENOENT)");
298 return ICO_SYC_ENOENT;
301 // set animation request to Multi Window Manager
302 int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
303 if ((NULL != animation) && (animation[0] != '\0')) {
304 CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
305 ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE,
306 animation, animationTime);
307 animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
310 // set visible request to Multi Window Manager
311 CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, window->nodeid,
312 ICO_WINDOW_MGR_V_NOCHANGE,
313 ICO_WINDOW_MGR_V_NOCHANGE,
317 CicoSCWayland::getInstance()->flushDisplay();
319 ICO_DBG("CicoSCWindowController::resize Leave(EOK)");
323 //--------------------------------------------------------------------------
325 * @brief move window(surface) size
327 * @param [in] surfaceid wayland surface id
328 * @param [in] nodeid node id
329 * @param [in] x window width
330 * @param [in] y window height
331 * @param [in] animation animation name
332 * @param [in] animationTime animation time
334 * @return ICO_SYC_EOK on success, other on error
335 * @retval ICO_SYC_EOK success
336 * @retval ICO_SYC_ESRCH error(not initialized)
337 * @retval ICO_SYC_ENOENT error(window dose not exist)
339 //--------------------------------------------------------------------------
341 CicoSCWindowController::move(int surfaceid,
345 const char *animation,
348 ICO_DBG("CicoSCWindowController::move Enter"
349 "(surfaceid=0x%08X nodeid=%d x=%d y=%d "
350 "animation=%s animationTime=%d)",
351 surfaceid, nodeid, x, y, animation, animationTime);
353 // find window information in window list
354 CicoSCWindow *window = findWindow(surfaceid);
355 if (NULL == window) {
356 ICO_WRN("CicoSCWindowController::move Leave(ENOENT)");
357 return ICO_SYC_ENOENT;
360 // set animation request to Multi Window Manager
361 int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
362 if ((NULL != animation) && (animation[0] != '\0')) {
363 CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
364 ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
365 animation, animationTime);
366 animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
369 int moveNodeId = ICO_WINDOW_MGR_V_NOCHANGE;
370 if ((nodeid >= 0) && (nodeid != INT_MAX)) {
374 // set visible request to Multi Window Manager
375 CicoSCWlWinMgrIF::setPositionsize(window->surfaceid,
377 ICO_WINDOW_MGR_V_NOCHANGE,
378 ICO_WINDOW_MGR_V_NOCHANGE,
382 CicoSCWayland::getInstance()->flushDisplay();
384 ICO_DBG("CicoSCWindowController::move Leave(EOK)");
388 //--------------------------------------------------------------------------
390 * @brief raise window(surface)
392 * @param [in] surfaceid wayland surface id
393 * @param [in] animation animation name
394 * @param [in] animationTime animation time
396 * @return ICO_SYC_EOK on success, other on error
397 * @retval ICO_SYC_EOK success
398 * @retval ICO_SYC_ESRCH error(not initialized)
399 * @retval ICO_SYC_ENOENT error(layer dose not exist)
401 //--------------------------------------------------------------------------
403 CicoSCWindowController::raise(int surfaceid,
404 const char *animation,
407 ICO_DBG("CicoSCWindowController::raise Enter"
408 "(surfaceid=0x%08X animation=%s animationTime=%d)",
409 surfaceid, animation, animationTime);
411 // find window information in window list
412 CicoSCWindow *window = findWindow(surfaceid);
413 if (NULL == window) {
414 ICO_WRN("CicoSCWindowController::raise Leave(ENOENT)");
415 return ICO_SYC_ENOENT;
418 // update visible attr
419 window->raise = true;
421 // set animation request to Multi Window Manager
422 int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
423 if ((NULL != animation) && (animation[0] != '\0')) {
424 CicoSCWindowController::setAnimation(window->surfaceid,
425 ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
426 animation, animationTime);
427 animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
430 // set visible request to Multi Window Manager
431 CicoSCWlWinMgrIF::setVisible(window->surfaceid,
432 ICO_WINDOW_MGR_V_NOCHANGE,
433 ICO_WINDOW_MGR_RAISE_RAISE, animaFlag);
436 CicoSCWayland::getInstance()->flushDisplay();
438 ICO_DBG("CicoSCWindowController::raise Leave(EOK)");
442 //--------------------------------------------------------------------------
444 * @brief set window(surface) geometry
446 * @param [in] surfaceid wayland surface id
447 * @param [in] nodeid node id
448 * @param [in] x window x position
449 * @param [in] y window y position
450 * @param [in] w window width
451 * @param [in] h window height
452 * @param [in] resizeAnimation resize animation name
453 * @param [in] resizeAnimationTime resize animation time
454 * @param [in] moveAnimation move animation name
455 * @param [in] moveanimationTime move animation time
457 * @return ICO_SYC_EOK on success, other on error
458 * @retval ICO_SYC_EOK success
459 * @retval ICO_SYC_ESRCH error(not initialized)
460 * @retval ICO_SYC_ENOENT error(window dose not exist)
462 //--------------------------------------------------------------------------
464 CicoSCWindowController::setGeometry(int surfaceid,
470 const char *resizeAnimation,
471 int resizeAnimationTime,
472 const char *moveAnimation,
473 int moveAnimationTime)
475 ICO_DBG("CicoSCWindowController::setGeometry Enter"
476 "(surfaceid=0x%08X nodeid=%d x=%d y=%d w=%d h=%d "
477 "resizeAnimation=%s resizeAnimationTime=%d "
478 "moveAnimation=%s moveAnimationTime=%d)",
479 surfaceid, nodeid, x, y, w, h,
480 resizeAnimation, resizeAnimationTime,
481 moveAnimation, moveAnimationTime);
483 // find window information in window list
484 CicoSCWindow *window = findWindow(surfaceid);
485 if (NULL == window) {
486 ICO_WRN("CicoSCWindowController::setGeometry Leave(ENOENT)");
487 return ICO_SYC_ENOENT;
490 // set animation request to Multi Window Manager
491 const char *animation = "";
492 if (NULL != resizeAnimation) {
493 animation = resizeAnimation;
495 CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
496 ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE,
497 animation, resizeAnimationTime);
499 if (NULL != moveAnimation) {
500 animation = moveAnimation;
502 CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
503 ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
504 animation, moveAnimationTime);
506 int moveNodeId = ICO_WINDOW_MGR_V_NOCHANGE;
511 moveNodeId = window->nodeid;
514 if (m_physicalDisplayTotal <= (unsigned int)moveNodeId) {
515 ICO_WRN("nodeid(%d) is over physical display total(%d)",
516 m_physicalDisplayTotal, nodeid);
517 ICO_WRN("CicoSCWindowController::setGeometry Leave(EINVAL)");
518 return ICO_SYC_EINVAL;
521 int moveX = ICO_WINDOW_MGR_V_NOCHANGE;
526 int moveY = ICO_WINDOW_MGR_V_NOCHANGE;
531 int moveW = ICO_WINDOW_MGR_V_NOCHANGE;
536 int moveH = ICO_WINDOW_MGR_V_NOCHANGE;
541 // set visible request to Multi Window Manager
542 CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, moveNodeId,
543 moveX, moveY, moveW, moveH,
544 ICO_WINDOW_MGR_FLAGS_ANIMATION);
547 CicoSCWayland::getInstance()->flushDisplay();
549 ICO_DBG("CicoSCWindowController::setGeometry Leave(EOK)");
553 //--------------------------------------------------------------------------
555 * @brief set window(surface) geometry
557 * @param [in] surfaceid wayland surface id
558 * @param [in] nodeid node id
559 * @param [in] zone display zone name
560 * @param [in] resizeAnimation resize animation name
561 * @param [in] resizeAnimationTime resize animation time
562 * @param [in] moveAnimation move animation name
563 * @param [in] moveanimationTime move animation time
565 * @return ICO_SYC_EOK on success, other on error
566 * @retval ICO_SYC_EOK success
567 * @retval ICO_SYC_ESRCH error(not initialized)
568 * @retval ICO_SYC_ENOENT error(window dose not exist)
569 * @retval ICO_SYC_EINVAL error(zone is null, zone name is invalid)
571 //--------------------------------------------------------------------------
573 CicoSCWindowController::setGeometry(int surfaceid,
575 const char *resizeAnimation,
576 int resizeAnimationTime,
577 const char *moveAnimation,
578 int moveAnimationTime)
580 ICO_DBG("CicoSCWindowController::setGeometry Enter"
581 "(surfaceid=0x%08X zone=%s "
582 "resizeAnimation=%s resizeAnimationTime=%d "
583 "moveAnimation=%s moveAnimationTime=%d)",
585 resizeAnimation, resizeAnimationTime,
586 moveAnimation, moveAnimationTime);
588 // find window information in window list
589 CicoSCWindow *window = findWindow(surfaceid);
590 if (NULL == window) {
591 ICO_WRN("CicoSCWindowController::setGeometry Leave(ENOENT)");
592 return ICO_SYC_ENOENT;
595 if ((NULL == zone) || ('\0' == zone[0])) {
596 ICO_WRN("CicoSCWindowController::setGeometry Leave(EINVAL)");
597 return ICO_SYC_EINVAL;
600 vector<CicoSCDisplay*>::iterator itr;
601 itr = m_displayList.begin();
602 CicoSCDisplayZone* dispzone = NULL;
604 for (; itr != m_displayList.end(); ++itr) {
605 dispzone = (*itr)->findDisplayZonebyFullName(zone);
606 if (NULL != dispzone) {
607 displayno = (*itr)->displayno;
612 if (NULL == dispzone) {
613 ICO_WRN("display zone name(%s) is invalid.", zone);
614 ICO_WRN("CicoSCWindowController::setGeometry Leave(EINVAL)");
615 return ICO_SYC_EINVAL;
618 if (m_physicalDisplayTotal <= (unsigned int)displayno) {
619 ICO_WRN("nodeid(%d) is over physical display total(%d)",
620 m_physicalDisplayTotal, displayno);
621 ICO_WRN("CicoSCWindowController::setGeometry Leave(EINVAL)");
622 return ICO_SYC_EINVAL;
625 // update window attr
626 window->zoneid = dispzone->zoneid;
627 window->zone = dispzone->fullname;
629 int ret = setGeometry(surfaceid, displayno,
630 dispzone->x, dispzone->y,
631 dispzone->width, dispzone->height,
632 resizeAnimation, resizeAnimationTime,
633 moveAnimation, moveAnimationTime);
635 ICO_DBG("CicoSCWindowController::setGeometry Leave(EOK)");
639 //--------------------------------------------------------------------------
641 * @brief lower window(surface)
643 * @param [in] surfaceid wayland surface id
644 * @param [in] animation animation name
645 * @param [in] animationTime animation time
647 * @return ICO_SYC_EOK on success, other on error
648 * @retval ICO_SYC_EOK success
649 * @retval ICO_SYC_ESRCH error(not initialized)
650 * @retval ICO_SYC_ENOENT error(layer dose not exist)
652 //--------------------------------------------------------------------------
654 CicoSCWindowController::lower(int surfaceid,
655 const char *animation,
658 ICO_DBG("CicoSCWindowController::lower Enter"
659 "(surfaceid=0x%08X animation=%s animationTime=%d)",
660 surfaceid, animation, animationTime);
662 // find window information in window list
663 CicoSCWindow *window = findWindow(surfaceid);
664 if (NULL == window) {
665 ICO_WRN("CicoSCWindowController::lower Leave(ENOENT)");
666 return ICO_SYC_ENOENT;
669 // update visible attr
670 window->raise = false;
672 // set animation request to Multi Window Manager
673 int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
674 if ((NULL != animation) && (animation[0] != '\0')) {
675 CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
676 ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE,
677 animation, animationTime);
678 animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
681 // set visible request to Multi Window Manager
682 CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_WINDOW_MGR_V_NOCHANGE,
683 ICO_WINDOW_MGR_RAISE_LOWER, animaFlag);
686 CicoSCWayland::getInstance()->flushDisplay();
688 ICO_DBG("CicoSCWindowController::lower Leave(EOK)");
692 //--------------------------------------------------------------------------
694 * @brief set window layer
696 * @param [in] surfaceid wayland surface id
697 * @param [in] layer layer id
699 * @return ICO_SYC_EOK on success, other on error
700 * @retval ICO_SYC_EOK success
701 * @retval ICO_SYC_ESRCH error(not initialized)
702 * @retval ICO_SYC_ENOENT error(window or layer dose not exist)
704 //--------------------------------------------------------------------------
706 CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
708 ICO_DBG("CicoSCWindowController::setWindowLayer Enter"
709 "(surfaceid=0x%08X layerid=%x)", surfaceid, layerid);
711 // find window information in window list
712 CicoSCWindow *window = findWindow(surfaceid);
713 if (NULL == window) {
714 ICO_WRN("CicoSCWindowController::setWindowLayer Leave(ENOENT)");
715 return ICO_SYC_ENOENT;
718 // find layer information in layer list
719 CicoSCLayer* layer = findLayer(window->displayid, layerid);
721 // check special layer
722 if ((layerid != ICO_WINDOW_MGR_V_LAYER_INPUT) &&
723 (layerid != ICO_WINDOW_MGR_V_LAYER_CURSOR)) {
724 ICO_WRN("CicoSCWindowController::setWindowLayer Leave(ENOENT[disp=%d,layer=%d])",
725 window->displayid, layerid);
726 return ICO_SYC_ENOENT;
730 // update window attr
731 window->layerid = layerid;
733 // set window layer request to Multi Window Manager
734 CicoSCWlWinMgrIF::setWindowLayer(window->surfaceid, window->layerid);
737 CicoSCWayland::getInstance()->flushDisplay();
739 ICO_DBG("CicoSCWindowController::setWindowLayer Leave(EOK)");
743 //--------------------------------------------------------------------------
747 * @param [in] displayid display id
748 * @param [in] layerid layer id
750 * @return ICO_SYC_EOK on success, other on error
751 * @retval ICO_SYC_EOK success
752 * @retval ICO_SYC_ESRCH error(not initialized)
753 * @retval ICO_SYC_ENOENT error(layer dose not exist)
755 //--------------------------------------------------------------------------
757 CicoSCWindowController::showLayer(int displayid, int layerid)
759 ICO_DBG("CicoSCWindowController::showLayer Enter"
760 "(displayid=%d layerid=%d)", displayid, layerid);
762 // find layer information in layer list
763 CicoSCLayer* layer = findLayer(displayid, layerid);
765 ICO_WRN("CicoSCWindowController::showLayer Leave(ENOENT)");
766 return ICO_SYC_ENOENT;
769 CicoSCWlWinMgrIF::setLayerVisible(layerid, ICO_WINDOW_MGR_VISIBLE_SHOW);
772 CicoSCWayland::getInstance()->flushDisplay();
774 ICO_DBG("CicoSCWindowController::showLayer Leave(EOK)");
778 //--------------------------------------------------------------------------
782 * @param [in] displayid display id
783 * @param [in] layerid layer id
785 * @return ICO_SYC_EOK on success, other on error
786 * @retval ICO_SYC_EOK success
787 * @retval ICO_SYC_ESRCH error(not initialized)
788 * @retval ICO_SYC_ENOENT error(layer dose not exist)
790 //--------------------------------------------------------------------------
792 CicoSCWindowController::hideLayer(int displayid, int layerid)
794 ICO_DBG("CicoSCWindowController::hideLayer Enter"
795 "displayid=%d layerid=%d)",
798 // find layer information in layer list
799 CicoSCLayer* layer = findLayer(displayid, layerid);
801 ICO_WRN("CicoSCWindowController::hideLayer Leave(ENOENT)");
802 return ICO_SYC_ENOENT;
805 CicoSCWlWinMgrIF::setLayerVisible(layerid, ICO_WINDOW_MGR_VISIBLE_HIDE);
808 CicoSCWayland::getInstance()->flushDisplay();
810 ICO_DBG("CicoSCWindowController::hideVisible Leave(EOK)");
814 //--------------------------------------------------------------------------
816 * @brief active window(surface)
818 * @param [in] surfaceid wayland surface id
819 * @param [in] target target(pointer and/or keyboard)
821 * @return ICO_SYC_EOK on success, other on error
822 * @retval ICO_SYC_EOK success
823 * @retval ICO_SYC_ESRCH error(not initialized)
824 * @retval ICO_SYC_ENOENT error(layer dose not exist)
826 //--------------------------------------------------------------------------
828 CicoSCWindowController::active(int surfaceid, int target)
830 ICO_DBG("CicoSCWindowController::active Enter"
831 "(surfaceid=0x%08X, target=%08X)", surfaceid, target);
833 // find window information in window list
834 CicoSCWindow *window = findWindow(surfaceid);
835 if (NULL == window) {
836 ICO_WRN("CicoSCWindowController::active Leave(ENOENT)");
837 return ICO_SYC_ENOENT;
841 target = ICO_WINDOW_MGR_ACTIVE_POINTER |
842 ICO_WINDOW_MGR_ACTIVE_KEYBOARD;
845 // set active request to Multi Window Manager
846 CicoSCWlWinMgrIF::setActive(window->surfaceid, target);
849 CicoSCWayland::getInstance()->flushDisplay();
851 // update visible attr
852 window->raise = true;
854 // update active window
855 map<unsigned int, CicoSCWindow*>::iterator itr;
856 itr = m_windowList.begin();
857 for (; itr != m_windowList.end(); ++itr) {
858 CicoSCWindow* window = itr->second;
859 if (window->surfaceid == surfaceid) {
860 window->active = target;
867 window->active &= ~target;
872 ICO_DBG("CicoSCWindowController::active Leave(EOK)");
876 //--------------------------------------------------------------------------
880 * @param [in] surfaceid wayland surface id
881 * @param [in] framerate surface change frame rate(frames par sec)
883 * @return ICO_SYC_EOK on success, other on error
884 * @retval ICO_SYC_EOK success
885 * @retval ICO_SYC_ESRCH error(not initialized)
886 * @retval ICO_SYC_ENOENT error(layer dose not exist)
888 //--------------------------------------------------------------------------
890 CicoSCWindowController::mapSurface(int surfaceid, int framerate)
892 ICO_WRN("CicoSCWindowController::mapSurface Enter");
894 // find window information in window list
895 CicoSCWindow *window = findWindow(surfaceid);
896 if (NULL == window) {
897 ICO_WRN("CicoSCWindowController::mapSurface Leave(ENOENT)");
898 return ICO_SYC_ENOENT;
905 CicoSCWlWinMgrIF::mapSurface(surfaceid, framerate);
907 ICO_DBG("CicoSCWindowController::mapSurface Leave(EOK)");
911 //--------------------------------------------------------------------------
913 * @brief unmap surface
915 * @param [in] surfaceid wayland surface id
917 * @return ICO_SYC_EOK on success, other on error
918 * @retval ICO_SYC_EOK success
919 * @retval ICO_SYC_ESRCH error(not initialized)
920 * @retval ICO_SYC_ENOENT error(layer dose not exist)
922 //--------------------------------------------------------------------------
924 CicoSCWindowController::unmapSurface(int surfaceid)
926 ICO_DBG("CicoSCWindowController::unmapSurface Enter");
928 // find window information in window list
929 CicoSCWindow *window = findWindow(surfaceid);
930 if (NULL == window) {
931 ICO_WRN("CicoSCWindowController::unmapSurface Leave(ENOENT)");
932 return ICO_SYC_ENOENT;
935 CicoSCWlWinMgrIF::unmapSurface(surfaceid);
937 ICO_DBG("CicoSCWindowController::unmapSurface Leave(EOK)");
941 //--------------------------------------------------------------------------
943 * @brief wayland surface create callback
945 * @param [in] data user data(unused)
946 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
947 * @param [in] surfaceid ico_window_mgr surface Id
948 * @param [in] winname surface window name(title)
949 * @param [in] pid wayland client process Id
950 * @param [in] appid wayland client application Id
952 //--------------------------------------------------------------------------
954 CicoSCWindowController::createdCB(void *data,
955 struct ico_window_mgr *ico_window_mgr,
961 ICO_DBG("CicoSCWindowController::createdCB Enter"
962 "(surfaceid=0x%08X winname=%s pid=%d appid=%s)",
963 surfaceid, winname, pid, appid);
965 CicoSCWindow* window = new CicoSCWindow();
967 window->surfaceid = surfaceid;
968 window->name = winname;
969 window->appid = appid;
971 window->displayid = ICO_SURFACEID_2_NODEID(surfaceid);
973 CicoSCLifeCycleController* appctrl;
974 appctrl = CicoSCLifeCycleController::getInstance();
975 const CicoSCAilItems *ailItem = appctrl->findAIL(appid);
976 if (NULL == ailItem) {
977 const CicoSCAulItems* aulitem = appctrl->findAUL(pid);
978 if (NULL != aulitem) {
979 window->appid = aulitem->m_appid;
980 ICO_DBG("appid=%s", window->appid.c_str());
981 ailItem = appctrl->findAIL(window->appid.c_str());
984 ICO_DBG("application information not found.");
988 if (NULL != ailItem) {
989 window->layerid = ailItem->m_layer;
990 window->zoneid = ailItem->m_displayZone;
991 window->nodeid = ailItem->m_nodeID;
992 if ((window->displayid >= 0) && (window->zoneid >= 0)) {
994 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
996 window->zone = zone->fullname;
999 window->width = zone->width;
1000 window->height = zone->height;
1005 ICO_WRN("ail item not found.");
1006 ICO_WRN("CicoSCWindowController::createdCB Leave(ENOENT)");
1010 appctrl->enterAUL(appid, pid, window);
1012 // dump log window information
1015 m_windowList[surfaceid] = window;
1018 CicoSCMessage *message = new CicoSCMessage();
1019 message->addRootObject("command", MSG_CMD_CREATE);
1020 message->addRootObject("appid", window->appid);
1021 message->addRootObject("pid", window->pid);
1022 message->addArgObject("surface", window->surfaceid);
1023 message->addArgObject("winname", window->name);
1024 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1027 if (NULL != m_resMgr) {
1029 CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
1031 cmd.cmdid = MSG_CMD_CREATE_RES;
1032 cmd.appid = window->appid;
1033 cmd.pid = window->pid;
1036 opt->dispres = true;
1037 opt->winname = window->name;
1038 opt->surfaceid = window->surfaceid;
1041 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1043 opt->dispzone = zone->fullname;
1047 opt->soundres = true;
1048 opt->soundname = window->appid;
1050 CicoSCSystemConfig *sysconf = CicoSCSystemConfig::getInstance();
1051 const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
1052 if (NULL != defconf) {
1053 const CicoSCSoundZoneConf *zoneconf =
1054 sysconf->findSoundZoneConfbyId(defconf->soundzone);
1055 if (NULL != zoneconf) {
1056 opt->soundzone = zoneconf->fullname;
1062 m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
1065 show(window->surfaceid, NULL, 0);
1069 ICO_DBG("CicoSCWindowController::createdCB Leave");
1072 //--------------------------------------------------------------------------
1074 * @brief wayland change surface name callback
1076 * @param [in] data user data(unused)
1077 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
1078 * @param [in] surfaceid ico_window_mgr surface Id
1079 * @param [in] winname surface window name(title)
1081 //--------------------------------------------------------------------------
1083 CicoSCWindowController::nameCB(void *data,
1084 struct ico_window_mgr *ico_window_mgr,
1086 const char *winname)
1088 ICO_DBG("CicoSCWindowController::nameCB Enter"
1089 "(surfaceid=0x%08X winname=%s)", surfaceid, winname);
1091 CicoSCWindow *window = findWindow(surfaceid);
1092 if (NULL == window) {
1093 ICO_DBG("CicoSCWindowController::nameCB Leave");
1097 ICO_DBG("nameCB: Update window name %s=>%s",
1098 window->name.c_str(), winname);
1099 window->name = winname;
1102 CicoSCMessage *message = new CicoSCMessage();
1103 message->addRootObject("command", MSG_CMD_NAME);
1104 message->addRootObject("appid", window->appid);
1105 message->addRootObject("pid", window->pid);
1106 message->addArgObject("surface", window->surfaceid);
1107 message->addArgObject("winname", window->name);
1108 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1110 ICO_DBG("CicoSCWindowController::nameCB Leave");
1113 //--------------------------------------------------------------------------
1115 * @brief wayland surface destroy callback
1117 * @param [in] data user data(unused)
1118 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
1119 * @param [in] surfaceid ico_window_mgr surface Id
1121 //--------------------------------------------------------------------------
1123 CicoSCWindowController::destroyedCB(void *data,
1124 struct ico_window_mgr *ico_window_mgr,
1127 ICO_DBG("CicoSCWindowController::destroyedCB Enter"
1128 "(surfaceid=0x%08X)", surfaceid);
1130 CicoSCWindow *window = findWindow(surfaceid);
1131 if (NULL == window) {
1132 ICO_DBG("CicoSCWindowController::destroyedCB Leave");
1137 CicoSCMessage *message = new CicoSCMessage();
1138 message->addRootObject("command", MSG_CMD_DESTROY);
1139 message->addRootObject("appid", window->appid);
1140 message->addRootObject("pid", window->pid);
1141 message->addArgObject("surface", window->surfaceid);
1142 message->addArgObject("winname", window->name);
1143 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1145 // TODO delete window in application
1147 if (NULL != m_resMgr) {
1149 CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
1151 cmd.cmdid = MSG_CMD_DESTORY_RES;
1152 cmd.appid = window->appid;
1153 cmd.pid = window->pid;
1156 opt->dispres = true;
1157 opt->winname = window->name;
1158 opt->surfaceid = window->surfaceid;
1161 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1163 opt->dispzone = zone->fullname;
1166 opt->soundres = true;
1167 opt->soundname = window->appid;
1169 CicoSCSystemConfig *sysconf = CicoSCSystemConfig::getInstance();
1170 const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
1171 if (NULL != defconf) {
1172 const CicoSCSoundZoneConf *zoneconf =
1173 sysconf->findSoundZoneConfbyId(defconf->soundzone);
1174 if (NULL != zoneconf) {
1175 opt->soundzone = zoneconf->fullname;
1179 m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
1182 // delete window in list
1183 m_windowList.erase(window->surfaceid);
1186 ICO_DBG("CicoSCWindowController::destroyedCB Leave");
1189 //--------------------------------------------------------------------------
1191 * @brief wayland surface visible callback
1193 * @param [in] data user data(unused)
1194 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
1195 * @param [in] surfaceid ico_window_mgr surface Id
1196 * @param [in] visible surface visible
1197 * (1=visible/0=invisible/other=no-change)
1198 * @param [in] raise surface raise
1199 * (1=raise/0=lower/other=no change)
1200 * @param [in] hint client request
1201 * (1=client request(not changed)/0=changed)
1203 //--------------------------------------------------------------------------
1205 CicoSCWindowController::visibleCB(void *data,
1206 struct ico_window_mgr *ico_window_mgr,
1212 ICO_DBG("CicoSCWindowController::visibleCB Enter"
1213 "(surfaceid=0x%08X visible=%d raise=%d hint=%d)",
1214 surfaceid, visible, raise, hint);
1216 CicoSCWindow *window = findWindow(surfaceid);
1217 if (NULL == window) {
1218 ICO_DBG("CicoSCWindowController::visibleCB Leave");
1222 int newVisible = visible;
1223 int newRaise = raise;
1225 if (visible == ICO_WINDOW_MGR_V_NOCHANGE) {
1226 newVisible = window->visible;
1229 if (raise == ICO_WINDOW_MGR_V_NOCHANGE) {
1230 newVisible = window->raise;
1233 if ((window->visible == newVisible) && (window->raise == newRaise) ){
1234 ICO_DBG("CicoSCWindowController::visibleCB Leave");
1239 window->visible = newVisible;
1240 window->raise = newRaise;
1242 // notify homescreen
1243 CicoSCMessage *message = new CicoSCMessage();
1244 message->addRootObject("command", MSG_CMD_CHANGE_ATTR);
1245 message->addRootObject("appid", window->appid);
1246 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1248 message->addArgObject("zone", zone->fullname);
1251 message->addArgObject("zone", "");
1253 message->addArgObject("surface", window->surfaceid);
1254 message->addArgObject("winname", window->name);
1255 message->addArgObject("node", window->nodeid);
1256 message->addArgObject("layer", window->layerid);
1257 message->addArgObject("pos_x", window->x);
1258 message->addArgObject("pos_y", window->y);
1259 message->addArgObject("width", window->width);
1260 message->addArgObject("height", window->height);
1261 message->addArgObject("raise", window->raise ? 1 : 0);
1262 message->addArgObject("visible", window->visible ? 1 : 0);
1263 message->addArgObject("active", window->active ? 1 : 0);
1264 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1266 ICO_DBG("CicoSCWindowController::visibleCB Leave");
1269 //--------------------------------------------------------------------------
1271 * @brief wayland surface configure callback
1273 * @param [in] data user data(unused)
1274 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
1275 * @param [in] surfaceid ico_window_mgr surface Id
1276 * @param [in] node surface node Id
1277 * @param [in] x surface upper-left X coordinate
1278 * @param [in] y surface upper-left Y coordinate
1279 * @param [in] width surface width
1280 * @param [in] height surface height
1281 * @param [in] hint client request
1282 * (1=client request(not changed)/0=changed)
1284 //--------------------------------------------------------------------------
1286 CicoSCWindowController::configureCB(void *data,
1287 struct ico_window_mgr *ico_window_mgr,
1297 ICO_DBG("CicoSCWindowController::configureCB Enter"
1298 "(surfaceid=0x%08X node=%d layer=%d x=%d y=%d "
1299 "width=%d height=%d hint=%d)",
1300 surfaceid, node, layer, x, y, width, height, hint);
1302 CicoSCWindow *window = findWindow(surfaceid);
1303 if (NULL == window) {
1304 ICO_DBG("CicoSCWindowController::visibleCB Leave"
1305 "(update window visible failed)");
1309 if (ICO_WINDOW_MGR_HINT_CHANGE == hint) {
1312 window->width = width;
1313 window->height = height;
1315 if (window->layerid != layer) {
1316 window->layerid = layer;
1317 layer = findLayer(window->displayid, layer);
1323 CicoSCMessage *message = new CicoSCMessage();
1324 message->addRootObject("command", MSG_CMD_CHANGE_ATTR);
1325 message->addRootObject("appid", window->appid);
1326 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1328 message->addArgObject("zone", zone->fullname);
1331 message->addArgObject("zone", "");
1333 message->addArgObject("surface", window->surfaceid);
1334 message->addArgObject("winname", window->name);
1335 message->addArgObject("node", window->nodeid);
1336 message->addArgObject("layer", window->layerid);
1337 message->addArgObject("pos_x", window->x);
1338 message->addArgObject("pos_y", window->y);
1339 message->addArgObject("width", window->width);
1340 message->addArgObject("height", window->height);
1341 message->addArgObject("raise", window->raise ? 1 : 0);
1342 message->addArgObject("visible", window->visible ? 1 : 0);
1343 message->addArgObject("active", window->active ? 1 : 0);
1344 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1346 ICO_DBG("CicoSCWindowController::configureCB Leave");
1349 //--------------------------------------------------------------------------
1351 * @brief wayland surface active callback
1353 * @param [in] data user data(unused)
1354 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
1355 * @param [in] surfaceid ico_window_mgr surface Id
1356 * @param [in] active surface active
1357 * (1=active/0=not active)
1359 //--------------------------------------------------------------------------
1361 CicoSCWindowController::activeCB(void *data,
1362 struct ico_window_mgr *ico_window_mgr,
1366 ICO_DBG("CicoSCWindowController::activeCB Enter"
1367 "(surfaceid=0x%08X active=%d)", surfaceid, active);
1369 CicoSCWindow *window = findWindow(surfaceid);
1370 if (NULL == window) {
1371 ICO_DBG("CicoSCWindowController::activeCB Leave(not found window)");
1376 ICO_DBG("CicoSCWindowController::activeCB Leave(not active)");
1380 if (0 != window->active) {
1381 ICO_DBG("CicoSCWindowController::activeCB Leave(already active)");
1386 CicoSCMessage *message = new CicoSCMessage();
1387 message->addRootObject("command", MSG_CMD_CHANGE_ACTIVE);
1388 message->addRootObject("appid", window->appid);
1389 message->addRootObject("pid", window->pid);
1390 message->addArgObject("surface", window->surfaceid);
1391 message->addArgObject("winname", window->name);
1392 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1394 if (true == window->visible) {
1395 (void)notifyResourceManager(window->surfaceid, NULL, NULL, 0);
1398 ICO_DBG("CicoSCWindowController::activeCB Leave");
1401 //--------------------------------------------------------------------------
1403 * @brief wayland layer visible callback
1405 * @param [in] data user data(unused)
1406 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
1407 * @param [in] layer layer Id
1408 * @param [in] visible layer visible
1409 * (1=visible/0=invisible/other=no change)
1411 //--------------------------------------------------------------------------
1413 CicoSCWindowController::layerVisibleCB(void *data,
1414 struct ico_window_mgr *ico_window_mgr,
1418 ICO_DBG("CicoSCWindowController::layerVisibleCB Enter"
1419 "layer=%d visible=%d)", layer, visible);
1422 CicoSCMessage *message = new CicoSCMessage();
1423 message->addRootObject("command", MSG_CMD_CHANGE_LAYER_ATTR);
1424 message->addRootObject("appid", "");
1425 message->addArgObject("layer", layer);
1426 message->addArgObject("visible", visible);
1427 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1429 ICO_DBG("CicoSCWindowController::layerVisibleCB Leave");
1432 //--------------------------------------------------------------------------
1434 * @brief query application surface callback
1436 * @param [in] data user data(unused)
1437 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
1438 * @param [in] appid application Id
1439 * @param [in] surface surface Id array
1441 //--------------------------------------------------------------------------
1443 CicoSCWindowController::appSurfacesCB(void *data,
1444 struct ico_window_mgr *ico_window_mgr,
1446 struct wl_array *surfaces)
1448 ICO_DBG("CicoSCWindowController::appSurfacesCB Enter(appid=%s)", appid);
1456 for (p = (uint32_t**)(surfaces)->data;
1457 (const char*) p < ((const char*) (surfaces)->data + (surfaces)->size);
1459 ICO_DBG("appSurfacesCB: surface=%d", (int)*p);
1462 ICO_DBG("CicoSCWindowController::appSurfacesCB Leave");
1465 //--------------------------------------------------------------------------
1467 * @brief surface map event callback
1469 * @param [in] data user data(unused)
1470 * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface
1471 * @param [in] event event
1472 * @param [in] surfaceid surface Id
1473 * @param [in] width surface width
1474 * @param [in] height surface height
1475 * @param [in] stride surface buffer(frame buffer) stride
1476 * @param [in] format surface buffer format
1478 //--------------------------------------------------------------------------
1480 CicoSCWindowController::mapSurfaceCB(void *data,
1481 struct ico_window_mgr *ico_window_mgr,
1491 ICO_DBG("CicoSCWindowController::mapSurfaceCB Enter"
1492 "(event=%d surface=%d type=%d target=%d "
1493 "width=%d height=%d stride=%d format=%d)",
1494 event, surfaceid, type, target,
1495 width, height, stride, format);
1497 CicoSCWindow *window = findWindow(surfaceid);
1498 if (NULL == window) {
1503 CicoSCMessage *message = new CicoSCMessage();
1504 message->addRootObject("command", MSG_CMD_MAP_THUMB);
1505 message->addRootObject("appid", window->appid);
1506 message->addArgObject("surface", window->surfaceid);
1507 message->addArgObject("width", width);
1508 message->addArgObject("height", height);
1509 message->addArgObject("stride", stride);
1510 message->addArgObject("format", format);
1511 CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
1513 ICO_DBG("CicoSCWindowController::mapSurfaceCB Leave");
1516 //--------------------------------------------------------------------------
1518 * @brief wayland display attribute callback
1520 * @param [in] data user data(unused)
1521 * @param [in] wl_output wayland wl_output interface
1522 * @param [in] x display upper-left X coordinate
1523 * @param [in] y display upper-left Y coordinate
1524 * @param [in] physical_width display physical width
1525 * @param [in] physical_height display physical height
1526 * @param [in] subpixel display sub pixel
1527 * @param [in] make display maker
1528 * @param [in] model display model
1529 * @param [in] transform transform
1531 //--------------------------------------------------------------------------
1533 CicoSCWindowController::outputGeometryCB(void *data,
1534 struct wl_output *wl_output,
1537 int32_t physical_width,
1538 int32_t physical_height,
1544 ICO_DBG("CicoSCWlWinMgrIF::outputGeometryCB Enter"
1545 "(x=%d y=%d physical_width=%d physical_height=%d "
1546 "subpixel=%d make=%s model=%s transform=%d)",
1547 x, y, physical_width, physical_height,
1548 subpixel, make, model, transform);
1550 ++m_physicalDisplayTotal;
1551 if (0 == m_displayList.size()) {
1552 ICO_DBG("CicoSCWlWinMgrIF::outputGeometryCB Leave(display is zero)");
1556 if (m_displayList.size() < m_physicalDisplayTotal) {
1557 ICO_WRN("CicoSCWlWinMgrIF::outputGeometryCB Leave(display total unmatch)");
1561 CicoSCDisplay* display = m_displayList.at(m_physicalDisplayTotal-1);
1562 switch (transform) {
1563 case WL_OUTPUT_TRANSFORM_90:
1564 case WL_OUTPUT_TRANSFORM_270:
1565 case WL_OUTPUT_TRANSFORM_FLIPPED_90:
1566 case WL_OUTPUT_TRANSFORM_FLIPPED_270:
1567 display->pWidth = physical_height;
1568 display->pHeight = physical_width;
1569 display->orientation = CicoSCDisplay::ORIENTATION_VERTICAL;
1571 case WL_OUTPUT_TRANSFORM_NORMAL:
1572 case WL_OUTPUT_TRANSFORM_180:
1573 case WL_OUTPUT_TRANSFORM_FLIPPED:
1574 case WL_OUTPUT_TRANSFORM_FLIPPED_180:
1576 display->pWidth = physical_width;
1577 display->pHeight = physical_height;
1578 display->orientation = CicoSCDisplay::ORIENTATION_HORIZONTAL;
1583 ICO_DBG("CicoSCWlWinMgrIF::outputGeometryCB Leave");
1586 //--------------------------------------------------------------------------
1588 * @brief wayland display mode callback
1590 * @param [in] data user data(unused)
1591 * @param [in] wl_output wayland wl_output interface
1592 * @param [in] flags flags
1593 * @param [in] width display width
1594 * @param [in] height display height
1595 * @param [in] refresh display refresh rate
1597 //--------------------------------------------------------------------------
1599 CicoSCWindowController::outputModeCB(void *data,
1600 struct wl_output *wl_output,
1606 ICO_DBG("CicoSCWlWinMgrIF::outputModeCB Enter"
1607 "(flags=%d width=%d height=%d refresh=%d)",
1608 flags, width, height, refresh);
1610 if (0 == m_displayList.size()) {
1611 ICO_DBG("CicoSCWlWinMgrIF::outputModeCB Leave(display is zero");
1615 CicoSCDisplay* display = m_displayList.at(0);
1616 if (flags & WL_OUTPUT_MODE_CURRENT) {
1617 if (display->orientation == CicoSCDisplay::ORIENTATION_VERTICAL) {
1618 display->pWidth = height;
1619 display->pHeight = width;
1622 display->pWidth = width;
1623 display->pHeight = height;
1628 ICO_DBG("CicoSCWlWinMgrIF::outputModeCB Leave");
1631 //==========================================================================
1633 //==========================================================================
1635 //--------------------------------------------------------------------------
1637 * @brief find window object by surfaceid
1639 * @param [in] surfaceid wayland surface id
1641 //--------------------------------------------------------------------------
1643 CicoSCWindowController::findWindow(int surfaceid)
1645 map<unsigned int, CicoSCWindow*>::iterator itr;
1646 itr = m_windowList.find(surfaceid);
1647 if (m_windowList.end() == itr) {
1648 ICO_WRN("not found window object. surfaceid=0x%08X", surfaceid);
1655 //--------------------------------------------------------------------------
1657 * @brief find window object by surfaceid
1659 * @param [in] surfaceid wayland surface id
1661 //--------------------------------------------------------------------------
1663 CicoSCWindowController::findLayer(int displayid, int layerid)
1665 vector<CicoSCDisplay*>::iterator itr;
1666 itr = m_displayList.begin();
1667 for (; itr != m_displayList.end(); ++itr) {
1668 if ((*itr)->displayid != displayid) {
1671 vector<CicoSCLayer*>::iterator itr2;
1672 itr2 = (*itr)->layerList.begin();
1673 for (; itr2 != (*itr)->layerList.end(); ++itr2) {
1674 if ((*itr2)->layerid == layerid) {
1682 //--------------------------------------------------------------------------
1684 * @brief find display zone by id
1686 //--------------------------------------------------------------------------
1687 const CicoSCDisplayZone *
1688 CicoSCWindowController::findDisplayZone(int zoneid)
1690 vector<CicoSCDisplay*>::iterator itr;
1691 itr = m_displayList.begin();
1692 for (; itr != m_displayList.end(); ++itr) {
1693 std::map<unsigned int, CicoSCDisplayZone*>::iterator itr2;
1694 itr2 = (*itr)->zoneList.find(zoneid);
1695 if ((*itr)->zoneList.end() != itr2) {
1696 return itr2->second;
1702 //--------------------------------------------------------------------------
1704 * @brief handle command
1706 * @param [in] cmd control command
1708 //--------------------------------------------------------------------------
1710 CicoSCWindowController::handleCommand(const CicoSCCommand * cmd)
1712 // ICO_DBG("CicoSCWindowController::handleCommand Enter(%d)", cmd->cmdid);
1714 CicoSCCmdWinCtrlOpt *opt = static_cast<CicoSCCmdWinCtrlOpt*>(cmd->opt);
1716 switch (cmd->cmdid) {
1718 ICO_DBG("command: MSG_CMD_SHOW");
1719 if (opt->animationTime & ICO_SYC_WIN_SURF_NORESCTL) {
1720 /* show command but not resource control (for HomeScreen) */
1721 (void)show(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
1724 /* show command (normal) */
1725 (void)notifyResourceManager(opt->surfaceid,
1727 opt->animation.c_str(),
1728 opt->animationTime);
1732 ICO_DBG("command: MSG_CMD_HIDE");
1733 (void)hide(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
1737 ICO_DBG("command: MSG_CMD_MOVE");
1738 CicoSCWindow *window = findWindow(opt->surfaceid);
1739 if (NULL == window) {
1742 if (true == opt->zone.empty()) {
1743 (void)setGeometry(opt->surfaceid, opt->nodeid, opt->x, opt->y,
1744 opt->width, opt->height,
1745 opt->animation.c_str(), opt->animationTime,
1746 opt->animation.c_str(), opt->animationTime);
1748 else if (opt->zone == window->zone) {
1749 (void)setGeometry(opt->surfaceid, opt->zone.c_str(),
1750 opt->animation.c_str(), opt->animationTime,
1751 opt->animation.c_str(), opt->animationTime);
1754 (void)notifyResourceManager(opt->surfaceid,
1756 opt->animation.c_str(),
1757 opt->animationTime);
1761 case MSG_CMD_CHANGE_ACTIVE:
1762 ICO_DBG("command: MSG_CMD_CHANGE_ACTIVE");
1763 (void)active(opt->surfaceid, opt->active);
1765 case MSG_CMD_CHANGE_LAYER:
1766 ICO_DBG("command: MSG_CMD_CHANGE_LAYER");
1767 (void)setWindowLayer(opt->surfaceid, opt->layerid);
1769 case MSG_CMD_MAP_THUMB:
1770 ICO_DBG("command: MSG_CMD_MAP_THUMB");
1771 (void)mapSurface(opt->surfaceid, opt->framerate);
1773 case MSG_CMD_UNMAP_THUMB:
1774 ICO_DBG("command: MSG_CMD_UNMAP_THUMB");
1775 (void)unmapSurface(opt->surfaceid);
1777 case MSG_CMD_SHOW_LAYER:
1778 ICO_DBG("command: MSG_CMD_SHOW_LAYER");
1779 (void)showLayer(opt->displayid, opt->layerid);
1781 case MSG_CMD_HIDE_LAYER:
1782 ICO_DBG("command: MSG_CMD_HIDE_LAYER");
1783 (void)hideLayer(opt->displayid, opt->layerid);
1786 ICO_WRN("command: Unknown(0x%08X)", cmd->cmdid);
1790 // ICO_DBG("CicoSCWindowController::handleCommand Leave");
1794 CicoSCWindowController::notifyResourceManager(int surfaceid,
1796 const char *animation,
1799 ICO_DBG("CicoSCWindowController::notifyResourceManager Enter"
1800 "(surfaceid=0x%08X zone=%s animation=%s animationTime=%d)",
1801 surfaceid, zone, animation, animationTime);
1803 // find window information in window list
1804 CicoSCWindow *window = findWindow(surfaceid);
1805 if (NULL == window) {
1806 ICO_WRN("CicoSCWindowController::notifyResourceManager Leave(ENOENT)");
1807 return ICO_SYC_ENOENT;
1811 CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
1813 cmd.cmdid = MSG_CMD_ACQUIRE_RES;
1814 cmd.appid = window->appid;
1815 cmd.pid = window->pid;
1818 opt->dispres = true;
1819 opt->winname = window->name;
1820 opt->surfaceid = window->surfaceid;
1821 opt->animation = animation ? animation : "";
1822 opt->animationTime = animationTime;
1825 const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
1827 opt->dispzone = zone->fullname;
1830 ICO_WRN("CicoSCWindowController::notifyResourceManager Leave(ENOENT)");
1831 return ICO_SYC_ENOENT;
1835 opt->dispzone = zone;
1838 opt->soundres = true;
1839 opt->soundname = window->appid;
1841 CicoSCSystemConfig *sysconf = CicoSCSystemConfig::getInstance();
1842 const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
1843 if (NULL != defconf) {
1844 const CicoSCSoundZoneConf *zoneconf =
1845 sysconf->findSoundZoneConfbyId(defconf->soundzone);
1846 if (NULL != zoneconf) {
1847 opt->soundzone = zoneconf->fullname;
1852 m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
1854 ICO_DBG("CicoSCWindowController::notifyResourceManager Leave(EOK)");
1858 // vim:set expandtab ts=4 sw=4: