2a2949e88ea8fdc86e65892834af421e78872fe0
[profile/ivi/ico-uxf-homescreen.git] / ico-app-framework / ico_uxf_private.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  * @brief   user experience library internal header
11  *
12  * @date    Feb-28-2013
13  */
14
15 #ifndef _ICO_UXF_INTERNAL_H_
16 #define _ICO_UXF_INTERNAL_H_
17
18 #include    <wayland-client.h>              /* Wayland client library               */
19 #include    <wayland-egl.h>                 /* Wayland EGL library                  */
20 #include    <wayland-util.h>                /* Wayland Misc library                 */
21 #include    <aul/aul.h>                     /* AppCore                              */
22
23 #include    "ico_uxf_sysdef.h"              /* UX-FW System convention value        */
24 #include    "ico_uxf_def.h"                 /* UX-FW definition value               */
25 #include    "ico_apf_log.h"                 /* wide use log definition              */
26 #include    "ico_apf_apimacro.h"
27
28 #include    "ico_input_mgr-client-protocol.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /* macro                                            */
35                                             /* get DisplayId from SurfaceId         */
36 #define ICO_UXF_GETDISPLAYID(surfaceid)   \
37             ((surfaceid >> 20) & 0x0fff)
38
39 /* define struct                                    */
40 /* struct management callback function              */
41 typedef struct  _Ico_Uxf_Mng_Callback   {
42     struct _Ico_Uxf_Mng_Callback    *next;  /* next callback struct                 */
43     unsigned int        eventmask;          /* notify event mask                    */
44     Ico_Uxf_Event_Cb    func;               /* callback function address            */
45     int                 arg;                /* function's argument                  */
46 }   Ico_Uxf_Mng_Callback;
47
48 /* struct management event queue                    */
49 typedef struct  _Ico_Uxf_Mng_EventQue   {
50     struct _Ico_Uxf_Mng_EventQue    *next;  /* next event queue struct              */
51     Ico_Uxf_EventDetail detail;             /* event detail                         */
52 }   Ico_Uxf_Mng_EventQue;
53
54 /* struct management window which proccess owns     */
55 typedef struct  _Ico_Uxf_Mng_ProcWin    {
56     struct _Ico_Uxf_Mng_ProcWin *next;      /* next window                          */
57     Ico_Uxf_ProcessWin  attr;               /* window configuration                 */
58 }   Ico_Uxf_Mng_ProcWin;
59
60 /* struct management proccess                       */
61 typedef struct  _Ico_Uxf_Mng_Process    {
62     struct _Ico_Uxf_Mng_Process *nextidhash;/* next process of the same id and hash */
63     Ico_Uxf_Mng_ProcWin *procwin;           /* process's subwindow                  */
64     void                *appconf;           /* configuration table address          */
65     struct _Ico_Uxf_Mng_Process *parent;    /* parent process                       */
66     short               susptimer;          /* suspend timer                        */
67     char                susp;               /* real suspend flag                    */
68     char                showmode;           /* resume show mode                     */
69     Ico_Uxf_ProcessAttr attr;               /* process configuration                */
70 }   Ico_Uxf_Mng_Process;
71
72 /* struct management display                        */
73 typedef struct  _Ico_Uxf_Mng_Display    {
74     struct _Ico_Uxf_Mng_Display *next;      /* next display                         */
75     Ico_Uxf_DisplayAttr attr;               /* display configuration                */
76 }   Ico_Uxf_Mng_Display;
77
78 /* struct management layer                          */
79 typedef struct  _Ico_Uxf_Mng_Layer  {
80     struct _Ico_Uxf_Mng_Layer   *next;      /* next layer                           */
81     Ico_Uxf_Mng_Display *mng_display;       /* display local cache                  */
82     Ico_Uxf_LayerAttr   attr;               /* layer attribute                      */
83 }   Ico_Uxf_Mng_Layer;
84
85 #define ICO_UXF_RESREQ_CLIENT       1       /* Request from client                  */
86 #define ICO_UXF_RESREQ_AUTO         2       /* Automatic request                    */
87 #define ICO_UXF_RESSTAT_NONE        0       /* Resource status: None                */
88 #define ICO_UXF_RESSTAT_ACQUIRED    1       /* Resource status: Acruired            */
89 #define ICO_UXF_RESSTAT_DEPRIVED    2       /* Resource status: Deprived            */
90
91 typedef struct  _Ico_Uxf_Mng_Window {
92     struct _Ico_Uxf_Mng_Window  *nextidhash;/* next window of the same id and hash  */
93     Ico_Uxf_Mng_Display *mng_display;       /* display local cache                  */
94     Ico_Uxf_Mng_Layer   *mng_layer;         /* layer local cache                    */
95     Ico_Uxf_Mng_Process *mng_process;       /* process local cache                  */
96     struct _Ico_Uxf_Mng_Window *mng_parent; /* parent window                        */
97     short               state;              /* Window status                        */
98     unsigned char       request;            /* Request                              */
99     char                res;                /* (unused)                             */
100     Ico_Uxf_WindowAttr  attr;               /* window attribute                     */
101 }   Ico_Uxf_Mng_Window;
102
103 /* struct management listener added by user         */
104 typedef struct _Ico_Uxf_Mng_EventListener {
105     struct _Ico_Uxf_Mng_EventListener *next;/* next table management listener function*/
106     void        (*func)(void *);            /* listener function address            */
107     void        *arg;                       /* listener function's argument         */
108 }   Ico_Uxf_Mng_EventListener;
109
110 /* struct management UX-FW API                      */
111 typedef struct  _Ico_Uxf_Api_Mng    {
112     /* variable                             */
113     int                     Initialized;    /* initialized flag                     */
114     int                     EventMask;      /* receive event                        */
115     unsigned int            LastEvent;      /* last receive event(end synchronization)*/
116     int                     AppsCtlVisible; /* Tempolary visible all windows        */
117     short                   Win_Show_Anima; /* Window animation at show             */
118     short                   Win_Hide_Anima; /* Window animation at hide             */
119     int                     NeedTimer;      /* need timer control                   */
120     int                     InitTimer;      /* initial timer                        */
121
122     /* process information myprocess        */
123     char                    MyProcess[ICO_UXF_MAX_PROCESS_NAME+1];
124                                             /* process id                           */
125     Ico_Uxf_Mng_Process     *Mng_MyProcess; /* process management table             */
126     int                     MyMainWindow;   /* main window id                       */
127     Ico_Uxf_Mng_Process     *Mng_LastProcess;/* last active process management table*/
128
129     /* table management callback function            */
130     Ico_Uxf_Mng_Callback    *Callback;      /* callback management table            */
131     Ico_Uxf_Mng_Callback    *CallbackLast;  /* last at callback management table's  */
132     Ico_Uxf_Mng_Callback    *CallbackFree;  /* free callback management table       */
133
134     /* event queue                                   */
135     Ico_Uxf_Mng_EventQue    *EventQue;      /* event queue list                     */
136     Ico_Uxf_Mng_EventQue    *EventQueLast;  /* last at event queue list             */
137     Ico_Uxf_Mng_EventQue    *EventQueFree;  /* opening event queue                  */
138
139     /* table management resource                     */
140     Ico_Uxf_Mng_Display     *Mng_Display;   /* display attribute cache              */
141     Ico_Uxf_Mng_Layer       *Mng_Layer;     /* layer attribute cache                */
142     Ico_Uxf_Mng_Process     *Hash_ProcessId[ICO_UXF_MISC_HASHSIZE];
143                                             /* process attribute table's hash       */
144     Ico_Uxf_Mng_Window      *Hash_WindowId[ICO_UXF_MISC_HASHSIZE];
145                                             /* window attribute table's hash        */
146     Ico_Uxf_InputDev        *InputDev;      /* Input device table                   */
147
148     /* Wayland                          */
149     struct wl_display       *Wayland_Display;   /* Wayland's display                */
150     struct wl_registry      *Wayland_Registry;  /* Wayland's Registry               */
151     struct wl_compositor    *Wayland_Compositor;/* Wayland's compositor             */
152     struct wl_seat          *Wayland_Seat;      /* Wayland's device input event     */
153     struct ico_window_mgr   *Wayland_WindowMgr; /* Wayland's Window Manager PlugIn  */
154     struct wl_output        *Wayland_Output;    /* Wayland's output describes       */
155     int                     WaylandFd;          /* Wayland's file descriptor        */
156     struct ico_input_mgr_control
157                             *Wayland_InputMgr;  /* Input Manager PulgIn             */
158     struct ico_exinput      *Wayland_exInput;   /* extra input event                */
159
160     /* Hook routines                    */
161     Ico_Uxf_Hook            Hook_Window;        /* Window control hook              */
162 }   Ico_Uxf_Api_Mng;
163
164 /* define inner misc function               */
165 void ico_uxf_enter_critical(void);          /* Exclusion section start              */
166 void ico_uxf_leave_critical(void);          /* Exclusion section end                */
167 void ico_uxf_broadcast_signal(void);        /* Dissolution of MainLoop's wait       */
168 Ico_Uxf_Mng_Callback *ico_uxf_alloc_callback(void);
169                                             /* get a callback management table      */
170 void ico_uxf_free_callback(Ico_Uxf_Mng_Callback *p);
171                                             /* free a callback management table     */
172 void ico_uxf_regist_callback(Ico_Uxf_Mng_Callback *p);
173                                             /* register callback management table   */
174 void ico_uxf_remove_callback(Ico_Uxf_Mng_Callback *p);
175                                             /* deregister callback management table */
176 Ico_Uxf_Mng_EventQue *ico_uxf_alloc_eventque(void);
177                                             /* allocate event queue block           */
178 void ico_uxf_free_eventque(Ico_Uxf_Mng_EventQue *p);
179                                             /* free a event queue block             */
180 void ico_uxf_regist_eventque(Ico_Uxf_Mng_EventQue *p);
181                                             /* register event queue block           */
182 Ico_Uxf_Mng_Display *ico_uxf_mng_display(const int display, const int create);
183                                             /* get a display management table       */
184 Ico_Uxf_Mng_Layer *ico_uxf_mng_layer(const int display, const int layer,
185                                      const int create);
186                                             /* get a layer management table         */
187 Ico_Uxf_Mng_Window *ico_uxf_mng_window(const int window, const int create);
188                                             /* get a window management table        */
189 Ico_Uxf_Mng_Process *ico_uxf_mng_process(const char *process, const int create);
190                                             /* get a process management table       */
191 void ico_uxf_update_procwin(const char *appid, int type);
192                                             /* update a process management table    */
193 void ico_uxf_free_procwin(Ico_Uxf_Mng_Process *prc);
194                                             /* release application windows          */
195 void ico_uxf_window_visible_control(Ico_Uxf_Mng_Window *winmng,
196                                     const int show, const int raise);
197                                             /* Window visible and cpu control       */
198 int ico_uxf_gl_create_window(const int display, const int layer, const int x,
199                              const int y, const int w, const int h, const int full);
200                                             /* create window by OpenGL ES/EGL       */
201
202 /* define log macros    */
203 #ifndef uifw_trace
204 #define uifw_trace      ICO_UXF_DEBUG
205 #define uifw_critical   ICO_UXF_CRITICAL
206 #define uifw_info       ICO_UXF_INFO
207 #define uifw_warn       ICO_UXF_WARN
208 #define uifw_error      ICO_UXF_ERROR
209 #define uifw_logflush   ico_uxf_log_flush
210 #endif  /*uifw_trace*/
211
212 #ifdef __cplusplus
213 }
214 #endif
215 #endif  /* _ICO_UXF_INTERNAL_H_ */
216