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->attr.menuoverlap = sysconf->display[dn].layer[tn].menuoverlap;
192 lay->mng_display = dsp;
196 uifw_trace("ico_uxf_init: set application configurations(num=%d)",
197 appconf->applicationNum);
198 /* set application configurations */
199 for(dn = 0; dn < appconf->applicationNum; dn++) {
200 prc = ico_uxf_mng_process(appconf->application[dn].appid, 1);
201 prc->attr.internalid = 0;
202 prc->appconf = (void *)&appconf->application[dn];
203 prc->attr.status = ICO_UXF_PROCSTATUS_STOP;
204 prc->attr.type = appconf->application[dn].categoryId;
205 prc->attr.hostId = appconf->application[dn].hostId;
206 prc->attr.myHost = (prc->attr.hostId == sysconf->misc.myhostId) ? 1 : 0;
207 prc->attr.noicon = appconf->application[dn].noicon;
208 prc->attr.autostart = appconf->application[dn].autostart;
209 prc->attr.invisiblecpu = appconf->application[dn].invisiblecpu;
211 appdsp = &appconf->application[dn].display[0];
212 prc->attr.mainwin.window = 0;
213 prc->attr.mainwin.windowtype = appconf->application[dn].categoryId;
214 prc->attr.mainwin.display = appdsp->displayId;
215 prc->attr.mainwin.layer = appdsp->layerId;
216 prc->attr.mainwin.x =
217 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
218 prc->attr.mainwin.y =
219 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
220 prc->attr.mainwin.w =
221 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
222 prc->attr.mainwin.h =
223 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
224 prc->attr.mainwin.name[ICO_UXF_MAX_WIN_NAME] = 0;
225 prc->attr.numwindows = appconf->application[dn].displayzoneNum;
226 /* get sub windows */
227 if (prc->attr.numwindows > 1) {
228 prc->attr.subwin = malloc(sizeof(Ico_Uxf_ProcessWin) *
229 (prc->attr.numwindows - 1));
230 if (! prc->attr.subwin) {
231 uifw_error("ico_uxf_init: No Memory");
232 appconf->application[dn].displayzoneNum = 1;
233 prc->attr.numwindows = 1;
236 memset(prc->attr.subwin, 0, (prc->attr.numwindows - 1));
237 for (tn = 0; tn < (prc->attr.numwindows - 1); tn++) {
239 prc->attr.subwin[tn].windowtype = prc->attr.mainwin.windowtype;
240 prc->attr.subwin[tn].display = appdsp->displayId;
241 prc->attr.subwin[tn].layer = appdsp->layerId;
242 prc->attr.subwin[tn].x =
243 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
244 prc->attr.subwin[tn].y =
245 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
246 prc->attr.subwin[tn].w =
247 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
248 prc->attr.subwin[tn].h =
249 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
255 gIco_Uxf_Api_Mng.Mng_MyProcess
256 = ico_uxf_mng_process(gIco_Uxf_Api_Mng.MyProcess, 0);
257 if (!gIco_Uxf_Api_Mng.Mng_MyProcess) {
258 uifw_error("ico_uxf_init: Leave(ESRCH), Unknown Apprication(%s)",
259 gIco_Uxf_Api_Mng.MyProcess);
260 return ICO_UXF_ESRCH;
262 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.internalid = getpid();
263 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.status = ICO_UXF_PROCSTATUS_RUN;
265 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
267 uifw_trace("ico_uxf_init: App.%d MainDisplay.%d %08x",
268 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.process,
269 gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, dsp);
271 for (ret = 0; ret < (5000/50); ret++) {
272 gIco_Uxf_Api_Mng.Wayland_Display = wl_display_connect(NULL);
273 if (gIco_Uxf_Api_Mng.Wayland_Display) break;
277 gIco_Uxf_Api_Mng.Wayland_Registry
278 = wl_display_get_registry(gIco_Uxf_Api_Mng.Wayland_Display);
279 wl_registry_add_listener(gIco_Uxf_Api_Mng.Wayland_Registry,
280 &ico_uxf_registry_listener, (void *)0);
282 for (ret = 0; ret < (500/20); ret++) {
283 if ((gIco_Uxf_Api_Mng.Wayland_WindowMgr != NULL) &&
284 (gIco_Uxf_Api_Mng.Wayland_exInput != NULL) &&
285 (gIco_Uxf_Api_Mng.Wayland_InputMgr != NULL)) break;
286 uifw_trace("ico_uxf_init: call wl_display_dispatch(%08x)",
287 (int)gIco_Uxf_Api_Mng.Wayland_Display);
288 wl_display_dispatch(gIco_Uxf_Api_Mng.Wayland_Display);
291 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
292 uifw_trace("ico_uxf_init: Wayland/Weston connect OK");
294 /* set client attribute if need */
295 if (gIco_Uxf_Api_Mng.Wayland_WindowMgr) {
296 for(dn = 0; dn < appconf->applicationNum; dn++) {
297 if (appconf->application[dn].noconfigure) {
298 uifw_trace("ico_uxf_init: %s no need configure event",
299 appconf->application[dn].appid);
300 ico_window_mgr_set_client_attr(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
301 appconf->application[dn].appid,
302 ICO_WINDOW_MGR_CLIENT_ATTR_NOCONFIGURE, 1);
303 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
308 gIco_Uxf_Api_Mng.WaylandFd
309 = wl_display_get_fd(gIco_Uxf_Api_Mng.Wayland_Display);
311 /* initialize mutex */
312 (void) pthread_mutexattr_init(&sMutexAttr);
313 if (pthread_mutex_init(&sMutex, &sMutexAttr) != 0) {
314 uifw_error("ico_uxf_init: Leave(ENOSYS), Mutex Create Error %d", errno);
315 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
316 gIco_Uxf_Api_Mng.Wayland_Display = NULL;
317 gIco_Uxf_Api_Mng.Initialized = 0;
318 return ICO_UXF_ENOSYS;
321 /* allocate free control blocks */
322 freecb = ico_uxf_alloc_callback();
323 ico_uxf_free_callback(freecb);
324 freeeq = ico_uxf_alloc_eventque();
325 ico_uxf_free_eventque(freeeq);
327 /* flush wayland connection */
328 ico_window_mgr_set_eventcb(gIco_Uxf_Api_Mng.Wayland_WindowMgr, 1);
329 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
331 /* application launch/dead callback from AppCore(aul) */
332 aul_listen_app_launch_signal(ico_uxf_aul_aulcb, (void *)0);
333 aul_listen_app_dead_signal(ico_uxf_aul_aulcb, (void *)1);
335 gIco_Uxf_Api_Mng.Initialized = 1;
337 uifw_trace("ico_uxf_init: Leave(EOK)");
343 /*--------------------------------------------------------------------------*/
345 * @brief ico_uxf_wl_display_fd: get wayland file discriptor
348 * @return wayland connect socket file descriptor
349 * @retval >=0 success(file descriptor)
350 * @retval < 0 error(wayland not connect)
352 /*--------------------------------------------------------------------------*/
354 ico_uxf_wl_display_fd(void)
356 uifw_trace("ico_uxf_wl_display_fd: fd=%d", gIco_Uxf_Api_Mng.WaylandFd);
358 return gIco_Uxf_Api_Mng.WaylandFd;
361 /*--------------------------------------------------------------------------*/
363 * @brief ico_uxf_shutdown: terminate user interface library hor HomeScreen
367 * @retval ICO_UXF_EOK success
368 * @retval ICO_UXF_EBUSY error(cullentry terminating)
370 /*--------------------------------------------------------------------------*/
372 ico_uxf_shutdown(void)
374 uifw_trace("ico_uxf_shutdown: Enter");
376 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
377 if (gIco_Uxf_Api_Mng.Initialized < 0) {
378 uifw_warn("ico_uxf_shutdown: Leave(EBUSY)");
379 return ICO_UXF_EBUSY;
381 uifw_trace("ico_uxf_shutdown: Leave(EOK)");
384 gIco_Uxf_Api_Mng.Initialized = -1;
385 gIco_Uxf_Api_Mng.LastEvent = 0;
387 (void) pthread_mutex_destroy(&sMutex);
389 if (gIco_Uxf_Api_Mng.Wayland_Seat) {
390 wl_seat_destroy(gIco_Uxf_Api_Mng.Wayland_Seat);
391 gIco_Uxf_Api_Mng.Wayland_Seat = NULL;
393 if (gIco_Uxf_Api_Mng.Wayland_exInput) {
394 ico_exinput_destroy(gIco_Uxf_Api_Mng.Wayland_exInput);
395 gIco_Uxf_Api_Mng.Wayland_exInput = NULL;
397 if (gIco_Uxf_Api_Mng.Wayland_InputMgr) {
398 ico_input_mgr_control_destroy(gIco_Uxf_Api_Mng.Wayland_InputMgr);
399 gIco_Uxf_Api_Mng.Wayland_InputMgr = NULL;
401 if (gIco_Uxf_Api_Mng.Wayland_Compositor) {
402 wl_compositor_destroy(gIco_Uxf_Api_Mng.Wayland_Compositor);
403 gIco_Uxf_Api_Mng.Wayland_Compositor = NULL;
405 if (gIco_Uxf_Api_Mng.Wayland_Display) {
406 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
407 wl_display_disconnect(gIco_Uxf_Api_Mng.Wayland_Display);
408 gIco_Uxf_Api_Mng.Wayland_Display = NULL;
411 gIco_Uxf_Api_Mng.Initialized = 0;
413 uifw_trace("ico_uxf_shutdown: Leave(EOK)");
417 /*--------------------------------------------------------------------------*/
419 * @brief ico_uxf_main_loop_iterate: process user interface library events
424 /*--------------------------------------------------------------------------*/
426 ico_uxf_main_loop_iterate(void)
429 Ico_Uxf_Mng_EventQue *wkque;
430 Ico_Uxf_Mng_Callback *callback;
431 Ico_Uxf_Event_Cb func;
433 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
436 if (ioctl(gIco_Uxf_Api_Mng.WaylandFd, FIONREAD, &arg) < 0) {
437 uifw_warn("ico_uxf_main_loop_iterate: ioclt(FIONREAD,) Error %d", errno);
442 wl_display_dispatch(gIco_Uxf_Api_Mng.Wayland_Display);
445 ico_uxf_enter_critical();
448 while (gIco_Uxf_Api_Mng.EventQue) {
450 wkque = gIco_Uxf_Api_Mng.EventQue;
451 gIco_Uxf_Api_Mng.EventQue = gIco_Uxf_Api_Mng.EventQue->next;
453 gIco_Uxf_Api_Mng.LastEvent = wkque->detail.event;
454 callback = gIco_Uxf_Api_Mng.Callback;
456 if (callback->eventmask & gIco_Uxf_Api_Mng.LastEvent) {
457 func = callback->func;
459 ico_uxf_leave_critical();
461 uifw_trace("ico_uxf_main_loop: Call Event Callback(%08x,,%08x)",
462 gIco_Uxf_Api_Mng.LastEvent, arg);
463 (*func)(gIco_Uxf_Api_Mng.LastEvent, wkque->detail, arg);
465 ico_uxf_enter_critical();
467 callback = callback->next;
469 ico_uxf_free_eventque(wkque);
472 ico_uxf_leave_critical();
474 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
477 /*--------------------------------------------------------------------------*/
479 * @brief ico_uxf_callback_set: set event calback function
481 * @param[in] mask event mask
482 * @param[in] func callback function
483 * @param[in] arg user argument
485 * @retval ICO_UXF_EOK success
486 * @retval ICO_UXF_ESRCH error(user interface library not initialized)
487 * @retval ICO_UXF_EINVAL error(illegal event mask)
488 * @retval ICO_UXF_EBUSY error(already set same event)
490 /*--------------------------------------------------------------------------*/
492 ico_uxf_callback_set(const unsigned int mask, Ico_Uxf_Event_Cb func, const int arg)
494 Ico_Uxf_Mng_Callback *callback;
497 uifw_trace("ico_uxf_callback_set: Enter(%08x,%08x,%08x)", mask, (int)func, arg);
499 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
500 uifw_warn("ico_uxf_callback_set: Leave(ESRCH)");
501 return ICO_UXF_ESRCH;
508 wkmask = ICO_UXF_EVENT_ALL;
510 if ((wkmask & ICO_UXF_EVENT_VALIDALL) == 0) {
511 uifw_warn("ico_uxf_callback_set: Leave(EINVAL)");
512 return ICO_UXF_EINVAL;
515 ico_uxf_enter_critical();
517 callback = gIco_Uxf_Api_Mng.Callback;
519 if ((callback->eventmask == wkmask) && (callback->func == func) &&
520 (callback->arg == arg)) {
522 ico_uxf_leave_critical();
523 uifw_warn("ico_uxf_callback_set: Leave(EBUSY)");
524 return ICO_UXF_EBUSY;
528 callback = ico_uxf_alloc_callback();
530 callback->eventmask = wkmask;
531 callback->func = func;
534 ico_uxf_regist_callback(callback);
536 gIco_Uxf_Api_Mng.EventMask |= wkmask;
538 ico_uxf_leave_critical();
540 uifw_trace("ico_uxf_callback_set: Leave(EOK)");
544 /*--------------------------------------------------------------------------*/
546 * @brief ico_uxf_callback_remove: remove event calback function
548 * @param[in] mask event mask
549 * @param[in] func callback function
550 * @param[in] arg user argument
552 * @retval ICO_UXF_EOK success
553 * @retval ICO_UXF_ESRCH error(user interface library not initialized)
555 /*--------------------------------------------------------------------------*/
557 ico_uxf_callback_remove(const unsigned int mask, Ico_Uxf_Event_Cb func, const int arg)
559 Ico_Uxf_Mng_Callback *callback;
562 uifw_trace("ico_uxf_callback_remove: Enter(%08x,%08x,%08x)", mask, (int)func, arg);
564 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
565 uifw_warn("ico_uxf_callback_remove: Leave(ESRCH)");
566 return ICO_UXF_ESRCH;
573 wkmask = ICO_UXF_EVENT_ALL;
576 ico_uxf_enter_critical();
578 gIco_Uxf_Api_Mng.EventMask = 0;
580 callback = gIco_Uxf_Api_Mng.Callback;
583 if ((callback->eventmask == wkmask) && (callback->func == func) &&
584 (callback->arg == arg)) {
585 ico_uxf_remove_callback(callback);
588 gIco_Uxf_Api_Mng.EventMask |= callback->eventmask;
590 callback = callback->next;
593 ico_uxf_leave_critical();
595 uifw_trace("ico_uxf_callback_remove: Leave(EOK)");
599 /*--------------------------------------------------------------------------*/
601 * @brief ico_uxf_free_procwin: free active window management table(internal function)
603 * @param[in] prc application management table address
606 /*--------------------------------------------------------------------------*/
608 ico_uxf_free_procwin(Ico_Uxf_Mng_Process *prc)
610 Ico_Uxf_Mng_Window *p;
611 Ico_Uxf_Mng_Window *pp;
612 Ico_Uxf_Mng_Window *freep;
615 uifw_trace("ico_uxf_free_procwin: Enter(%d)", prc->attr.process);
617 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
618 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
619 pp = (Ico_Uxf_Mng_Window *)0;
621 if (p->attr.process == prc->attr.process) {
625 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
630 uifw_trace("ico_uxf_free_procwin: Free Window(%08x)", freep->attr.window);
639 uifw_trace("ico_uxf_free_procwin: Leave");
642 /*--------------------------------------------------------------------------*/
644 * @brief ico_uxf_wayland_globalcb: wayland global callback(static function)
646 * @param[in] data user data(unused)
647 * @param[in] registry wayland registry
648 * @param[in] name wayland display Id(unused)
649 * @param[in] interface wayland interface name
650 * @param[in] version wayland interface version number(unused)
653 /*--------------------------------------------------------------------------*/
655 ico_uxf_wayland_globalcb(void *data, struct wl_registry *registry,
656 uint32_t name, const char *interface, uint32_t version)
658 uifw_trace("ico_uxf_wayland_globalcb: Enter(Event=%s DispId=%08x)", interface, name);
660 if (strcmp(interface, "ico_window_mgr") == 0) {
661 gIco_Uxf_Api_Mng.Wayland_WindowMgr = (struct ico_window_mgr *)
662 wl_registry_bind(registry, name, &ico_window_mgr_interface, 1);
663 ico_window_mgr_add_listener(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
664 &windowlistener, NULL);
665 ico_window_mgr_set_user(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
666 getpid(), gIco_Uxf_Api_Mng.MyProcess);
668 else if (strcmp(interface, "ico_exinput") == 0) {
670 gIco_Uxf_Api_Mng.Wayland_exInput = (struct ico_exinput *)
671 wl_registry_bind(registry, name, &ico_exinput_interface, 1);
672 ico_exinput_add_listener(gIco_Uxf_Api_Mng.Wayland_exInput, &exinputlistener, NULL);
674 else if (strcmp(interface, "ico_input_mgr_control") == 0) {
675 /* regist Multi Input Manager interface */
676 gIco_Uxf_Api_Mng.Wayland_InputMgr = (struct ico_input_mgr_control *)
677 wl_registry_bind(registry, name, &ico_input_mgr_control_interface, 1);
679 else if (strcmp(interface, "wl_output") == 0) {
680 /* regist wl_output listener to get display info */
681 gIco_Uxf_Api_Mng.Wayland_Output = (struct wl_output *)
682 wl_registry_bind(registry, name, &wl_output_interface, 1);
683 wl_output_add_listener(gIco_Uxf_Api_Mng.Wayland_Output, &outputlistener, NULL);
685 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
686 uifw_trace("ico_uxf_wayland_globalcb: Leave");
689 /*--------------------------------------------------------------------------*/
691 * @brief ico_uxf_output_geometrycb: wayland display attribute callback(static function)
693 * @param[in] data user data(unused)
694 * @param[in] wl_output wayland wl_output interface
695 * @param[in] x display upper-left X coodinate
696 * @param[in] y display upper-left Y coodinate
697 * @param[in] physical_width display physical width
698 * @param[in] physical_height display physical height
699 * @param[in] subpixel display sub pixcel
700 * @param[in] make display maker
701 * @param[in] model diaplay model
702 * @param[in] transform transform
705 /*--------------------------------------------------------------------------*/
707 ico_uxf_output_geometrycb(void *data, struct wl_output *wl_output, int32_t x, int32_t y,
708 int32_t physical_width, int32_t physical_height, int32_t subpixel,
709 const char *make, const char *model, int32_t transform)
711 Ico_Uxf_Mng_Display *dsp;
713 uifw_trace("ico_uxf_output_geometrycb: Enter(x/y=%d/%d, pwidth/height=%d/%d, trans=%d)",
714 x, y, physical_width, physical_height, transform);
716 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
719 if ((transform == WL_OUTPUT_TRANSFORM_90)
720 || (transform == WL_OUTPUT_TRANSFORM_270)
721 || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_90)
722 || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_270)) {
723 dsp->attr.pWidth = physical_height;
724 dsp->attr.pHeight = physical_width;
725 dsp->attr.orientation = ICO_UXF_ORIENTATION_VERTICAL;
728 dsp->attr.pWidth = physical_width;
729 dsp->attr.pHeight = physical_height;
730 dsp->attr.orientation = ICO_UXF_ORIENTATION_HORIZONTAL;
733 uifw_trace("ico_uxf_output_geometrycb: Leave");
736 /*--------------------------------------------------------------------------*/
738 * @brief ico_uxf_output_modecb: wayland display mode callback(static function)
740 * @param[in] data user data(unused)
741 * @param[in] wl_output wayland wl_output interface
742 * @param[in] flags flags
743 * @param[in] width display width
744 * @param[in] height display height
745 * @param[in] refresh display refresh rate
748 /*--------------------------------------------------------------------------*/
750 ico_uxf_output_modecb(void *data, struct wl_output *wl_output, uint32_t flags,
751 int32_t width, int32_t height, int32_t refresh)
753 Ico_Uxf_Mng_Display *dsp;
755 uifw_trace("ico_uxf_output_modecb: Enter(flg=%d, width=%d, height=%d, ref=%d)",
756 flags, width, height, refresh);
758 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
760 if (dsp && (flags & WL_OUTPUT_MODE_CURRENT)) {
761 if (dsp->attr.orientation == ICO_UXF_ORIENTATION_VERTICAL) {
762 dsp->attr.pWidth = height;
763 dsp->attr.pHeight = width;
766 dsp->attr.pWidth = width;
767 dsp->attr.pHeight = height;
770 uifw_trace("ico_uxf_output_modecb: Leave");
773 /*--------------------------------------------------------------------------*/
775 * @brief ico_uxf_window_createdcb: wayland surface create callback(static function)
777 * @param[in] data user data(unused)
778 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
779 * @param[in] surfaceid ico_window_mgr surface Id
780 * @param[in] pid wayland client process Id
781 * @param[in] appid wayland client application Id
784 /*--------------------------------------------------------------------------*/
786 ico_uxf_window_createdcb(void *data, struct ico_window_mgr *ico_window_mgr,
787 uint32_t surfaceid, int32_t pid, const char *appid)
789 Ico_Uxf_Mng_Process *prc;
790 Ico_Uxf_Mng_ProcWin *ppwin;
791 Ico_Uxf_Mng_ProcWin *ppw;
793 uifw_trace("ico_uxf_window_createdcb: Enter(surf=%08x pid=%d appid=%s myapp=%s)",
794 (int)surfaceid, pid, appid, gIco_Uxf_Api_Mng.MyProcess);
796 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) {
801 ico_window_mgr_set_animation(
802 gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid,
803 ((Ico_Uxf_conf_application *)prc->appconf)->animation,
804 ((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
806 else if (((Ico_Uxf_conf_application *)prc->appconf)->animation_time > 0) {
807 ico_window_mgr_set_animation(
808 gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid, " ",
809 ((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
812 if (prc->attr.mainwin.window <= 0) {
813 uifw_trace("ico_uxf_window_createdcb: Set Main Window, Config Data");
814 prc->attr.mainwin.window = surfaceid;
815 ico_uxf_window_configurecb(data, ico_window_mgr, surfaceid, appid,
816 prc->attr.mainwin.layer, prc->attr.mainwin.x,
817 prc->attr.mainwin.y, prc->attr.mainwin.w,
818 prc->attr.mainwin.h, 0);
819 if (gIco_Uxf_Api_Mng.Hook_Window) {
820 (*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
821 ICO_UXF_HOOK_WINDOW_CREATE_MAIN);
825 uifw_trace("ico_uxf_window_createdcb: Sub Window, Dummy Data");
826 ico_uxf_window_configurecb(data, ico_window_mgr, surfaceid, appid,
827 prc->attr.mainwin.layer, 16384, 16384, 1, 1, 0);
828 ppwin = (Ico_Uxf_Mng_ProcWin *)malloc(sizeof(Ico_Uxf_Mng_ProcWin));
830 memset(ppwin, 0, sizeof(Ico_Uxf_Mng_ProcWin));
831 ppwin->attr.window = surfaceid;
832 ppwin->attr.display = prc->attr.mainwin.display;
834 prc->procwin = ppwin;
844 if (gIco_Uxf_Api_Mng.Hook_Window) {
845 (*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
846 ICO_UXF_HOOK_WINDOW_CREATE_SUB);
851 uifw_warn("ico_uxf_window_createdcb: Application.%s dose not exist", appid);
853 uifw_trace("ico_uxf_window_createdcb: Leave");
856 /*--------------------------------------------------------------------------*/
858 * @brief ico_uxf_window_destroyedcb: wayland surface destroy callback(static function)
860 * @param[in] data user data(unused)
861 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
862 * @param[in] surfaceid ico_window_mgr surface Id
865 /*--------------------------------------------------------------------------*/
867 ico_uxf_window_destroyedcb(void *data, struct ico_window_mgr *ico_window_mgr,
870 Ico_Uxf_Mng_Window *p;
871 Ico_Uxf_Mng_Window *pp;
872 Ico_Uxf_Mng_Window *freep;
873 Ico_Uxf_Mng_Process *prc;
874 Ico_Uxf_Mng_EventQue *que;
876 char wkappid[ICO_UXF_MAX_PROCESS_NAME+1];
879 uifw_trace("ico_uxf_window_destroyedcb: Enter(surf=%08x)", (int)surfaceid);
881 ico_uxf_enter_critical();
883 p = ico_uxf_mng_window(surfaceid, 0);
886 ico_uxf_leave_critical();
887 uifw_trace("ico_uxf_window_destroyedcb: Leave(Surface=%08x dose not exist)",
891 prc = p->mng_process;
892 if ((prc != NULL) && (prc->attr.mainwin.window == (int)surfaceid)) {
893 prc->attr.mainwin.window = 0;
896 strcpy(wkappid, p->attr.process);
897 wksubwindow = p->attr.subwindow;
899 if ((gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_DESTORYWINDOW) &&
900 (p->attr.eventmask & ICO_UXF_EVENT_DESTORYWINDOW)) {
902 que = ico_uxf_alloc_eventque();
903 que->detail.event = ICO_UXF_EVENT_DESTORYWINDOW;
904 que->detail.window.display = p->attr.display;
905 que->detail.window.window = surfaceid;
906 que->detail.window.layer = p->attr.layer;
907 que->detail.window.x = p->attr.x;
908 que->detail.window.y = p->attr.y;
909 que->detail.window.w = p->attr.w;
910 que->detail.window.h = p->attr.h;
911 que->detail.window.visible = p->attr.visible;
912 que->detail.window.raise = p->attr.raise;
913 que->detail.window.active = p->attr.active;
914 ico_uxf_regist_eventque(que);
917 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
918 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
919 pp = (Ico_Uxf_Mng_Window *)0;
921 if (p->attr.window == (int)surfaceid) {
925 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
930 uifw_trace("ico_uxf_window_destroyedcb: Free Window.%08x(%08x)",
931 (int)freep, freep->attr.window);
933 hash = ICO_UXF_MISC_HASHSIZE;
940 ico_uxf_leave_critical();
942 if (gIco_Uxf_Api_Mng.Hook_Window) {
943 (*gIco_Uxf_Api_Mng.Hook_Window)(wkappid, surfaceid,
944 wksubwindow ? ICO_UXF_HOOK_WINDOW_DESTORY_SUB :
945 ICO_UXF_HOOK_WINDOW_DESTORY_MAIN);
947 uifw_trace("ico_uxf_window_destroyedcb: Leave");
950 /*--------------------------------------------------------------------------*/
952 * @brief ico_uxf_window_visiblecb: wayland surface visible callback(static function)
954 * @param[in] data user data(unused)
955 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
956 * @param[in] surfaceid ico_window_mgr surface Id
957 * @param[in] visibility surface visible(1=visible/0=unvisible/9=nochange)
958 * @param[in] raise surface raise(1=raise/0=lower/9=nochange)
959 * @param[in] hint client request(1=client request(not changed)/0=changed)
962 /*--------------------------------------------------------------------------*/
964 ico_uxf_window_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
965 uint32_t surfaceid, int32_t visible, int32_t raise, int32_t hint)
967 Ico_Uxf_Mng_Window *win;
968 Ico_Uxf_Mng_EventQue *que;
972 ico_uxf_enter_critical();
974 win = ico_uxf_mng_window(surfaceid, 0);
977 ico_uxf_leave_critical();
978 uifw_trace("ico_uxf_window_visiblecb: Surface=%08x dose not exist",
986 ovisible = win->attr.visible;
989 oraise = win->attr.raise;
992 if ((win->attr.visible != ovisible) ||
993 (win->attr.raise != oraise)) {
995 if (((hint == 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_VISIBLE) &&
996 (win->attr.eventmask & ICO_UXF_EVENT_VISIBLE)) ||
997 ((hint != 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_VISIBLE_REQ) &&
998 (win->attr.eventmask & ICO_UXF_EVENT_VISIBLE_REQ))) {
1000 que = ico_uxf_alloc_eventque();
1002 (hint == 0) ? ICO_UXF_EVENT_VISIBLE : ICO_UXF_EVENT_VISIBLE_REQ;
1003 que->detail.window.display = win->attr.display;
1004 que->detail.window.window = win->attr.window;
1005 que->detail.window.layer = win->attr.layer;
1006 que->detail.window.x = win->attr.x;
1007 que->detail.window.y = win->attr.y;
1008 que->detail.window.w = win->attr.w;
1009 que->detail.window.h = win->attr.h;
1010 que->detail.window.visible = ovisible;
1011 que->detail.window.raise = oraise;
1012 que->detail.window.active = win->attr.active;
1014 ico_uxf_regist_eventque(que);
1017 ico_uxf_leave_critical();
1020 /*--------------------------------------------------------------------------*/
1022 * @brief ico_uxf_window_configurecb: wayland surface configure callback(static function)
1024 * @param[in] data user data(unused)
1025 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
1026 * @param[in] surfaceid ico_window_mgr surface Id
1027 * @param[in] appid client application Id
1028 * @param[in] x surface upper-left X coodinate
1029 * @param[in] y surface upper-left Y coodinate
1030 * @param[in] width surface width
1031 * @param[in] height surface height
1032 * @param[in] hint client request(1=client request(not changed)/0=changed)
1035 /*--------------------------------------------------------------------------*/
1037 ico_uxf_window_configurecb(void *data, struct ico_window_mgr *ico_window_mgr,
1038 uint32_t surfaceid, const char *appid, int32_t layer,
1039 int32_t x, int32_t y, int32_t width, int32_t height,
1042 Ico_Uxf_Mng_Window *win;
1043 Ico_Uxf_Mng_EventQue *que;
1045 Ico_Uxf_Mng_Process *prc;
1047 #if 0 /* too many logout, change to comment out */
1048 uifw_trace("ico_uxf_window_configurecb: surf=%08x app=%s layer=%d "
1049 "x/y=%d/%d w/h=%d/%d hint=%d",
1050 (int)surfaceid, appid, layer, x, y, width, height, hint);
1051 #endif /* too many logout, change to comment out */
1053 ico_uxf_enter_critical();
1055 win = ico_uxf_mng_window(surfaceid, 0);
1058 win = ico_uxf_mng_window(surfaceid, 1);
1059 display = ICO_UXF_GETDISPLAYID(surfaceid);
1060 win->mng_display = ico_uxf_mng_display(display, 0);
1061 win->mng_layer = ico_uxf_mng_layer(display, layer, 0);
1062 win->attr.eventmask = ICO_UXF_EVENT_NEWWINDOW;
1063 win->attr.display = display;
1064 win->attr.layer = layer;
1065 memset(win->attr.process, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
1066 strncpy(win->attr.process, appid, ICO_UXF_MAX_PROCESS_NAME);
1069 win->attr.w = width;
1070 win->attr.h = height;
1073 prc = ico_uxf_mng_process(appid, 0);
1074 win->mng_process = prc;
1075 if ((prc != NULL) && (prc->attr.mainwin.window != (int)surfaceid)) {
1077 win->attr.subwindow = 1;
1080 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_NEWWINDOW) {
1082 que = ico_uxf_alloc_eventque();
1084 que->detail.event = ICO_UXF_EVENT_NEWWINDOW;
1085 que->detail.window.display = display;
1086 que->detail.window.window = surfaceid;
1087 que->detail.window.layer = layer;
1088 que->detail.window.x = win->attr.x;
1089 que->detail.window.y = win->attr.y;
1090 que->detail.window.w = win->attr.w;
1091 que->detail.window.h = win->attr.h;
1092 que->detail.window.visible = win->attr.visible;
1093 que->detail.window.raise = win->attr.raise;
1094 que->detail.window.active = win->attr.active;
1096 ico_uxf_regist_eventque(que);
1100 if ((win->attr.layer != layer) ||
1101 (win->attr.x != x) || (win->attr.y != y) ||
1102 (win->attr.w != width) || (win->attr.h != height)) {
1104 if (((hint == 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_RESIZE) &&
1105 (win->attr.eventmask & ICO_UXF_EVENT_RESIZE)) ||
1106 ((hint != 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_RESIZE_REQ) &&
1107 (win->attr.eventmask & ICO_UXF_EVENT_RESIZE_REQ))) {
1109 que = ico_uxf_alloc_eventque();
1112 (hint == 0) ? ICO_UXF_EVENT_RESIZE : ICO_UXF_EVENT_RESIZE_REQ;
1113 que->detail.window.display = win->mng_display->attr.display;
1114 que->detail.window.window = win->attr.window;
1115 que->detail.window.layer = layer;
1116 que->detail.window.x = x;
1117 que->detail.window.y = y;
1118 que->detail.window.w = width;
1119 que->detail.window.h = height;
1120 que->detail.window.visible = win->attr.visible;
1121 que->detail.window.raise = win->attr.raise;
1122 que->detail.window.active = win->attr.active;
1124 ico_uxf_regist_eventque(que);
1129 win->attr.w = width;
1130 win->attr.h = height;
1131 if (win->attr.layer != layer) {
1132 win->attr.layer = layer;
1133 win->mng_layer = ico_uxf_mng_layer(win->mng_display->attr.display,
1139 ico_uxf_leave_critical();
1142 /*--------------------------------------------------------------------------*/
1144 * @brief ico_uxf_window_activecb: wayland surface active callback(static function)
1146 * @param[in] data user data(unused)
1147 * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
1148 * @param[in] surfaceid ico_window_mgr surface Id
1149 * @param[in] active surface active(1=active/0=not active)
1152 /*--------------------------------------------------------------------------*/
1154 ico_uxf_window_activecb(void *data, struct ico_window_mgr *ico_window_mgr,
1155 uint32_t surfaceid, uint32_t active)
1157 Ico_Uxf_Mng_Window *win;
1158 Ico_Uxf_Mng_EventQue *que;
1160 uifw_trace("ico_uxf_window_activecb: Enter(surf=%08x active=%d)", surfaceid, active);
1162 ico_uxf_enter_critical();
1164 win = ico_uxf_mng_window(surfaceid, 0);
1167 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_ACTIVEWINDOW) {
1169 que = ico_uxf_alloc_eventque();
1171 que->detail.event = ICO_UXF_EVENT_ACTIVEWINDOW;
1172 que->detail.window.display = ICO_UXF_GETDISPLAYID(surfaceid);
1173 que->detail.window.window = surfaceid;
1174 que->detail.window.active = active;
1175 win->attr.active = active;
1177 ico_uxf_regist_eventque(que);
1180 ico_uxf_leave_critical();
1181 uifw_trace("ico_uxf_window_activecb: Leave");
1184 /*--------------------------------------------------------------------------*/
1186 * @brief ico_uxf_input_capabilitiescb: wayland extended input
1187 * input capabilities callback(static function)
1189 * @param[in] data user data(unused)
1190 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1191 * @param[in] device input device name
1192 * @param[in] type input device type
1193 * @param[in] swname input switch name
1194 * @param[in] input input switch number
1195 * @param[in] codename input code name
1196 * @param[in] code input code value
1199 /*--------------------------------------------------------------------------*/
1201 ico_uxf_input_capabilitiescb(void *data, struct ico_exinput *ico_exinput,
1202 const char *device, int32_t type, const char *swname,
1203 int32_t input, const char *codename, int32_t code)
1206 Ico_Uxf_Sys_Config *sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
1207 Ico_Uxf_InputDev *inputdev;
1208 Ico_Uxf_InputDev *bpdev;
1209 Ico_Uxf_InputSw *inputsw;
1210 Ico_Uxf_InputSw *bpsw;
1212 uifw_trace("ico_uxf_input_capabilitiescb: "
1213 "Enter(device=%s type=%d sw=%s input=%d code=%s[%d])",
1214 device, type, swname, input, codename, code);
1216 if (! sysconf) return;
1218 /* search and create input device table */
1220 inputdev = gIco_Uxf_Api_Mng.InputDev;
1222 if (strcasecmp(inputdev->device, device) == 0) break;
1224 inputdev = inputdev->next;
1227 inputdev = malloc(sizeof(Ico_Uxf_InputDev));
1229 uifw_error("ico_uxf_input_capabilitiescb: Leave(No Memory)");
1232 memset(inputdev, 0, sizeof(Ico_Uxf_InputDev));
1235 bpdev->next = inputdev;
1238 gIco_Uxf_Api_Mng.InputDev = inputdev;
1241 strncpy(inputdev->device, device, sizeof(inputdev->device)-1);
1242 inputdev->type = type;
1245 inputsw = inputdev->inputSw;
1247 if (strcasecmp(inputsw->swname, swname) == 0) break;
1249 inputsw = inputsw->next;
1252 inputsw = malloc(sizeof(Ico_Uxf_InputSw));
1254 uifw_error("ico_uxf_input_capabilitiescb: Leave(No Memory)");
1258 bpsw->next = inputsw;
1261 inputdev->inputSw = inputsw;
1263 inputdev->numInputSw ++;
1265 memset(inputsw, 0, sizeof(Ico_Uxf_InputSw));
1266 strncpy(inputsw->swname, swname, sizeof(inputsw->swname)-1);
1267 inputsw->input = input;
1268 inputsw->numCode = 1;
1269 inputsw->inputCode[0].code = code;
1270 strncpy(inputsw->inputCode[0].codename, codename,
1271 sizeof(inputsw->inputCode[0].codename)-1);
1272 uifw_trace("ico_uxf_input_capabilitiescb: create new inputsw");
1274 /* send fixed application if fixed switch */
1275 for (i = 0; i < sysconf->inputdevNum; i++) {
1276 if (strcasecmp(sysconf->inputdev[i].name, inputdev->device) != 0) continue;
1278 for (j = 0; j < sysconf->inputdev[i].inputswNum; j++) {
1279 if (! sysconf->inputdev[i].inputsw[j].appid) continue;
1280 if (strcasecmp(sysconf->inputdev[i].inputsw[j].name,
1281 inputsw->swname) != 0) continue;
1283 uifw_trace("ico_uxf_input_capabilitiescb: input %s.%s = %s",
1284 inputdev->device, inputsw->swname,
1285 sysconf->inputdev[i].inputsw[j].appid);
1286 ico_input_mgr_control_add_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr,
1287 sysconf->inputdev[i].inputsw[j].appid,
1288 inputdev->device, inputsw->input, 1);
1293 uifw_trace("ico_uxf_input_capabilitiescb: Leave");
1296 /*--------------------------------------------------------------------------*/
1298 * @brief ico_uxf_input_codecb: wayland extended input
1299 * input code callback(static function)
1301 * @param[in] data user data(unused)
1302 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1303 * @param[in] device input device name
1304 * @param[in] input input switch number
1305 * @param[in] codename input code name
1306 * @param[in] code input code value
1309 /*--------------------------------------------------------------------------*/
1311 ico_uxf_input_codecb(void *data, struct ico_exinput *ico_exinput, const char *device,
1312 int32_t input, const char *codename, int32_t code)
1315 Ico_Uxf_InputDev *inputdev;
1316 Ico_Uxf_InputSw *inputsw;
1318 uifw_trace("ico_uxf_input_codecb: device=%s input=%d code=%s[%d]",
1319 device, input, codename, code);
1321 /* search input device table */
1322 inputdev = gIco_Uxf_Api_Mng.InputDev;
1324 if (strcasecmp(inputdev->device, device) == 0) break;
1325 inputdev = inputdev->next;
1328 uifw_error("ico_uxf_input_codecb: device.%s dose not exist", device);
1332 /* search input switch */
1333 inputsw = inputdev->inputSw;
1335 if (inputsw->input == input) break;
1336 inputsw = inputsw->next;
1339 uifw_error("ico_uxf_input_codecb: device.%s input=%d dose not exist",
1343 for (i = 0; i < inputsw->numCode; i++) {
1344 if (inputsw->inputCode[i].code == code) break;
1346 if (i >= inputsw->numCode) {
1348 uifw_error("ico_uxf_input_codecb: device.%s input=%d number of codes overflow",
1352 inputsw->numCode ++;
1353 i = inputsw->numCode - 1;
1355 memset(inputsw->inputCode[i].codename, 0, sizeof(inputsw->inputCode[i].codename));
1356 strncpy(inputsw->inputCode[i].codename, codename,
1357 sizeof(inputsw->inputCode[i].codename)-1);
1358 inputsw->inputCode[i].code = code;
1361 /*--------------------------------------------------------------------------*/
1363 * @brief ico_uxf_input_inputcb: wayland extended input
1364 * input switch callback(static function)
1366 * @param[in] data user data(unused)
1367 * @param[in] ico_exinput wayland ico_input_mgr plugin interface
1368 * @param[in] time input time(miri-sec)
1369 * @param[in] device input device name
1370 * @param[in] input input switch number
1371 * @param[in] code input code value
1372 * @param[in] state input state(1=switch On/0=switch Off)
1375 /*--------------------------------------------------------------------------*/
1377 ico_uxf_input_inputcb(void *data, struct ico_exinput *ico_exinput, uint32_t time,
1378 const char *device, int32_t input, int32_t code, int32_t state)
1380 Ico_Uxf_Mng_EventQue *que;
1381 uifw_trace("ico_uxf_input_inputcb: device=%s input=%d code=%d state=%d",
1382 device, input, code, state);
1384 if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_EXINPUT) {
1386 ico_uxf_enter_critical();
1387 que = ico_uxf_alloc_eventque();
1389 strncpy(que->detail.exinput.device, device,
1390 sizeof(que->detail.exinput.device)-1);
1391 que->detail.exinput.input = input;
1392 que->detail.exinput.code = code;
1393 que->detail.exinput.state = state;
1395 ico_uxf_regist_eventque(que);
1396 ico_uxf_leave_critical();
1400 /*--------------------------------------------------------------------------*/
1402 * @brief ico_uxf_aul_aulcb: AppCore(AUL) application launch/dead callback(static function)
1404 * @param[in] pid target application process Id
1405 * @param[in] data user data(0=launch, 1=dead)
1406 * @return result(always 0, means success)
1408 /*--------------------------------------------------------------------------*/
1410 ico_uxf_aul_aulcb(int pid, void *data)
1412 Ico_Uxf_Mng_Process *proc;
1414 Ico_Uxf_Mng_EventQue *que;
1416 char appid[ICO_UXF_MAX_PROCESS_NAME+1];
1419 memset(appid, 0, sizeof(appid));
1421 (void) aul_app_get_appid_bypid(pid, appid, sizeof(appid));
1422 uifw_trace("ico_uxf_aul_aulcb: Enter(pid=%d, dead=No, appid=%s)", pid, appid);
1425 uifw_trace("ico_uxf_aul_aulcb: Enter(pid=%d, dead=Yes)", pid);
1427 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1428 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1430 if (proc->attr.internalid == pid) break;
1431 if (strcmp(proc->attr.process, appid) == 0) break;
1432 proc = proc->nextidhash;
1437 /* not handle process, */
1438 /* or the process is correctly terminated by ico_uxf_process_terminate */
1439 uifw_trace("ico_uxf_aul_aulcb: Leave(not find)");
1442 uifw_trace("ico_uxf_aul_aulcb: find(appid=%s)", proc->attr.process);
1444 ico_uxf_enter_critical();
1446 que = ico_uxf_alloc_eventque();
1447 strncpy(que->detail.process.process, proc->attr.process, ICO_UXF_MAX_PROCESS_NAME);
1449 que->detail.event = ICO_UXF_EVENT_TERMPROCESS;
1450 que->detail.process.status = ICO_UXF_PROCSTATUS_STOP;
1452 /* delete process info */
1453 proc->attr.status = ICO_UXF_PROCSTATUS_STOP;
1454 proc->attr.internalid = -1;
1455 proc->attr.mainwin.window = 0;
1456 ico_uxf_free_procwin(proc);
1459 que->detail.event = ICO_UXF_EVENT_EXECPROCESS;
1460 que->detail.process.status = ICO_UXF_PROCSTATUS_RUN;
1462 /* setup process info */
1463 if (proc->attr.status != ICO_UXF_PROCSTATUS_RUN) {
1464 proc->attr.internalid = pid;
1465 if (proc->attr.status != ICO_UXF_PROCSTATUS_INIT) {
1466 /* child process, search parent process */
1467 uifw_trace("ico_uxf_aul_aulcb: fork&exec %s", proc->attr.process);
1468 proc->attr.child = 1;
1469 /* save parent application if exist */
1470 if (gIco_Uxf_Api_Mng.Mng_LastProcess != proc) {
1471 proc->parent = gIco_Uxf_Api_Mng.Mng_LastProcess;
1474 uifw_trace("ico_uxf_aul_aulcb: same process %s real %s", proc->attr.process,
1475 proc->parent ? proc->parent->attr.process : "(None)");
1479 proc->attr.child = 0;
1481 proc->attr.status = ICO_UXF_PROCSTATUS_RUN;
1486 ico_uxf_regist_eventque(que);
1488 ico_uxf_leave_critical();
1490 uifw_trace("ico_uxf_aul_aulcb: Leave");
1494 /*--------------------------------------------------------------------------*/
1496 * @brief ico_uxf_set_lastapp: save last application
1498 * @param[in] appid applicationId (if NULL, no last application)
1501 /*--------------------------------------------------------------------------*/
1503 ico_uxf_set_lastapp(const char *appid)
1506 gIco_Uxf_Api_Mng.Mng_LastProcess = ico_uxf_mng_process(appid, 0);
1509 gIco_Uxf_Api_Mng.Mng_LastProcess = NULL;
1513 /*--------------------------------------------------------------------------*/
1515 * @brief ico_uxf_getchild_appid: get child applicationId
1517 * @param[in] appid parent applicationId
1518 * @return last child applicationId
1519 * @retval !=NULL success(applicationId)
1520 * @retval ==NULL no child application
1522 /*--------------------------------------------------------------------------*/
1524 ico_uxf_getchild_appid(const char *appid)
1526 Ico_Uxf_Mng_Process *pproc;
1527 Ico_Uxf_Mng_Process *proc;
1530 pproc = ico_uxf_mng_process(appid, 0);
1532 /* unknown parent application, no child */
1533 uifw_trace("ico_uxf_getchild_appid: Unknown parent(%s)", appid);
1538 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1539 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1541 if (proc->parent == pproc) {
1542 uifw_trace("ico_uxf_getchild_appid: child(%s) parent(%s)",
1543 proc->attr.process, appid);
1544 return proc->attr.process;
1546 proc = proc->nextidhash;
1549 uifw_trace("ico_uxf_getchild_appid: parent(%s) has no child", appid);
1553 /*--------------------------------------------------------------------------*/
1555 * @brief ico_uxf_set_lastapp: save last application
1557 * @param[in] appid applicationId (if NULL, no last application)
1560 /*--------------------------------------------------------------------------*/
1562 ico_uxf_timer_wake(const int msec)
1564 Ico_Uxf_Mng_Process *proc;
1567 if (gIco_Uxf_Api_Mng.InitTimer > 0) {
1568 gIco_Uxf_Api_Mng.InitTimer -= msec;
1569 if (gIco_Uxf_Api_Mng.InitTimer > 0) {
1572 gIco_Uxf_Api_Mng.InitTimer = 0;
1575 if (gIco_Uxf_Api_Mng.NeedTimer == 0) {
1578 gIco_Uxf_Api_Mng.NeedTimer = 0;
1579 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
1580 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1582 if (proc->susptimer > 0) {
1583 if (msec >= proc->susptimer) {
1584 proc->susptimer = 0;
1585 if (proc->attr.suspend) {
1586 if (proc->susp == 0) {
1588 uifw_trace("ico_uxf_timer_wake: CPU suspend pid=%d",
1589 proc->attr.internalid);
1590 kill(proc->attr.internalid, SIGSTOP);
1593 else if (proc->susp == 0) {
1594 uifw_trace("ico_uxf_timer_wake: CPU resume pid=%d(show=%d)",
1595 proc->attr.internalid, proc->showmode);
1596 ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
1597 proc->attr.mainwin.window,
1599 ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION ?
1600 ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION :
1601 ICO_WINDOW_MGR_VISIBLE_SHOW,
1602 ICO_WINDOW_MGR_RAISE_NOCHANGE);
1603 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
1607 proc->susptimer -= msec;
1608 gIco_Uxf_Api_Mng.NeedTimer ++;
1611 proc = proc->nextidhash;
1616 /*--------------------------------------------------------------------------*/
1618 * @brief ico_uxf_enter_critical: enter critical section(internal function)
1623 /*--------------------------------------------------------------------------*/
1625 ico_uxf_enter_critical(void)
1627 if (pthread_mutex_lock(&sMutex)) {
1628 uifw_error("ico_uxf_enter_critical: Error<%d>", errno);
1632 /*--------------------------------------------------------------------------*/
1634 * @brief ico_uxf_leave_critical: leave critical section(internal function)
1639 /*--------------------------------------------------------------------------*/
1641 ico_uxf_leave_critical(void)
1643 if (pthread_mutex_unlock(&sMutex)) {
1644 uifw_error("ico_uxf_leave_critical: Error<%d>", errno);
1648 /*--------------------------------------------------------------------------*/
1650 * @brief ico_uxf_alloc_callback: allocate callback management table(internal function)
1653 * @return allocated callback management table address
1655 /*--------------------------------------------------------------------------*/
1656 Ico_Uxf_Mng_Callback *
1657 ico_uxf_alloc_callback(void)
1659 Ico_Uxf_Mng_Callback *p;
1662 p = gIco_Uxf_Api_Mng.CallbackFree;
1664 p = (Ico_Uxf_Mng_Callback *)malloc(sizeof(Ico_Uxf_Mng_Callback) *
1665 ICO_UXF_MNG_BLOCK_ALLOCS);
1667 uifw_error("ico_uxf_alloc_callback: NO Memory (malloc Error)");
1670 gIco_Uxf_Api_Mng.CallbackFree = p;
1672 for (idx = 0; idx < ICO_UXF_MNG_BLOCK_ALLOCS; idx++, p++) {
1673 if (idx != (ICO_UXF_MNG_BLOCK_ALLOCS-1)) {
1677 p->next = (struct _Ico_Uxf_Mng_Callback *)0;
1680 p = gIco_Uxf_Api_Mng.CallbackFree;
1682 gIco_Uxf_Api_Mng.CallbackFree = p->next;
1686 /*--------------------------------------------------------------------------*/
1688 * @brief ico_uxf_free_callback: release callback management table(internal function)
1690 * @param[in] p callback management table address
1693 /*--------------------------------------------------------------------------*/
1695 ico_uxf_free_callback(Ico_Uxf_Mng_Callback *p)
1697 p->next = gIco_Uxf_Api_Mng.CallbackFree;
1698 gIco_Uxf_Api_Mng.CallbackFree = p;
1701 /*--------------------------------------------------------------------------*/
1703 * @brief ico_uxf_regist_callback: register a callback management table(internal function)
1705 * @param[in] p callback management table address
1708 /*--------------------------------------------------------------------------*/
1710 ico_uxf_regist_callback(Ico_Uxf_Mng_Callback *p)
1712 p->next = (struct _Ico_Uxf_Mng_Callback *)0;
1714 if (gIco_Uxf_Api_Mng.Callback) {
1715 gIco_Uxf_Api_Mng.CallbackLast->next = p;
1716 gIco_Uxf_Api_Mng.CallbackLast = p;
1719 gIco_Uxf_Api_Mng.Callback = p;
1720 gIco_Uxf_Api_Mng.CallbackLast = gIco_Uxf_Api_Mng.Callback;
1724 /*--------------------------------------------------------------------------*/
1726 * @brief ico_uxf_remove_callback: remove a callback management table(internal function)
1728 * @param[in] p callback management table address
1731 /*--------------------------------------------------------------------------*/
1733 ico_uxf_remove_callback(Ico_Uxf_Mng_Callback *p)
1735 Ico_Uxf_Mng_Callback *pp;
1736 Ico_Uxf_Mng_Callback *before;
1738 pp = gIco_Uxf_Api_Mng.Callback;
1739 before = (Ico_Uxf_Mng_Callback *)0;
1748 before->next = p->next;
1750 gIco_Uxf_Api_Mng.CallbackLast = before;
1754 gIco_Uxf_Api_Mng.Callback = p->next;
1759 /*--------------------------------------------------------------------------*/
1761 * @brief ico_uxf_alloc_eventque: allocate event queue block(internal function)
1764 * @return allocated event queue control block address
1766 /*--------------------------------------------------------------------------*/
1767 Ico_Uxf_Mng_EventQue
1768 *ico_uxf_alloc_eventque(void)
1770 Ico_Uxf_Mng_EventQue *p;
1773 p = gIco_Uxf_Api_Mng.EventQueFree;
1775 p = (Ico_Uxf_Mng_EventQue *)
1776 malloc(sizeof(Ico_Uxf_Mng_EventQue) * ICO_UXF_MNG_BLOCK_ALLOCS);
1778 uifw_error("ico_uxf_alloc_eventque: NO Memory (malloc Error)");
1781 gIco_Uxf_Api_Mng.EventQueFree = p;
1783 for (idx = 0; idx < ICO_UXF_MNG_BLOCK_ALLOCS; idx++, p++) {
1784 if (idx != (ICO_UXF_MNG_BLOCK_ALLOCS-1)) {
1788 p->next = (struct _Ico_Uxf_Mng_EventQue *)0;
1791 p = gIco_Uxf_Api_Mng.EventQueFree;
1793 gIco_Uxf_Api_Mng.EventQueFree = p->next;
1798 /*--------------------------------------------------------------------------*/
1800 * @brief ico_uxf_free_eventque: release event queue block(internal function)
1802 * @param[in] p event queue control block address
1805 /*--------------------------------------------------------------------------*/
1807 ico_uxf_free_eventque(Ico_Uxf_Mng_EventQue *p)
1809 p->next = gIco_Uxf_Api_Mng.EventQueFree;
1810 gIco_Uxf_Api_Mng.EventQueFree = p;
1813 /*--------------------------------------------------------------------------*/
1815 * @brief ico_uxf_regist_eventque: register a event queue(internal function)
1817 * @param[in] p event queue control block address
1820 /*--------------------------------------------------------------------------*/
1822 ico_uxf_regist_eventque(Ico_Uxf_Mng_EventQue *p)
1824 p->next = (struct _Ico_Uxf_Mng_EventQue *)0;
1826 if (gIco_Uxf_Api_Mng.EventQue) {
1827 gIco_Uxf_Api_Mng.EventQueLast->next = p;
1828 gIco_Uxf_Api_Mng.EventQueLast = p;
1831 gIco_Uxf_Api_Mng.EventQue = p;
1832 gIco_Uxf_Api_Mng.EventQueLast = gIco_Uxf_Api_Mng.EventQue;
1836 /*--------------------------------------------------------------------------*/
1838 * @brief ico_uxf_mng_display: get display management table(internal function)
1840 * @param[in] display display Id
1841 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1842 * @return display management table address
1843 * @retval !=NULL display management table address
1844 * @retval ==NULL display dose not exist(parameter 'create' only 0)
1846 /*--------------------------------------------------------------------------*/
1847 Ico_Uxf_Mng_Display *
1848 ico_uxf_mng_display(const int display, const int create)
1850 Ico_Uxf_Mng_Display *p;
1851 Ico_Uxf_Mng_Display *plast;
1853 p = gIco_Uxf_Api_Mng.Mng_Display;
1854 plast = (Ico_Uxf_Mng_Display *)0;
1856 if (p->attr.display == display) break;
1861 if ((! p) && (create != 0)) {
1863 p = (Ico_Uxf_Mng_Display *) malloc(sizeof(Ico_Uxf_Mng_Display));
1865 uifw_error("ico_uxf_mng_display: NO Memory (malloc Error)");
1868 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Display));
1869 p->attr.display = display;
1874 gIco_Uxf_Api_Mng.Mng_Display = p;
1880 /*--------------------------------------------------------------------------*/
1882 * @brief ico_uxf_mng_layer: get layer management table(internal function)
1884 * @param[in] display display Id
1885 * @param[in] layer layer Id
1886 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1887 * @return layer management table address
1888 * @retval !=NULL layer management table address
1889 * @retval ==NULL layer dose not exist(parameter 'create' only 0)
1891 /*--------------------------------------------------------------------------*/
1893 ico_uxf_mng_layer(const int display, const int layer, const int create)
1895 Ico_Uxf_Mng_Layer *p;
1896 Ico_Uxf_Mng_Layer *plast;
1898 p = gIco_Uxf_Api_Mng.Mng_Layer;
1899 plast = (Ico_Uxf_Mng_Layer *)0;
1901 if ((p->attr.display == display) &&
1902 (p->attr.layer == layer)) break;
1907 if ((! p) && (create != 0)) {
1909 p = (Ico_Uxf_Mng_Layer *) malloc(sizeof(Ico_Uxf_Mng_Layer));
1911 uifw_error("ico_uxf_mng_layer: NO Memory (malloc Error)");
1914 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Layer));
1915 p->attr.layer = layer;
1920 gIco_Uxf_Api_Mng.Mng_Layer = p;
1926 /*--------------------------------------------------------------------------*/
1928 * @brief ico_uxf_mng_window: get window management table(internal function)
1930 * @param[in] window window Id(same as ico_window_mgr surface Id)
1931 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1932 * @return window management table address
1933 * @retval !=NULL window management table address
1934 * @retval ==NULL window dose not exist(parameter 'create' only 0)
1936 /*--------------------------------------------------------------------------*/
1937 Ico_Uxf_Mng_Window *
1938 ico_uxf_mng_window(const int window, const int create)
1940 Ico_Uxf_Mng_Window *p;
1941 Ico_Uxf_Mng_Window *plast = (Ico_Uxf_Mng_Window *)0;
1944 hash = ICO_UXF_MISC_HASHBYID(window);
1945 p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
1947 if (p->attr.window == window) break;
1952 if ((! p) && (create != 0)) {
1954 p = (Ico_Uxf_Mng_Window *) malloc(sizeof(Ico_Uxf_Mng_Window));
1956 uifw_error("ico_uxf_mng_window: NO Memory (malloc Error)");
1959 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Window));
1960 p->attr.window = window;
1962 plast->nextidhash = p;
1965 gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
1967 uifw_trace("ico_uxf_mng_window: Create New Table=%08x", (int)p);
1972 /*--------------------------------------------------------------------------*/
1974 * @brief ico_uxf_mng_process: get process management table(internal function)
1976 * @param[in] process application Id
1977 * @param[in] create create flag(1=create tabell if not exist/0=not create)
1978 * @return process management table address
1979 * @retval !=NULL process management table address
1980 * @retval ==NULL process dose not exist(parameter 'create' only 0)
1982 /*--------------------------------------------------------------------------*/
1983 Ico_Uxf_Mng_Process *
1984 ico_uxf_mng_process(const char *process, const int create)
1986 Ico_Uxf_Mng_Process *p;
1987 Ico_Uxf_Mng_Process *plast = (Ico_Uxf_Mng_Process *)0;
1990 hash = ICO_UXF_MISC_HASHBYNAME(process);
1991 p = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
1993 if(strncmp(p->attr.process, process, ICO_UXF_MAX_PROCESS_NAME) == 0) break;
1998 if ((! p) && (create != 0)) {
2000 p = (Ico_Uxf_Mng_Process *) malloc(sizeof(Ico_Uxf_Mng_Process));
2002 uifw_error("ico_uxf_mng_process: NO Memory (malloc Error)");
2005 memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Process));
2006 strncpy(p->attr.process, process, ICO_UXF_MAX_PROCESS_NAME);
2008 plast->nextidhash = p;
2011 gIco_Uxf_Api_Mng.Hash_ProcessId[hash] = p;
2017 /*--------------------------------------------------------------------------*/
2019 * @brief ico_uxf_update_procwin: update a process management table
2021 * @param[in] appid application id
2022 * @param[in] type type(install/uninstall)
2023 * @param[in] func window create/destroy hook function
2026 /*--------------------------------------------------------------------------*/
2028 ico_uxf_update_procwin(const char *appid, int type)
2030 Ico_Uxf_Mng_Process *prc = NULL;
2031 Ico_Uxf_Sys_Config *sysconf;
2032 Ico_Uxf_App_Config *appconf;
2033 Ico_Uxf_conf_appdisplay *appdsp;
2035 Ico_Uxf_conf_application *app = NULL;
2037 uifw_trace("ico_uxf_update_procwin: Enter(appid=%s, type=%d)", appid, type);
2039 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
2040 uifw_trace("ico_uxf_callback_remove: Leave(not initialized)");
2043 prc = ico_uxf_mng_process(appid, 0);
2045 if (type == ICO_UXF_CONF_EVENT_INSTALL) {
2047 sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
2048 appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
2049 if ((sysconf == NULL) || (appconf == NULL)) {
2050 uifw_trace("ico_uxf_update_procwin: Leave(cannot find tables)");
2053 for (dn = 0; dn < appconf->applicationNum; dn++) {
2054 app = &appconf->application[dn];
2055 if (strncmp(app->appid, appid, ICO_UXF_MAX_PROCESS_NAME) == 0) {
2056 uifw_trace("ico_uxf_update_procwin: Install(%s)", appid);
2057 /* add process management table */
2058 prc = ico_uxf_mng_process(appid, 1);
2059 prc->attr.internalid = 0;
2060 prc->attr.status = ICO_UXF_PROCSTATUS_STOP;
2061 prc->attr.type = app->categoryId;
2062 prc->attr.hostId = app->hostId;
2063 prc->attr.myHost = (prc->attr.hostId == sysconf->misc.myhostId) ? 1 : 0;
2065 appdsp = &app->display[0];
2066 prc->attr.mainwin.window = 0;
2067 prc->attr.mainwin.windowtype = app->categoryId;
2068 prc->attr.mainwin.display = appdsp->displayId;
2069 prc->attr.mainwin.layer = appdsp->layerId;
2070 prc->attr.mainwin.x =
2071 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
2072 prc->attr.mainwin.y =
2073 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
2074 prc->attr.mainwin.w =
2075 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
2076 prc->attr.mainwin.h =
2077 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
2078 prc->attr.mainwin.name[ICO_UXF_MAX_WIN_NAME] = 0;
2079 prc->attr.numwindows = app->displayzoneNum;
2080 /* get sub windows */
2081 if (prc->attr.numwindows > 1) {
2082 prc->attr.subwin = malloc(sizeof(Ico_Uxf_ProcessWin) *
2083 (prc->attr.numwindows - 1));
2084 if (! prc->attr.subwin) {
2085 uifw_trace("ico_uxf_update_procwin: Install(No memory)");
2086 app->displayzoneNum = 1;
2087 prc->attr.numwindows = 1;
2090 memset(prc->attr.subwin, 0, (prc->attr.numwindows - 1));
2091 for (tn = 0; tn < (prc->attr.numwindows - 1); tn++) {
2093 prc->attr.subwin[tn].windowtype = prc->attr.mainwin.windowtype;
2094 prc->attr.subwin[tn].display = appdsp->displayId;
2095 prc->attr.subwin[tn].layer = appdsp->layerId;
2096 prc->attr.subwin[tn].x =
2097 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
2098 prc->attr.subwin[tn].y =
2099 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
2100 prc->attr.subwin[tn].w =
2101 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
2102 prc->attr.subwin[tn].h =
2103 sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
2111 else if (type == ICO_UXF_CONF_EVENT_UNINSTALL) {
2113 /* not delete process management table */
2117 uifw_trace("ico_uxf_update_procwin: Leave");
2122 /*--------------------------------------------------------------------------*/
2124 * @brief ico_uxf_window_screen_size_get: get display physical size
2126 * @param[out] width variable to receive the width of the display
2127 * @param[out] height variable to receive the height of the display
2130 /*--------------------------------------------------------------------------*/
2132 ico_uxf_window_screen_size_get(int *width, int *height)
2134 Ico_Uxf_Mng_Display *dsp;
2135 dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
2137 uifw_trace("ico_uxf_window_screen_size_get: Enter(dsp=%d(%d))",
2138 dsp, gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display);
2140 if ((dsp != NULL) && (width != NULL) && (height != NULL)) {
2141 uifw_trace("ico_uxf_window_screen_size_get: %dx%d",
2142 dsp->attr.pWidth, dsp->attr.pHeight);
2143 *width = dsp->attr.pWidth;
2144 *height = dsp->attr.pHeight;
2148 /*--------------------------------------------------------------------------*/
2150 * @brief ico_uxf_window_hook: set window create/destroy hook function
2152 * @param[in] func window create/destroy hook function
2155 /*--------------------------------------------------------------------------*/
2157 ico_uxf_window_hook(Ico_Uxf_Hook func)
2159 uifw_trace("ico_uxf_window_hook: Window Control Hook=%08x", (int)func);
2161 gIco_Uxf_Api_Mng.Hook_Window = func;