Test tool The name of test_send_input is changed into ico_send_inputevent.
[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-2014 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    Feb-21-2014
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     struct wl_list link;                    /* link to next manager                 */
37 };
38
39 /* Cleint management table              */
40 struct uifw_client  {
41     struct wl_client *client;               /* Wayland client                       */
42     int         pid;                        /* ProcessId (pid)                      */
43     char        appid[ICO_IVI_APPID_LENGTH];/* ApplicationId(from AppCore AUL)      */
44     struct uifw_manager *mgr;               /* Manager table (if manager)           */
45     char        manager;                    /* Manager flag (Need send event)       */
46     char        fixed_appid;                /* ApplicationId fix flag(and counter)  */
47     char        noconfigure;                /* no need configure event              */
48     char        privilege;                  /* privilege aplication                 */
49     char        *shmbuf;                    /* shared memory for surface image      */
50     int         bufsize;                    /* shared memory buffer size            */
51     int         bufnum;                     /* number of shared memory buffer       */
52     struct wl_listener destroy_listener;    /* client destroy listener              */
53     struct wl_list  surface_link;           /* surface list of same client          */
54     struct wl_list  link;                   /* client list                          */
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 /* Surface map table                    */
69 struct uifw_win_surface;
70 struct uifw_surface_map {
71     struct uifw_win_surface *usurf;         /* UIFW surface                         */
72     struct uifw_client      *uclient;       /* UIFW client                          */
73     struct weston_buffer    *curbuf;        /* current buffer                       */
74     char        filepath[ICO_IVI_FILEPATH_LENGTH];
75                                             /* surface image file path              */
76     uint32_t    format;                     /* format                               */
77     uint16_t    type;                       /* buffer type(currently only EGL buffer)*/
78     uint16_t    width;                      /* width                                */
79     uint16_t    height;                     /* height                               */
80     uint16_t    stride;                     /* stride                               */
81     uint16_t    framerate;                  /* update frame rate (frame/sec)        */
82     uint16_t    interval;                   /* interval time (ms)                   */
83     uint32_t    lasttime;                   /* last event time (ms)                 */
84     char        initflag;                   /* map event send flag(0=no/1=yes)      */
85     char        eventque;                   /* send event queue flag                */
86     char        res[2];                     /* (unused)                             */
87     struct wl_list  map_link;               /* surface map list                     */
88     struct wl_list  surf_link;              /* surface map list from UIFW surface   */
89 };
90
91 /* UIFW surface                         */
92 struct shell_surface;
93 struct weston_layout_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 weston_surface *surface;         /* Weston surface                       */
98     struct weston_layout_surface *ivisurf;  /* Weston layout surface                */
99     struct uifw_client    *uclient;         /* Client                               */
100     struct wl_resource    *shsurf_resource; /* wl_shell_surface resource            */
101     int         x;                          /* X-coordinate                         */
102     int         y;                          /* Y-coordinate                         */
103     uint16_t    width;                      /* Width                                */
104     uint16_t    height;                     /* Height                               */
105     uint16_t    client_width;               /* Widht that a client(App) required    */
106     uint16_t    client_height;              /* Height that a client(App) required   */
107     uint16_t    configure_width;            /* Widht that a client(App) configured  */
108     uint16_t    configure_height;           /* Height that a client(App) configured */
109     char        winname[ICO_IVI_WINNAME_LENGTH];/* Window name                      */
110     char        visible;                    /* visibility                           */
111     char        restrain_configure;         /* restrant configure event             */
112     char        res[1];                     /* (unused)                             */
113     struct  _uifw_win_surface_animation {   /* wndow animation                      */
114         struct weston_animation animation;  /* weston animation control             */
115         uint16_t    type;                   /* current animation type               */
116         uint16_t    anima;                  /* curremt animation Id                 */
117         uint16_t    next_anima;             /* next animation Id                    */
118         uint16_t    hide_anima;             /* animation Id for hide                */
119         uint16_t    hide_time;              /* animation time(ms) for hide          */
120         uint16_t    show_anima;             /* animation Id for show                */
121         uint16_t    show_time;              /* animation time(ms) for show          */
122         uint16_t    move_anima;             /* animation Id for move                */
123         uint16_t    move_time;              /* animation time(ms) for move          */
124         uint16_t    resize_anima;           /* animation Id for resize              */
125         uint16_t    resize_time;            /* animation time(ms) for resize        */
126         uint16_t    time;                   /* current animation time(ms)           */
127         uint16_t    pos_x;                  /* start/end X-coordinate               */
128         uint16_t    pos_y;                  /* start/end Y-coordinate               */
129         uint16_t    pos_width;              /* start/end width                      */
130         uint16_t    pos_height;             /* start/end height                     */
131         float       alpha;                  /* original alpha                       */
132         short       current;                /* animation current percentage         */
133         char        state;                  /* animation state                      */
134         char        visible;                /* need hide(1)/show(2) at end of animation*/
135         char        restrain_configure;     /* restrain surface resize              */
136         char        ahalf;                  /* after half                           */
137         char        no_configure;           /* no send configure to client          */
138         char        res;                    /* (unused)                             */
139         uint32_t    starttime;              /* start time(ms)                       */
140         void        *animadata;             /* animation data                       */
141     }           animation;
142     struct wl_list  client_link;            /* surface list of same client          */
143     struct wl_list  surf_map;               /* surface map list                     */
144     struct wl_list  input_region;           /* surface input region list            */
145     struct uifw_win_surface *next_idhash;   /* UIFW SurfaceId hash list             */
146     struct uifw_win_surface *next_wshash;   /* Weston SurfaceId hash list           */
147 };
148
149 /* animation operation                  */
150 /* default animation                    */
151 #define ICO_WINDOW_MGR_ANIMATION_NONE           0   /* no animation                 */
152
153 /* return code of animation hook function*/
154 #define ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA    -1  /* no animation                 */
155 #define ICO_WINDOW_MGR_ANIMATION_RET_ANIMA      0   /* animation                    */
156 #define ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL 1   /* animation but no control     */
157
158 /* animation state                      */
159 #define ICO_WINDOW_MGR_ANIMATION_STATE_NONE     0   /* not animation                */
160 #define ICO_WINDOW_MGR_ANIMATION_STATE_SHOW     1   /* show(in) animation           */
161 #define ICO_WINDOW_MGR_ANIMATION_STATE_HIDE     2   /* hide(out) animation          */
162 #define ICO_WINDOW_MGR_ANIMATION_STATE_MOVE     3   /* move animation               */
163 #define ICO_WINDOW_MGR_ANIMATION_STATE_RESIZE   4   /* resize animation             */
164
165 /* extended(plugin) animation operation */
166 #define ICO_WINDOW_MGR_ANIMATION_NAME       0       /* convert animation name to Id */
167 #define ICO_WINDOW_MGR_ANIMATION_DESTROY   99       /* surface destroy              */
168 #define ICO_WINDOW_MGR_ANIMATION_OPNONE     0       /* no animation                 */
169 #define ICO_WINDOW_MGR_ANIMATION_OPHIDE     1       /* change to hide               */
170 #define ICO_WINDOW_MGR_ANIMATION_OPSHOW     2       /* change to show               */
171 #define ICO_WINDOW_MGR_ANIMATION_OPMOVE     3       /* surface move                 */
172 #define ICO_WINDOW_MGR_ANIMATION_OPRESIZE   4       /* surface resize               */
173 #define ICO_WINDOW_MGR_ANIMATION_OPCANCEL   9       /* animation cancel             */
174 #define ICO_WINDOW_MGR_ANIMATION_OPHIDEPOS 11       /* change to hide with position */
175 #define ICO_WINDOW_MGR_ANIMATION_OPSHOWPOS 12       /* change to show with position */
176
177 /* Prototype for function               */
178                                             /* find uifw_client table               */
179 struct uifw_client *ico_window_mgr_find_uclient(struct wl_client *client);
180                                             /* get client applicationId             */
181 char *ico_window_mgr_get_appid(struct wl_client* client);
182                                             /* get display coordinate               */
183 void ico_window_mgr_get_display_coordinate(int displayno, int *x, int *y);
184                                             /* get buffer width                     */
185 int ico_ivi_surface_buffer_width(struct weston_surface *es);
186                                             /* get buffer height                    */
187 int ico_ivi_surface_buffer_height(struct weston_surface *es);
188                                             /* get buffer size                      */
189 void ico_ivi_surface_buffer_size(struct weston_surface *es, int *width, int *height);
190                                             /* get surface primary view             */
191 struct weston_view *ico_ivi_get_primary_view(struct uifw_win_surface *usurf);
192                                             /* change weston surface                */
193 void ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, int x, int y,
194                                        int width, int height);
195                                             /* get UIFW client table                */
196 struct uifw_client *ico_window_mgr_get_uclient(const char *appid);
197                                             /* get UIFW surface table               */
198 struct uifw_win_surface *ico_window_mgr_get_usurf(const uint32_t surfaceid);
199                                             /* get UIFW surface table               */
200 struct uifw_win_surface *ico_window_mgr_get_usurf_client(const uint32_t surfaceid,
201                                                          struct wl_client *client);
202                                             /* get application surface              */
203 struct uifw_win_surface *ico_window_mgr_get_client_usurf(const char *target);
204                                             /* set window animation hook            */
205 void ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data));
206                                             /* set surface attribute change hook    */
207 void ico_window_mgr_set_hook_change(void (*hook_change)(struct uifw_win_surface *usurf));
208                                             /* set surface destory hook             */
209 void ico_window_mgr_set_hook_destory(void (*hook_destroy)(struct uifw_win_surface *usurf));
210                                             /* set input region set/unset hook      */
211 void ico_window_mgr_set_hook_inputregion(void (*hook_inputregion)(
212                         int set, struct uifw_win_surface *usurf, int32_t x, int32_t y,
213                         int32_t width, int32_t height, int32_t hotspot_x, int32_t hotspot_y,
214                         int32_t cursor_x, int32_t cursor_y, int32_t cursor_width,
215                         int32_t cursor_height, uint32_t attr));
216
217 #endif  /*_ICO_WINDOW_MGR_PRIVATE_H_*/