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