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 experiance library(initialize/terminate/event)
21 #include <sys/ioctl.h>
25 #include "wayland-client.h"
26 #include "ico_window_mgr-client-protocol.h"
28 #include "ico_uxf_conf.h"
29 #include "ico_uxf_private.h"
31 /* static functions */
32 /* wayland standard callback functions */
33 static void ico_uxf_wayland_globalcb(void *data, struct wl_registry *registry,
34 uint32_t name, const char *interface,
36 static void ico_uxf_output_geometrycb(void *data, struct wl_output *wl_output,
37 int32_t x, int32_t y, int32_t physical_width,
38 int32_t physical_height, int32_t subpixel,
39 const char *make, const char *model,
41 static void ico_uxf_output_modecb(void *data, struct wl_output *wl_output,
42 uint32_t flags, int32_t width, int32_t height,
45 /* ico_window_mgr(Multi Window Manager) callback functions */
47 static void ico_uxf_window_createdcb(void *data, struct ico_window_mgr *ico_window_mgr,
48 uint32_t surfaceid, int32_t pid, const char *appid);
49 static void ico_uxf_window_destroyedcb(void *data, struct ico_window_mgr *ico_window_mgr,
51 static void ico_uxf_window_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
52 uint32_t surfaceid, int32_t visible, int32_t raise,
54 static void ico_uxf_window_configurecb(void *data, struct ico_window_mgr *ico_window_mgr,
55 uint32_t surfaceid, const char *appid,
56 int32_t layer, int32_t x, int32_t y,
57 int32_t width, int32_t height, int32_t hint);
58 static void ico_uxf_window_activecb(void *data,
59 struct ico_window_mgr *ico_window_mgr,
63 /* ico_input_mgr(Multi Input Manager) callback functions */
64 static void ico_uxf_input_capabilitiescb(void *data, struct ico_exinput *ico_exinput,
65 const char *device, int32_t type,
66 const char *swname, int32_t input,
67 const char *codename, int32_t code);
68 static void ico_uxf_input_codecb(void *data, struct ico_exinput *ico_exinput,
69 const char *device, int32_t input, const char *codename,
71 static void ico_uxf_input_inputcb(void *data, struct ico_exinput *ico_exinput,
72 uint32_t time, const char *device, int32_t input,
73 int32_t code, int32_t state);
75 /* AppCore(AUL) callback function */
76 static int ico_uxf_aul_aulcb(int pid, void *data);
78 /* Variables & Tables */
79 Ico_Uxf_Api_Mng gIco_Uxf_Api_Mng = { 0 };
81 static pthread_mutex_t sMutex;
83 /* Wayland Registry Listener */
84 static const struct wl_registry_listener ico_uxf_registry_listener = {
85 ico_uxf_wayland_globalcb
88 /* Window Manger Interface */
89 static const struct ico_window_mgr_listener windowlistener = {
90 ico_uxf_window_createdcb,
91 ico_uxf_window_destroyedcb,
92 ico_uxf_window_visiblecb,
93 ico_uxf_window_configurecb,
94 ico_uxf_window_activecb
97 /* Input Manger Interface */
98 static const struct ico_exinput_listener exinputlistener = {
99 ico_uxf_input_capabilitiescb,
100 ico_uxf_input_codecb,
101 ico_uxf_input_inputcb
104 /* Wayland Output interface */
105 static const struct wl_output_listener outputlistener = {
106 ico_uxf_output_geometrycb,
107 ico_uxf_output_modecb
111 /*--------------------------------------------------------------------------*/
113 * @brief ico_uxf_init: initialize user interface library hor HomeScreen
115 * @param[in] name application id
117 * @retval ICO_UXF_EOK success
118 * @retval ICO_UXF_EBUSY error(cullentry terminating)
119 * @retval ICO_UXF_ESRCH error(configuration error)
120 * @retval ICO_UXF_ENOSYS error(system error)
122 /*--------------------------------------------------------------------------*/
124 ico_uxf_init(const char *name)
126 Ico_Uxf_Mng_Display *dsp;
127 Ico_Uxf_Mng_Layer *lay;
128 Ico_Uxf_Mng_Process *prc;
129 pthread_mutexattr_t sMutexAttr;
130 Ico_Uxf_Sys_Config *sysconf;
131 Ico_Uxf_App_Config *appconf;
132 Ico_Uxf_conf_appdisplay *appdsp;
133 Ico_Uxf_Mng_Callback *freecb;
134 Ico_Uxf_Mng_EventQue *freeeq;
138 ico_uxf_log_open(name);
140 if (gIco_Uxf_Api_Mng.Initialized) {
141 if (gIco_Uxf_Api_Mng.Initialized < 0) {
142 uifw_trace("ico_uxf_init: Enter");
143 uifw_warn("ico_uxf_init: Leave(EBUSY)");
144 return ICO_UXF_EBUSY;
146 uifw_trace("ico_uxf_init: Enter");
147 uifw_trace("ico_uxf_init: Leave(EOK)");
150 uifw_trace("ico_uxf_init: Enter");
152 gIco_Uxf_Api_Mng.Initialized = -1;
153 memset(gIco_Uxf_Api_Mng.MyProcess, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
154 strncpy(gIco_Uxf_Api_Mng.MyProcess, name, ICO_UXF_MAX_PROCESS_NAME);
155 gIco_Uxf_Api_Mng.EventMask = 0;
156 gIco_Uxf_Api_Mng.WaylandFd = -1;
157 gIco_Uxf_Api_Mng.Wayland_Display = NULL;
158 gIco_Uxf_Api_Mng.InitTimer = ICO_UXF_SUSP_INITTIME;
159 gIco_Uxf_Api_Mng.Win_Show_Anima = 1;
160 gIco_Uxf_Api_Mng.Win_Hide_Anima = 1;
162 /* read configurations */
163 sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
164 appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
165 if ((sysconf == NULL) || (appconf == NULL)) {
166 uifw_error("ico_uxf_init: Leave(ESRCH), Configuration Read Error");
167 return ICO_UXF_ESRCH;
170 uifw_trace("ico_uxf_init: set display configurations");
171 /* set display configurations */
172 for (dn = 0; dn < sysconf->displayNum; dn++) {
173 dsp = ico_uxf_mng_display(sysconf->display[dn].id, 1);
174 dsp->attr.type = sysconf->display[dn].type;
175 dsp->attr.num_layers = sysconf->display[dn].layerNum;
176 dsp->attr.hostId = sysconf->display[dn].hostId;
177 dsp->attr.displayNo = sysconf->display[dn].displayno;
178 dsp->attr.w = sysconf->display[dn].width;
179 dsp->attr.h = sysconf->display[dn].height;
180 dsp->attr.pWidth = -1;
181 dsp->attr.pHeight = -1;
182 dsp->attr.orientation = ICO_UXF_ORIENTATION_HORIZONTAL;
183 dsp->attr.inch = sysconf->display[dn].inch;
184 strncpy(dsp->attr.name, sysconf->display[dn].name, ICO_UXF_MAX_WIN_NAME);
185 dsp->attr.name[ICO_UXF_MAX_WIN_NAME] = 0;
187 for (tn = 0; tn < sysconf->display[dn].layerNum; tn++) {
188 lay = ico_uxf_mng_layer(sysconf->display[dn].id,
189 sysconf->display[dn].layer[tn].id, 1);
190 lay->attr.display = sysconf->display[dn].id;
191 lay->attr.w = sysconf->display[dn].width;
192 lay->attr.h = sysconf->display[dn].height;
193 lay->attr.menuoverlap = sysconf->display[dn].layer[tn].menuoverlap;
194 lay->mng_display = dsp;
198 uifw_trace("ico_uxf_init: set application configurations(num=%d)",
199 appconf->applicationNum);
200 /* set application configurations */
201 for(dn = 0; dn < appconf->applicationNum; dn++) {
202 prc = ico_uxf_mng_process(appconf->application[dn].appid, 1);
203 prc->attr.internalid = 0;
204 prc->appconf = (void *)&appconf->application[dn];
205 prc->attr.status = ICO_UXF_PROCSTATUS_STOP;
206 prc->attr.type = appconf->application[dn].categoryId;
207 prc->attr.hostId = appconf->application[dn].hostId;
208 prc->attr.myHost = (prc->attr.hostId == sysconf->misc.myhostId) ? 1 : 0;
209 prc->attr.noicon = appconf->application[dn].noicon;
210 prc->attr.autostart = appconf->application[dn].autostart;
211 prc->attr.invisiblecpu = appconf->application[dn].invisiblecpu;
213 appdsp = &appconf->application[dn].display[0];
214 prc->attr.mainwin.window = 0;
215 prc->attr.mainwin.windowtype = appconf->application[dn].categoryId;
216 prc->attr.mainwin.display = appdsp->displayId;
217 prc->attr.mainwin.layer = appdsp->layerId;
218 prc->attr.mainwin.x =
219 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
220 prc->attr.mainwin.y =
221 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
222 prc->attr.mainwin.w =
223 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
224 prc->attr.mainwin.h =
225 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
226 prc->attr.mainwin.name[ICO_UXF_MAX_WIN_NAME] = 0;
227 prc->attr.numwindows = appconf->application[dn].displayzoneNum;
228 /* get sub windows */
229 if (prc->attr.numwindows > 1) {
230 prc->attr.subwin = malloc(sizeof(Ico_Uxf_ProcessWin) *
231 (prc->attr.numwindows - 1));
232 if (! prc->attr.subwin) {
233 uifw_error("ico_uxf_init: No Memory");
234 appconf->application[dn].displayzoneNum = 1;
235 prc->attr.numwindows = 1;
238 memset(prc->attr.subwin, 0, (prc->attr.numwindows - 1));
239 for (tn = 0; tn < (prc->attr.numwindows - 1); tn++) {
241 prc->attr.subwin[tn].windowtype = prc->attr.mainwin.windowtype;
242 prc->attr.subwin[tn].display = appdsp->displayId;
243 prc->attr.subwin[tn].layer = appdsp->layerId;
244 prc->attr.subwin[tn].x =
245 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
246 prc->attr.subwin[tn].y =
247 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
248 prc->attr.subwin[tn].w =
249 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
250 prc->attr.subwin[tn].h =
251 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
257 gIco_Uxf_Api_Mng.Mng_MyProcess
258 = ico_uxf_mng_process(gIco_Uxf_Api_Mng.MyProcess, 0);
259 if (!gIco_Uxf_Api_Mng.Mng_MyProcess) {
260 uifw_error("ico_uxf_init: Leave(ESRCH), Unknown Apprication(%s)",
261 gIco_Uxf_Api_Mng.MyProcess);
262 return ICO_UXF_ESRCH;
264 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.internalid = getpid();
265 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.status = ICO_UXF_PROCSTATUS_RUN;
267 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
269 uifw_trace("ico_uxf_init: App.%d MainDisplay.%d %08x",
270 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.process,
271 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, dsp);
273 for (ret = 0; ret < (5000/50); ret++) {
274 gIco_Uxf_Api_Mng.Wayland_Display = wl_display_connect(NULL);
275 if (gIco_Uxf_Api_Mng.Wayland_Display) break;
279 gIco_Uxf_Api_Mng.Wayland_Registry
280 = wl_display_get_registry(gIco_Uxf_Api_Mng.Wayland_Display);
281 wl_registry_add_listener(gIco_Uxf_Api_Mng.Wayland_Registry,
282 &ico_uxf_registry_listener, (void *)0);
284 for (ret = 0; ret < (500/20); ret++) {
285 if ((gIco_Uxf_Api_Mng.Wayland_WindowMgr != NULL) &&
286 (gIco_Uxf_Api_Mng.Wayland_exInput != NULL) &&
287 (gIco_Uxf_Api_Mng.Wayland_InputMgr != NULL)) break;
288 uifw_trace("ico_uxf_init: call wl_display_dispatch(%08x)",
289 (int)gIco_Uxf_Api_Mng.Wayland_Display);
290 wl_display_dispatch(gIco_Uxf_Api_Mng.Wayland_Display);
293 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
294 uifw_trace("ico_uxf_init: Wayland/Weston connect OK");
296 /* set client attribute if need */
297 if (gIco_Uxf_Api_Mng.Wayland_WindowMgr) {
298 for(dn = 0; dn < appconf->applicationNum; dn++) {
299 if (appconf->application[dn].noconfigure) {
300 uifw_trace("ico_uxf_init: %s no need configure event",
301 appconf->application[dn].appid);
302 ico_window_mgr_set_client_attr(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
303 appconf->application[dn].appid,
304 ICO_WINDOW_MGR_CLIENT_ATTR_NOCONFIGURE, 1);
305 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
310 gIco_Uxf_Api_Mng.WaylandFd
311 = wl_display_get_fd(gIco_Uxf_Api_Mng.Wayland_Display);
313 /* initialize mutex */
314 (void) pthread_mutexattr_init(&sMutexAttr);
315 if (pthread_mutex_init(&sMutex, &sMutexAttr) != 0) {
316 uifw_error("ico_uxf_init: Leave(ENOSYS), Mutex Create Error %d", errno);
317 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
318 gIco_Uxf_Api_Mng.Wayland_Display = NULL;
319 gIco_Uxf_Api_Mng.Initialized = 0;
320 return ICO_UXF_ENOSYS;
323 /* allocate free control blocks */
324 freecb = ico_uxf_alloc_callback();
325 ico_uxf_free_callback(freecb);
326 freeeq = ico_uxf_alloc_eventque();
327 ico_uxf_free_eventque(freeeq);
329 /* flush wayland connection */
330 ico_window_mgr_set_eventcb(gIco_Uxf_Api_Mng.Wayland_WindowMgr, 1);
331 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
333 /* application launch/dead callback from AppCore(aul) */
334 aul_listen_app_launch_signal(ico_uxf_aul_aulcb, (void *)0);
335 aul_listen_app_dead_signal(ico_uxf_aul_aulcb, (void *)1);
337 gIco_Uxf_Api_Mng.Initialized = 1;
339 uifw_trace("ico_uxf_init: Leave(EOK)");
345 /*--------------------------------------------------------------------------*/
347 * @brief ico_uxf_wl_display_fd: get wayland file discriptor
350 * @return wayland connect socket file descriptor
351 * @retval >=0 success(file descriptor)
352 * @retval < 0 error(wayland not connect)
354 /*--------------------------------------------------------------------------*/
356 ico_uxf_wl_display_fd(void)
358 uifw_trace("ico_uxf_wl_display_fd: fd=%d", gIco_Uxf_Api_Mng.WaylandFd);
360 return gIco_Uxf_Api_Mng.WaylandFd;
363 /*--------------------------------------------------------------------------*/
365 * @brief ico_uxf_shutdown: terminate user interface library hor HomeScreen
369 * @retval ICO_UXF_EOK success
370 * @retval ICO_UXF_EBUSY error(cullentry terminating)
372 /*--------------------------------------------------------------------------*/
374 ico_uxf_shutdown(void)
376 uifw_trace("ico_uxf_shutdown: Enter");
378 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
379 if (gIco_Uxf_Api_Mng.Initialized < 0) {
380 uifw_warn("ico_uxf_shutdown: Leave(EBUSY)");
381 return ICO_UXF_EBUSY;
383 uifw_trace("ico_uxf_shutdown: Leave(EOK)");
386 gIco_Uxf_Api_Mng.Initialized = -1;
387 gIco_Uxf_Api_Mng.LastEvent = 0;
389 (void) pthread_mutex_destroy(&sMutex);
391 if (gIco_Uxf_Api_Mng.Wayland_Seat) {
392 wl_seat_destroy(gIco_Uxf_Api_Mng.Wayland_Seat);
393 gIco_Uxf_Api_Mng.Wayland_Seat = NULL;
395 if (gIco_Uxf_Api_Mng.Wayland_exInput) {
396 ico_exinput_destroy(gIco_Uxf_Api_Mng.Wayland_exInput);
397 gIco_Uxf_Api_Mng.Wayland_exInput = NULL;
399 if (gIco_Uxf_Api_Mng.Wayland_InputMgr) {
400 ico_input_mgr_control_destroy(gIco_Uxf_Api_Mng.Wayland_InputMgr);
401 gIco_Uxf_Api_Mng.Wayland_InputMgr = NULL;
403 if (gIco_Uxf_Api_Mng.Wayland_Compositor) {
404 wl_compositor_destroy(gIco_Uxf_Api_Mng.Wayland_Compositor);
405 gIco_Uxf_Api_Mng.Wayland_Compositor = NULL;
407 if (gIco_Uxf_Api_Mng.Wayland_Display) {
408 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
409 wl_display_disconnect(gIco_Uxf_Api_Mng.Wayland_Display);
410 gIco_Uxf_Api_Mng.Wayland_Display = NULL;
413 gIco_Uxf_Api_Mng.Initialized = 0;
415 uifw_trace("ico_uxf_shutdown: Leave(EOK)");
419 /*--------------------------------------------------------------------------*/
421 * @brief ico_uxf_main_loop_iterate: process user interface library events
426 /*--------------------------------------------------------------------------*/
428 ico_uxf_main_loop_iterate(void)
431 Ico_Uxf_Mng_EventQue *wkque;
432 Ico_Uxf_Mng_Callback *callback;
433 Ico_Uxf_Event_Cb func;
435 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
438 if (ioctl(gIco_Uxf_Api_Mng.WaylandFd, FIONREAD, &arg) < 0) {
439 uifw_warn("ico_uxf_main_loop_iterate: ioclt(FIONREAD,) Error %d", errno);
444 wl_display_dispatch(gIco_Uxf_Api_Mng.Wayland_Display);
447 ico_uxf_enter_critical();
450 while (gIco_Uxf_Api_Mng.EventQue) {
452 wkque = gIco_Uxf_Api_Mng.EventQue;
453 gIco_Uxf_Api_Mng.EventQue = gIco_Uxf_Api_Mng.EventQue->next;
455 gIco_Uxf_Api_Mng.LastEvent = wkque->detail.event;
456 callback = gIco_Uxf_Api_Mng.Callback;
458 if (callback->eventmask & gIco_Uxf_Api_Mng.LastEvent) {
459 func = callback->func;
461 ico_uxf_leave_critical();
463 uifw_trace("ico_uxf_main_loop: Call Event Callback(%08x,,%08x)",
464 gIco_Uxf_Api_Mng.LastEvent, arg);
465 (*func)(gIco_Uxf_Api_Mng.LastEvent, wkque->detail, arg);
467 ico_uxf_enter_critical();
469 callback = callback->next;
471 ico_uxf_free_eventque(wkque);
474 ico_uxf_leave_critical();
476 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
479 /*--------------------------------------------------------------------------*/
481 * @brief ico_uxf_callback_set: set event calback function
483 * @param[in] mask event mask
484 * @param[in] func callback function
485 * @param[in] arg user argument
487 * @retval ICO_UXF_EOK success
488 * @retval ICO_UXF_ESRCH error(user interface library not initialized)
489 * @retval ICO_UXF_EINVAL error(illegal event mask)
490 * @retval ICO_UXF_EBUSY error(already set same event)
492 /*--------------------------------------------------------------------------*/
494 ico_uxf_callback_set(const unsigned int mask, Ico_Uxf_Event_Cb func, const int arg)
496 Ico_Uxf_Mng_Callback *callback;
499 uifw_trace("ico_uxf_callback_set: Enter(%08x,%08x,%08x)", mask, (int)func, arg);
501 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
502 uifw_warn("ico_uxf_callback_set: Leave(ESRCH)");
503 return ICO_UXF_ESRCH;
510 wkmask = ICO_UXF_EVENT_ALL;
512 if ((wkmask & ICO_UXF_EVENT_VALIDALL) == 0) {
513 uifw_warn("ico_uxf_callback_set: Leave(EINVAL)");
514 return ICO_UXF_EINVAL;
517 ico_uxf_enter_critical();
519 callback = gIco_Uxf_Api_Mng.Callback;
521 if ((callback->eventmask == wkmask) && (callback->func == func) &&
522 (callback->arg == arg)) {
524 ico_uxf_leave_critical();
525 uifw_warn("ico_uxf_callback_set: Leave(EBUSY)");
526 return ICO_UXF_EBUSY;
530 callback = ico_uxf_alloc_callback();
532 callback->eventmask = wkmask;
533 callback->func = func;
536 ico_uxf_regist_callback(callback);
538 gIco_Uxf_Api_Mng.EventMask |= wkmask;
540 ico_uxf_leave_critical();
542 uifw_trace("ico_uxf_callback_set: Leave(EOK)");
546 /*--------------------------------------------------------------------------*/
548 * @brief ico_uxf_callback_remove: remove event calback function
550 * @param[in] mask event mask
551 * @param[in] func callback function
552 * @param[in] arg user argument
554 * @retval ICO_UXF_EOK success
555 * @retval ICO_UXF_ESRCH error(user interface library not initialized)
557 /*--------------------------------------------------------------------------*/
559 ico_uxf_callback_remove(const unsigned int mask, Ico_Uxf_Event_Cb func, const int arg)
561 Ico_Uxf_Mng_Callback *callback;
564 uifw_trace("ico_uxf_callback_remove: Enter(%08x,%08x,%08x)", mask, (int)func, arg);
566 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
567 uifw_warn("ico_uxf_callback_remove: Leave(ESRCH)");
568 return ICO_UXF_ESRCH;
575 wkmask = ICO_UXF_EVENT_ALL;
578 ico_uxf_enter_critical();
580 gIco_Uxf_Api_Mng.EventMask = 0;
582 callback = gIco_Uxf_Api_Mng.Callback;
585 if ((callback->eventmask == wkmask) && (callback->func == func) &&
586 (callback->arg == arg)) {
587 ico_uxf_remove_callback(callback);
590 gIco_Uxf_Api_Mng.EventMask |= callback->eventmask;
592 callback = callback->next;
595 ico_uxf_leave_critical();
597 uifw_trace("ico_uxf_callback_remove: Leave(EOK)");
601 /*--------------------------------------------------------------------------*/
603 * @brief ico_uxf_free_procwin: free active window management table(internal function)
605 * @param[in] prc application management table address
608 /*--------------------------------------------------------------------------*/
610 ico_uxf_free_procwin(Ico_Uxf_Mng_Process *prc)
612 Ico_Uxf_Mng_Window *p;
613 Ico_Uxf_Mng_Window *pp;
614 Ico_Uxf_Mng_Window *freep;
617 uifw_trace("ico_uxf_free_procwin: Enter(%d)", prc->attr.process);
619 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
620 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
621 pp = (Ico_Uxf_Mng_Window *)0;
623 if (p->attr.process == prc->attr.process) {
627 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
632 uifw_trace("ico_uxf_free_procwin: Free Window(%08x)", freep->attr.window);
641 uifw_trace("ico_uxf_free_procwin: Leave");
644 /*--------------------------------------------------------------------------*/
646 * @brief ico_uxf_wayland_globalcb: wayland global callback(static function)
648 * @param[in] data user data(unused)
649 * @param[in] registry wayland registry
650 * @param[in] name wayland display Id(unused)
651 * @param[in] interface wayland interface name
652 * @param[in] version wayland interface version number(unused)
655 /*--------------------------------------------------------------------------*/
657 ico_uxf_wayland_globalcb(void *data, struct wl_registry *registry,
658 uint32_t name, const char *interface, uint32_t version)
660 uifw_trace("ico_uxf_wayland_globalcb: Enter(Event=%s DispId=%08x)", interface, name);
662 if (strcmp(interface, "ico_window_mgr") == 0) {
663 gIco_Uxf_Api_Mng.Wayland_WindowMgr = (struct ico_window_mgr *)
664 wl_registry_bind(registry, name, &ico_window_mgr_interface, 1);
665 ico_window_mgr_add_listener(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
666 &windowlistener, NULL);
667 ico_window_mgr_set_user(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
668 getpid(), gIco_Uxf_Api_Mng.MyProcess);
670 else if (strcmp(interface, "ico_exinput") == 0) {
672 gIco_Uxf_Api_Mng.Wayland_exInput = (struct ico_exinput *)
673 wl_registry_bind(registry, name, &ico_exinput_interface, 1);
674 ico_exinput_add_listener(gIco_Uxf_Api_Mng.Wayland_exInput, &exinputlistener, NULL);
676 else if (strcmp(interface, "ico_input_mgr_control") == 0) {
677 /* regist Multi Input Manager interface */
678 gIco_Uxf_Api_Mng.Wayland_InputMgr = (struct ico_input_mgr_control *)
679 wl_registry_bind(registry, name, &ico_input_mgr_control_interface, 1);
681 else if (strcmp(interface, "wl_output") == 0) {
682 /* regist wl_output listener to get display info */
683 gIco_Uxf_Api_Mng.Wayland_Output = (struct wl_output *)
684 wl_registry_bind(registry, name, &wl_output_interface, 1);
685 wl_output_add_listener(gIco_Uxf_Api_Mng.Wayland_Output, &outputlistener, NULL);
687 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
688 uifw_trace("ico_uxf_wayland_globalcb: Leave");
691 /*--------------------------------------------------------------------------*/
693 * @brief ico_uxf_output_geometrycb: wayland display attribute callback(static function)
695 * @param[in] data user data(unused)
696 * @param[in] wl_output wayland wl_output interface
697 * @param[in] x display upper-left X coodinate
698 * @param[in] y display upper-left Y coodinate
699 * @param[in] physical_width display physical width
700 * @param[in] physical_height display physical height
701 * @param[in] subpixel display sub pixcel
702 * @param[in] make display maker
703 * @param[in] model diaplay model
704 * @param[in] transform transform
707 /*--------------------------------------------------------------------------*/
709 ico_uxf_output_geometrycb(void *data, struct wl_output *wl_output, int32_t x, int32_t y,
710 int32_t physical_width, int32_t physical_height, int32_t subpixel,
711 const char *make, const char *model, int32_t transform)
713 Ico_Uxf_Mng_Display *dsp;
715 uifw_trace("ico_uxf_output_geometrycb: Enter(x/y=%d/%d, pwidth/height=%d/%d, trans=%d)",
716 x, y, physical_width, physical_height, transform);
718 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
721 if ((transform == WL_OUTPUT_TRANSFORM_90)
722 || (transform == WL_OUTPUT_TRANSFORM_270)
723 || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_90)
724 || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_270)) {
725 dsp->attr.pWidth = physical_height;
726 dsp->attr.pHeight = physical_width;
727 dsp->attr.orientation = ICO_UXF_ORIENTATION_VERTICAL;
730 dsp->attr.pWidth = physical_width;
731 dsp->attr.pHeight = physical_height;
732 dsp->attr.orientation = ICO_UXF_ORIENTATION_HORIZONTAL;
735 uifw_trace("ico_uxf_output_geometrycb: Leave");
738 /*--------------------------------------------------------------------------*/
740 * @brief ico_uxf_output_modecb: wayland display mode callback(static function)
742 * @param[in] data user data(unused)
743 * @param[in] wl_output wayland wl_output interface
744 * @param[in] flags flags
745 * @param[in] width display width
746 * @param[in] height display height
747 * @param[in] refresh display refresh rate
750 /*--------------------------------------------------------------------------*/
752 ico_uxf_output_modecb(void *data, struct wl_output *wl_output, uint32_t flags,
753 int32_t width, int32_t height, int32_t refresh)
755 Ico_Uxf_Mng_Display *dsp;
757 uifw_trace("ico_uxf_output_modecb: Enter(flg=%d, width=%d, height=%d, ref=%d)",
758 flags, width, height, refresh);
760 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
762 if (dsp && (flags & WL_OUTPUT_MODE_CURRENT)) {
763 if (dsp->attr.orientation == ICO_UXF_ORIENTATION_VERTICAL) {
764 dsp->attr.pWidth = height;
765 dsp->attr.pHeight = width;
768 dsp->attr.pWidth = width;
769 dsp->attr.pHeight = height;
772 uifw_trace("ico_uxf_output_modecb: Leave");
775 /*--------------------------------------------------------------------------*/
777 * @brief ico_uxf_window_createdcb: wayland surface create callback(static function)
779 * @param[in] data user data(unused)
780 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
781 * @param[in] surfaceid ico_window_mgr surface Id
782 * @param[in] pid wayland client process Id
783 * @param[in] appid wayland client application Id
786 /*--------------------------------------------------------------------------*/
788 ico_uxf_window_createdcb(void *data, struct ico_window_mgr *ico_window_mgr,
789 uint32_t surfaceid, int32_t pid, const char *appid)
791 Ico_Uxf_Mng_Process *prc;
792 Ico_Uxf_Mng_ProcWin *ppwin;
793 Ico_Uxf_Mng_ProcWin *ppw;
795 uifw_trace("ico_uxf_window_createdcb: Enter(surf=%08x pid=%d appid=%s myapp=%s)",
796 (int)surfaceid, pid, appid, gIco_Uxf_Api_Mng.MyProcess);
798 prc = ico_uxf_mng_process(appid, 0);
800 /* set window animation */
801 if (prc->appconf != NULL) {
802 if (((Ico_Uxf_conf_application *)prc->appconf)->animation) {
803 ico_window_mgr_set_animation(
804 gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid,
805 ((Ico_Uxf_conf_application *)prc->appconf)->animation,
806 ((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
808 else if (((Ico_Uxf_conf_application *)prc->appconf)->animation_time > 0) {
809 ico_window_mgr_set_animation(
810 gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid, " ",
811 ((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
814 if (prc->attr.mainwin.window <= 0) {
815 uifw_trace("ico_uxf_window_createdcb: Set Main Window, Config Data");
816 prc->attr.mainwin.window = surfaceid;
817 ico_uxf_window_configurecb(data, ico_window_mgr, surfaceid, appid,
818 prc->attr.mainwin.layer, prc->attr.mainwin.x,
819 prc->attr.mainwin.y, prc->attr.mainwin.w,
820 prc->attr.mainwin.h, 0);
821 if (gIco_Uxf_Api_Mng.Hook_Window) {
822 (*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
823 ICO_UXF_HOOK_WINDOW_CREATE_MAIN);
827 uifw_trace("ico_uxf_window_createdcb: Sub Window, Dummy Data");
828 ico_uxf_window_configurecb(data, ico_window_mgr, surfaceid, appid,
829 prc->attr.mainwin.layer, 16384, 16384, 1, 1, 0);
830 ppwin = (Ico_Uxf_Mng_ProcWin *)malloc(sizeof(Ico_Uxf_Mng_ProcWin));
832 memset(ppwin, 0, sizeof(Ico_Uxf_Mng_ProcWin));
833 ppwin->attr.window = surfaceid;
834 ppwin->attr.display = prc->attr.mainwin.display;
836 prc->procwin = ppwin;
846 if (gIco_Uxf_Api_Mng.Hook_Window) {
847 (*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
848 ICO_UXF_HOOK_WINDOW_CREATE_SUB);
853 uifw_warn("ico_uxf_window_createdcb: Application.%s dose not exist", appid);
855 uifw_trace("ico_uxf_window_createdcb: Leave");
858 /*--------------------------------------------------------------------------*/
860 * @brief ico_uxf_window_destroyedcb: wayland surface destroy callback(static function)
862 * @param[in] data user data(unused)
863 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
864 * @param[in] surfaceid ico_window_mgr surface Id
867 /*--------------------------------------------------------------------------*/
869 ico_uxf_window_destroyedcb(void *data, struct ico_window_mgr *ico_window_mgr,
872 Ico_Uxf_Mng_Window *p;
873 Ico_Uxf_Mng_Window *pp;
874 Ico_Uxf_Mng_Window *freep;
875 Ico_Uxf_Mng_Process *prc;
876 Ico_Uxf_Mng_EventQue *que;
878 char wkappid[ICO_UXF_MAX_PROCESS_NAME+1];
881 uifw_trace("ico_uxf_window_destroyedcb: Enter(surf=%08x)", (int)surfaceid);
883 ico_uxf_enter_critical();
885 p = ico_uxf_mng_window(surfaceid, 0);
888 ico_uxf_leave_critical();
889 uifw_trace("ico_uxf_window_destroyedcb: Leave(Surface=%08x dose not exist)",
893 prc = p->mng_process;
894 if ((prc != NULL) && (prc->attr.mainwin.window == (int)surfaceid)) {
895 prc->attr.mainwin.window = 0;
898 strcpy(wkappid, p->attr.process);
899 wksubwindow = p->attr.subwindow;
901 if ((gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_DESTORYWINDOW) &&
902 (p->attr.eventmask & ICO_UXF_EVENT_DESTORYWINDOW)) {
904 que = ico_uxf_alloc_eventque();
905 que->detail.event = ICO_UXF_EVENT_DESTORYWINDOW;
906 que->detail.window.display = p->attr.display;
907 que->detail.window.window = surfaceid;
908 que->detail.window.layer = p->attr.layer;
909 que->detail.window.x = p->attr.x;
910 que->detail.window.y = p->attr.y;
911 que->detail.window.w = p->attr.w;
912 que->detail.window.h = p->attr.h;
913 que->detail.window.visible = p->attr.visible;
914 que->detail.window.raise = p->attr.raise;
915 que->detail.window.active = p->attr.active;
916 ico_uxf_regist_eventque(que);
919 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
920 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
921 pp = (Ico_Uxf_Mng_Window *)0;
923 if (p->attr.window == (int)surfaceid) {
927 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
932 uifw_trace("ico_uxf_window_destroyedcb: Free Window.%08x(%08x)",
933 (int)freep, freep->attr.window);
935 hash = ICO_UXF_MISC_HASHSIZE;
942 ico_uxf_leave_critical();
944 if (gIco_Uxf_Api_Mng.Hook_Window) {
945 (*gIco_Uxf_Api_Mng.Hook_Window)(wkappid, surfaceid,
946 wksubwindow ? ICO_UXF_HOOK_WINDOW_DESTORY_SUB :
947 ICO_UXF_HOOK_WINDOW_DESTORY_MAIN);
949 uifw_trace("ico_uxf_window_destroyedcb: Leave");
952 /*--------------------------------------------------------------------------*/
954 * @brief ico_uxf_window_visiblecb: wayland surface visible callback(static function)
956 * @param[in] data user data(unused)
957 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
958 * @param[in] surfaceid ico_window_mgr surface Id
959 * @param[in] visibility surface visible(1=visible/0=unvisible/9=nochange)
960 * @param[in] raise surface raise(1=raise/0=lower/9=nochange)
961 * @param[in] hint client request(1=client request(not changed)/0=changed)
964 /*--------------------------------------------------------------------------*/
966 ico_uxf_window_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
967 uint32_t surfaceid, int32_t visible, int32_t raise, int32_t hint)
969 Ico_Uxf_Mng_Window *win;
970 Ico_Uxf_Mng_EventQue *que;
974 ico_uxf_enter_critical();
976 win = ico_uxf_mng_window(surfaceid, 0);
979 ico_uxf_leave_critical();
980 uifw_trace("ico_uxf_window_visiblecb: Surface=%08x dose not exist",
988 ovisible = win->attr.visible;
991 oraise = win->attr.raise;
994 if ((win->attr.visible != ovisible) ||
995 (win->attr.raise != oraise)) {
997 if (((hint == 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_VISIBLE) &&
998 (win->attr.eventmask & ICO_UXF_EVENT_VISIBLE)) ||
999 ((hint != 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_VISIBLE_REQ) &&
1000 (win->attr.eventmask & ICO_UXF_EVENT_VISIBLE_REQ))) {
1002 que = ico_uxf_alloc_eventque();
1004 (hint == 0) ? ICO_UXF_EVENT_VISIBLE : ICO_UXF_EVENT_VISIBLE_REQ;
1005 que->detail.window.display = win->attr.display;
1006 que->detail.window.window = win->attr.window;
1007 que->detail.window.layer = win->attr.layer;
1008 que->detail.window.x = win->attr.x;
1009 que->detail.window.y = win->attr.y;
1010 que->detail.window.w = win->attr.w;
1011 que->detail.window.h = win->attr.h;
1012 que->detail.window.visible = ovisible;
1013 que->detail.window.raise = oraise;
1014 que->detail.window.active = win->attr.active;
1016 ico_uxf_regist_eventque(que);
1019 ico_uxf_leave_critical();
1022 /*--------------------------------------------------------------------------*/
1024 * @brief ico_uxf_window_configurecb: wayland surface configure callback(static function)
1026 * @param[in] data user data(unused)
1027 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
1028 * @param[in] surfaceid ico_window_mgr surface Id
1029 * @param[in] appid client application Id
1030 * @param[in] x surface upper-left X coodinate
1031 * @param[in] y surface upper-left Y coodinate
1032 * @param[in] width surface width
1033 * @param[in] height surface height
1034 * @param[in] hint client request(1=client request(not changed)/0=changed)
1037 /*--------------------------------------------------------------------------*/
1039 ico_uxf_window_configurecb(void *data, struct ico_window_mgr *ico_window_mgr,
1040 uint32_t surfaceid, const char *appid, int32_t layer,
1041 int32_t x, int32_t y, int32_t width, int32_t height,
1044 Ico_Uxf_Mng_Window *win;
1045 Ico_Uxf_Mng_EventQue *que;
1047 Ico_Uxf_Mng_Process *prc;
1049 #if 0 /* too many logout, change to comment out */
1050 uifw_trace("ico_uxf_window_configurecb: surf=%08x app=%s layer=%d "
1051 "x/y=%d/%d w/h=%d/%d hint=%d",
1052 (int)surfaceid, appid, layer, x, y, width, height, hint);
1053 #endif /* too many logout, change to comment out */
1055 ico_uxf_enter_critical();
1057 win = ico_uxf_mng_window(surfaceid, 0);
1060 win = ico_uxf_mng_window(surfaceid, 1);
1061 display = ICO_UXF_GETDISPLAYID(surfaceid);
1062 win->mng_display = ico_uxf_mng_display(display, 0);
1063 win->mng_layer = ico_uxf_mng_layer(display, layer, 0);
1064 win->attr.eventmask = ICO_UXF_EVENT_NEWWINDOW;
1065 win->attr.display = display;
1066 win->attr.layer = layer;
1067 memset(win->attr.process, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
1068 strncpy(win->attr.process, appid, ICO_UXF_MAX_PROCESS_NAME);
1071 win->attr.w = width;
1072 win->attr.h = height;
1075 prc = ico_uxf_mng_process(appid, 0);
1076 win->mng_process = prc;
1077 if ((prc != NULL) && (prc->attr.mainwin.window != (int)surfaceid)) {
1079 win->attr.subwindow = 1;
1082 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_NEWWINDOW) {
1084 que = ico_uxf_alloc_eventque();
1086 que->detail.event = ICO_UXF_EVENT_NEWWINDOW;
1087 que->detail.window.display = display;
1088 que->detail.window.window = surfaceid;
1089 que->detail.window.layer = layer;
1090 que->detail.window.x = win->attr.x;
1091 que->detail.window.y = win->attr.y;
1092 que->detail.window.w = win->attr.w;
1093 que->detail.window.h = win->attr.h;
1094 que->detail.window.visible = win->attr.visible;
1095 que->detail.window.raise = win->attr.raise;
1096 que->detail.window.active = win->attr.active;
1098 ico_uxf_regist_eventque(que);
1102 if ((win->attr.layer != layer) ||
1103 (win->attr.x != x) || (win->attr.y != y) ||
1104 (win->attr.w != width) || (win->attr.h != height)) {
1106 if (((hint == 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_RESIZE) &&
1107 (win->attr.eventmask & ICO_UXF_EVENT_RESIZE)) ||
1108 ((hint != 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_RESIZE_REQ) &&
1109 (win->attr.eventmask & ICO_UXF_EVENT_RESIZE_REQ))) {
1111 que = ico_uxf_alloc_eventque();
1114 (hint == 0) ? ICO_UXF_EVENT_RESIZE : ICO_UXF_EVENT_RESIZE_REQ;
1115 que->detail.window.display = win->mng_display->attr.display;
1116 que->detail.window.window = win->attr.window;
1117 que->detail.window.layer = layer;
1118 que->detail.window.x = x;
1119 que->detail.window.y = y;
1120 que->detail.window.w = width;
1121 que->detail.window.h = height;
1122 que->detail.window.visible = win->attr.visible;
1123 que->detail.window.raise = win->attr.raise;
1124 que->detail.window.active = win->attr.active;
1126 ico_uxf_regist_eventque(que);
1131 win->attr.w = width;
1132 win->attr.h = height;
1133 if (win->attr.layer != layer) {
1134 win->attr.layer = layer;
1135 win->mng_layer = ico_uxf_mng_layer(win->mng_display->attr.display,
1141 ico_uxf_leave_critical();
1144 /*--------------------------------------------------------------------------*/
1146 * @brief ico_uxf_window_activecb: wayland surface active callback(static function)
1148 * @param[in] data user data(unused)
1149 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
1150 * @param[in] surfaceid ico_window_mgr surface Id
1151 * @param[in] active surface active(1=active/0=not active)
1154 /*--------------------------------------------------------------------------*/
1156 ico_uxf_window_activecb(void *data, struct ico_window_mgr *ico_window_mgr,
1157 uint32_t surfaceid, uint32_t active)
1159 Ico_Uxf_Mng_Window *win;
1160 Ico_Uxf_Mng_EventQue *que;
1162 uifw_trace("ico_uxf_window_activecb: Enter(surf=%08x active=%d)", surfaceid, active);
1164 ico_uxf_enter_critical();
1166 win = ico_uxf_mng_window(surfaceid, 0);
1169 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_ACTIVEWINDOW) {
1171 que = ico_uxf_alloc_eventque();
1173 que->detail.event = ICO_UXF_EVENT_ACTIVEWINDOW;
1174 que->detail.window.display = ICO_UXF_GETDISPLAYID(surfaceid);
1175 que->detail.window.window = surfaceid;
1176 que->detail.window.active = active;
1177 win->attr.active = active;
1179 ico_uxf_regist_eventque(que);
1182 ico_uxf_leave_critical();
1183 uifw_trace("ico_uxf_window_activecb: Leave");
1186 /*--------------------------------------------------------------------------*/
1188 * @brief ico_uxf_input_capabilitiescb: wayland extended input
1189 * input capabilities callback(static function)
1191 * @param[in] data user data(unused)
1192 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1193 * @param[in] device input device name
1194 * @param[in] type input device type
1195 * @param[in] swname input switch name
1196 * @param[in] input input switch number
1197 * @param[in] codename input code name
1198 * @param[in] code input code value
1201 /*--------------------------------------------------------------------------*/
1203 ico_uxf_input_capabilitiescb(void *data, struct ico_exinput *ico_exinput,
1204 const char *device, int32_t type, const char *swname,
1205 int32_t input, const char *codename, int32_t code)
1208 Ico_Uxf_Sys_Config *sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
1209 Ico_Uxf_InputDev *inputdev;
1210 Ico_Uxf_InputDev *bpdev;
1211 Ico_Uxf_InputSw *inputsw;
1212 Ico_Uxf_InputSw *bpsw;
1214 uifw_trace("ico_uxf_input_capabilitiescb: "
1215 "Enter(device=%s type=%d sw=%s input=%d code=%s[%d])",
1216 device, type, swname, input, codename, code);
1218 if (! sysconf) return;
1220 /* search and create input device table */
1222 inputdev = gIco_Uxf_Api_Mng.InputDev;
1224 if (strcasecmp(inputdev->device, device) == 0) break;
1226 inputdev = inputdev->next;
1229 inputdev = malloc(sizeof(Ico_Uxf_InputDev));
1231 uifw_error("ico_uxf_input_capabilitiescb: Leave(No Memory)");
1234 memset(inputdev, 0, sizeof(Ico_Uxf_InputDev));
1237 bpdev->next = inputdev;
1240 gIco_Uxf_Api_Mng.InputDev = inputdev;
1243 strncpy(inputdev->device, device, sizeof(inputdev->device)-1);
1244 inputdev->type = type;
1247 inputsw = inputdev->inputSw;
1249 if (strcasecmp(inputsw->swname, swname) == 0) break;
1251 inputsw = inputsw->next;
1254 inputsw = malloc(sizeof(Ico_Uxf_InputSw));
1256 uifw_error("ico_uxf_input_capabilitiescb: Leave(No Memory)");
1260 bpsw->next = inputsw;
1263 inputdev->inputSw = inputsw;
1265 inputdev->numInputSw ++;
1267 memset(inputsw, 0, sizeof(Ico_Uxf_InputSw));
1268 strncpy(inputsw->swname, swname, sizeof(inputsw->swname)-1);
1269 inputsw->input = input;
1270 inputsw->numCode = 1;
1271 inputsw->inputCode[0].code = code;
1272 strncpy(inputsw->inputCode[0].codename, codename,
1273 sizeof(inputsw->inputCode[0].codename)-1);
1274 uifw_trace("ico_uxf_input_capabilitiescb: create new inputsw");
1276 /* send fixed application if fixed switch */
1277 for (i = 0; i < sysconf->inputdevNum; i++) {
1278 if (strcasecmp(sysconf->inputdev[i].name, inputdev->device) != 0) continue;
1280 for (j = 0; j < sysconf->inputdev[i].inputswNum; j++) {
1281 if (! sysconf->inputdev[i].inputsw[j].appid) continue;
1282 if (strcasecmp(sysconf->inputdev[i].inputsw[j].name,
1283 inputsw->swname) != 0) continue;
1285 uifw_trace("ico_uxf_input_capabilitiescb: input %s.%s = %s",
1286 inputdev->device, inputsw->swname,
1287 sysconf->inputdev[i].inputsw[j].appid);
1288 ico_input_mgr_control_add_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr,
1289 sysconf->inputdev[i].inputsw[j].appid,
1290 inputdev->device, inputsw->input, 1);
1295 uifw_trace("ico_uxf_input_capabilitiescb: Leave");
1298 /*--------------------------------------------------------------------------*/
1300 * @brief ico_uxf_input_codecb: wayland extended input
1301 * input code callback(static function)
1303 * @param[in] data user data(unused)
1304 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1305 * @param[in] device input device name
1306 * @param[in] input input switch number
1307 * @param[in] codename input code name
1308 * @param[in] code input code value
1311 /*--------------------------------------------------------------------------*/
1313 ico_uxf_input_codecb(void *data, struct ico_exinput *ico_exinput, const char *device,
1314 int32_t input, const char *codename, int32_t code)
1317 Ico_Uxf_InputDev *inputdev;
1318 Ico_Uxf_InputSw *inputsw;
1320 uifw_trace("ico_uxf_input_codecb: device=%s input=%d code=%s[%d]",
1321 device, input, codename, code);
1323 /* search input device table */
1324 inputdev = gIco_Uxf_Api_Mng.InputDev;
1326 if (strcasecmp(inputdev->device, device) == 0) break;
1327 inputdev = inputdev->next;
1330 uifw_error("ico_uxf_input_codecb: device.%s dose not exist", device);
1334 /* search input switch */
1335 inputsw = inputdev->inputSw;
1337 if (inputsw->input == input) break;
1338 inputsw = inputsw->next;
1341 uifw_error("ico_uxf_input_codecb: device.%s input=%d dose not exist",
1345 for (i = 0; i < inputsw->numCode; i++) {
1346 if (inputsw->inputCode[i].code == code) break;
1348 if (i >= inputsw->numCode) {
1350 uifw_error("ico_uxf_input_codecb: device.%s input=%d number of codes overflow",
1354 inputsw->numCode ++;
1355 i = inputsw->numCode - 1;
1357 memset(inputsw->inputCode[i].codename, 0, sizeof(inputsw->inputCode[i].codename));
1358 strncpy(inputsw->inputCode[i].codename, codename,
1359 sizeof(inputsw->inputCode[i].codename)-1);
1360 inputsw->inputCode[i].code = code;
1363 /*--------------------------------------------------------------------------*/
1365 * @brief ico_uxf_input_inputcb: wayland extended input
1366 * input switch callback(static function)
1368 * @param[in] data user data(unused)
1369 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1370 * @param[in] time input time(miri-sec)
1371 * @param[in] device input device name
1372 * @param[in] input input switch number
1373 * @param[in] code input code value
1374 * @param[in] state input state(1=switch On/0=switch Off)
1377 /*--------------------------------------------------------------------------*/
1379 ico_uxf_input_inputcb(void *data, struct ico_exinput *ico_exinput, uint32_t time,
1380 const char *device, int32_t input, int32_t code, int32_t state)
1382 Ico_Uxf_Mng_EventQue *que;
1383 uifw_trace("ico_uxf_input_inputcb: device=%s input=%d code=%d state=%d",
1384 device, input, code, state);
1386 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_EXINPUT) {
1388 ico_uxf_enter_critical();
1389 que = ico_uxf_alloc_eventque();
1391 strncpy(que->detail.exinput.device, device,
1392 sizeof(que->detail.exinput.device)-1);
1393 que->detail.exinput.input = input;
1394 que->detail.exinput.code = code;
1395 que->detail.exinput.state = state;
1397 ico_uxf_regist_eventque(que);
1398 ico_uxf_leave_critical();
1402 /*--------------------------------------------------------------------------*/
1404 * @brief ico_uxf_aul_aulcb: AppCore(AUL) application launch/dead callback(static function)
1406 * @param[in] pid target application process Id
1407 * @param[in] data user data(0=launch, 1=dead)
1408 * @return result(always 0, means success)
1410 /*--------------------------------------------------------------------------*/
1412 ico_uxf_aul_aulcb(int pid, void *data)
1414 Ico_Uxf_Mng_Process *proc;
1416 Ico_Uxf_Mng_EventQue *que;
1418 char appid[ICO_UXF_MAX_PROCESS_NAME+1];
1421 memset(appid, 0, sizeof(appid));
1423 (void) aul_app_get_appid_bypid(pid, appid, sizeof(appid));
1424 uifw_trace("ico_uxf_aul_aulcb: Enter(pid=%d, dead=No, appid=%s)", pid, appid);
1427 uifw_trace("ico_uxf_aul_aulcb: Enter(pid=%d, dead=Yes)", pid);
1429 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1430 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1432 if (proc->attr.internalid == pid) break;
1433 if (strcmp(proc->attr.process, appid) == 0) break;
1434 proc = proc->nextidhash;
1439 /* not handle process, */
1440 /* or the process is correctly terminated by ico_uxf_process_terminate */
1441 uifw_trace("ico_uxf_aul_aulcb: Leave(not find)");
1444 uifw_trace("ico_uxf_aul_aulcb: find(appid=%s)", proc->attr.process);
1446 ico_uxf_enter_critical();
1448 que = ico_uxf_alloc_eventque();
1449 strncpy(que->detail.process.process, proc->attr.process, ICO_UXF_MAX_PROCESS_NAME);
1451 que->detail.event = ICO_UXF_EVENT_TERMPROCESS;
1452 que->detail.process.status = ICO_UXF_PROCSTATUS_STOP;
1454 /* delete process info */
1455 proc->attr.status = ICO_UXF_PROCSTATUS_STOP;
1456 proc->attr.internalid = -1;
1457 proc->attr.mainwin.window = 0;
1458 ico_uxf_free_procwin(proc);
1461 que->detail.event = ICO_UXF_EVENT_EXECPROCESS;
1462 que->detail.process.status = ICO_UXF_PROCSTATUS_RUN;
1464 /* setup process info */
1465 if (proc->attr.status != ICO_UXF_PROCSTATUS_RUN) {
1466 proc->attr.internalid = pid;
1467 if (proc->attr.status != ICO_UXF_PROCSTATUS_INIT) {
1468 /* child process, search parent process */
1469 uifw_trace("ico_uxf_aul_aulcb: fork&exec %s", proc->attr.process);
1470 proc->attr.child = 1;
1471 /* save parent application if exist */
1472 if (gIco_Uxf_Api_Mng.Mng_LastProcess != proc) {
1473 proc->parent = gIco_Uxf_Api_Mng.Mng_LastProcess;
1476 uifw_trace("ico_uxf_aul_aulcb: same process %s real %s", proc->attr.process,
1477 proc->parent ? proc->parent->attr.process : "(None)");
1481 proc->attr.child = 0;
1483 proc->attr.status = ICO_UXF_PROCSTATUS_RUN;
1488 ico_uxf_regist_eventque(que);
1490 ico_uxf_leave_critical();
1492 uifw_trace("ico_uxf_aul_aulcb: Leave");
1496 /*--------------------------------------------------------------------------*/
1498 * @brief ico_uxf_set_lastapp: save last application
1500 * @param[in] appid applicationId (if NULL, no last application)
1503 /*--------------------------------------------------------------------------*/
1505 ico_uxf_set_lastapp(const char *appid)
1508 gIco_Uxf_Api_Mng.Mng_LastProcess = ico_uxf_mng_process(appid, 0);
1511 gIco_Uxf_Api_Mng.Mng_LastProcess = NULL;
1515 /*--------------------------------------------------------------------------*/
1517 * @brief ico_uxf_getchild_appid: get child applicationId
1519 * @param[in] appid parent applicationId
1520 * @return last child applicationId
1521 * @retval !=NULL success(applicationId)
1522 * @retval ==NULL no child application
1524 /*--------------------------------------------------------------------------*/
1526 ico_uxf_getchild_appid(const char *appid)
1528 Ico_Uxf_Mng_Process *pproc;
1529 Ico_Uxf_Mng_Process *proc;
1532 pproc = ico_uxf_mng_process(appid, 0);
1534 /* unknown parent application, no child */
1535 uifw_trace("ico_uxf_getchild_appid: Unknown parent(%s)", appid);
1540 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1541 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1543 if (proc->parent == pproc) {
1544 uifw_trace("ico_uxf_getchild_appid: child(%s) parent(%s)",
1545 proc->attr.process, appid);
1546 return proc->attr.process;
1548 proc = proc->nextidhash;
1551 uifw_trace("ico_uxf_getchild_appid: parent(%s) has no child", appid);
1555 /*--------------------------------------------------------------------------*/
1557 * @brief ico_uxf_set_lastapp: save last application
1559 * @param[in] appid applicationId (if NULL, no last application)
1562 /*--------------------------------------------------------------------------*/
1564 ico_uxf_timer_wake(const int msec)
1566 Ico_Uxf_Mng_Process *proc;
1569 if (gIco_Uxf_Api_Mng.InitTimer > 0) {
1570 gIco_Uxf_Api_Mng.InitTimer -= msec;
1571 if (gIco_Uxf_Api_Mng.InitTimer > 0) {
1574 gIco_Uxf_Api_Mng.InitTimer = 0;
1577 if (gIco_Uxf_Api_Mng.NeedTimer == 0) {
1580 gIco_Uxf_Api_Mng.NeedTimer = 0;
1581 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1582 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1584 if (proc->susptimer > 0) {
1585 if (msec >= proc->susptimer) {
1586 proc->susptimer = 0;
1587 if (proc->attr.suspend) {
1588 if (proc->susp == 0) {
1590 uifw_trace("ico_uxf_timer_wake: CPU suspend pid=%d",
1591 proc->attr.internalid);
1592 kill(proc->attr.internalid, SIGSTOP);
1595 else if (proc->susp == 0) {
1596 uifw_trace("ico_uxf_timer_wake: CPU resume pid=%d(show=%d)",
1597 proc->attr.internalid, proc->showmode);
1598 ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
1599 proc->attr.mainwin.window,
1601 ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION ?
1602 ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION :
1603 ICO_WINDOW_MGR_VISIBLE_SHOW,
1604 ICO_WINDOW_MGR_RAISE_NOCHANGE);
1605 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
1609 proc->susptimer -= msec;
1610 gIco_Uxf_Api_Mng.NeedTimer ++;
1613 proc = proc->nextidhash;
1618 /*--------------------------------------------------------------------------*/
1620 * @brief ico_uxf_enter_critical: enter critical section(internal function)
1625 /*--------------------------------------------------------------------------*/
1627 ico_uxf_enter_critical(void)
1629 if (pthread_mutex_lock(&sMutex)) {
1630 uifw_error("ico_uxf_enter_critical: Error<%d>", errno);
1634 /*--------------------------------------------------------------------------*/
1636 * @brief ico_uxf_leave_critical: leave critical section(internal function)
1641 /*--------------------------------------------------------------------------*/
1643 ico_uxf_leave_critical(void)
1645 if (pthread_mutex_unlock(&sMutex)) {
1646 uifw_error("ico_uxf_leave_critical: Error<%d>", errno);
1650 /*--------------------------------------------------------------------------*/
1652 * @brief ico_uxf_alloc_callback: allocate callback management table(internal function)
1655 * @return allocated callback management table address
1657 /*--------------------------------------------------------------------------*/
1658 Ico_Uxf_Mng_Callback *
1659 ico_uxf_alloc_callback(void)
1661 Ico_Uxf_Mng_Callback *p;
1664 p = gIco_Uxf_Api_Mng.CallbackFree;
1666 p = (Ico_Uxf_Mng_Callback *)malloc(sizeof(Ico_Uxf_Mng_Callback) *
1667 ICO_UXF_MNG_BLOCK_ALLOCS);
1669 uifw_error("ico_uxf_alloc_callback: NO Memory (malloc Error)");
1672 gIco_Uxf_Api_Mng.CallbackFree = p;
1674 for (idx = 0; idx < ICO_UXF_MNG_BLOCK_ALLOCS; idx++, p++) {
1675 if (idx != (ICO_UXF_MNG_BLOCK_ALLOCS-1)) {
1679 p->next = (struct _Ico_Uxf_Mng_Callback *)0;
1682 p = gIco_Uxf_Api_Mng.CallbackFree;
1684 gIco_Uxf_Api_Mng.CallbackFree = p->next;
1688 /*--------------------------------------------------------------------------*/
1690 * @brief ico_uxf_free_callback: release callback management table(internal function)
1692 * @param[in] p callback management table address
1695 /*--------------------------------------------------------------------------*/
1697 ico_uxf_free_callback(Ico_Uxf_Mng_Callback *p)
1699 p->next = gIco_Uxf_Api_Mng.CallbackFree;
1700 gIco_Uxf_Api_Mng.CallbackFree = p;
1703 /*--------------------------------------------------------------------------*/
1705 * @brief ico_uxf_regist_callback: register a callback management table(internal function)
1707 * @param[in] p callback management table address
1710 /*--------------------------------------------------------------------------*/
1712 ico_uxf_regist_callback(Ico_Uxf_Mng_Callback *p)
1714 p->next = (struct _Ico_Uxf_Mng_Callback *)0;
1716 if (gIco_Uxf_Api_Mng.Callback) {
1717 gIco_Uxf_Api_Mng.CallbackLast->next = p;
1718 gIco_Uxf_Api_Mng.CallbackLast = p;
1721 gIco_Uxf_Api_Mng.Callback = p;
1722 gIco_Uxf_Api_Mng.CallbackLast = gIco_Uxf_Api_Mng.Callback;
1726 /*--------------------------------------------------------------------------*/
1728 * @brief ico_uxf_remove_callback: remove a callback management table(internal function)
1730 * @param[in] p callback management table address
1733 /*--------------------------------------------------------------------------*/
1735 ico_uxf_remove_callback(Ico_Uxf_Mng_Callback *p)
1737 Ico_Uxf_Mng_Callback *pp;
1738 Ico_Uxf_Mng_Callback *before;
1740 pp = gIco_Uxf_Api_Mng.Callback;
1741 before = (Ico_Uxf_Mng_Callback *)0;
1750 before->next = p->next;
1752 gIco_Uxf_Api_Mng.CallbackLast = before;
1756 gIco_Uxf_Api_Mng.Callback = p->next;
1761 /*--------------------------------------------------------------------------*/
1763 * @brief ico_uxf_alloc_eventque: allocate event queue block(internal function)
1766 * @return allocated event queue control block address
1768 /*--------------------------------------------------------------------------*/
1769 Ico_Uxf_Mng_EventQue
1770 *ico_uxf_alloc_eventque(void)
1772 Ico_Uxf_Mng_EventQue *p;
1775 p = gIco_Uxf_Api_Mng.EventQueFree;
1777 p = (Ico_Uxf_Mng_EventQue *)
1778 malloc(sizeof(Ico_Uxf_Mng_EventQue) * ICO_UXF_MNG_BLOCK_ALLOCS);
1780 uifw_error("ico_uxf_alloc_eventque: NO Memory (malloc Error)");
1783 gIco_Uxf_Api_Mng.EventQueFree = p;
1785 for (idx = 0; idx < ICO_UXF_MNG_BLOCK_ALLOCS; idx++, p++) {
1786 if (idx != (ICO_UXF_MNG_BLOCK_ALLOCS-1)) {
1790 p->next = (struct _Ico_Uxf_Mng_EventQue *)0;
1793 p = gIco_Uxf_Api_Mng.EventQueFree;
1795 gIco_Uxf_Api_Mng.EventQueFree = p->next;
1800 /*--------------------------------------------------------------------------*/
1802 * @brief ico_uxf_free_eventque: release event queue block(internal function)
1804 * @param[in] p event queue control block address
1807 /*--------------------------------------------------------------------------*/
1809 ico_uxf_free_eventque(Ico_Uxf_Mng_EventQue *p)
1811 p->next = gIco_Uxf_Api_Mng.EventQueFree;
1812 gIco_Uxf_Api_Mng.EventQueFree = p;
1815 /*--------------------------------------------------------------------------*/
1817 * @brief ico_uxf_regist_eventque: register a event queue(internal function)
1819 * @param[in] p event queue control block address
1822 /*--------------------------------------------------------------------------*/
1824 ico_uxf_regist_eventque(Ico_Uxf_Mng_EventQue *p)
1826 p->next = (struct _Ico_Uxf_Mng_EventQue *)0;
1828 if (gIco_Uxf_Api_Mng.EventQue) {
1829 gIco_Uxf_Api_Mng.EventQueLast->next = p;
1830 gIco_Uxf_Api_Mng.EventQueLast = p;
1833 gIco_Uxf_Api_Mng.EventQue = p;
1834 gIco_Uxf_Api_Mng.EventQueLast = gIco_Uxf_Api_Mng.EventQue;
1838 /*--------------------------------------------------------------------------*/
1840 * @brief ico_uxf_mng_display: get display management table(internal function)
1842 * @param[in] display display Id
1843 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1844 * @return display management table address
1845 * @retval !=NULL display management table address
1846 * @retval ==NULL display dose not exist(parameter 'create' only 0)
1848 /*--------------------------------------------------------------------------*/
1849 Ico_Uxf_Mng_Display *
1850 ico_uxf_mng_display(const int display, const int create)
1852 Ico_Uxf_Mng_Display *p;
1853 Ico_Uxf_Mng_Display *plast;
1855 p = gIco_Uxf_Api_Mng.Mng_Display;
1856 plast = (Ico_Uxf_Mng_Display *)0;
1858 if (p->attr.display == display) break;
1863 if ((! p) && (create != 0)) {
1865 p = (Ico_Uxf_Mng_Display *) malloc(sizeof(Ico_Uxf_Mng_Display));
1867 uifw_error("ico_uxf_mng_display: NO Memory (malloc Error)");
1870 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Display));
1871 p->attr.display = display;
1876 gIco_Uxf_Api_Mng.Mng_Display = p;
1882 /*--------------------------------------------------------------------------*/
1884 * @brief ico_uxf_mng_layer: get layer management table(internal function)
1886 * @param[in] display display Id
1887 * @param[in] layer layer Id
1888 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1889 * @return layer management table address
1890 * @retval !=NULL layer management table address
1891 * @retval ==NULL layer dose not exist(parameter 'create' only 0)
1893 /*--------------------------------------------------------------------------*/
1895 ico_uxf_mng_layer(const int display, const int layer, const int create)
1897 Ico_Uxf_Mng_Layer *p;
1898 Ico_Uxf_Mng_Layer *plast;
1900 p = gIco_Uxf_Api_Mng.Mng_Layer;
1901 plast = (Ico_Uxf_Mng_Layer *)0;
1903 if ((p->attr.display == display) &&
1904 (p->attr.layer == layer)) break;
1909 if ((! p) && (create != 0)) {
1911 p = (Ico_Uxf_Mng_Layer *) malloc(sizeof(Ico_Uxf_Mng_Layer));
1913 uifw_error("ico_uxf_mng_layer: NO Memory (malloc Error)");
1916 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Layer));
1917 p->attr.layer = layer;
1922 gIco_Uxf_Api_Mng.Mng_Layer = p;
1928 /*--------------------------------------------------------------------------*/
1930 * @brief ico_uxf_mng_window: get window management table(internal function)
1932 * @param[in] window window Id(same as ico_window_mgr surface Id)
1933 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1934 * @return window management table address
1935 * @retval !=NULL window management table address
1936 * @retval ==NULL window dose not exist(parameter 'create' only 0)
1938 /*--------------------------------------------------------------------------*/
1939 Ico_Uxf_Mng_Window *
1940 ico_uxf_mng_window(const int window, const int create)
1942 Ico_Uxf_Mng_Window *p;
1943 Ico_Uxf_Mng_Window *plast = (Ico_Uxf_Mng_Window *)0;
1946 hash = ICO_UXF_MISC_HASHBYID(window);
1947 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
1949 if (p->attr.window == window) break;
1954 if ((! p) && (create != 0)) {
1956 p = (Ico_Uxf_Mng_Window *) malloc(sizeof(Ico_Uxf_Mng_Window));
1958 uifw_error("ico_uxf_mng_window: NO Memory (malloc Error)");
1961 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Window));
1962 p->attr.window = window;
1964 plast->nextidhash = p;
1967 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
1969 uifw_trace("ico_uxf_mng_window: Create New Table=%08x", (int)p);
1974 /*--------------------------------------------------------------------------*/
1976 * @brief ico_uxf_mng_process: get process management table(internal function)
1978 * @param[in] process application Id
1979 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1980 * @return process management table address
1981 * @retval !=NULL process management table address
1982 * @retval ==NULL process dose not exist(parameter 'create' only 0)
1984 /*--------------------------------------------------------------------------*/
1985 Ico_Uxf_Mng_Process *
1986 ico_uxf_mng_process(const char *process, const int create)
1988 Ico_Uxf_Mng_Process *p;
1989 Ico_Uxf_Mng_Process *plast = (Ico_Uxf_Mng_Process *)0;
1992 hash = ICO_UXF_MISC_HASHBYNAME(process);
1993 p = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1995 if(strncmp(p->attr.process, process, ICO_UXF_MAX_PROCESS_NAME) == 0) break;
2000 if ((! p) && (create != 0)) {
2002 p = (Ico_Uxf_Mng_Process *) malloc(sizeof(Ico_Uxf_Mng_Process));
2004 uifw_error("ico_uxf_mng_process: NO Memory (malloc Error)");
2007 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Process));
2008 strncpy(p->attr.process, process, ICO_UXF_MAX_PROCESS_NAME);
2010 plast->nextidhash = p;
2013 gIco_Uxf_Api_Mng.Hash_ProcessId[hash] = p;
2019 /*--------------------------------------------------------------------------*/
2021 * @brief ico_uxf_update_procwin: update a process management table
2023 * @param[in] appid application id
2024 * @param[in] type type(install/uninstall)
2025 * @param[in] func window create/destroy hook function
2028 /*--------------------------------------------------------------------------*/
2030 ico_uxf_update_procwin(const char *appid, int type)
2032 Ico_Uxf_Mng_Process *prc = NULL;
2033 Ico_Uxf_Sys_Config *sysconf;
2034 Ico_Uxf_App_Config *appconf;
2035 Ico_Uxf_conf_appdisplay *appdsp;
2037 Ico_Uxf_conf_application *app = NULL;
2039 uifw_trace("ico_uxf_update_procwin: Enter(appid=%s, type=%d)", appid, type);
2041 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
2042 uifw_trace("ico_uxf_callback_remove: Leave(not initialized)");
2045 prc = ico_uxf_mng_process(appid, 0);
2047 if (type == ICO_UXF_CONF_EVENT_INSTALL) {
2049 sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
2050 appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
2051 if ((sysconf == NULL) || (appconf == NULL)) {
2052 uifw_trace("ico_uxf_update_procwin: Leave(cannot find tables)");
2055 for (dn = 0; dn < appconf->applicationNum; dn++) {
2056 app = &appconf->application[dn];
2057 if (strncmp(app->appid, appid, ICO_UXF_MAX_PROCESS_NAME) == 0) {
2058 uifw_trace("ico_uxf_update_procwin: Install(%s)", appid);
2059 /* add process management table */
2060 prc = ico_uxf_mng_process(appid, 1);
2061 prc->attr.internalid = 0;
2062 prc->attr.status = ICO_UXF_PROCSTATUS_STOP;
2063 prc->attr.type = app->categoryId;
2064 prc->attr.hostId = app->hostId;
2065 prc->attr.myHost = (prc->attr.hostId == sysconf->misc.myhostId) ? 1 : 0;
2067 appdsp = &app->display[0];
2068 prc->attr.mainwin.window = 0;
2069 prc->attr.mainwin.windowtype = app->categoryId;
2070 prc->attr.mainwin.display = appdsp->displayId;
2071 prc->attr.mainwin.layer = appdsp->layerId;
2072 prc->attr.mainwin.x =
2073 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
2074 prc->attr.mainwin.y =
2075 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
2076 prc->attr.mainwin.w =
2077 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
2078 prc->attr.mainwin.h =
2079 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
2080 prc->attr.mainwin.name[ICO_UXF_MAX_WIN_NAME] = 0;
2081 prc->attr.numwindows = app->displayzoneNum;
2082 /* get sub windows */
2083 if (prc->attr.numwindows > 1) {
2084 prc->attr.subwin = malloc(sizeof(Ico_Uxf_ProcessWin) *
2085 (prc->attr.numwindows - 1));
2086 if (! prc->attr.subwin) {
2087 uifw_trace("ico_uxf_update_procwin: Install(No memory)");
2088 app->displayzoneNum = 1;
2089 prc->attr.numwindows = 1;
2092 memset(prc->attr.subwin, 0, (prc->attr.numwindows - 1));
2093 for (tn = 0; tn < (prc->attr.numwindows - 1); tn++) {
2095 prc->attr.subwin[tn].windowtype = prc->attr.mainwin.windowtype;
2096 prc->attr.subwin[tn].display = appdsp->displayId;
2097 prc->attr.subwin[tn].layer = appdsp->layerId;
2098 prc->attr.subwin[tn].x =
2099 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
2100 prc->attr.subwin[tn].y =
2101 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
2102 prc->attr.subwin[tn].w =
2103 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
2104 prc->attr.subwin[tn].h =
2105 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
2113 else if (type == ICO_UXF_CONF_EVENT_UNINSTALL) {
2115 /* not delete process management table */
2119 uifw_trace("ico_uxf_update_procwin: Leave");
2124 /*--------------------------------------------------------------------------*/
2126 * @brief ico_uxf_window_screen_size_get: get display physical size
2128 * @param[out] width variable to receive the width of the display
2129 * @param[out] height variable to receive the height of the display
2132 /*--------------------------------------------------------------------------*/
2134 ico_uxf_window_screen_size_get(int *width, int *height)
2136 Ico_Uxf_Mng_Display *dsp;
2137 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
2139 uifw_trace("ico_uxf_window_screen_size_get: Enter(dsp=%d(%d))",
2140 dsp, gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display);
2142 if ((dsp != NULL) && (width != NULL) && (height != NULL)) {
2143 uifw_trace("ico_uxf_window_screen_size_get: %dx%d",
2144 dsp->attr.pWidth, dsp->attr.pHeight);
2145 *width = dsp->attr.pWidth;
2146 *height = dsp->attr.pHeight;
2150 /*--------------------------------------------------------------------------*/
2152 * @brief ico_uxf_window_hook: set window create/destroy hook function
2154 * @param[in] func window create/destroy hook function
2157 /*--------------------------------------------------------------------------*/
2159 ico_uxf_window_hook(Ico_Uxf_Hook func)
2161 uifw_trace("ico_uxf_window_hook: Window Control Hook=%08x", (int)func);
2163 gIco_Uxf_Api_Mng.Hook_Window = func;