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