0.9.21 release -- It changes so that the layer controlling function of GENIVI may...
[profile/ivi/ico-uxf-homescreen.git] / lib / system-controller / CicoSCWlWinMgrIF.h
1 /*
2  * Copyright (c) 2013-2014, 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 //==========================================================================
11 /**
12  *  @file   CicoSCWlWinMgrIF.h
13  *
14  *  @brief  This file is definition of CicoSCWlWinMgrIF class
15  */
16 //==========================================================================
17 #ifndef __CICO_SC_WL_WINMGR_IF_H__
18 #define __CICO_SC_WL_WINMGR_IF_H__
19
20 #include <wayland-client.h>
21 #include <ilm_client.h>
22 #include <ilm_control.h>
23 #include <ico_window_mgr-client-protocol.h>
24 #include <ivi-controller-client-protocol.h>
25 #include <ivi-application-client-protocol.h>
26
27 #include "ico_syc_type.h"
28 #include "CicoSCWaylandIF.h"
29 #include "CicoSCWindow.h"
30
31 //--------------------------------------------------------------------------
32 /**
33  *  @brief  This class is wayland interface of multi window manager
34  */
35 //--------------------------------------------------------------------------
36 struct creation_surface_wait    {
37     struct creation_surface_wait    *next;
38     int32_t     pid;
39     uint32_t    id_surface;
40     struct wl_surface *surface;
41     uint32_t    create_time;
42     char        title[ICO_SYC_MAX_WINNAME_LEN];
43 };
44
45 class CicoSCWlWinMgrIF : public CicoSCWaylandIF {
46 public:
47     virtual void initInterface(void               *data,
48                                struct wl_registry *registry,
49                                uint32_t           name,
50                                const char         *interface,
51                                uint32_t           version);
52
53     virtual void activeCB(void *data,
54                           struct ico_window_mgr *ico_window_mgr,
55                           uint32_t surfaceid,
56                           int32_t select);
57
58     virtual void mapSurfaceCB(void *data,
59                               struct ico_window_mgr *ico_window_mgr,
60                               int32_t event,
61                               uint32_t surfaceid,
62                               uint32_t type,
63                               int32_t width,
64                               int32_t height,
65                               int32_t stride,
66                               uint32_t format);
67
68     //
69     virtual void outputGeometryCB(void             *data,
70                                   struct wl_output *wl_output,
71                                   int32_t          x,
72                                   int32_t          y,
73                                   int32_t          physical_width,
74                                   int32_t          physical_height,
75                                   int32_t          subpixel,
76                                   const char       *make,
77                                   const char       *model,
78                                   int32_t          transform);
79
80     virtual void outputModeCB(void              *data,
81                               struct wl_output  *wl_output,
82                               uint32_t          flags,
83                               int32_t           width,
84                               int32_t           height,
85                               int32_t           refresh);
86
87     virtual void createSurfaceCB(void           *data,
88                                  struct ivi_controller *ivi_controller,
89                                  uint32_t id_surface);
90
91     static void wlIviCtrlRemoveSurface(uint32_t id_surface);
92
93 protected:
94     // default constructor
95     CicoSCWlWinMgrIF();
96
97     // destructor
98     virtual ~CicoSCWlWinMgrIF();
99
100     // assignment operator
101     CicoSCWlWinMgrIF& operator=(const CicoSCWlWinMgrIF &object);
102
103     // copy constructor
104     CicoSCWlWinMgrIF(const CicoSCWlWinMgrIF &object);
105
106     // wrapper function ico_window_mgr_set_window_layer
107     void setWindowLayer(uint32_t surfaceid, uint32_t layer, uint32_t oldlayer);
108
109     // wrapper function ico_window_mgr_set_positionsize
110     void setPositionsize(uint32_t surfaceid, uint32_t node,
111                          int32_t x, int32_t y, int32_t width,
112                          int32_t height, int32_t flags);
113
114     // wrapper function ico_window_mgr_set_visible
115     void setVisible(uint32_t surfaceid, int32_t  visible,
116                     int32_t  raise, int32_t  flags);
117
118     // wrapper function of ico_window_mgr_set_animation
119     void setAnimation(uint32_t surfaceid, int32_t type,
120                       const char *animation, int32_t time);
121
122     // wrapper function of ico_window_mgr_set_active
123     void setActive(uint32_t surfaceid, int32_t active);
124
125     // wrapper function of ico_window_mgr_set_layer_visible
126     void setLayerVisible(uint32_t layer, int32_t visible);
127
128     // wrapper function of ilm_takeSurfaceScreenshot
129     void setmapGet(int surfaceid, const char *filepath);
130
131     // wrapper function of ico_window_mgr_map_surface
132     void mapSurface(uint32_t surfaceid, int32_t framerate, const char *filepath);
133
134     // wrapper function of ico_window_mgr_unmap_surface
135     void unmapSurface(uint32_t surfaceid);
136
137     static const char *wlIviCtrlGetSurfaceWaiting(uint32_t id_surface, int *pid);
138
139 private:
140     // ico_window_mgr(Multi Window Manager) callback functions
141     static void wlActiveCB(void *data,
142                            struct ico_window_mgr *ico_window_mgr,
143                            uint32_t surfaceid,
144                            int32_t active);
145
146     static void wlMapSurfaceCB(void *data,
147                                struct ico_window_mgr *ico_window_mgr,
148                                int32_t event,
149                                uint32_t surfaceid,
150                                uint32_t type,
151                                int32_t width,
152                                int32_t height,
153                                int32_t stride,
154                                uint32_t format);
155
156     //
157     static void wlOutputGeometryCB(void             *data,
158                                    struct wl_output *wl_output,
159                                    int32_t          x,
160                                    int32_t          y,
161                                    int32_t          physical_width,
162                                    int32_t          physical_height,
163                                    int32_t          subpixel,
164                                    const char       *make,
165                                    const char       *model,
166                                    int32_t          transform);
167
168     static void wlOutputModeCB(void             *data,
169                                struct wl_output *wl_output,
170                                uint32_t         flags,
171                                int32_t          width,
172                                int32_t          height,
173                                int32_t          refresh);
174
175     static void wlIviAppErrorCB(void                    *data,
176                                 struct ivi_application  *ivi_application,
177                                 int32_t                 error_code,
178                                 const char              *error_text);
179
180     static void wlIviAppNativeShellInfoCB(void          *data,
181                                           struct ivi_application *ivi_application,
182                                           int32_t       pid,
183                                           const char    *title);
184     static void wlIviCtrlScreenCB(void                  *data,
185                                   struct ivi_controller *ivi_controller,
186                                   uint32_t              id_screen,
187                                   struct ivi_controller_screen *screen);
188
189     static void wlIviCtrlLayerCB(void                   *data,
190                                  struct ivi_controller  *ivi_controller,
191                                  uint32_t               id_layer);
192
193     static void wlIviCtrlSurfaceCB(void                 *data,
194                                    struct ivi_controller *ivi_controller,
195                                    uint32_t             id_surface);
196
197     static void wlIviCtrlErrorCB(void                   *data,
198                                  struct ivi_controller  *ivi_controller,
199                                  int32_t                object_id,
200                                  int32_t                object_type,
201                                  int32_t                error_code,
202                                  const char             *error_text);
203
204     static void wlIviCtrlNativeHandleCB(void            *data,
205                                         struct ivi_controller *ivi_controller,
206                                         struct wl_surface *surface);
207
208 protected:
209     // ico_window_mgr listener
210     struct ico_window_mgr_listener m_listener;
211
212     // wayland output listener
213     struct wl_output_listener m_wlOutputListener;
214
215     // genivi ivi-application listener
216     struct ivi_application_listener m_ivi_app_listener;
217
218     // genivi ivi-controller listener
219     struct ivi_controller_listener m_ivi_ctrl_listener;
220
221     // Wayland's Window Manager PlugIn instance
222     static struct ico_window_mgr *m_winmgr;
223
224     // Wayland's genivi ivi_application instance
225     static struct ivi_application *m_ivi_app;
226
227     // Wayland's genivi ivi_controller instance
228     static struct ivi_controller *m_ivi_ctrl;
229
230     // wayland output instance
231     static struct wl_output *m_wloutput;
232
233     // surface id for wayland/weston applications
234     static int m_id_surface;
235
236     // creation surface title name
237     static struct creation_surface_wait *m_wait_surface_creation;
238     static struct creation_surface_wait *m_free_surface_creation;
239 };
240 #endif  // __CICO_SC_WL_WINMGR_IF_H__
241 // vim:set expandtab ts=4 sw=4: