Bugfix for TIVI-1997, TIVI-2244, TIVI-2256, A ivi cursor layer may pick up a touch...
[profile/ivi/ico-uxf-weston-plugin.git] / src / ico_window_mgr_private.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_PRIVATE_H_
31 #define _ICO_WINDOW_MGR_PRIVATE_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        privilege;                  /* privilege aplication                 */
50     char        *shmbuf;                    /* shared memory for surface image      */
51     int         bufsize;                    /* shared memory buffer size            */
52     int         bufnum;                     /* number of shared memory buffer       */
53     struct wl_list  surface_link;           /* surface list of same client          */
54     struct wl_list  link;
55 };
56
57 /* Node information                     */
58 struct uifw_node_table {
59     uint16_t    node;                       /* node Id                              */
60     uint16_t    displayno;                  /* weston display number                */
61     struct weston_output *output;           /* weston output                        */
62     int         disp_x;                     /* display frame buffer X-coordinate    */
63     int         disp_y;                     /* display frame buffer Y-coordinate    */
64     int         disp_width;                 /* display width                        */
65     int         disp_height;                /* display height                       */
66 };
67
68 /* Layer management table               */
69 struct  uifw_win_layer  {
70     uint32_t    layer;                      /* Layer Id                             */
71     char        visible;                    /* visibility                           */
72     char        layertype;                  /* layer type                           */
73     char        res[2];                     /* (unused)                             */
74     struct wl_list surface_list;            /* Surfacae list                        */
75     struct wl_list link;                    /* Link pointer for layer list          */
76 };
77
78 /* Surface map table                    */
79 struct uifw_win_surface;
80 struct uifw_surface_map {
81     struct uifw_win_surface *usurf;         /* UIFW surface                         */
82     struct uifw_client      *uclient;       /* UIFW client                          */
83     struct weston_buffer    *curbuf;        /* current buffer                       */
84     uint32_t    eglname;                    /* EGL buffer name                      */
85     uint32_t    format;                     /* format                               */
86     uint16_t    type;                       /* buffer type(currently only EGL buffer)*/
87     uint16_t    width;                      /* width                                */
88     uint16_t    height;                     /* height                               */
89     uint16_t    stride;                     /* stride                               */
90     uint16_t    framerate;                  /* update frame rate (frame/sec)        */
91     uint16_t    interval;                   /* interval time (ms)                   */
92     uint32_t    lasttime;                   /* last event time (ms)                 */
93     char        initflag;                   /* map event send flag(0=no/1=yes)      */
94     char        eventque;                   /* send event queue flag                */
95     char        res[2];                     /* (unused)                             */
96     struct wl_list  map_link;               /* surface map list                     */
97     struct wl_list  surf_link;              /* surface map list from UIFW surface   */
98 };
99
100 /* UIFW surface                         */
101 struct shell_surface;
102 struct uifw_win_surface {
103     uint32_t    surfaceid;                  /* UIFW SurfaceId                       */
104     struct uifw_node_table *node_tbl;       /* Node manager of ico_window_mgr       */
105     struct uifw_win_layer *win_layer;       /* surface layer                        */
106     struct uifw_win_layer *old_layer;       /* saved surface layer for change full screen*/
107     struct weston_surface *surface;         /* Weston surface                       */
108     struct shell_surface  *shsurf;          /* Shell(IVI-Shell) surface             */
109     struct uifw_client    *uclient;         /* Client                               */
110     struct weston_transform transform;      /* transform matrix                     */
111     float       scalex;                     /* surface transform scale of X         */
112     float       scaley;                     /* surface transform scale of Y         */
113     int         x;                          /* X-coordinate                         */
114     int         y;                          /* Y-coordinate                         */
115     short       xadd;                       /* X-coordinate delta                   */
116     short       yadd;                       /* Y-coordinate delta                   */
117     uint16_t    width;                      /* Width                                */
118     uint16_t    height;                     /* Height                               */
119     uint16_t    client_width;               /* Widht that a client(App) required    */
120     uint16_t    client_height;              /* Height that a client(App) required   */
121     uint16_t    conf_width;                 /* Width that notified to client        */
122     uint16_t    conf_height;                /* Height that notified to client       */
123     uint32_t    attributes;                 /* surface attributes                   */
124     char        winname[ICO_IVI_WINNAME_LENGTH];/* Window name                      */
125     char        disable;                    /* can not display                      */
126     char        visible;                    /* visibility                           */
127     char        raise;                      /* raise(top of the layer)              */
128     char        created;                    /* sended created event to manager      */
129     char        mapped;                     /* end of map                           */
130     char        restrain_configure;         /* restrant configure event             */
131     char        set_transform;              /* surface transform flag               */
132     char        layertype;                  /* surface layer type                   */
133     char        old_layertype;              /* surface old layer type               */
134     char        res[3];                     /* (unused)                             */
135     struct  _uifw_win_surface_animation {   /* wndow animation                      */
136         struct weston_animation animation;  /* weston animation control             */
137         uint16_t    type;                   /* current animation type               */
138         uint16_t    anima;                  /* curremt animation Id                 */
139         uint16_t    next_anima;             /* next animation Id                    */
140         uint16_t    hide_anima;             /* animation Id for hide                */
141         uint16_t    hide_time;              /* animation time(ms) for hide          */
142         uint16_t    show_anima;             /* animation Id for show                */
143         uint16_t    show_time;              /* animation time(ms) for show          */
144         uint16_t    move_anima;             /* animation Id for move                */
145         uint16_t    move_time;              /* animation time(ms) for move          */
146         uint16_t    resize_anima;           /* animation Id for resize              */
147         uint16_t    resize_time;            /* animation time(ms) for resize        */
148         uint16_t    time;                   /* current animation time(ms)           */
149         uint16_t    pos_x;                  /* start/end X-coordinate               */
150         uint16_t    pos_y;                  /* start/end Y-coordinate               */
151         uint16_t    pos_width;              /* start/end width                      */
152         uint16_t    pos_height;             /* start/end height                     */
153         short       current;                /* animation current percentage         */
154         char        state;                  /* animation state                      */
155         char        visible;                /* need hide(1)/show(2) at end of animation*/
156         char        restrain_configure;     /* restrain surface resize              */
157         char        ahalf;                  /* after half                           */
158         char        no_configure;           /* no send configure to client          */
159         char        res;                    /* (unused)                             */
160         uint32_t    starttime;              /* start time(ms)                       */
161         void        *animadata;             /* animation data                       */
162     }           animation;
163     struct wl_list  ivi_layer;              /* surface list of same layer           */
164     struct wl_list  client_link;            /* surface list of same client          */
165     struct wl_list  surf_map;               /* surface map list                     */
166     struct wl_list  input_region;           /* surface input region list            */
167     struct uifw_win_surface *next_idhash;   /* UIFW SurfaceId hash list             */
168     struct uifw_win_surface *next_wshash;   /* Weston SurfaceId hash list           */
169 };
170
171 /* animation operation                  */
172 /* default animation                    */
173 #define ICO_WINDOW_MGR_ANIMATION_NONE           0   /* no animation                 */
174
175 /* return code of animation hook function*/
176 #define ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA    -1  /* no animation                 */
177 #define ICO_WINDOW_MGR_ANIMATION_RET_ANIMA      0   /* animation                    */
178 #define ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL 1   /* animation but no control     */
179
180 /* animation state                      */
181 #define ICO_WINDOW_MGR_ANIMATION_STATE_NONE     0   /* not animation                */
182 #define ICO_WINDOW_MGR_ANIMATION_STATE_SHOW     1   /* show(in) animation           */
183 #define ICO_WINDOW_MGR_ANIMATION_STATE_HIDE     2   /* hide(out) animation          */
184 #define ICO_WINDOW_MGR_ANIMATION_STATE_MOVE     3   /* move animation               */
185 #define ICO_WINDOW_MGR_ANIMATION_STATE_RESIZE   4   /* resize animation             */
186
187 /* extended(plugin) animation operation */
188 #define ICO_WINDOW_MGR_ANIMATION_NAME       0       /* convert animation name to Id */
189 #define ICO_WINDOW_MGR_ANIMATION_DESTROY   99       /* surface destroy              */
190 #define ICO_WINDOW_MGR_ANIMATION_OPNONE     0       /* no animation                 */
191 #define ICO_WINDOW_MGR_ANIMATION_OPHIDE     1       /* change to hide               */
192 #define ICO_WINDOW_MGR_ANIMATION_OPSHOW     2       /* change to show               */
193 #define ICO_WINDOW_MGR_ANIMATION_OPMOVE     3       /* surface move                 */
194 #define ICO_WINDOW_MGR_ANIMATION_OPRESIZE   4       /* surface resize               */
195 #define ICO_WINDOW_MGR_ANIMATION_OPCANCEL   9       /* animation cancel             */
196 #define ICO_WINDOW_MGR_ANIMATION_OPHIDEPOS 11       /* change to hide with position */
197 #define ICO_WINDOW_MGR_ANIMATION_OPSHOWPOS 12       /* change to show with position */
198
199 /* Prototype for function               */
200                                             /* surface visible control              */
201 void ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible);
202                                             /* get client applicationId             */
203 char *ico_window_mgr_get_appid(struct wl_client* client);
204                                             /* get display coordinate               */
205 void ico_window_mgr_get_display_coordinate(int displayno, int *x, int *y);
206                                             /* change weston surface                */
207 void ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, int x, int y,
208                                        int width, int height);
209                                             /* surface change                       */
210 void ico_window_mgr_change_surface(struct uifw_win_surface *usurf,
211                                    const int to, const int manager);
212                                             /* check active keyboard surface        */
213 int ico_window_mgr_ismykeyboard(struct uifw_win_surface *usurf);
214                                             /* get UIFW client table                */
215 struct uifw_client *ico_window_mgr_get_uclient(const char *appid);
216                                             /* get UIFW surface table               */
217 struct uifw_win_surface *ico_window_mgr_get_usurf(const uint32_t surfaceid);
218                                             /* get UIFW surface table               */
219 struct uifw_win_surface *ico_window_mgr_get_usurf_client(const uint32_t surfaceid,
220                                                          struct wl_client *client);
221                                             /* get application surface              */
222 struct uifw_win_surface *ico_window_mgr_get_client_usurf(const char *target);
223                                             /* rebuild surface layer list           */
224 void ico_window_mgr_restack_layer(struct uifw_win_surface *usurf);
225                                             /* touch layer control for input manager*/
226 void ico_window_mgr_touch_layer(int omit);
227                                             /* chek surface visibility              */
228 int ico_window_mgr_is_visible(struct uifw_win_surface *usurf);
229                                             /* set active surface                   */
230 void ico_window_mgr_active_surface(struct weston_surface *surface);
231                                             /* set window animation hook            */
232 void ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data));
233                                             /* set surface attribute change hook    */
234 void ico_window_mgr_set_hook_change(void (*hook_change)(struct uifw_win_surface *usurf));
235                                             /* set surface destory hook             */
236 void ico_window_mgr_set_hook_destory(void (*hook_destroy)(struct uifw_win_surface *usurf));
237                                             /* set input region set/unset hook      */
238 void ico_window_mgr_set_hook_inputregion(void (*hook_inputregion)(
239                         int set, struct uifw_win_surface *usurf, int32_t x, int32_t y,
240                         int32_t width, int32_t height, int32_t hotspot_x, int32_t hotspot_y,
241                         int32_t cursor_x, int32_t cursor_y, int32_t cursor_width,
242                         int32_t cursor_height, uint32_t attr));
243
244 #endif  /*_ICO_WINDOW_MGR_PRIVATE_H_*/