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;
160 /* read configurations */
161 sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
162 appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
163 if ((sysconf == NULL) || (appconf == NULL)) {
164 uifw_error("ico_uxf_init: Leave(ESRCH), Configuration Read Error");
165 return ICO_UXF_ESRCH;
168 uifw_trace("ico_uxf_init: set display configurations");
169 /* set display configurations */
170 for (dn = 0; dn < sysconf->displayNum; dn++) {
171 dsp = ico_uxf_mng_display(sysconf->display[dn].id, 1);
172 dsp->attr.type = sysconf->display[dn].type;
173 dsp->attr.num_layers = sysconf->display[dn].layerNum;
174 dsp->attr.hostId = sysconf->display[dn].hostId;
175 dsp->attr.displayNo = sysconf->display[dn].displayno;
176 dsp->attr.w = sysconf->display[dn].width;
177 dsp->attr.h = sysconf->display[dn].height;
178 dsp->attr.pWidth = -1;
179 dsp->attr.pHeight = -1;
180 dsp->attr.orientation = ICO_UXF_ORIENTATION_HORIZONTAL;
181 dsp->attr.inch = sysconf->display[dn].inch;
182 strncpy(dsp->attr.name, sysconf->display[dn].name, ICO_UXF_MAX_WIN_NAME);
183 dsp->attr.name[ICO_UXF_MAX_WIN_NAME] = 0;
185 for (tn = 0; tn < sysconf->display[dn].layerNum; tn++) {
186 lay = ico_uxf_mng_layer(sysconf->display[dn].id,
187 sysconf->display[dn].layer[tn].id, 1);
188 lay->attr.display = sysconf->display[dn].id;
189 lay->attr.w = sysconf->display[dn].width;
190 lay->attr.h = sysconf->display[dn].height;
191 lay->mng_display = dsp;
195 uifw_trace("ico_uxf_init: set application configurations(num=%d)",
196 appconf->applicationNum);
197 /* set application configurations */
198 for(dn = 0; dn < appconf->applicationNum; dn++) {
199 prc = ico_uxf_mng_process(appconf->application[dn].appid, 1);
200 prc->attr.internalid = 0;
201 prc->appconf = (void *)&appconf->application[dn];
202 prc->attr.status = ICO_UXF_PROCSTATUS_STOP;
203 prc->attr.type = appconf->application[dn].categoryId;
204 prc->attr.hostId = appconf->application[dn].hostId;
205 prc->attr.myHost = (prc->attr.hostId == sysconf->misc.myhostId) ? 1 : 0;
206 prc->attr.noicon = appconf->application[dn].noicon;
207 prc->attr.autostart = appconf->application[dn].autostart;
208 prc->attr.invisiblecpu = appconf->application[dn].invisiblecpu;
210 appdsp = &appconf->application[dn].display[0];
211 prc->attr.mainwin.window = 0;
212 prc->attr.mainwin.windowtype = appconf->application[dn].categoryId;
213 prc->attr.mainwin.display = appdsp->displayId;
214 prc->attr.mainwin.layer = appdsp->layerId;
215 prc->attr.mainwin.x =
216 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
217 prc->attr.mainwin.y =
218 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
219 prc->attr.mainwin.w =
220 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
221 prc->attr.mainwin.h =
222 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
223 prc->attr.mainwin.name[ICO_UXF_MAX_WIN_NAME] = 0;
224 prc->attr.numwindows = appconf->application[dn].displayzoneNum;
225 /* get sub windows */
226 if (prc->attr.numwindows > 1) {
227 prc->attr.subwin = malloc(sizeof(Ico_Uxf_ProcessWin) *
228 (prc->attr.numwindows - 1));
229 if (! prc->attr.subwin) {
230 uifw_error("ico_uxf_init: No Memory");
231 appconf->application[dn].displayzoneNum = 1;
232 prc->attr.numwindows = 1;
235 memset(prc->attr.subwin, 0, (prc->attr.numwindows - 1));
236 for (tn = 0; tn < (prc->attr.numwindows - 1); tn++) {
238 prc->attr.subwin[tn].windowtype = prc->attr.mainwin.windowtype;
239 prc->attr.subwin[tn].display = appdsp->displayId;
240 prc->attr.subwin[tn].layer = appdsp->layerId;
241 prc->attr.subwin[tn].x =
242 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
243 prc->attr.subwin[tn].y =
244 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
245 prc->attr.subwin[tn].w =
246 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
247 prc->attr.subwin[tn].h =
248 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
254 gIco_Uxf_Api_Mng.Mng_MyProcess
255 = ico_uxf_mng_process(gIco_Uxf_Api_Mng.MyProcess, 0);
256 if (!gIco_Uxf_Api_Mng.Mng_MyProcess) {
257 uifw_error("ico_uxf_init: Leave(ESRCH), Unknown Apprication(%s)",
258 gIco_Uxf_Api_Mng.MyProcess);
259 return ICO_UXF_ESRCH;
261 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.internalid = getpid();
262 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.status = ICO_UXF_PROCSTATUS_RUN;
264 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
266 uifw_trace("ico_uxf_init: App.%d MainDisplay.%d %08x",
267 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.process,
268 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, dsp);
270 for (ret = 0; ret < (5000/50); ret++) {
271 gIco_Uxf_Api_Mng.Wayland_Display = wl_display_connect(NULL);
272 if (gIco_Uxf_Api_Mng.Wayland_Display) break;
276 gIco_Uxf_Api_Mng.Wayland_Registry
277 = wl_display_get_registry(gIco_Uxf_Api_Mng.Wayland_Display);
278 wl_registry_add_listener(gIco_Uxf_Api_Mng.Wayland_Registry,
279 &ico_uxf_registry_listener, (void *)0);
281 for (ret = 0; ret < (500/20); ret++) {
282 if ((gIco_Uxf_Api_Mng.Wayland_WindowMgr != NULL) &&
283 (gIco_Uxf_Api_Mng.Wayland_exInput != NULL) &&
284 (gIco_Uxf_Api_Mng.Wayland_InputMgr != NULL)) break;
285 uifw_trace("ico_uxf_init: call wl_display_dispatch(%08x)",
286 (int)gIco_Uxf_Api_Mng.Wayland_Display);
287 wl_display_dispatch(gIco_Uxf_Api_Mng.Wayland_Display);
290 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
291 uifw_trace("ico_uxf_init: Wayland/Weston connect OK");
293 /* set client attribute if need */
294 if (gIco_Uxf_Api_Mng.Wayland_WindowMgr) {
295 for(dn = 0; dn < appconf->applicationNum; dn++) {
296 if (appconf->application[dn].noconfigure) {
297 uifw_trace("ico_uxf_init: %s no need configure event",
298 appconf->application[dn].appid);
299 ico_window_mgr_set_client_attr(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
300 appconf->application[dn].appid,
301 ICO_WINDOW_MGR_CLIENT_ATTR_NOCONFIGURE, 1);
302 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
307 gIco_Uxf_Api_Mng.WaylandFd
308 = wl_display_get_fd(gIco_Uxf_Api_Mng.Wayland_Display);
310 /* initialize mutex */
311 (void) pthread_mutexattr_init(&sMutexAttr);
312 if (pthread_mutex_init(&sMutex, &sMutexAttr) != 0) {
313 uifw_error("ico_uxf_init: Leave(ENOSYS), Mutex Create Error %d", errno);
314 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
315 gIco_Uxf_Api_Mng.Wayland_Display = NULL;
316 gIco_Uxf_Api_Mng.Initialized = 0;
317 return ICO_UXF_ENOSYS;
320 /* allocate free control blocks */
321 freecb = ico_uxf_alloc_callback();
322 ico_uxf_free_callback(freecb);
323 freeeq = ico_uxf_alloc_eventque();
324 ico_uxf_free_eventque(freeeq);
326 /* flush wayland connection */
327 ico_window_mgr_set_eventcb(gIco_Uxf_Api_Mng.Wayland_WindowMgr, 1);
328 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
330 /* application launch/dead callback from AppCore(aul) */
331 aul_listen_app_launch_signal(ico_uxf_aul_aulcb, (void *)0);
332 aul_listen_app_dead_signal(ico_uxf_aul_aulcb, (void *)1);
334 gIco_Uxf_Api_Mng.Initialized = 1;
336 uifw_trace("ico_uxf_init: Leave(EOK)");
342 /*--------------------------------------------------------------------------*/
344 * @brief ico_uxf_wl_display_fd: get wayland file discriptor
347 * @return wayland connect socket file descriptor
348 * @retval >=0 success(file descriptor)
349 * @retval < 0 error(wayland not connect)
351 /*--------------------------------------------------------------------------*/
353 ico_uxf_wl_display_fd(void)
355 uifw_trace("ico_uxf_wl_display_fd: fd=%d", gIco_Uxf_Api_Mng.WaylandFd);
357 return gIco_Uxf_Api_Mng.WaylandFd;
360 /*--------------------------------------------------------------------------*/
362 * @brief ico_uxf_shutdown: terminate user interface library hor HomeScreen
366 * @retval ICO_UXF_EOK success
367 * @retval ICO_UXF_EBUSY error(cullentry terminating)
369 /*--------------------------------------------------------------------------*/
371 ico_uxf_shutdown(void)
373 uifw_trace("ico_uxf_shutdown: Enter");
375 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
376 if (gIco_Uxf_Api_Mng.Initialized < 0) {
377 uifw_warn("ico_uxf_shutdown: Leave(EBUSY)");
378 return ICO_UXF_EBUSY;
380 uifw_trace("ico_uxf_shutdown: Leave(EOK)");
383 gIco_Uxf_Api_Mng.Initialized = -1;
384 gIco_Uxf_Api_Mng.LastEvent = 0;
386 (void) pthread_mutex_destroy(&sMutex);
388 if (gIco_Uxf_Api_Mng.Wayland_Seat) {
389 wl_seat_destroy(gIco_Uxf_Api_Mng.Wayland_Seat);
390 gIco_Uxf_Api_Mng.Wayland_Seat = NULL;
392 if (gIco_Uxf_Api_Mng.Wayland_exInput) {
393 ico_exinput_destroy(gIco_Uxf_Api_Mng.Wayland_exInput);
394 gIco_Uxf_Api_Mng.Wayland_exInput = NULL;
396 if (gIco_Uxf_Api_Mng.Wayland_InputMgr) {
397 ico_input_mgr_control_destroy(gIco_Uxf_Api_Mng.Wayland_InputMgr);
398 gIco_Uxf_Api_Mng.Wayland_InputMgr = NULL;
400 if (gIco_Uxf_Api_Mng.Wayland_Compositor) {
401 wl_compositor_destroy(gIco_Uxf_Api_Mng.Wayland_Compositor);
402 gIco_Uxf_Api_Mng.Wayland_Compositor = NULL;
404 if (gIco_Uxf_Api_Mng.Wayland_Display) {
405 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
406 wl_display_disconnect(gIco_Uxf_Api_Mng.Wayland_Display);
407 gIco_Uxf_Api_Mng.Wayland_Display = NULL;
410 gIco_Uxf_Api_Mng.Initialized = 0;
412 uifw_trace("ico_uxf_shutdown: Leave(EOK)");
416 /*--------------------------------------------------------------------------*/
418 * @brief ico_uxf_main_loop_iterate: process user interface library events
423 /*--------------------------------------------------------------------------*/
425 ico_uxf_main_loop_iterate(void)
428 Ico_Uxf_Mng_EventQue *wkque;
429 Ico_Uxf_Mng_Callback *callback;
430 Ico_Uxf_Event_Cb func;
432 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
435 if (ioctl(gIco_Uxf_Api_Mng.WaylandFd, FIONREAD, &arg) < 0) {
436 uifw_warn("ico_uxf_main_loop_iterate: ioclt(FIONREAD,) Error %d", errno);
441 wl_display_dispatch(gIco_Uxf_Api_Mng.Wayland_Display);
444 ico_uxf_enter_critical();
447 while (gIco_Uxf_Api_Mng.EventQue) {
449 wkque = gIco_Uxf_Api_Mng.EventQue;
450 gIco_Uxf_Api_Mng.EventQue = gIco_Uxf_Api_Mng.EventQue->next;
452 gIco_Uxf_Api_Mng.LastEvent = wkque->detail.event;
453 callback = gIco_Uxf_Api_Mng.Callback;
455 if (callback->eventmask & gIco_Uxf_Api_Mng.LastEvent) {
456 func = callback->func;
458 ico_uxf_leave_critical();
460 uifw_trace("ico_uxf_main_loop: Call Event Callback(%08x,,%08x)",
461 gIco_Uxf_Api_Mng.LastEvent, arg);
462 (*func)(gIco_Uxf_Api_Mng.LastEvent, wkque->detail, arg);
464 ico_uxf_enter_critical();
466 callback = callback->next;
468 ico_uxf_free_eventque(wkque);
471 ico_uxf_leave_critical();
473 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
476 /*--------------------------------------------------------------------------*/
478 * @brief ico_uxf_callback_set: set event calback function
480 * @param[in] mask event mask
481 * @param[in] func callback function
482 * @param[in] arg user argument
484 * @retval ICO_UXF_EOK success
485 * @retval ICO_UXF_ESRCH error(user interface library not initialized)
486 * @retval ICO_UXF_EINVAL error(illegal event mask)
487 * @retval ICO_UXF_EBUSY error(already set same event)
489 /*--------------------------------------------------------------------------*/
491 ico_uxf_callback_set(const unsigned int mask, Ico_Uxf_Event_Cb func, const int arg)
493 Ico_Uxf_Mng_Callback *callback;
496 uifw_trace("ico_uxf_callback_set: Enter(%08x,%08x,%08x)", mask, (int)func, arg);
498 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
499 uifw_warn("ico_uxf_callback_set: Leave(ESRCH)");
500 return ICO_UXF_ESRCH;
507 wkmask = ICO_UXF_EVENT_ALL;
509 if ((wkmask & ICO_UXF_EVENT_VALIDALL) == 0) {
510 uifw_warn("ico_uxf_callback_set: Leave(EINVAL)");
511 return ICO_UXF_EINVAL;
514 ico_uxf_enter_critical();
516 callback = gIco_Uxf_Api_Mng.Callback;
518 if ((callback->eventmask == wkmask) && (callback->func == func) &&
519 (callback->arg == arg)) {
521 ico_uxf_leave_critical();
522 uifw_warn("ico_uxf_callback_set: Leave(EBUSY)");
523 return ICO_UXF_EBUSY;
527 callback = ico_uxf_alloc_callback();
529 callback->eventmask = wkmask;
530 callback->func = func;
533 ico_uxf_regist_callback(callback);
535 gIco_Uxf_Api_Mng.EventMask |= wkmask;
537 ico_uxf_leave_critical();
539 uifw_trace("ico_uxf_callback_set: Leave(EOK)");
543 /*--------------------------------------------------------------------------*/
545 * @brief ico_uxf_callback_remove: remove event calback function
547 * @param[in] mask event mask
548 * @param[in] func callback function
549 * @param[in] arg user argument
551 * @retval ICO_UXF_EOK success
552 * @retval ICO_UXF_ESRCH error(user interface library not initialized)
554 /*--------------------------------------------------------------------------*/
556 ico_uxf_callback_remove(const unsigned int mask, Ico_Uxf_Event_Cb func, const int arg)
558 Ico_Uxf_Mng_Callback *callback;
561 uifw_trace("ico_uxf_callback_remove: Enter(%08x,%08x,%08x)", mask, (int)func, arg);
563 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
564 uifw_warn("ico_uxf_callback_remove: Leave(ESRCH)");
565 return ICO_UXF_ESRCH;
572 wkmask = ICO_UXF_EVENT_ALL;
575 ico_uxf_enter_critical();
577 gIco_Uxf_Api_Mng.EventMask = 0;
579 callback = gIco_Uxf_Api_Mng.Callback;
582 if ((callback->eventmask == wkmask) && (callback->func == func) &&
583 (callback->arg == arg)) {
584 ico_uxf_remove_callback(callback);
587 gIco_Uxf_Api_Mng.EventMask |= callback->eventmask;
589 callback = callback->next;
592 ico_uxf_leave_critical();
594 uifw_trace("ico_uxf_callback_remove: Leave(EOK)");
598 /*--------------------------------------------------------------------------*/
600 * @brief ico_uxf_free_procwin: free active window management table(internal function)
602 * @param[in] prc application management table address
605 /*--------------------------------------------------------------------------*/
607 ico_uxf_free_procwin(Ico_Uxf_Mng_Process *prc)
609 Ico_Uxf_Mng_Window *p;
610 Ico_Uxf_Mng_Window *pp;
611 Ico_Uxf_Mng_Window *freep;
614 uifw_trace("ico_uxf_free_procwin: Enter(%d)", prc->attr.process);
616 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
617 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
618 pp = (Ico_Uxf_Mng_Window *)0;
620 if (p->attr.process == prc->attr.process) {
624 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
629 uifw_trace("ico_uxf_free_procwin: Free Window(%08x)", freep->attr.window);
638 uifw_trace("ico_uxf_free_procwin: Leave");
641 /*--------------------------------------------------------------------------*/
643 * @brief ico_uxf_wayland_globalcb: wayland global callback(static function)
645 * @param[in] data user data(unused)
646 * @param[in] registry wayland registry
647 * @param[in] name wayland display Id(unused)
648 * @param[in] interface wayland interface name
649 * @param[in] version wayland interface version number(unused)
652 /*--------------------------------------------------------------------------*/
654 ico_uxf_wayland_globalcb(void *data, struct wl_registry *registry,
655 uint32_t name, const char *interface, uint32_t version)
657 uifw_trace("ico_uxf_wayland_globalcb: Enter(Event=%s DispId=%08x)", interface, name);
659 if (strcmp(interface, "ico_window_mgr") == 0) {
660 gIco_Uxf_Api_Mng.Wayland_WindowMgr = (struct ico_window_mgr *)
661 wl_registry_bind(registry, name, &ico_window_mgr_interface, 1);
662 ico_window_mgr_add_listener(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
663 &windowlistener, NULL);
664 ico_window_mgr_set_user(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
665 getpid(), gIco_Uxf_Api_Mng.MyProcess);
667 else if (strcmp(interface, "ico_exinput") == 0) {
669 gIco_Uxf_Api_Mng.Wayland_exInput = (struct ico_exinput *)
670 wl_registry_bind(registry, name, &ico_exinput_interface, 1);
671 ico_exinput_add_listener(gIco_Uxf_Api_Mng.Wayland_exInput, &exinputlistener, NULL);
673 else if (strcmp(interface, "ico_input_mgr_control") == 0) {
674 /* regist Multi Input Manager interface */
675 gIco_Uxf_Api_Mng.Wayland_InputMgr = (struct ico_input_mgr_control *)
676 wl_registry_bind(registry, name, &ico_input_mgr_control_interface, 1);
678 else if (strcmp(interface, "wl_output") == 0) {
679 /* regist wl_output listener to get display info */
680 gIco_Uxf_Api_Mng.Wayland_Output = (struct wl_output *)
681 wl_registry_bind(registry, name, &wl_output_interface, 1);
682 wl_output_add_listener(gIco_Uxf_Api_Mng.Wayland_Output, &outputlistener, NULL);
684 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
685 uifw_trace("ico_uxf_wayland_globalcb: Leave");
688 /*--------------------------------------------------------------------------*/
690 * @brief ico_uxf_output_geometrycb: wayland display attribute callback(static function)
692 * @param[in] data user data(unused)
693 * @param[in] wl_output wayland wl_output interface
694 * @param[in] x display upper-left X coodinate
695 * @param[in] y display upper-left Y coodinate
696 * @param[in] physical_width display physical width
697 * @param[in] physical_height display physical height
698 * @param[in] subpixel display sub pixcel
699 * @param[in] make display maker
700 * @param[in] model diaplay model
701 * @param[in] transform transform
704 /*--------------------------------------------------------------------------*/
706 ico_uxf_output_geometrycb(void *data, struct wl_output *wl_output, int32_t x, int32_t y,
707 int32_t physical_width, int32_t physical_height, int32_t subpixel,
708 const char *make, const char *model, int32_t transform)
710 Ico_Uxf_Mng_Display *dsp;
712 uifw_trace("ico_uxf_output_geometrycb: Enter(x/y=%d/%d, pwidth/height=%d/%d, trans=%d)",
713 x, y, physical_width, physical_height, transform);
715 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
718 if ((transform == WL_OUTPUT_TRANSFORM_90)
719 || (transform == WL_OUTPUT_TRANSFORM_270)
720 || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_90)
721 || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_270)) {
722 dsp->attr.pWidth = physical_height;
723 dsp->attr.pHeight = physical_width;
724 dsp->attr.orientation = ICO_UXF_ORIENTATION_VERTICAL;
727 dsp->attr.pWidth = physical_width;
728 dsp->attr.pHeight = physical_height;
729 dsp->attr.orientation = ICO_UXF_ORIENTATION_HORIZONTAL;
732 uifw_trace("ico_uxf_output_geometrycb: Leave");
735 /*--------------------------------------------------------------------------*/
737 * @brief ico_uxf_output_modecb: wayland display mode callback(static function)
739 * @param[in] data user data(unused)
740 * @param[in] wl_output wayland wl_output interface
741 * @param[in] flags flags
742 * @param[in] width display width
743 * @param[in] height display height
744 * @param[in] refresh display refresh rate
747 /*--------------------------------------------------------------------------*/
749 ico_uxf_output_modecb(void *data, struct wl_output *wl_output, uint32_t flags,
750 int32_t width, int32_t height, int32_t refresh)
752 Ico_Uxf_Mng_Display *dsp;
754 uifw_trace("ico_uxf_output_modecb: Enter(flg=%d, width=%d, height=%d, ref=%d)",
755 flags, width, height, refresh);
757 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
759 if (dsp && (flags & WL_OUTPUT_MODE_CURRENT)) {
760 if (dsp->attr.orientation == ICO_UXF_ORIENTATION_VERTICAL) {
761 dsp->attr.pWidth = height;
762 dsp->attr.pHeight = width;
765 dsp->attr.pWidth = width;
766 dsp->attr.pHeight = height;
769 uifw_trace("ico_uxf_output_modecb: Leave");
772 /*--------------------------------------------------------------------------*/
774 * @brief ico_uxf_window_createdcb: wayland surface create callback(static function)
776 * @param[in] data user data(unused)
777 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
778 * @param[in] surfaceid ico_window_mgr surface Id
779 * @param[in] pid wayland client process Id
780 * @param[in] appid wayland client application Id
783 /*--------------------------------------------------------------------------*/
785 ico_uxf_window_createdcb(void *data, struct ico_window_mgr *ico_window_mgr,
786 uint32_t surfaceid, int32_t pid, const char *appid)
788 Ico_Uxf_Mng_Process *prc;
789 Ico_Uxf_Mng_ProcWin *ppwin;
790 Ico_Uxf_Mng_ProcWin *ppw;
792 uifw_trace("ico_uxf_window_createdcb: Enter(surf=%08x pid=%d appid=%s myapp=%s)",
793 (int)surfaceid, pid, appid, gIco_Uxf_Api_Mng.MyProcess);
795 prc = ico_uxf_mng_process(appid, 0);
798 /* set window animation */
799 if (prc->appconf != NULL) {
800 if (((Ico_Uxf_conf_application *)prc->appconf)->animation_visible) {
801 ico_window_mgr_set_animation(
802 gIco_Uxf_Api_Mng.Wayland_WindowMgr,
803 surfaceid, ICO_WINDOW_MGR_ANIMATION_CHANGE_VISIBLE,
804 ((Ico_Uxf_conf_application *)prc->appconf)->animation_visible);
806 if (((Ico_Uxf_conf_application *)prc->appconf)->animation_resize) {
807 ico_window_mgr_set_animation(
808 gIco_Uxf_Api_Mng.Wayland_WindowMgr,
809 surfaceid, ICO_WINDOW_MGR_ANIMATION_CHANGE_RESIZE,
810 ((Ico_Uxf_conf_application *)prc->appconf)->animation_resize);
812 if (((Ico_Uxf_conf_application *)prc->appconf)->animation_move) {
813 ico_window_mgr_set_animation(
814 gIco_Uxf_Api_Mng.Wayland_WindowMgr,
815 surfaceid, ICO_WINDOW_MGR_ANIMATION_CHANGE_MOVE,
816 ((Ico_Uxf_conf_application *)prc->appconf)->animation_move);
819 if (prc->attr.mainwin.window <= 0) {
820 uifw_trace("ico_uxf_window_createdcb: Set Main Window, Config Data");
821 prc->attr.mainwin.window = surfaceid;
822 ico_uxf_window_configurecb(data, ico_window_mgr, surfaceid, appid,
823 prc->attr.mainwin.layer, prc->attr.mainwin.x,
824 prc->attr.mainwin.y, prc->attr.mainwin.w,
825 prc->attr.mainwin.h, 0);
826 if (gIco_Uxf_Api_Mng.Hook_Window) {
827 (*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
828 ICO_UXF_HOOK_WINDOW_CREATE_MAIN);
832 uifw_trace("ico_uxf_window_createdcb: Sub Window, Dummy Data");
833 ico_uxf_window_configurecb(data, ico_window_mgr, surfaceid, appid,
834 prc->attr.mainwin.layer, 16384, 16384, 1, 1, 0);
835 ppwin = (Ico_Uxf_Mng_ProcWin *)malloc(sizeof(Ico_Uxf_Mng_ProcWin));
837 memset(ppwin, 0, sizeof(Ico_Uxf_Mng_ProcWin));
838 ppwin->attr.window = surfaceid;
839 ppwin->attr.display = prc->attr.mainwin.display;
841 prc->procwin = ppwin;
851 if (gIco_Uxf_Api_Mng.Hook_Window) {
852 (*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
853 ICO_UXF_HOOK_WINDOW_CREATE_SUB);
858 uifw_warn("ico_uxf_window_createdcb: Application.%s dose not exist", appid);
860 uifw_trace("ico_uxf_window_createdcb: Leave");
863 /*--------------------------------------------------------------------------*/
865 * @brief ico_uxf_window_destroyedcb: wayland surface destroy callback(static function)
867 * @param[in] data user data(unused)
868 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
869 * @param[in] surfaceid ico_window_mgr surface Id
872 /*--------------------------------------------------------------------------*/
874 ico_uxf_window_destroyedcb(void *data, struct ico_window_mgr *ico_window_mgr,
877 Ico_Uxf_Mng_Window *p;
878 Ico_Uxf_Mng_Window *pp;
879 Ico_Uxf_Mng_Window *freep;
880 Ico_Uxf_Mng_Process *prc;
881 Ico_Uxf_Mng_EventQue *que;
883 char wkappid[ICO_UXF_MAX_PROCESS_NAME+1];
886 uifw_trace("ico_uxf_window_destroyedcb: Enter(surf=%08x)", (int)surfaceid);
888 ico_uxf_enter_critical();
890 p = ico_uxf_mng_window(surfaceid, 0);
893 ico_uxf_leave_critical();
894 uifw_trace("ico_uxf_window_destroyedcb: Leave(Surface=%08x dose not exist)",
898 prc = p->mng_process;
899 if ((prc != NULL) && (prc->attr.mainwin.window == (int)surfaceid)) {
900 prc->attr.mainwin.window = 0;
903 strcpy(wkappid, p->attr.process);
904 wksubwindow = p->attr.subwindow;
906 if ((gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_DESTORYWINDOW) &&
907 (p->attr.eventmask & ICO_UXF_EVENT_DESTORYWINDOW)) {
909 que = ico_uxf_alloc_eventque();
910 que->detail.event = ICO_UXF_EVENT_DESTORYWINDOW;
911 que->detail.window.display = p->attr.display;
912 que->detail.window.window = surfaceid;
913 que->detail.window.layer = p->attr.layer;
914 que->detail.window.x = p->attr.x;
915 que->detail.window.y = p->attr.y;
916 que->detail.window.w = p->attr.w;
917 que->detail.window.h = p->attr.h;
918 que->detail.window.visible = p->attr.visible;
919 que->detail.window.raise = p->attr.raise;
920 que->detail.window.active = p->attr.active;
921 ico_uxf_regist_eventque(que);
924 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
925 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
926 pp = (Ico_Uxf_Mng_Window *)0;
928 if (p->attr.window == (int)surfaceid) {
932 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
937 uifw_trace("ico_uxf_window_destroyedcb: Free Window.%08x(%08x)",
938 (int)freep, freep->attr.window);
940 hash = ICO_UXF_MISC_HASHSIZE;
947 ico_uxf_leave_critical();
949 if (gIco_Uxf_Api_Mng.Hook_Window) {
950 (*gIco_Uxf_Api_Mng.Hook_Window)(wkappid, surfaceid,
951 wksubwindow ? ICO_UXF_HOOK_WINDOW_DESTORY_SUB :
952 ICO_UXF_HOOK_WINDOW_DESTORY_MAIN);
954 uifw_trace("ico_uxf_window_destroyedcb: Leave");
957 /*--------------------------------------------------------------------------*/
959 * @brief ico_uxf_window_visiblecb: wayland surface visible callback(static function)
961 * @param[in] data user data(unused)
962 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
963 * @param[in] surfaceid ico_window_mgr surface Id
964 * @param[in] visibility surface visible(1=visible/0=unvisible/9=nochange)
965 * @param[in] raise surface raise(1=raise/0=lower/9=nochange)
966 * @param[in] hint client request(1=client request(not changed)/0=changed)
969 /*--------------------------------------------------------------------------*/
971 ico_uxf_window_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
972 uint32_t surfaceid, int32_t visible, int32_t raise, int32_t hint)
974 Ico_Uxf_Mng_Window *win;
975 Ico_Uxf_Mng_EventQue *que;
979 ico_uxf_enter_critical();
981 win = ico_uxf_mng_window(surfaceid, 0);
984 ico_uxf_leave_critical();
985 uifw_trace("ico_uxf_window_visiblecb: Surface=%08x dose not exist",
993 ovisible = win->attr.visible;
996 oraise = win->attr.raise;
999 if ((win->attr.visible != ovisible) ||
1000 (win->attr.raise != oraise)) {
1002 if (((hint == 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_VISIBLE) &&
1003 (win->attr.eventmask & ICO_UXF_EVENT_VISIBLE)) ||
1004 ((hint != 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_VISIBLE_REQ) &&
1005 (win->attr.eventmask & ICO_UXF_EVENT_VISIBLE_REQ))) {
1007 que = ico_uxf_alloc_eventque();
1009 (hint == 0) ? ICO_UXF_EVENT_VISIBLE : ICO_UXF_EVENT_VISIBLE_REQ;
1010 que->detail.window.display = win->attr.display;
1011 que->detail.window.window = win->attr.window;
1012 que->detail.window.layer = win->attr.layer;
1013 que->detail.window.x = win->attr.x;
1014 que->detail.window.y = win->attr.y;
1015 que->detail.window.w = win->attr.w;
1016 que->detail.window.h = win->attr.h;
1017 que->detail.window.visible = ovisible;
1018 que->detail.window.raise = oraise;
1019 que->detail.window.active = win->attr.active;
1021 ico_uxf_regist_eventque(que);
1024 ico_uxf_leave_critical();
1027 /*--------------------------------------------------------------------------*/
1029 * @brief ico_uxf_window_configurecb: wayland surface configure callback(static function)
1031 * @param[in] data user data(unused)
1032 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
1033 * @param[in] surfaceid ico_window_mgr surface Id
1034 * @param[in] appid client application Id
1035 * @param[in] x surface upper-left X coodinate
1036 * @param[in] y surface upper-left Y coodinate
1037 * @param[in] width surface width
1038 * @param[in] height surface height
1039 * @param[in] hint client request(1=client request(not changed)/0=changed)
1042 /*--------------------------------------------------------------------------*/
1044 ico_uxf_window_configurecb(void *data, struct ico_window_mgr *ico_window_mgr,
1045 uint32_t surfaceid, const char *appid, int32_t layer,
1046 int32_t x, int32_t y, int32_t width, int32_t height,
1049 Ico_Uxf_Mng_Window *win;
1050 Ico_Uxf_Mng_EventQue *que;
1052 Ico_Uxf_Mng_Process *prc;
1054 uifw_trace("ico_uxf_window_configurecb: surf=%08x app=%s layer=%d "
1055 "x/y=%d/%d w/h=%d/%d hint=%d",
1056 (int)surfaceid, appid, layer, x, y, width, height, hint);
1058 ico_uxf_enter_critical();
1060 win = ico_uxf_mng_window(surfaceid, 0);
1063 win = ico_uxf_mng_window(surfaceid, 1);
1064 display = ICO_UXF_GETDISPLAYID(surfaceid);
1065 win->mng_display = ico_uxf_mng_display(display, 0);
1066 win->mng_layer = ico_uxf_mng_layer(display, layer, 0);
1067 win->attr.eventmask = ICO_UXF_EVENT_NEWWINDOW;
1068 win->attr.display = display;
1069 win->attr.layer = layer;
1070 memset(win->attr.process, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
1071 strncpy(win->attr.process, appid, ICO_UXF_MAX_PROCESS_NAME);
1074 win->attr.w = width;
1075 win->attr.h = height;
1078 prc = ico_uxf_mng_process(appid, 0);
1079 win->mng_process = prc;
1080 if ((prc != NULL) && (prc->attr.mainwin.window != (int)surfaceid)) {
1082 win->attr.subwindow = 1;
1085 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_NEWWINDOW) {
1087 que = ico_uxf_alloc_eventque();
1089 que->detail.event = ICO_UXF_EVENT_NEWWINDOW;
1090 que->detail.window.display = display;
1091 que->detail.window.window = surfaceid;
1092 que->detail.window.layer = layer;
1093 que->detail.window.x = win->attr.x;
1094 que->detail.window.y = win->attr.y;
1095 que->detail.window.w = win->attr.w;
1096 que->detail.window.h = win->attr.h;
1097 que->detail.window.visible = win->attr.visible;
1098 que->detail.window.raise = win->attr.raise;
1099 que->detail.window.active = win->attr.active;
1101 ico_uxf_regist_eventque(que);
1105 if ((win->attr.layer != layer) ||
1106 (win->attr.x != x) || (win->attr.y != y) ||
1107 (win->attr.w != width) || (win->attr.h != height)) {
1109 if (((hint == 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_RESIZE) &&
1110 (win->attr.eventmask & ICO_UXF_EVENT_RESIZE)) ||
1111 ((hint != 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_RESIZE_REQ) &&
1112 (win->attr.eventmask & ICO_UXF_EVENT_RESIZE_REQ))) {
1114 que = ico_uxf_alloc_eventque();
1117 (hint == 0) ? ICO_UXF_EVENT_RESIZE : ICO_UXF_EVENT_RESIZE_REQ;
1118 que->detail.window.display = win->mng_display->attr.display;
1119 que->detail.window.window = win->attr.window;
1120 que->detail.window.layer = layer;
1121 que->detail.window.x = x;
1122 que->detail.window.y = y;
1123 que->detail.window.w = width;
1124 que->detail.window.h = height;
1125 que->detail.window.visible = win->attr.visible;
1126 que->detail.window.raise = win->attr.raise;
1127 que->detail.window.active = win->attr.active;
1129 ico_uxf_regist_eventque(que);
1134 win->attr.w = width;
1135 win->attr.h = height;
1136 if (win->attr.layer != layer) {
1137 win->attr.layer = layer;
1138 win->mng_layer = ico_uxf_mng_layer(win->mng_display->attr.display,
1142 else if ((win->attr.w != width) || (win->attr.h != height)) {
1143 (void)ico_uxf_window_resize(win->attr.window, win->attr.w, win->attr.h);
1147 ico_uxf_leave_critical();
1150 /*--------------------------------------------------------------------------*/
1152 * @brief ico_uxf_window_activecb: wayland surface active callback(static function)
1154 * @param[in] data user data(unused)
1155 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
1156 * @param[in] surfaceid ico_window_mgr surface Id
1157 * @param[in] active surface active(1=active/0=not active)
1160 /*--------------------------------------------------------------------------*/
1162 ico_uxf_window_activecb(void *data, struct ico_window_mgr *ico_window_mgr,
1163 uint32_t surfaceid, uint32_t active)
1165 Ico_Uxf_Mng_Window *win;
1166 Ico_Uxf_Mng_EventQue *que;
1168 uifw_trace("ico_uxf_window_activecb: Enter(surf=%08x active=%d)", surfaceid, active);
1170 ico_uxf_enter_critical();
1172 win = ico_uxf_mng_window(surfaceid, 0);
1175 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_ACTIVEWINDOW) {
1177 que = ico_uxf_alloc_eventque();
1179 que->detail.event = ICO_UXF_EVENT_ACTIVEWINDOW;
1180 que->detail.window.display = ICO_UXF_GETDISPLAYID(surfaceid);
1181 que->detail.window.window = surfaceid;
1182 que->detail.window.active = active;
1183 win->attr.active = active;
1185 ico_uxf_regist_eventque(que);
1188 ico_uxf_leave_critical();
1189 uifw_trace("ico_uxf_window_activecb: Leave");
1192 /*--------------------------------------------------------------------------*/
1194 * @brief ico_uxf_input_capabilitiescb: wayland extended input
1195 * input capabilities callback(static function)
1197 * @param[in] data user data(unused)
1198 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1199 * @param[in] device input device name
1200 * @param[in] type input device type
1201 * @param[in] swname input switch name
1202 * @param[in] input input switch number
1203 * @param[in] codename input code name
1204 * @param[in] code input code value
1207 /*--------------------------------------------------------------------------*/
1209 ico_uxf_input_capabilitiescb(void *data, struct ico_exinput *ico_exinput,
1210 const char *device, int32_t type, const char *swname,
1211 int32_t input, const char *codename, int32_t code)
1214 Ico_Uxf_Sys_Config *sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
1215 Ico_Uxf_InputDev *inputdev;
1216 Ico_Uxf_InputDev *bpdev;
1217 Ico_Uxf_InputSw *inputsw;
1218 Ico_Uxf_InputSw *bpsw;
1220 uifw_trace("ico_uxf_input_capabilitiescb: "
1221 "Enter(device=%s type=%d sw=%s input=%d code=%s[%d])",
1222 device, type, swname, input, codename, code);
1224 if (! sysconf) return;
1226 /* search and create input device table */
1228 inputdev = gIco_Uxf_Api_Mng.InputDev;
1230 if (strcasecmp(inputdev->device, device) == 0) break;
1232 inputdev = inputdev->next;
1235 inputdev = malloc(sizeof(Ico_Uxf_InputDev));
1237 uifw_error("ico_uxf_input_capabilitiescb: Leave(No Memory)");
1240 memset(inputdev, 0, sizeof(Ico_Uxf_InputDev));
1243 bpdev->next = inputdev;
1246 gIco_Uxf_Api_Mng.InputDev = inputdev;
1249 strncpy(inputdev->device, device, sizeof(inputdev->device)-1);
1250 inputdev->type = type;
1253 inputsw = inputdev->inputSw;
1255 if (strcasecmp(inputsw->swname, swname) == 0) break;
1257 inputsw = inputsw->next;
1260 inputsw = malloc(sizeof(Ico_Uxf_InputSw));
1262 uifw_error("ico_uxf_input_capabilitiescb: Leave(No Memory)");
1266 bpsw->next = inputsw;
1269 inputdev->inputSw = inputsw;
1271 inputdev->numInputSw ++;
1273 memset(inputsw, 0, sizeof(Ico_Uxf_InputSw));
1274 strncpy(inputsw->swname, swname, sizeof(inputsw->swname)-1);
1275 inputsw->input = input;
1276 inputsw->numCode = 1;
1277 inputsw->inputCode[0].code = code;
1278 strncpy(inputsw->inputCode[0].codename, codename,
1279 sizeof(inputsw->inputCode[0].codename)-1);
1280 uifw_trace("ico_uxf_input_capabilitiescb: create new inputsw");
1282 /* send fixed application if fixed switch */
1283 for (i = 0; i < sysconf->inputdevNum; i++) {
1284 if (strcasecmp(sysconf->inputdev[i].name, inputdev->device) != 0) continue;
1286 for (j = 0; j < sysconf->inputdev[i].inputswNum; j++) {
1287 if (! sysconf->inputdev[i].inputsw[j].appid) continue;
1288 if (strcasecmp(sysconf->inputdev[i].inputsw[j].name,
1289 inputsw->swname) != 0) continue;
1291 uifw_trace("ico_uxf_input_capabilitiescb: input %s.%s = %s",
1292 inputdev->device, inputsw->swname,
1293 sysconf->inputdev[i].inputsw[j].appid);
1294 ico_input_mgr_control_add_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr,
1295 sysconf->inputdev[i].inputsw[j].appid,
1296 inputdev->device, inputsw->input, 1);
1301 uifw_trace("ico_uxf_input_capabilitiescb: Leave");
1304 /*--------------------------------------------------------------------------*/
1306 * @brief ico_uxf_input_codecb: wayland extended input
1307 * input code callback(static function)
1309 * @param[in] data user data(unused)
1310 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1311 * @param[in] device input device name
1312 * @param[in] input input switch number
1313 * @param[in] codename input code name
1314 * @param[in] code input code value
1317 /*--------------------------------------------------------------------------*/
1319 ico_uxf_input_codecb(void *data, struct ico_exinput *ico_exinput, const char *device,
1320 int32_t input, const char *codename, int32_t code)
1323 Ico_Uxf_InputDev *inputdev;
1324 Ico_Uxf_InputSw *inputsw;
1326 uifw_trace("ico_uxf_input_codecb: device=%s input=%d code=%s[%d]",
1327 device, input, codename, code);
1329 /* search input device table */
1330 inputdev = gIco_Uxf_Api_Mng.InputDev;
1332 if (strcasecmp(inputdev->device, device) == 0) break;
1333 inputdev = inputdev->next;
1336 uifw_error("ico_uxf_input_codecb: device.%s dose not exist", device);
1340 /* search input switch */
1341 inputsw = inputdev->inputSw;
1343 if (inputsw->input == input) break;
1344 inputsw = inputsw->next;
1347 uifw_error("ico_uxf_input_codecb: device.%s input=%d dose not exist",
1351 for (i = 0; i < inputsw->numCode; i++) {
1352 if (inputsw->inputCode[i].code == code) break;
1354 if (i >= inputsw->numCode) {
1356 uifw_error("ico_uxf_input_codecb: device.%s input=%d number of codes overflow",
1360 inputsw->numCode ++;
1361 i = inputsw->numCode - 1;
1363 memset(inputsw->inputCode[i].codename, 0, sizeof(inputsw->inputCode[i].codename));
1364 strncpy(inputsw->inputCode[i].codename, codename,
1365 sizeof(inputsw->inputCode[i].codename)-1);
1366 inputsw->inputCode[i].code = code;
1369 /*--------------------------------------------------------------------------*/
1371 * @brief ico_uxf_input_inputcb: wayland extended input
1372 * input switch callback(static function)
1374 * @param[in] data user data(unused)
1375 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1376 * @param[in] time input time(miri-sec)
1377 * @param[in] device input device name
1378 * @param[in] input input switch number
1379 * @param[in] code input code value
1380 * @param[in] state input state(1=switch On/0=switch Off)
1383 /*--------------------------------------------------------------------------*/
1385 ico_uxf_input_inputcb(void *data, struct ico_exinput *ico_exinput, uint32_t time,
1386 const char *device, int32_t input, int32_t code, int32_t state)
1388 Ico_Uxf_Mng_EventQue *que;
1389 uifw_trace("ico_uxf_input_inputcb: device=%s input=%d code=%d state=%d",
1390 device, input, code, state);
1392 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_EXINPUT) {
1394 ico_uxf_enter_critical();
1395 que = ico_uxf_alloc_eventque();
1397 strncpy(que->detail.exinput.device, device,
1398 sizeof(que->detail.exinput.device)-1);
1399 que->detail.exinput.input = input;
1400 que->detail.exinput.code = code;
1401 que->detail.exinput.state = state;
1403 ico_uxf_regist_eventque(que);
1404 ico_uxf_leave_critical();
1408 /*--------------------------------------------------------------------------*/
1410 * @brief ico_uxf_aul_aulcb: AppCore(AUL) application launch/dead callback(static function)
1412 * @param[in] pid target application process Id
1413 * @param[in] data user data(0=launch, 1=dead)
1414 * @return result(always 0, means success)
1416 /*--------------------------------------------------------------------------*/
1418 ico_uxf_aul_aulcb(int pid, void *data)
1420 Ico_Uxf_Mng_Process *proc;
1422 Ico_Uxf_Mng_EventQue *que;
1424 char appid[ICO_UXF_MAX_PROCESS_NAME+1];
1427 memset(appid, 0, sizeof(appid));
1429 (void) aul_app_get_appid_bypid(pid, appid, sizeof(appid));
1430 uifw_trace("ico_uxf_aul_aulcb: Enter(pid=%d, dead=No, appid=%s)", pid, appid);
1433 uifw_trace("ico_uxf_aul_aulcb: Enter(pid=%d, dead=Yes)", pid);
1435 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1436 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1438 if (proc->attr.internalid == pid) break;
1439 if (strcmp(proc->attr.process, appid) == 0) break;
1440 proc = proc->nextidhash;
1445 /* not handle process, */
1446 /* or the process is correctly terminated by ico_uxf_process_terminate */
1447 uifw_trace("ico_uxf_aul_aulcb: Leave(not find)");
1450 uifw_trace("ico_uxf_aul_aulcb: find(appid=%s)", proc->attr.process);
1452 ico_uxf_enter_critical();
1454 que = ico_uxf_alloc_eventque();
1455 strncpy(que->detail.process.process, proc->attr.process, ICO_UXF_MAX_PROCESS_NAME);
1457 que->detail.event = ICO_UXF_EVENT_TERMPROCESS;
1458 que->detail.process.status = ICO_UXF_PROCSTATUS_STOP;
1460 /* delete process info */
1461 proc->attr.status = ICO_UXF_PROCSTATUS_STOP;
1462 proc->attr.internalid = -1;
1463 proc->attr.mainwin.window = 0;
1464 ico_uxf_free_procwin(proc);
1467 que->detail.event = ICO_UXF_EVENT_EXECPROCESS;
1468 que->detail.process.status = ICO_UXF_PROCSTATUS_RUN;
1470 /* setup process info */
1471 if (proc->attr.status != ICO_UXF_PROCSTATUS_RUN) {
1472 proc->attr.internalid = pid;
1473 if (proc->attr.status != ICO_UXF_PROCSTATUS_INIT) {
1474 /* child process, search parent process */
1475 uifw_trace("ico_uxf_aul_aulcb: fork&exec %s", proc->attr.process);
1476 proc->attr.child = 1;
1477 /* save parent application if exist */
1478 if (gIco_Uxf_Api_Mng.Mng_LastProcess != proc) {
1479 proc->parent = gIco_Uxf_Api_Mng.Mng_LastProcess;
1482 uifw_trace("ico_uxf_aul_aulcb: same process %s real %s", proc->attr.process,
1483 proc->parent ? proc->parent->attr.process : "(None)");
1487 proc->attr.child = 0;
1489 proc->attr.status = ICO_UXF_PROCSTATUS_RUN;
1494 ico_uxf_regist_eventque(que);
1496 ico_uxf_leave_critical();
1498 uifw_trace("ico_uxf_aul_aulcb: Leave");
1502 /*--------------------------------------------------------------------------*/
1504 * @brief ico_uxf_set_lastapp: save last application
1506 * @param[in] appid applicationId (if NULL, no last application)
1509 /*--------------------------------------------------------------------------*/
1511 ico_uxf_set_lastapp(const char *appid)
1514 gIco_Uxf_Api_Mng.Mng_LastProcess = ico_uxf_mng_process(appid, 0);
1517 gIco_Uxf_Api_Mng.Mng_LastProcess = NULL;
1521 /*--------------------------------------------------------------------------*/
1523 * @brief ico_uxf_getchild_appid: get child applicationId
1525 * @param[in] appid parent applicationId
1526 * @return last child applicationId
1527 * @retval !=NULL success(applicationId)
1528 * @retval ==NULL no child application
1530 /*--------------------------------------------------------------------------*/
1532 ico_uxf_getchild_appid(const char *appid)
1534 Ico_Uxf_Mng_Process *pproc;
1535 Ico_Uxf_Mng_Process *proc;
1538 pproc = ico_uxf_mng_process(appid, 0);
1540 /* unknown parent application, no child */
1541 uifw_trace("ico_uxf_getchild_appid: Unknown parent(%s)", appid);
1546 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1547 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1549 if (proc->parent == pproc) {
1550 uifw_trace("ico_uxf_getchild_appid: child(%s) parent(%s)",
1551 proc->attr.process, appid);
1552 return proc->attr.process;
1554 proc = proc->nextidhash;
1557 uifw_trace("ico_uxf_getchild_appid: parent(%s) has no child", appid);
1561 /*--------------------------------------------------------------------------*/
1563 * @brief ico_uxf_set_lastapp: save last application
1565 * @param[in] appid applicationId (if NULL, no last application)
1568 /*--------------------------------------------------------------------------*/
1570 ico_uxf_timer_wake(const int msec)
1572 Ico_Uxf_Mng_Process *proc;
1575 if (gIco_Uxf_Api_Mng.InitTimer > 0) {
1576 gIco_Uxf_Api_Mng.InitTimer -= msec;
1577 if (gIco_Uxf_Api_Mng.InitTimer > 0) {
1580 gIco_Uxf_Api_Mng.InitTimer = 0;
1583 if (gIco_Uxf_Api_Mng.NeedTimer == 0) {
1586 gIco_Uxf_Api_Mng.NeedTimer = 0;
1587 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1588 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1590 if (proc->susptimer > 0) {
1591 if (msec >= proc->susptimer) {
1592 proc->susptimer = 0;
1593 if (proc->attr.suspend) {
1594 if (proc->susp == 0) {
1596 uifw_trace("ico_uxf_timer_wake: CPU suspend pid=%d",
1597 proc->attr.internalid);
1598 kill(proc->attr.internalid, SIGSTOP);
1601 else if (proc->susp == 0) {
1602 uifw_trace("ico_uxf_timer_wake: CPU resume pid=%d(show=%d)",
1603 proc->attr.internalid, proc->showmode);
1604 ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
1605 proc->attr.mainwin.window,
1607 ICO_WINDOW_MGR_VISIBLE_SHOW_WO_ANIMATION ?
1608 ICO_WINDOW_MGR_VISIBLE_SHOW_WO_ANIMATION :
1609 ICO_WINDOW_MGR_VISIBLE_SHOW,
1610 ICO_WINDOW_MGR_RAISE_NOCHANGE);
1611 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
1615 proc->susptimer -= msec;
1616 gIco_Uxf_Api_Mng.NeedTimer ++;
1619 proc = proc->nextidhash;
1624 /*--------------------------------------------------------------------------*/
1626 * @brief ico_uxf_enter_critical: enter critical section(internal function)
1631 /*--------------------------------------------------------------------------*/
1633 ico_uxf_enter_critical(void)
1635 if (pthread_mutex_lock(&sMutex)) {
1636 uifw_error("ico_uxf_enter_critical: Error<%d>", errno);
1640 /*--------------------------------------------------------------------------*/
1642 * @brief ico_uxf_leave_critical: leave critical section(internal function)
1647 /*--------------------------------------------------------------------------*/
1649 ico_uxf_leave_critical(void)
1651 if (pthread_mutex_unlock(&sMutex)) {
1652 uifw_error("ico_uxf_leave_critical: Error<%d>", errno);
1656 /*--------------------------------------------------------------------------*/
1658 * @brief ico_uxf_alloc_callback: allocate callback management table(internal function)
1661 * @return allocated callback management table address
1663 /*--------------------------------------------------------------------------*/
1664 Ico_Uxf_Mng_Callback *
1665 ico_uxf_alloc_callback(void)
1667 Ico_Uxf_Mng_Callback *p;
1670 p = gIco_Uxf_Api_Mng.CallbackFree;
1672 p = (Ico_Uxf_Mng_Callback *)malloc(sizeof(Ico_Uxf_Mng_Callback) *
1673 ICO_UXF_MNG_BLOCK_ALLOCS);
1675 uifw_error("ico_uxf_alloc_callback: NO Memory (malloc Error)");
1678 gIco_Uxf_Api_Mng.CallbackFree = p;
1680 for (idx = 0; idx < ICO_UXF_MNG_BLOCK_ALLOCS; idx++, p++) {
1681 if (idx != (ICO_UXF_MNG_BLOCK_ALLOCS-1)) {
1685 p->next = (struct _Ico_Uxf_Mng_Callback *)0;
1688 p = gIco_Uxf_Api_Mng.CallbackFree;
1690 gIco_Uxf_Api_Mng.CallbackFree = p->next;
1694 /*--------------------------------------------------------------------------*/
1696 * @brief ico_uxf_free_callback: release callback management table(internal function)
1698 * @param[in] p callback management table address
1701 /*--------------------------------------------------------------------------*/
1703 ico_uxf_free_callback(Ico_Uxf_Mng_Callback *p)
1705 p->next = gIco_Uxf_Api_Mng.CallbackFree;
1706 gIco_Uxf_Api_Mng.CallbackFree = p;
1709 /*--------------------------------------------------------------------------*/
1711 * @brief ico_uxf_regist_callback: register a callback management table(internal function)
1713 * @param[in] p callback management table address
1716 /*--------------------------------------------------------------------------*/
1718 ico_uxf_regist_callback(Ico_Uxf_Mng_Callback *p)
1720 p->next = (struct _Ico_Uxf_Mng_Callback *)0;
1722 if (gIco_Uxf_Api_Mng.Callback) {
1723 gIco_Uxf_Api_Mng.CallbackLast->next = p;
1724 gIco_Uxf_Api_Mng.CallbackLast = p;
1727 gIco_Uxf_Api_Mng.Callback = p;
1728 gIco_Uxf_Api_Mng.CallbackLast = gIco_Uxf_Api_Mng.Callback;
1732 /*--------------------------------------------------------------------------*/
1734 * @brief ico_uxf_remove_callback: remove a callback management table(internal function)
1736 * @param[in] p callback management table address
1739 /*--------------------------------------------------------------------------*/
1741 ico_uxf_remove_callback(Ico_Uxf_Mng_Callback *p)
1743 Ico_Uxf_Mng_Callback *pp;
1744 Ico_Uxf_Mng_Callback *before;
1746 pp = gIco_Uxf_Api_Mng.Callback;
1747 before = (Ico_Uxf_Mng_Callback *)0;
1756 before->next = p->next;
1758 gIco_Uxf_Api_Mng.CallbackLast = before;
1762 gIco_Uxf_Api_Mng.Callback = p->next;
1767 /*--------------------------------------------------------------------------*/
1769 * @brief ico_uxf_alloc_eventque: allocate event queue block(internal function)
1772 * @return allocated event queue control block address
1774 /*--------------------------------------------------------------------------*/
1775 Ico_Uxf_Mng_EventQue
1776 *ico_uxf_alloc_eventque(void)
1778 Ico_Uxf_Mng_EventQue *p;
1781 p = gIco_Uxf_Api_Mng.EventQueFree;
1783 p = (Ico_Uxf_Mng_EventQue *)
1784 malloc(sizeof(Ico_Uxf_Mng_EventQue) * ICO_UXF_MNG_BLOCK_ALLOCS);
1786 uifw_error("ico_uxf_alloc_eventque: NO Memory (malloc Error)");
1789 gIco_Uxf_Api_Mng.EventQueFree = p;
1791 for (idx = 0; idx < ICO_UXF_MNG_BLOCK_ALLOCS; idx++, p++) {
1792 if (idx != (ICO_UXF_MNG_BLOCK_ALLOCS-1)) {
1796 p->next = (struct _Ico_Uxf_Mng_EventQue *)0;
1799 p = gIco_Uxf_Api_Mng.EventQueFree;
1801 gIco_Uxf_Api_Mng.EventQueFree = p->next;
1806 /*--------------------------------------------------------------------------*/
1808 * @brief ico_uxf_free_eventque: release event queue block(internal function)
1810 * @param[in] p event queue control block address
1813 /*--------------------------------------------------------------------------*/
1815 ico_uxf_free_eventque(Ico_Uxf_Mng_EventQue *p)
1817 p->next = gIco_Uxf_Api_Mng.EventQueFree;
1818 gIco_Uxf_Api_Mng.EventQueFree = p;
1821 /*--------------------------------------------------------------------------*/
1823 * @brief ico_uxf_regist_eventque: register a event queue(internal function)
1825 * @param[in] p event queue control block address
1828 /*--------------------------------------------------------------------------*/
1830 ico_uxf_regist_eventque(Ico_Uxf_Mng_EventQue *p)
1832 p->next = (struct _Ico_Uxf_Mng_EventQue *)0;
1834 if (gIco_Uxf_Api_Mng.EventQue) {
1835 gIco_Uxf_Api_Mng.EventQueLast->next = p;
1836 gIco_Uxf_Api_Mng.EventQueLast = p;
1839 gIco_Uxf_Api_Mng.EventQue = p;
1840 gIco_Uxf_Api_Mng.EventQueLast = gIco_Uxf_Api_Mng.EventQue;
1844 /*--------------------------------------------------------------------------*/
1846 * @brief ico_uxf_mng_display: get display management table(internal function)
1848 * @param[in] display display Id
1849 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1850 * @return display management table address
1851 * @retval !=NULL display management table address
1852 * @retval ==NULL display dose not exist(parameter 'create' only 0)
1854 /*--------------------------------------------------------------------------*/
1855 Ico_Uxf_Mng_Display *
1856 ico_uxf_mng_display(const int display, const int create)
1858 Ico_Uxf_Mng_Display *p;
1859 Ico_Uxf_Mng_Display *plast;
1861 p = gIco_Uxf_Api_Mng.Mng_Display;
1862 plast = (Ico_Uxf_Mng_Display *)0;
1864 if (p->attr.display == display) break;
1869 if ((! p) && (create != 0)) {
1871 p = (Ico_Uxf_Mng_Display *) malloc(sizeof(Ico_Uxf_Mng_Display));
1873 uifw_error("ico_uxf_mng_display: NO Memory (malloc Error)");
1876 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Display));
1877 p->attr.display = display;
1882 gIco_Uxf_Api_Mng.Mng_Display = p;
1888 /*--------------------------------------------------------------------------*/
1890 * @brief ico_uxf_mng_layer: get layer management table(internal function)
1892 * @param[in] display display Id
1893 * @param[in] layer layer Id
1894 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1895 * @return layer management table address
1896 * @retval !=NULL layer management table address
1897 * @retval ==NULL layer dose not exist(parameter 'create' only 0)
1899 /*--------------------------------------------------------------------------*/
1901 ico_uxf_mng_layer(const int display, const int layer, const int create)
1903 Ico_Uxf_Mng_Layer *p;
1904 Ico_Uxf_Mng_Layer *plast;
1906 p = gIco_Uxf_Api_Mng.Mng_Layer;
1907 plast = (Ico_Uxf_Mng_Layer *)0;
1909 if ((p->attr.display == display) &&
1910 (p->attr.layer == layer)) break;
1915 if ((! p) && (create != 0)) {
1917 p = (Ico_Uxf_Mng_Layer *) malloc(sizeof(Ico_Uxf_Mng_Layer));
1919 uifw_error("ico_uxf_mng_layer: NO Memory (malloc Error)");
1922 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Layer));
1923 p->attr.layer = layer;
1928 gIco_Uxf_Api_Mng.Mng_Layer = p;
1934 /*--------------------------------------------------------------------------*/
1936 * @brief ico_uxf_mng_window: get window management table(internal function)
1938 * @param[in] window window Id(same as ico_window_mgr surface Id)
1939 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1940 * @return window management table address
1941 * @retval !=NULL window management table address
1942 * @retval ==NULL window dose not exist(parameter 'create' only 0)
1944 /*--------------------------------------------------------------------------*/
1945 Ico_Uxf_Mng_Window *
1946 ico_uxf_mng_window(const int window, const int create)
1948 Ico_Uxf_Mng_Window *p;
1949 Ico_Uxf_Mng_Window *plast = (Ico_Uxf_Mng_Window *)0;
1952 hash = ICO_UXF_MISC_HASHBYID(window);
1953 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
1955 if (p->attr.window == window) break;
1960 if ((! p) && (create != 0)) {
1962 p = (Ico_Uxf_Mng_Window *) malloc(sizeof(Ico_Uxf_Mng_Window));
1964 uifw_error("ico_uxf_mng_window: NO Memory (malloc Error)");
1967 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Window));
1968 p->attr.window = window;
1970 plast->nextidhash = p;
1973 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
1975 uifw_trace("ico_uxf_mng_window: Create New Table=%08x", (int)p);
1980 /*--------------------------------------------------------------------------*/
1982 * @brief ico_uxf_mng_process: get process management table(internal function)
1984 * @param[in] process application Id
1985 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1986 * @return process management table address
1987 * @retval !=NULL process management table address
1988 * @retval ==NULL process dose not exist(parameter 'create' only 0)
1990 /*--------------------------------------------------------------------------*/
1991 Ico_Uxf_Mng_Process *
1992 ico_uxf_mng_process(const char *process, const int create)
1994 Ico_Uxf_Mng_Process *p;
1995 Ico_Uxf_Mng_Process *plast = (Ico_Uxf_Mng_Process *)0;
1998 hash = ICO_UXF_MISC_HASHBYNAME(process);
1999 uifw_trace("ico_uxf_mng_process: find(hash=%d)", hash);
2000 p = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
2002 if(strncmp(p->attr.process, process, ICO_UXF_MAX_PROCESS_NAME) == 0) break;
2007 if ((! p) && (create != 0)) {
2009 p = (Ico_Uxf_Mng_Process *) malloc(sizeof(Ico_Uxf_Mng_Process));
2011 uifw_error("ico_uxf_mng_process: NO Memory (malloc Error)");
2014 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Process));
2015 strncpy(p->attr.process, process, ICO_UXF_MAX_PROCESS_NAME);
2016 uifw_trace("ico_uxf_mng_process: create table(hash=%d, proc=%s)", hash, process);
2018 plast->nextidhash = p;
2021 gIco_Uxf_Api_Mng.Hash_ProcessId[hash] = p;
2027 /*--------------------------------------------------------------------------*/
2029 * @brief ico_uxf_update_procwin: update a process management table
2031 * @param[in] appid application id
2032 * @param[in] type type(install/uninstall)
2033 * @param[in] func window create/destroy hook function
2036 /*--------------------------------------------------------------------------*/
2038 ico_uxf_update_procwin(const char *appid, int type)
2040 Ico_Uxf_Mng_Process *prc = NULL;
2041 Ico_Uxf_Sys_Config *sysconf;
2042 Ico_Uxf_App_Config *appconf;
2043 Ico_Uxf_conf_appdisplay *appdsp;
2045 Ico_Uxf_conf_application *app = NULL;
2047 uifw_trace("ico_uxf_update_procwin: Enter(appid=%s, type=%d)", appid, type);
2049 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
2050 uifw_trace("ico_uxf_callback_remove: Leave(not initialized)");
2053 prc = ico_uxf_mng_process(appid, 0);
2055 if (type == ICO_UXF_CONF_EVENT_INSTALL) {
2057 sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
2058 appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
2059 if ((sysconf == NULL) || (appconf == NULL)) {
2060 uifw_trace("ico_uxf_update_procwin: Leave(cannot find tables)");
2063 for (dn = 0; dn < appconf->applicationNum; dn++) {
2064 app = &appconf->application[dn];
2065 if (strncmp(app->appid, appid, ICO_UXF_MAX_PROCESS_NAME) == 0) {
2066 uifw_trace("ico_uxf_update_procwin: Install(%s)", appid);
2067 /* add process management table */
2068 prc = ico_uxf_mng_process(appid, 1);
2069 prc->attr.internalid = 0;
2070 prc->attr.status = ICO_UXF_PROCSTATUS_STOP;
2071 prc->attr.type = app->categoryId;
2072 prc->attr.hostId = app->hostId;
2073 prc->attr.myHost = (prc->attr.hostId == sysconf->misc.myhostId) ? 1 : 0;
2075 appdsp = &app->display[0];
2076 prc->attr.mainwin.window = 0;
2077 prc->attr.mainwin.windowtype = app->categoryId;
2078 prc->attr.mainwin.display = appdsp->displayId;
2079 prc->attr.mainwin.layer = appdsp->layerId;
2080 prc->attr.mainwin.x =
2081 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
2082 prc->attr.mainwin.y =
2083 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
2084 prc->attr.mainwin.w =
2085 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
2086 prc->attr.mainwin.h =
2087 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
2088 prc->attr.mainwin.name[ICO_UXF_MAX_WIN_NAME] = 0;
2089 prc->attr.numwindows = app->displayzoneNum;
2090 /* get sub windows */
2091 if (prc->attr.numwindows > 1) {
2092 prc->attr.subwin = malloc(sizeof(Ico_Uxf_ProcessWin) *
2093 (prc->attr.numwindows - 1));
2094 if (! prc->attr.subwin) {
2095 uifw_trace("ico_uxf_update_procwin: Install(No memory)");
2096 app->displayzoneNum = 1;
2097 prc->attr.numwindows = 1;
2100 memset(prc->attr.subwin, 0, (prc->attr.numwindows - 1));
2101 for (tn = 0; tn < (prc->attr.numwindows - 1); tn++) {
2103 prc->attr.subwin[tn].windowtype = prc->attr.mainwin.windowtype;
2104 prc->attr.subwin[tn].display = appdsp->displayId;
2105 prc->attr.subwin[tn].layer = appdsp->layerId;
2106 prc->attr.subwin[tn].x =
2107 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
2108 prc->attr.subwin[tn].y =
2109 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
2110 prc->attr.subwin[tn].w =
2111 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
2112 prc->attr.subwin[tn].h =
2113 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
2121 else if (type == ICO_UXF_CONF_EVENT_UNINSTALL) {
2123 /* not delete process management table */
2127 uifw_trace("ico_uxf_update_procwin: Leave");
2132 /*--------------------------------------------------------------------------*/
2134 * @brief ico_uxf_window_screen_size_get: get display physical size
2136 * @param[out] width variable to receive the width of the display
2137 * @param[out] height variable to receive the height of the display
2140 /*--------------------------------------------------------------------------*/
2142 ico_uxf_window_screen_size_get(int *width, int *height)
2144 Ico_Uxf_Mng_Display *dsp;
2145 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
2147 uifw_trace("ico_uxf_window_screen_size_get: Enter(dsp=%d(%d))",
2148 dsp, gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display);
2150 if ((dsp != NULL) && (width != NULL) && (height != NULL)) {
2151 uifw_trace("ico_uxf_window_screen_size_get: %dx%d",
2152 dsp->attr.pWidth, dsp->attr.pHeight);
2153 *width = dsp->attr.pWidth;
2154 *height = dsp->attr.pHeight;
2158 /*--------------------------------------------------------------------------*/
2160 * @brief ico_uxf_window_hook: set window create/destroy hook function
2162 * @param[in] func window create/destroy hook function
2165 /*--------------------------------------------------------------------------*/
2167 ico_uxf_window_hook(Ico_Uxf_Hook func)
2169 uifw_trace("ico_uxf_window_hook: Window Control Hook=%08x", (int)func);
2171 gIco_Uxf_Api_Mng.Hook_Window = func;