c80c9ff4fcfd9e8b6a829c451dd9aa336e04544a
[profile/ivi/ico-uxf-homescreen.git] / src / homescreen / CicoHSWindowController.cpp
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  */
9 /**
10  * @brief   window control
11  *
12  * @date    Aug-08-2013
13  */
14 #include "CicoHSWindowController.h"
15 #include "CicoConf.h"
16 #include "CicoSystemConfig.h"
17
18 Ecore_Evas *CicoHSWindowController::ms_ecoreEvas = NULL;
19
20 /*============================================================================*/
21 /* functions                                                                  */
22 /*============================================================================*/
23 /*--------------------------------------------------------------------------*/
24 /**
25  * @brief   CicoHSWindowController::CicoHSWindowController
26  *          Constructor
27  */
28 /*--------------------------------------------------------------------------*/
29 CicoHSWindowController::CicoHSWindowController()
30 {
31 }
32
33 /*--------------------------------------------------------------------------*/
34 /**
35  * @brief   CicoHSWindowController::CicoHSWindowController
36  *          Destructor
37  */
38 /*--------------------------------------------------------------------------*/
39 CicoHSWindowController::~CicoHSWindowController()
40 {
41 }
42
43 /*--------------------------------------------------------------------------*/
44 /**
45  * @brief   CicoHSWindowController::Initialize
46  *          Initialize
47  *
48  * @param[in]   none
49  * @return      none
50  */
51 /*--------------------------------------------------------------------------*/
52 void
53 CicoHSWindowController::Initialize(void)
54 {
55     int ret;
56     /* Reset a ecore_evas */
57     ret = ecore_evas_init();
58     ICO_DBG("CicoHSWindowController::Initialize: ecore_evas_init retrun %d",
59             ret);
60 }
61
62 /*--------------------------------------------------------------------------*/
63 /**
64  * @brief   CicoHSWindowController::Finalize
65  *          Finalize
66  *
67  * @param[in]   none
68  * @return      none
69  */
70 /*--------------------------------------------------------------------------*/
71 void
72 CicoHSWindowController::Finalize(void)
73 {
74     /* end the ecore_evas */
75     ecore_evas_shutdown();
76 }
77
78 /*--------------------------------------------------------------------------*/
79 /**
80  * @brief   CicoHSWindowController::GetFullScreenSize
81  *          get size of full screen
82  *
83  * @param[in]   orientation    vertial or horizontal
84  * @param[out]  width          width of window
85  * @param[out]  height         heigth of window
86  * @return      none
87  */
88 /*--------------------------------------------------------------------------*/
89 void
90 CicoHSWindowController::GetFullScreenSize(int orientation,
91                                           int *width, int *height)
92 {
93     ICO_TRA("CicoHSWindowController::GetFullScreenSize Enter");
94
95     int display_width  = 0;
96     int display_height = 0;
97
98     ms_ecoreEvas = ecore_evas_new(NULL, 0, 0, 1, 1, "frame=0");
99
100     /* getting size of screen */
101     /* home screen size is full of display*/
102     ecore_wl_screen_size_get(&display_width, &display_height);
103
104     ICO_DBG("ecore_wl_screen_size_get => w/h=%d/%d",
105             display_width, display_height);
106
107 #if 1       /* 2014/07/16 ecore_wl_screen_size_get() bug    */
108     if ((display_width <= 0) || (display_height <= 0))  {
109         const CicoSCDisplayConf* dispconf = CicoSystemConfig::getInstance()
110                                                 ->findDisplayConfbyId(0);
111         if (dispconf)   {
112             // if Ecore has no full screen size, get from configuration
113             display_width = dispconf->width;
114             display_height = dispconf->height;
115             ICO_DBG("Screen size w/h=%d/%d from Config", display_width, display_height);
116         }
117         else    {
118             // if Ecore and config has no full screen size, fixed vaule
119             display_width = 1080;
120             display_height = 1920;
121             ICO_DBG("Screen size w/h=1080/1920 fixed");
122         }
123     }
124 #endif      /* 2014/07/16 ecore_wl_screen_size_get() bug    */
125
126     *width = display_width;
127     *height = display_height;
128
129     ICO_TRA("CicoHSWindowController::GetFullScreenSize Leave(w/h=%d/%d)", *width, *height);
130 }
131 // vim:set expandtab ts=4 sw=4: