Some interfaces were added for SystemController
[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     virtual void updateSurfaceCB(void *data,
69                                  struct ico_window_mgr *ico_window_mgr,
70                                  uint32_t surfaceid,
71                                  int visible,
72                                  int srcwidth,
73                                  int srcheight,
74                                  int x,
75                                  int y,
76                                  int width,
77                                  int height);
78
79     virtual void destroySurfaceCB(void *data,
80                                   struct ico_window_mgr *ico_window_mgr,
81                                   uint32_t surfaceid);
82
83     virtual void updateWinnameCB(uint32_t surfaceid,
84                                  const char *winname);
85     //
86     virtual void outputGeometryCB(void             *data,
87                                   struct wl_output *wl_output,
88                                   int32_t          x,
89                                   int32_t          y,
90                                   int32_t          physical_width,
91                                   int32_t          physical_height,
92                                   int32_t          subpixel,
93                                   const char       *make,
94                                   const char       *model,
95                                   int32_t          transform);
96
97     virtual void outputModeCB(void              *data,
98                               struct wl_output  *wl_output,
99                               uint32_t          flags,
100                               int32_t           width,
101                               int32_t           height,
102                               int32_t           refresh);
103
104     virtual void createSurfaceCB(void           *data,
105                                  struct ivi_controller *ivi_controller,
106                                  uint32_t id_surface);
107
108     static void wlIviCtrlRemoveSurface(uint32_t id_surface);
109
110 protected:
111     // default constructor
112     CicoSCWlWinMgrIF();
113
114     // destructor
115     virtual ~CicoSCWlWinMgrIF();
116
117     // assignment operator
118     CicoSCWlWinMgrIF& operator=(const CicoSCWlWinMgrIF &object);
119
120     // copy constructor
121     CicoSCWlWinMgrIF(const CicoSCWlWinMgrIF &object);
122
123     // wrapper function ico_window_mgr_set_window_layer
124     void setWindowLayer(uint32_t surfaceid, uint32_t layer, uint32_t oldlayer);
125
126     // wrapper function ico_window_mgr_set_positionsize
127     void setPositionsize(uint32_t surfaceid, uint32_t node,
128                          int32_t x, int32_t y, int32_t width, int32_t height);
129
130     // wrapper function ico_window_mgr_set_visible
131     void setVisible(uint32_t surfaceid, int32_t visible);
132
133     // wrapper function of ico_window_mgr_set_animation
134     void setAnimation(uint32_t surfaceid, int32_t type,
135                       const char *animation, int32_t time);
136
137     // wrapper function of ico_window_mgr_set_active
138     void setActive(uint32_t surfaceid, int32_t active);
139
140     // wrapper function of ico_window_mgr_set_layer_visible
141     void setLayerVisible(uint32_t layer, int32_t visible);
142
143     // wrapper function of ilm_takeSurfaceScreenshot
144     void setmapGet(int surfaceid, const char *filepath);
145
146     // wrapper function of ico_window_mgr_map_surface
147     void mapSurface(uint32_t surfaceid, int32_t framerate, const char *filepath);
148
149     // wrapper function of ico_window_mgr_unmap_surface
150     void unmapSurface(uint32_t surfaceid);
151
152     static const char *wlIviCtrlGetSurfaceWaiting(uint32_t id_surface, int *pid);
153
154 private:
155     // ico_window_mgr(Multi Window Manager) callback functions
156     static void wlActiveCB(void *data,
157                            struct ico_window_mgr *ico_window_mgr,
158                            uint32_t surfaceid,
159                            int32_t active);
160
161     static void wlMapSurfaceCB(void *data,
162                                struct ico_window_mgr *ico_window_mgr,
163                                int32_t event,
164                                uint32_t surfaceid,
165                                uint32_t type,
166                                int32_t width,
167                                int32_t height,
168                                int32_t stride,
169                                uint32_t format);
170
171     static void wlUpdateSurfaceCB(void *data,
172                                   struct ico_window_mgr *ico_window_mgr,
173                                   uint32_t surfaceid,
174                                   int layer,
175                                   int srcwidth,
176                                   int srcheight,
177                                   int x,
178                                   int y,
179                                   int width,
180                                   int height);
181
182     static void wlDestroySurfaceCB(void *data,
183                                    struct ico_window_mgr *ico_window_mgr,
184                                    uint32_t surfaceid);
185     //
186     static void wlOutputGeometryCB(void             *data,
187                                    struct wl_output *wl_output,
188                                    int32_t          x,
189                                    int32_t          y,
190                                    int32_t          physical_width,
191                                    int32_t          physical_height,
192                                    int32_t          subpixel,
193                                    const char       *make,
194                                    const char       *model,
195                                    int32_t          transform);
196
197     static void wlOutputModeCB(void             *data,
198                                struct wl_output *wl_output,
199                                uint32_t         flags,
200                                int32_t          width,
201                                int32_t          height,
202                                int32_t          refresh);
203
204     static void wlIviAppErrorCB(void                    *data,
205                                 struct ivi_application  *ivi_application,
206                                 int32_t                 error_code,
207                                 const char              *error_text);
208
209     static void wlIviAppNativeShellInfoCB(void          *data,
210                                           struct ivi_application *ivi_application,
211                                           int32_t       pid,
212                                           const char    *title);
213     static void wlIviCtrlScreenCB(void                  *data,
214                                   struct ivi_controller *ivi_controller,
215                                   uint32_t              id_screen,
216                                   struct ivi_controller_screen *screen);
217
218     static void wlIviCtrlLayerCB(void                   *data,
219                                  struct ivi_controller  *ivi_controller,
220                                  uint32_t               id_layer);
221
222     static void wlIviCtrlSurfaceCB(void                 *data,
223                                    struct ivi_controller *ivi_controller,
224                                    uint32_t             id_surface);
225
226     static void wlIviCtrlErrorCB(void                   *data,
227                                  struct ivi_controller  *ivi_controller,
228                                  int32_t                object_id,
229                                  int32_t                object_type,
230                                  int32_t                error_code,
231                                  const char             *error_text);
232
233     static void wlIviCtrlNativeHandleCB(void            *data,
234                                         struct ivi_controller *ivi_controller,
235                                         struct wl_surface *surface);
236
237 protected:
238     // ico_window_mgr listener
239     struct ico_window_mgr_listener m_listener;
240
241     // wayland output listener
242     struct wl_output_listener m_wlOutputListener;
243
244     // genivi ivi-application listener
245     struct ivi_application_listener m_ivi_app_listener;
246
247     // genivi ivi-controller listener
248     struct ivi_controller_listener m_ivi_ctrl_listener;
249
250     // Wayland's Window Manager PlugIn instance
251     static struct ico_window_mgr *m_winmgr;
252
253     // Wayland's genivi ivi_application instance
254     static struct ivi_application *m_ivi_app;
255
256     // Wayland's genivi ivi_controller instance
257     static struct ivi_controller *m_ivi_ctrl;
258
259     // Wayland's genivi ivi_controller_surface instance
260     static struct ivi_controller_surface *m_ivi_ctrl_surf;
261
262     // wayland output instance
263     static struct wl_output *m_wloutput;
264
265     // surface id for wayland/weston applications
266     static int m_id_surface;
267
268     // creation surface title name
269     static struct creation_surface_wait *m_wait_surface_creation;
270     static struct creation_surface_wait *m_free_surface_creation;
271 };
272 #endif  // __CICO_SC_WL_WINMGR_IF_H__
273 // vim:set expandtab ts=4 sw=4: