2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
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
10 * @brief user experience library internal header
15 #ifndef _ICO_UXF_INTERNAL_H_
16 #define _ICO_UXF_INTERNAL_H_
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 */
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"
28 #include "ico_input_mgr-client-protocol.h"
35 /* get DisplayId from SurfaceId */
36 #define ICO_UXF_GETDISPLAYID(surfaceid) \
37 ((surfaceid >> 20) & 0x0fff)
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;
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;
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;
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 *exttable; /* extended table */
65 struct _Ico_Uxf_Mng_Process *parent; /* parent process */
66 short susptimer; /* suspend timer */
67 char susp; /* real suspend flag */
68 char res; /* (unused) */
69 Ico_Uxf_ProcessAttr attr; /* process configuration */
70 } Ico_Uxf_Mng_Process;
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;
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 */
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 */
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;
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;
110 /* struct management UX-FW API */
111 typedef struct _Ico_Uxf_Api_Mng {
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 int NeedTimer; /* need timer control */
118 int InitTimer; /* initial timer */
120 /* process information myprocess */
121 char MyProcess[ICO_UXF_MAX_PROCESS_NAME+1];
123 Ico_Uxf_Mng_Process *Mng_MyProcess; /* process management table */
124 int MyMainWindow; /* main window id */
125 Ico_Uxf_Mng_Process *Mng_LastProcess;/* last active process management table*/
127 /* table management callback function */
128 Ico_Uxf_Mng_Callback *Callback; /* callback management table */
129 Ico_Uxf_Mng_Callback *CallbackLast; /* last at callback management table's */
130 Ico_Uxf_Mng_Callback *CallbackFree; /* free callback management table */
133 Ico_Uxf_Mng_EventQue *EventQue; /* event queue list */
134 Ico_Uxf_Mng_EventQue *EventQueLast; /* last at event queue list */
135 Ico_Uxf_Mng_EventQue *EventQueFree; /* opening event queue */
137 /* table management resource */
138 Ico_Uxf_Mng_Display *Mng_Display; /* display attribute cache */
139 Ico_Uxf_Mng_Layer *Mng_Layer; /* layer attribute cache */
140 Ico_Uxf_Mng_Process *Hash_ProcessId[ICO_UXF_MISC_HASHSIZE];
141 /* process attribute table's hash */
142 Ico_Uxf_Mng_Window *Hash_WindowId[ICO_UXF_MISC_HASHSIZE];
143 /* window attribute table's hash */
144 Ico_Uxf_InputDev *InputDev; /* Input device table */
147 struct wl_display *Wayland_Display; /* Wayland's display */
148 struct wl_registry *Wayland_Registry; /* Wayland's Registry */
149 struct wl_compositor *Wayland_Compositor;/* Wayland's compositor */
150 struct wl_seat *Wayland_Seat; /* Wayland's device input event */
151 struct ico_window_mgr *Wayland_WindowMgr; /* Wayland's Window Manager PlugIn */
152 struct wl_output *Wayland_Output; /* Wayland's output describes */
153 int WaylandFd; /* Wayland's file descriptor */
154 struct ico_input_mgr_control
155 *Wayland_InputMgr; /* Input Manager PulgIn */
156 struct ico_exinput *Wayland_exInput; /* extra input event */
159 Ico_Uxf_Hook Hook_Window; /* Window control hook */
162 /* define inner misc function */
163 void ico_uxf_enter_critical(void); /* Exclusion section start */
164 void ico_uxf_leave_critical(void); /* Exclusion section end */
165 void ico_uxf_broadcast_signal(void); /* Dissolution of MainLoop's wait */
166 Ico_Uxf_Mng_Callback *ico_uxf_alloc_callback(void);
167 /* get a callback management table */
168 void ico_uxf_free_callback(Ico_Uxf_Mng_Callback *p);
169 /* free a callback management table */
170 void ico_uxf_regist_callback(Ico_Uxf_Mng_Callback *p);
171 /* register callback management table */
172 void ico_uxf_remove_callback(Ico_Uxf_Mng_Callback *p);
173 /* deregister callback management table */
174 Ico_Uxf_Mng_EventQue *ico_uxf_alloc_eventque(void);
175 /* allocate event queue block */
176 void ico_uxf_free_eventque(Ico_Uxf_Mng_EventQue *p);
177 /* free a event queue block */
178 void ico_uxf_regist_eventque(Ico_Uxf_Mng_EventQue *p);
179 /* register event queue block */
180 Ico_Uxf_Mng_Display *ico_uxf_mng_display(const int display, const int create);
181 /* get a display management table */
182 Ico_Uxf_Mng_Layer *ico_uxf_mng_layer(const int display, const int layer,
184 /* get a layer management table */
185 Ico_Uxf_Mng_Window *ico_uxf_mng_window(const int window, const int create);
186 /* get a window management table */
187 Ico_Uxf_Mng_Process *ico_uxf_mng_process(const char *process, const int create);
188 /* get a process management table */
189 void ico_uxf_update_procwin(const char *appid, int type);
190 /* update a process management table */
191 void ico_uxf_free_procwin(Ico_Uxf_Mng_Process *prc);
192 /* release application windows */
193 void ico_uxf_window_visible_control(Ico_Uxf_Mng_Window *winmng,
194 const int show, const int raise);
195 /* Window visible and cpu control */
196 int ico_uxf_gl_create_window(const int display, const int layer, const int x,
197 const int y, const int w, const int h, const int full);
198 /* create window by OpenGL ES/EGL */
200 /* define log macros */
202 #define uifw_trace ICO_UXF_DEBUG
203 #define uifw_critical ICO_UXF_CRITICAL
204 #define uifw_info ICO_UXF_INFO
205 #define uifw_warn ICO_UXF_WARN
206 #define uifw_error ICO_UXF_ERROR
207 #define uifw_logflush ico_uxf_log_flush
208 #endif /*uifw_trace*/
213 #endif /* _ICO_UXF_INTERNAL_H_ */