summaryrefslogtreecommitdiff
path: root/src/ico_window_mgr_private.h
blob: 34450e1da6cb22d93ce79554d5b60b1fedcbc9ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/*
 * Copyright © 2010-2011 Intel Corporation
 * Copyright © 2008-2011 Kristian Høgsberg
 * Copyright © 2013 TOYOTA MOTOR CORPORATION.
 *
 * Permission to use, copy, modify, distribute, and sell this software and
 * its documentation for any purpose is hereby granted without fee, provided
 * that the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of the copyright holders not be used in
 * advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  The copyright holders make
 * no representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 *
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
/**
 * @brief   Public functions in ico_window_mgr Weston plugin
 *
 * @date    Jul-26-2013
 */

#ifndef _ICO_WINDOW_MGR_PRIVATE_H_
#define _ICO_WINDOW_MGR_PRIVATE_H_

/* Manager management table             */
struct uifw_manager {
    struct wl_resource *resource;           /* Manager resource                     */
    int         manager;                    /* Manager(=event send flag)            */
    struct wl_list link;                    /* link to next manager                 */
};

/* Cleint management table              */
struct uifw_client  {
    struct wl_client *client;               /* Wayland client                       */
    int         pid;                        /* ProcessId (pid)                      */
    char        appid[ICO_IVI_APPID_LENGTH];/* ApplicationId(from AppCore AUL)      */
    struct uifw_manager *mgr;               /* Manager table (if manager)           */
    char        manager;                    /* Manager flag (Need send event)       */
    char        fixed_appid;                /* ApplicationId fix flag(and counter)  */
    char        noconfigure;                /* no need configure event              */
    char        privilege;                  /* privilege aplication                 */
    char        *shmbuf;                    /* shared memory for surface image      */
    int         bufsize;                    /* shared memory buffer size            */
    int         bufnum;                     /* number of shared memory buffer       */
    struct wl_list  surface_link;           /* surface list of same client          */
    struct wl_list  link;
};

/* Node information                     */
struct uifw_node_table {
    uint16_t    node;                       /* node Id                              */
    uint16_t    displayno;                  /* weston display number                */
    struct weston_output *output;           /* weston output                        */
    int         disp_x;                     /* display frame buffer X-coordinate    */
    int         disp_y;                     /* display frame buffer Y-coordinate    */
    int         disp_width;                 /* display width                        */
    int         disp_height;                /* display height                       */
};

/* Layer management table               */
struct  uifw_win_layer  {
    uint32_t    layer;                      /* Layer Id                             */
    char        visible;                    /* visibility                           */
    char        layertype;                  /* layer type                           */
    char        res[2];                     /* (unused)                             */
    struct wl_list surface_list;            /* Surfacae list                        */
    struct wl_list link;                    /* Link pointer for layer list          */
};

/* Surface map table                    */
struct uifw_win_surface;
struct uifw_surface_map {
    struct uifw_win_surface *usurf;         /* UIFW surface                         */
    struct uifw_client      *uclient;       /* UIFW client                          */
    struct weston_buffer    *curbuf;        /* current buffer                       */
    uint32_t    eglname;                    /* EGL buffer name                      */
    uint32_t    format;                     /* format                               */
    uint16_t    type;                       /* buffer type(currently only EGL buffer)*/
    uint16_t    width;                      /* width                                */
    uint16_t    height;                     /* height                               */
    uint16_t    stride;                     /* stride                               */
    uint16_t    framerate;                  /* update frame rate (frame/sec)        */
    uint16_t    interval;                   /* interval time (ms)                   */
    uint32_t    lasttime;                   /* last event time (ms)                 */
    char        initflag;                   /* map event send flag(0=no/1=yes)      */
    char        eventque;                   /* send event queue flag                */
    char        res[2];                     /* (unused)                             */
    struct wl_list  map_link;               /* surface map list                     */
    struct wl_list  surf_link;              /* surface map list from UIFW surface   */
};

/* UIFW surface                         */
struct shell_surface;
struct uifw_win_surface {
    uint32_t    surfaceid;                  /* UIFW SurfaceId                       */
    struct uifw_node_table *node_tbl;       /* Node manager of ico_window_mgr       */
    struct uifw_win_layer *win_layer;       /* surface layer                        */
    struct uifw_win_layer *old_layer;       /* saved surface layer for change full screen*/
    struct weston_surface *surface;         /* Weston surface                       */
    struct shell_surface  *shsurf;          /* Shell(IVI-Shell) surface             */
    struct uifw_client    *uclient;         /* Client                               */
    struct weston_transform transform;      /* transform matrix                     */
    float       scalex;                     /* surface transform scale of X         */
    float       scaley;                     /* surface transform scale of Y         */
    int         x;                          /* X-coordinate                         */
    int         y;                          /* Y-coordinate                         */
    short       xadd;                       /* X-coordinate delta                   */
    short       yadd;                       /* Y-coordinate delta                   */
    uint16_t    width;                      /* Width                                */
    uint16_t    height;                     /* Height                               */
    uint16_t    client_width;               /* Widht that a client(App) required    */
    uint16_t    client_height;              /* Height that a client(App) required   */
    uint16_t    conf_width;                 /* Width that notified to client        */
    uint16_t    conf_height;                /* Height that notified to client       */
    uint32_t    attributes;                 /* surface attributes                   */
    char        winname[ICO_IVI_WINNAME_LENGTH];/* Window name                      */
    char        disable;                    /* can not display                      */
    char        visible;                    /* visibility                           */
    char        raise;                      /* raise(top of the layer)              */
    char        created;                    /* sended created event to manager      */
    char        mapped;                     /* end of map                           */
    char        restrain_configure;         /* restrant configure event             */
    char        set_transform;              /* surface transform flag               */
    char        layertype;                  /* surface layer type                   */
    char        old_layertype;              /* surface old layer type               */
    char        res[3];                     /* (unused)                             */
    struct  _uifw_win_surface_animation {   /* wndow animation                      */
        struct weston_animation animation;  /* weston animation control             */
        uint16_t    type;                   /* current animation type               */
        uint16_t    anima;                  /* curremt animation Id                 */
        uint16_t    next_anima;             /* next animation Id                    */
        uint16_t    hide_anima;             /* animation Id for hide                */
        uint16_t    hide_time;              /* animation time(ms) for hide          */
        uint16_t    show_anima;             /* animation Id for show                */
        uint16_t    show_time;              /* animation time(ms) for show          */
        uint16_t    move_anima;             /* animation Id for move                */
        uint16_t    move_time;              /* animation time(ms) for move          */
        uint16_t    resize_anima;           /* animation Id for resize              */
        uint16_t    resize_time;            /* animation time(ms) for resize        */
        uint16_t    time;                   /* current animation time(ms)           */
        uint16_t    pos_x;                  /* start/end X-coordinate               */
        uint16_t    pos_y;                  /* start/end Y-coordinate               */
        uint16_t    pos_width;              /* start/end width                      */
        uint16_t    pos_height;             /* start/end height                     */
        short       current;                /* animation current percentage         */
        char        state;                  /* animation state                      */
        char        visible;                /* need hide(1)/show(2) at end of animation*/
        char        restrain_configure;     /* restrain surface resize              */
        char        ahalf;                  /* after half                           */
        char        no_configure;           /* no send configure to client          */
        char        res;                    /* (unused)                             */
        uint32_t    starttime;              /* start time(ms)                       */
        void        *animadata;             /* animation data                       */
    }           animation;
    struct wl_list  ivi_layer;              /* surface list of same layer           */
    struct wl_list  client_link;            /* surface list of same client          */
    struct wl_list  surf_map;               /* surface map list                     */
    struct wl_list  input_region;           /* surface input region list            */
    struct uifw_win_surface *next_idhash;   /* UIFW SurfaceId hash list             */
    struct uifw_win_surface *next_wshash;   /* Weston SurfaceId hash list           */
};

/* animation operation                  */
/* default animation                    */
#define ICO_WINDOW_MGR_ANIMATION_NONE           0   /* no animation                 */

/* return code of animation hook function*/
#define ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA    -1  /* no animation                 */
#define ICO_WINDOW_MGR_ANIMATION_RET_ANIMA      0   /* animation                    */
#define ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL 1   /* animation but no control     */

/* animation state                      */
#define ICO_WINDOW_MGR_ANIMATION_STATE_NONE     0   /* not animation                */
#define ICO_WINDOW_MGR_ANIMATION_STATE_SHOW     1   /* show(in) animation           */
#define ICO_WINDOW_MGR_ANIMATION_STATE_HIDE     2   /* hide(out) animation          */
#define ICO_WINDOW_MGR_ANIMATION_STATE_MOVE     3   /* move animation               */
#define ICO_WINDOW_MGR_ANIMATION_STATE_RESIZE   4   /* resize animation             */

/* extended(plugin) animation operation */
#define ICO_WINDOW_MGR_ANIMATION_NAME       0       /* convert animation name to Id */
#define ICO_WINDOW_MGR_ANIMATION_DESTROY   99       /* surface destroy              */
#define ICO_WINDOW_MGR_ANIMATION_OPNONE     0       /* no animation                 */
#define ICO_WINDOW_MGR_ANIMATION_OPHIDE     1       /* change to hide               */
#define ICO_WINDOW_MGR_ANIMATION_OPSHOW     2       /* change to show               */
#define ICO_WINDOW_MGR_ANIMATION_OPMOVE     3       /* surface move                 */
#define ICO_WINDOW_MGR_ANIMATION_OPRESIZE   4       /* surface resize               */
#define ICO_WINDOW_MGR_ANIMATION_OPCANCEL   9       /* animation cancel             */
#define ICO_WINDOW_MGR_ANIMATION_OPHIDEPOS 11       /* change to hide with position */
#define ICO_WINDOW_MGR_ANIMATION_OPSHOWPOS 12       /* change to show with position */

/* Prototype for function               */
                                            /* surface visible control              */
void ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible);
                                            /* get client applicationId             */
char *ico_window_mgr_get_appid(struct wl_client* client);
                                            /* get display coordinate               */
void ico_window_mgr_get_display_coordinate(int displayno, int *x, int *y);
                                            /* change weston surface                */
void ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, int x, int y,
                                       int width, int height);
                                            /* surface change                       */
void ico_window_mgr_change_surface(struct uifw_win_surface *usurf,
                                   const int to, const int manager);
                                            /* check active keyboard surface        */
int ico_window_mgr_ismykeyboard(struct uifw_win_surface *usurf);
                                            /* get UIFW client table                */
struct uifw_client *ico_window_mgr_get_uclient(const char *appid);
                                            /* get UIFW surface table               */
struct uifw_win_surface *ico_window_mgr_get_usurf(const uint32_t surfaceid);
                                            /* get UIFW surface table               */
struct uifw_win_surface *ico_window_mgr_get_usurf_client(const uint32_t surfaceid,
                                                         struct wl_client *client);
                                            /* get application surface              */
struct uifw_win_surface *ico_window_mgr_get_client_usurf(const char *target);
                                            /* rebuild surface layer list           */
void ico_window_mgr_restack_layer(struct uifw_win_surface *usurf);
                                            /* touch layer control for input manager*/
void ico_window_mgr_touch_layer(int omit);
                                            /* chek surface visibility              */
int ico_window_mgr_is_visible(struct uifw_win_surface *usurf);
                                            /* set active surface                   */
void ico_window_mgr_active_surface(struct weston_surface *surface);
                                            /* set window animation hook            */
void ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data));
                                            /* set surface attribute change hook    */
void ico_window_mgr_set_hook_change(void (*hook_change)(struct uifw_win_surface *usurf));
                                            /* set surface destory hook             */
void ico_window_mgr_set_hook_destory(void (*hook_destroy)(struct uifw_win_surface *usurf));
                                            /* set input region set/unset hook      */
void ico_window_mgr_set_hook_inputregion(void (*hook_inputregion)(
                        int set, struct uifw_win_surface *usurf, int32_t x, int32_t y,
                        int32_t width, int32_t height, int32_t hotspot_x, int32_t hotspot_y,
                        int32_t cursor_x, int32_t cursor_y, int32_t cursor_width,
                        int32_t cursor_height, uint32_t attr));

#endif  /*_ICO_WINDOW_MGR_PRIVATE_H_*/