The change of the configuration and the implementation of the event input.
[profile/ivi/ico-uxf-weston-plugin.git] / src / ico_window_mgr.h
1 /*
2  * Copyright © 2010-2011 Intel Corporation
3  * Copyright © 2008-2011 Kristian Høgsberg
4  * Copyright © 2013 TOYOTA MOTOR CORPORATION.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and
7  * its documentation for any purpose is hereby granted without fee, provided
8  * that the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of the copyright holders not be used in
11  * advertising or publicity pertaining to distribution of the software
12  * without specific, written prior permission.  The copyright holders make
13  * no representations about the suitability of this software for any
14  * purpose.  It is provided "as is" without express or implied warranty.
15  *
16  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
21  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23  */
24 /**
25  * @brief   Public functions in ico_window_mgr Weston plugin
26  *
27  * @date    Jul-26-2013
28  */
29
30 #ifndef _ICO_WINDOW_MGR_H_
31 #define _ICO_WINDOW_MGR_H_
32
33 /* Manager management table             */
34 struct uifw_manager {
35     struct wl_resource *resource;           /* Manager resource                     */
36     int     manager;                        /* Manager(=event send flag)            */
37     struct wl_list link;                    /* link to next manager                 */
38 };
39
40 /* Cleint management table              */
41 struct uifw_client  {
42     struct wl_client *client;               /* Wayland client                       */
43     int     pid;                            /* ProcessId (pid)                      */
44     char    appid[ICO_IVI_APPID_LENGTH];    /* ApplicationId(from AppCore AUL)      */
45     struct uifw_manager *mgr;               /* Manager table (if manager)           */
46     char    manager;                        /* Manager flag (Need send event)       */
47     char    fixed_appid;                    /* ApplicationId fix flag(and counter)  */
48     char    noconfigure;                    /* no need configure event              */
49     char    res;                            /* (unused)                             */
50     struct wl_list  surface_link;           /* surface list of same client          */
51     struct wl_list  link;
52 };
53
54 /* Node information                     */
55 struct uifw_node_table {
56     uint16_t    node;                       /* node Id                              */
57     uint16_t    displayno;                  /* weston display number                */
58     int         disp_x;                     /* display frame buffer X-coordinate    */
59     int         disp_y;                     /* display frame buffer Y-coordinate    */
60     int         disp_width;                 /* display width                        */
61     int         disp_height;                /* display height                       */
62 };
63
64 /* Layer management table               */
65 struct  uifw_win_layer  {
66     uint32_t layer;                         /* Layer Id                             */
67     char     visible;                       /* visibility                           */
68     char     layer_type;                    /* layer type                           */
69     char     res[2];                        /* (unused)                             */
70     struct wl_list surface_list;            /* Surfacae list                        */
71     struct wl_list link;                    /* Link pointer for layer list          */
72 };
73
74 /* Surface map table                    */
75 struct uifw_win_surface;
76 struct uifw_surface_map {
77     struct uifw_win_surface *usurf;         /* UIFW surface                         */
78     struct uifw_client  *uclient;           /* UIFW client                          */
79     uint32_t    eglname;                    /* EGL buffer name                      */
80     uint32_t    format;                     /* format                               */
81     uint16_t    type;                       /* buffer type(currently only EGL buffer)*/
82     uint16_t    width;                      /* width                                */
83     uint16_t    height;                     /* height                               */
84     uint16_t    stride;                     /* stride                               */
85     uint16_t    framerate;                  /* update frame rate (frame/sec)        */
86     char        initflag;                   /* map event send flag(0=no/1=yes)      */
87     char        res;                        /* (unused)                             */
88     struct wl_list  map_link;               /* map list                             */
89     struct wl_list  surf_link;              /* map list from UIFW surface           */
90 };
91
92 /* UIFW surface                         */
93 struct shell_surface;
94 struct uifw_win_surface {
95     uint32_t surfaceid;                     /* UIFW SurfaceId                       */
96     struct uifw_node_table *node_tbl;       /* Node manager of ico_window_mgr       */
97     struct uifw_win_layer *win_layer;       /* surface layer                        */
98     struct weston_surface *surface;         /* Weston surface                       */
99     struct shell_surface  *shsurf;          /* Shell(IVI-Shell) surface             */
100     struct uifw_client    *uclient;         /* Client                               */
101     struct weston_transform transform;      /* transform matrix                     */
102     float   scalex;                         /* surface transform scale of X         */
103     float   scaley;                         /* surface transform scale of Y         */
104     int     x;                              /* X-coordinate                         */
105     int     y;                              /* Y-coordinate                         */
106     short   xadd;                           /* X-coordinate delta                   */
107     short   yadd;                           /* Y-coordinate delta                   */
108     uint16_t width;                         /* Width                                */
109     uint16_t height;                        /* Height                               */
110     uint16_t client_width;                  /* Widht that a client(App) required    */
111     uint16_t client_height;                 /* Height that a client(App) required   */
112     uint16_t conf_width;                    /* Width that notified to client        */
113     uint16_t conf_height;                   /* Height that notified to client       */
114     uint32_t attributes;                    /* surface attributes                   */
115     char    winname[ICO_IVI_WINNAME_LENGTH];/* Window name                          */
116     char    visible;                        /* visibility                           */
117     char    raise;                          /* raise(top of the layer)              */
118     char    created;                        /* sended created event to manager      */
119     char    mapped;                         /* end of map                           */
120     char    restrain_configure;             /* restrant configure event             */
121     char    set_transform;                  /* surface transform flag               */
122     char    res[2];                         /* (unused)                             */
123     struct  _uifw_win_surface_animation {   /* wndow animation                      */
124         struct weston_animation animation;  /* weston animation control             */
125         uint16_t type;                      /* current animation type               */
126         uint16_t anima;                     /* curremt animation Id                 */
127         uint16_t next_anima;                /* next animation Id                    */
128         uint16_t hide_anima;                /* animation Id for hide                */
129         uint16_t hide_time;                 /* animation time(ms) for hide          */
130         uint16_t show_anima;                /* animation Id for show                */
131         uint16_t show_time;                 /* animation time(ms) for show          */
132         uint16_t move_anima;                /* animation Id for move                */
133         uint16_t move_time;                 /* animation time(ms) for move          */
134         uint16_t resize_anima;              /* animation Id for resize              */
135         uint16_t resize_time;               /* animation time(ms) for resize        */
136         uint16_t time;                      /* current animation time(ms)           */
137         uint16_t pos_x;                     /* start/end X-coordinate               */
138         uint16_t pos_y;                     /* start/end Y-coordinate               */
139         uint16_t pos_width;                 /* start/end width                      */
140         uint16_t pos_height;                /* start/end height                     */
141         short   current;                    /* animation current percentage         */
142         char    state;                      /* animation state                      */
143         char    visible;                    /* need hide(1)/show(2) at end of animation*/
144         char    restrain_configure;         /* restrain surface resize              */
145         char    ahalf;                      /* after half                           */
146         char    no_configure;               /* no send configure to client          */
147         char    res;                        /* (unused)                             */
148         uint32_t starttime;                 /* start time(ms)                       */
149         void    *animadata;                 /* animation data                       */
150     }       animation;
151     struct wl_list          ivi_layer;      /* surface list of same layer           */
152     struct wl_list          client_link;    /* surface list of same client          */
153     struct wl_list          surf_map;       /* surface map list                     */
154     struct uifw_win_surface *next_idhash;   /* UIFW SurfaceId hash list             */
155     struct uifw_win_surface *next_wshash;   /* Weston SurfaceId hash list           */
156 };
157
158 /* layer type                           */
159 #define ICO_WINDOW_MGR_LAYER_TYPE_NORMAL     0      /* normal layer                 */
160 #define ICO_WINDOW_MGR_LAYER_TYPE_BACKGROUND 1      /* touch input layer            */
161 #define ICO_WINDOW_MGR_LAYER_TYPE_INPUT      7      /* touch input layer            */
162 #define ICO_WINDOW_MGR_LAYER_TYPE_CURSOR     8      /* cursor layer                 */
163
164 /* animation operation                  */
165 /* default animation                    */
166 #define ICO_WINDOW_MGR_ANIMATION_NONE           0   /* no animation                 */
167
168 /* return code of animation hook function*/
169 #define ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA    -1  /* no animation                 */
170 #define ICO_WINDOW_MGR_ANIMATION_RET_ANIMA      0   /* animation                    */
171 #define ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL 1   /* animation but no control     */
172
173 /* animation state                      */
174 #define ICO_WINDOW_MGR_ANIMATION_STATE_NONE     0   /* not animation                */
175 #define ICO_WINDOW_MGR_ANIMATION_STATE_SHOW     1   /* show(in) animation           */
176 #define ICO_WINDOW_MGR_ANIMATION_STATE_HIDE     2   /* hide(out) animation          */
177 #define ICO_WINDOW_MGR_ANIMATION_STATE_MOVE     3   /* move animation               */
178 #define ICO_WINDOW_MGR_ANIMATION_STATE_RESIZE   4   /* resize animation             */
179
180 /* extended(plugin) animation operation */
181 #define ICO_WINDOW_MGR_ANIMATION_NAME       0       /* convert animation name to Id */
182 #define ICO_WINDOW_MGR_ANIMATION_DESTROY   99       /* surface destroy              */
183 #define ICO_WINDOW_MGR_ANIMATION_OPNONE     0       /* no animation                 */
184 #define ICO_WINDOW_MGR_ANIMATION_OPHIDE     1       /* change to hide               */
185 #define ICO_WINDOW_MGR_ANIMATION_OPSHOW     2       /* change to show               */
186 #define ICO_WINDOW_MGR_ANIMATION_OPMOVE     3       /* surface move                 */
187 #define ICO_WINDOW_MGR_ANIMATION_OPRESIZE   4       /* surface resize               */
188 #define ICO_WINDOW_MGR_ANIMATION_OPCANCEL   9       /* animation cancel             */
189 #define ICO_WINDOW_MGR_ANIMATION_OPHIDEPOS 11       /* change to hide with position */
190 #define ICO_WINDOW_MGR_ANIMATION_OPSHOWPOS 12       /* change to show with position */
191
192 /* Prototype for function               */
193                                             /* surface visible control              */
194 void ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible);
195                                             /* get client applicationId             */
196 char *ico_window_mgr_get_appid(struct wl_client* client);
197                                             /* change weston surface                */
198 void ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, int x, int y,
199                                        int width, int height);
200                                             /* surface change                       */
201 void ico_window_mgr_change_surface(struct uifw_win_surface *usurf,
202                                    const int to, const int manager);
203                                             /* get UIFW client table                */
204 struct uifw_client *ico_window_mgr_get_uclient(const char *appid);
205                                             /* get UIFW surface table               */
206 struct uifw_win_surface *ico_window_mgr_get_usurf(const uint32_t surfaceid);
207                                             /* get application surface              */
208 struct uifw_win_surface *ico_window_mgr_get_client_usurf(const char *appid,
209                                                          const char *winname);
210                                             /* rebuild surface layer list           */
211 void ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touch);
212                                             /* set window animation hook            */
213 void ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data));
214
215 #endif  /*_ICO_WINDOW_MGR_H_*/
216