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 header file of Window control for HomeScreen
23 #include "ico_uxf_conf.h"
24 #include "ico_uxf_private.h"
25 #include "ico_window_mgr-client-protocol.h"
27 extern Ico_Uxf_Api_Mng gIco_Uxf_Api_Mng;
29 /*--------------------------------------------------------------------------*/
31 * @brief ico_uxf_window_visible_control: window visible control(internal function)
33 * @param[in] winmng process management table
34 * @param[in] show show(1)/hide(0)/nochange(other)
35 * @param[in] raise raise(1)/lower(0)/nochange(other)
38 /*--------------------------------------------------------------------------*/
40 ico_uxf_window_visible_control(Ico_Uxf_Mng_Window *winmng, const int show, const int raise)
42 int showshow = show & 0x0ffff;
44 uifw_trace("ico_uxf_window_visible_control: send visible to weston(%s,%08x,%x,%d)",
45 (winmng->mng_process)->attr.process, winmng->attr.window, showshow, raise);
47 if ((showshow & (~ICO_UXF_WITHANIMA)) == ICO_WINDOW_MGR_VISIBLE_SHOW) {
49 if (((winmng->mng_process)->attr.invisiblecpu == 0) &&
50 ((winmng->mng_process)->attr.suspend != 0)) {
52 /* change to show, application resume */
53 (winmng->mng_process)->attr.suspend = 0;
54 (winmng->mng_process)->susptimer = 0;
55 if ((winmng->mng_process)->susp) {
56 (winmng->mng_process)->susp = 0;
57 (winmng->mng_process)->showmode = showshow;
58 (winmng->mng_process)->susptimer = ICO_UXF_SUSP_DELAY;
59 gIco_Uxf_Api_Mng.NeedTimer = 1;
60 kill((winmng->mng_process)->attr.internalid, SIGCONT);
61 uifw_trace("ico_uxf_window_visible_control: CPU resume(%s)",
62 (winmng->mng_process)->attr.process);
63 if ((raise == ICO_WINDOW_MGR_RAISE_RAISE) ||
64 (raise == ICO_WINDOW_MGR_RAISE_LOWER)) {
65 ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
67 ICO_WINDOW_MGR_V_NOCHANGE, raise,
68 ICO_WINDOW_MGR_ANIMATION_NOANIMATION);
69 if ((show & 0x00010000) == 0) {
70 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
76 else if (((winmng->mng_process)->showmode & (~ICO_UXF_WITHANIMA)) ==
77 ICO_WINDOW_MGR_VISIBLE_SHOW) {
82 /* send visible control to Weston(Multi Window Manager) */
83 ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
84 winmng->attr.window, showshow & (~ICO_UXF_WITHANIMA), raise,
85 (showshow & ICO_UXF_WITHANIMA) ?
86 ICO_WINDOW_MGR_ANIMATION_ANIMATION :
87 ICO_WINDOW_MGR_ANIMATION_NOANIMATION);
88 if ((show & 0x00010000) == 0) {
89 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
91 if (((showshow & (~ICO_UXF_WITHANIMA)) == ICO_WINDOW_MGR_VISIBLE_HIDE) &&
92 ((winmng->mng_process)->attr.invisiblecpu == 0) &&
93 ((winmng->mng_process)->attr.suspend == 0)) {
94 /* change to hide, application suspend */
95 (winmng->mng_process)->attr.suspend = 1;
96 (winmng->mng_process)->showmode = showshow;
97 (winmng->mng_process)->susptimer = ICO_UXF_SUSP_DELAY;
98 gIco_Uxf_Api_Mng.NeedTimer = 1;
99 uifw_trace("ico_uxf_window_visible_control: set CPU suspend(%s)",
100 (winmng->mng_process)->attr.process);
103 (winmng->mng_process)->showmode = 0xff;
104 (winmng->mng_process)->susptimer = 0;
108 /*--------------------------------------------------------------------------*/
110 * @brief ico_uxf_window_layer: Set window layer
112 * @param[in] window window Id
113 * @param[in] layer layer Id
115 * @retval ICO_UXF_EOK success
116 * @retval ICO_UXF_ESRCH error(not initialized)
117 * @retval ICO_UXF_ENOENT error(window or layer dose not exist)
119 /*--------------------------------------------------------------------------*/
121 ico_uxf_window_layer(const int window, const int layer)
123 Ico_Uxf_Mng_Window *winmng;
124 Ico_Uxf_Mng_Layer *layermng;
126 uifw_trace("ico_uxf_window_layer: Enter(%08x,%d)", window, layer);
128 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
129 uifw_warn("ico_uxf_window_layer: Leave(ESRCH)");
130 return ICO_UXF_ESRCH;
133 winmng = ico_uxf_mng_window(window, 0);
134 if ((! winmng) || (! winmng->mng_display)) {
135 uifw_warn("ico_uxf_window_layer: Leave(ENOENT)");
136 return ICO_UXF_ENOENT;
139 layermng = ico_uxf_mng_layer(winmng->attr.display, layer, 0);
140 if ((! layermng) || (! layermng->mng_display)) {
141 uifw_warn("ico_uxf_window_layer: Leave(ENOENT)");
142 return ICO_UXF_ENOENT;
145 uifw_trace("ico_uxf_window_layer: ico_window_mgr_set_window_layer(%08x,%d)",
147 winmng->mng_layer = layermng;
148 ico_window_mgr_set_window_layer(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window, layer);
149 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
151 uifw_trace("ico_uxf_window_layer: Leave(EOK)");
155 /*--------------------------------------------------------------------------*/
157 * @brief ico_uxf_layer_visible: Control layer visibility
159 * @param[in] display display Id
160 * @param[in] layer layer Id
161 * @param[in] visible layer show(1)/hide(0)
163 * @retval ICO_UXF_EOK success
164 * @retval ICO_UXF_ESRCH error(not initialized)
165 * @retval ICO_UXF_ENOENT error(layer dose not exist)
167 /*--------------------------------------------------------------------------*/
169 ico_uxf_layer_visible(const int display, const int layer, const int visible)
171 Ico_Uxf_Mng_Layer *layermng;
173 uifw_trace("ico_uxf_layer_visible: Enter(%d,%d,%d)", display, layer, visible);
175 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
176 uifw_warn("ico_uxf_layer_visible: Leave(ESRCH)");
177 return ICO_UXF_ESRCH;
180 layermng = ico_uxf_mng_layer(display, layer, 0);
181 if ((! layermng) || (! layermng->mng_display)) {
182 uifw_warn("ico_uxf_layer_visible: Leave(ENOENT)");
183 return ICO_UXF_ENOENT;
186 uifw_trace("ico_uxf_layer_visible: ico_window_mgr_set_layer_visible(%d,%d)",
188 ico_window_mgr_set_layer_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr, layer, visible);
189 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
191 uifw_trace("ico_uxf_layer_visible: Leave(EOK)");
195 /*--------------------------------------------------------------------------*/
197 * @brief ico_uxf_window_resize: resize window(surface) size
199 * @param[in] window window Id(same as ico_window_mgr surface Id)
200 * @param[in] w window width
201 * @param[in] h window height
203 * @retval ICO_UXF_EOK success
204 * @retval ICO_UXF_ESRCH error(not initialized)
205 * @retval ICO_UXF_ENOENT error(layer dose not exist)
207 /*--------------------------------------------------------------------------*/
209 ico_uxf_window_resize(const int window, const int w, const int h)
211 Ico_Uxf_Mng_Window *winmng;
213 uifw_trace("ico_uxf_window_resize: Enter(%08x,%d,%d)", window, w, h);
215 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
216 uifw_warn("ico_uxf_window_resize: Leave(ESRCH)");
217 return ICO_UXF_ESRCH;
220 winmng = ico_uxf_mng_window(window, 0);
221 if ((! winmng) || (! winmng->mng_layer)) {
222 uifw_warn("ico_uxf_window_resize: Leave(ENOENT)");
223 return ICO_UXF_ENOENT;
226 if ((w <= 0) || (w > winmng->mng_layer->attr.w) ||
227 (h <= 0) || (h > winmng->mng_layer->attr.h)) {
228 uifw_warn("ico_uxf_window_resize: Leave(EINVAL)");
229 return ICO_UXF_EINVAL;
235 ico_window_mgr_set_positionsize(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window,
237 ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_V_NOCHANGE,
238 winmng->attr.w, winmng->attr.h,
239 ICO_WINDOW_MGR_ANIMATION_NOANIMATION);
240 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
242 uifw_trace("ico_uxf_window_resize: Leave(EOK)");
246 /*--------------------------------------------------------------------------*/
248 * @brief ico_uxf_window_move: move window(surface) geometry
250 * @param[in] window window Id(same as ico_window_mgr surface Id)
251 * @param[in] x window upper-left X coodinate of display
252 * @param[in] y window upper-left Y coodinate of display
253 * @param[in] animation move with animation(=1)/no animation(=0)
255 * @retval ICO_UXF_EOK success
256 * @retval ICO_UXF_ESRCH error(not initialized)
257 * @retval ICO_UXF_ENOENT error(layer dose not exist)
259 /*--------------------------------------------------------------------------*/
261 ico_uxf_window_move(const int window, const int x, const int y, const int animation)
263 Ico_Uxf_Mng_Window *winmng;
265 uifw_trace("ico_uxf_window_move: Enter(%08x,%d,%d,%d)", window, x, y, animation);
267 if(gIco_Uxf_Api_Mng.Initialized <= 0) {
268 uifw_warn("ico_uxf_window_move: Leave(ESRCH)");
269 return ICO_UXF_ESRCH;
272 winmng = ico_uxf_mng_window(window, 0);
273 if ((! winmng) || (! winmng->mng_layer)) {
274 uifw_warn("ico_uxf_window_move: Leave(ENOENT)");
275 return ICO_UXF_ENOENT;
281 ico_window_mgr_set_positionsize(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window,
282 winmng->attr.node, winmng->attr.x, winmng->attr.y,
283 ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_V_NOCHANGE,
285 ICO_WINDOW_MGR_ANIMATION_NOANIMATION :
286 ICO_WINDOW_MGR_ANIMATION_ANIMATION);
287 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
289 uifw_trace("ico_uxf_window_move: Leave(EOK)");
293 /*--------------------------------------------------------------------------*/
295 * @brief ico_uxf_window_raise: raise window(surface)
297 * @param[in] window window Id(same as ico_window_mgr surface Id)
299 * @retval ICO_UXF_EOK success
300 * @retval ICO_UXF_ESRCH error(not initialized)
301 * @retval ICO_UXF_ENOENT error(layer dose not exist)
303 /*--------------------------------------------------------------------------*/
305 ico_uxf_window_raise(const int window)
307 Ico_Uxf_Mng_Window *winmng;
309 uifw_trace("ico_uxf_window_raise: Enter(%08x)", window);
311 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
312 uifw_warn("ico_uxf_window_raise: Leave(ESRCH)");
313 return ICO_UXF_ESRCH;
316 winmng = ico_uxf_mng_window(window, 0);
317 if ((! winmng) || (! winmng->mng_display)) {
318 uifw_warn("ico_uxf_window_raise: Leave(ENOENT)");
319 return ICO_UXF_ENOENT;
322 ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_V_NOCHANGE,
323 ICO_WINDOW_MGR_RAISE_RAISE);
325 uifw_trace("ico_uxf_window_raise: Leave(EOK)");
329 /*--------------------------------------------------------------------------*/
331 * @brief ico_uxf_window_lower: lower window(surface)
333 * @param[in] window window Id(same as ico_window_mgr surface Id)
335 * @retval ICO_UXF_EOK success
336 * @retval ICO_UXF_ESRCH error(not initialized)
337 * @retval ICO_UXF_ENOENT error(layer dose not exist)
339 /*--------------------------------------------------------------------------*/
341 ico_uxf_window_lower(const int window)
343 Ico_Uxf_Mng_Window *winmng;
345 uifw_trace("ico_uxf_window_lower: Enter(%08x)", window);
347 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
348 uifw_warn("ico_uxf_window_lower: Leave(ESRCH)");
349 return ICO_UXF_ESRCH;
352 winmng = ico_uxf_mng_window(window, 0);
353 if ((! winmng) || (! winmng->mng_display)) {
354 uifw_warn("ico_uxf_window_lower: Leave(ENOENT)");
355 return ICO_UXF_ENOENT;
358 ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_V_NOCHANGE,
359 ICO_WINDOW_MGR_RAISE_LOWER);
361 uifw_trace("ico_uxf_window_lower: Leave(EOK)");
365 /*--------------------------------------------------------------------------*/
367 * @brief ico_uxf_window_active: active window(surface)
369 * @param[in] window window Id(same as ico_window_mgr surface Id)
370 * @param[in] target target(pointer and/or keyboard)
372 * @retval ICO_UXF_EOK success
373 * @retval ICO_UXF_ESRCH error(not initialized)
374 * @retval ICO_UXF_ENOENT error(layer dose not exist)
376 /*--------------------------------------------------------------------------*/
378 ico_uxf_window_active(const int window, const int target)
380 Ico_Uxf_Mng_Window *winmng;
381 Ico_Uxf_Mng_Process *proc;
382 Ico_Uxf_Mng_Process *aproc;
385 uifw_trace("ico_uxf_window_active: Enter(%08x,%x)", window, target);
387 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
388 uifw_warn("ico_uxf_window_active: Leave(ESRCH)");
389 return ICO_UXF_ESRCH;
392 winmng = ico_uxf_mng_window(window, 0);
393 if ((! winmng) || (! winmng->mng_display)) {
394 uifw_warn("ico_uxf_window_active: Leave(ENOENT)");
395 return ICO_UXF_ENOENT;
398 uifw_trace("ico_uxf_window_active: ico_window_mgr_set_active(%08x)", window);
399 ico_window_mgr_set_active(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window, target);
400 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
402 /* reset all active window widthout target window */
403 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
404 winmng = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
406 if (winmng->attr.window == window) {
407 winmng->attr.active = target;
411 winmng->attr.active = 0;
414 winmng->attr.active &= ~target;
417 winmng = winmng->nextidhash;
421 /* reset all active application without this application */
423 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
424 proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
426 if (proc->attr.mainwin.window == window) {
431 proc->attr.active = 0;
434 proc->attr.active &= ~target;
437 proc = proc->nextidhash;
441 aproc->attr.active = target;
443 uifw_trace("ico_uxf_window_active: Leave(EOK)");
447 /*--------------------------------------------------------------------------*/
449 * @brief ico_uxf_window_event_mask: set window(surface) event mask
451 * @param[in] window window Id(same as ico_window_mgr surface Id)
452 * @param[in] mask event mask
454 * @retval ICO_UXF_EOK success
455 * @retval ICO_UXF_ESRCH error(not initialized)
456 * @retval ICO_UXF_ENOENT error(layer dose not exist)
458 /*--------------------------------------------------------------------------*/
460 ico_uxf_window_event_mask(const int window, const unsigned int mask)
462 Ico_Uxf_Mng_Window *winmng;
464 uifw_trace("ico_uxf_window_event_mask: Enter(%08x,%08x)", window, mask);
466 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
467 uifw_warn("ico_uxf_window_event_mask: Leave(ESRCH)");
468 return ICO_UXF_ESRCH;
471 winmng = ico_uxf_mng_window(window, 0);
473 uifw_warn("ico_uxf_window_event_mask: Leave(ENOENT)");
474 return ICO_UXF_ENOENT;
477 winmng->attr.eventmask = mask;
479 uifw_trace("ico_uxf_window_event_mask: Leave(EOK)");
483 /*--------------------------------------------------------------------------*/
485 * @brief ico_uxf_window_attribute_get: get window(surface) attribute
487 * @param[in] window window Id(same as ico_window_mgr surface Id)
488 * @param[out] attr window attribute
490 * @retval ICO_UXF_EOK success
491 * @retval ICO_UXF_ESRCH error(not initialized)
492 * @retval ICO_UXF_ENOENT error(layer dose not exist)
494 /*--------------------------------------------------------------------------*/
496 ico_uxf_window_attribute_get(const int window, Ico_Uxf_WindowAttr *attr)
498 Ico_Uxf_Mng_Window *winmng;
500 uifw_trace("ico_uxf_window_attribute_get: Enter(%08x)", window);
502 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
503 uifw_warn("ico_uxf_window_attribute_get: Leave(ESRCH)");
504 return ICO_UXF_ESRCH;
507 winmng = ico_uxf_mng_window(window, 0);
509 uifw_warn("ico_uxf_window_attribute_get: Leave(ENOENT)");
510 return ICO_UXF_ENOENT;
513 memcpy((char *)attr, (char *)&(winmng->attr), sizeof(Ico_Uxf_WindowAttr));
515 uifw_trace("ico_uxf_window_attribute_get: Leave(EOK)");
519 /*--------------------------------------------------------------------------*/
521 * @brief ico_uxf_window_query_windows: get all windows attribute
523 * @param[in] display target display Id
524 * @param[out] attr window attribute array
525 * @param[in] num number of window attribute area
527 * @retval >= 0 success(number of windows)
528 * @retval ICO_UXF_ESRCH error(not initialized)
529 * @retval ICO_UXF_EINVAL error(illegal parameter 'num')
530 * @retval ICO_UXF_E2BIG error(number of windows over 'num')
532 /*--------------------------------------------------------------------------*/
534 ico_uxf_window_query_windows(const int display, Ico_Uxf_WindowAttr attr[], const int num)
537 Ico_Uxf_Mng_Window *winmng;
540 uifw_trace("ico_uxf_window_query_windows: Enter(%d,,%d)", display, num);
542 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
543 uifw_warn("ico_uxf_window_query_windows: Leave(ESRCH)");
544 return ICO_UXF_ESRCH;
548 uifw_warn("ico_uxf_window_query_windows: Leave(EINVAL)");
549 return ICO_UXF_EINVAL;
553 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
554 winmng = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
557 memcpy((char *)(&attr[n]), (char *)&(winmng->attr), sizeof(Ico_Uxf_WindowAttr));
559 winmng = winmng->nextidhash;
565 uifw_trace("ico_uxf_window_query_windows: Leave(E2BIG)");
568 uifw_trace("ico_uxf_window_query_windows: Leave(%d)", n);
573 /*--------------------------------------------------------------------------*/
575 * @brief ico_uxf_window_control: target window control from AppsController
577 * @param[in] appid Application Id
578 * @param[in] winidx Window index
579 * @param[in] control Window control
580 * ICO_UXF_APPSCTL_INVISIBLE: Invisible by low priority
581 * ICO_UXF_APPSCTL_REGULATION: Invisible by regulation
582 * ICO_UXF_APPSCTL_TEMPVISIBLE: Visible as HomeScreen menu
583 * @param[in] onoff Flag On(1)/Off(0)
584 * ICO_UXF_APPSCTL_INVISIBLE: On(1) is invisible
585 * ICO_UXF_APPSCTL_REGULATION: On(1) is invisible
586 * ICO_UXF_APPSCTL_TEMPVISIBLE: On(1) is visible(menu)
588 * @retval ICO_UXF_EOK success
589 * @retval ICO_UXF_ESRCH error(not initialized)
590 * @retval ICO_UXF_ENOENT error(not exist)
592 /*--------------------------------------------------------------------------*/
594 ico_uxf_window_control(const char *appid, const int winidx,
595 const int control, const int onoff)
597 #define MAX_APP_WINDOWS 20
598 Ico_Uxf_ProcessWin procattr[MAX_APP_WINDOWS];
600 Ico_Uxf_Mng_Window *winmng; /* window management table */
605 uifw_trace("ico_uxf_window_control: Enter(%s,%d,%x,%d)",
606 appid, winidx, control, onoff);
608 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
609 uifw_warn("ico_uxf_window_control: Leave(ESRCH)");
610 return ICO_UXF_ESRCH;
613 if (control == ICO_UXF_APPSCTL_TEMPVISIBLE) {
614 if (onoff != gIco_Uxf_Api_Mng.AppsCtlVisible) {
615 if (onoff > 0) gIco_Uxf_Api_Mng.AppsCtlVisible = 1;
616 else gIco_Uxf_Api_Mng.AppsCtlVisible = 0;
618 /* control all windows */
619 for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
620 winmng = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
622 if ((winmng->attr.window > 0) && (winmng->attr.visible)) {
623 if ((winmng->mng_process)->attr.noicon == 0) {
624 if ((gIco_Uxf_Api_Mng.AppsCtlVisible != 0) ||
625 (winmng->attr.control == 0)) {
626 i = ICO_WINDOW_MGR_VISIBLE_SHOW;
629 i = ICO_WINDOW_MGR_VISIBLE_HIDE;
633 if ((gIco_Uxf_Api_Mng.AppsCtlVisible == 0) &&
634 (winmng->attr.control == 0)) {
635 i = ICO_WINDOW_MGR_VISIBLE_SHOW;
638 i = ICO_WINDOW_MGR_VISIBLE_HIDE;
641 ico_uxf_window_visible_control(winmng, i | 0x00010000,
642 ICO_WINDOW_MGR_V_NOCHANGE);
644 winmng = winmng->nextidhash;
647 wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
649 uifw_trace("ico_uxf_window_control: Leave(EOK)");
652 /* get current application status */
654 nwin = ico_uxf_process_window_get_one(appid, procattr, winidx);
655 if (nwin == 0) nwin = 1;
659 nwin = ico_uxf_process_window_get(appid, procattr, MAX_APP_WINDOWS);
661 if (nwin == ICO_UXF_E2BIG) nwin = MAX_APP_WINDOWS;
663 uifw_trace("ico_uxf_window_control: Leave(Unknown appid(%s))", appid);
664 return ICO_UXF_ENOENT;
666 for (i = 0; i < nwin; i++) {
667 if (procattr[i].window == 0) continue;
668 winmng = ico_uxf_mng_window(procattr[i].window, 0);
670 uifw_trace("ico_uxf_window_control: winid=%08x not exist",
674 newcontrol = winmng->attr.control;
675 if (onoff) newcontrol |= control;
676 else newcontrol &= (~control);
678 uifw_trace("ico_uxf_window_control: control %08x(%s) %02x=>%02x vis=%d icon=%d",
679 procattr[i].window, (winmng->mng_process)->attr.process,
680 winmng->attr.control, newcontrol, winmng->attr.visible,
681 (winmng->mng_process)->attr.noicon);
682 if (winmng->attr.control != newcontrol) {
683 winmng->attr.control = newcontrol;
684 if (winmng->attr.visible != 0) {
685 if ((gIco_Uxf_Api_Mng.AppsCtlVisible != 0) &&
686 (((winmng->mng_process)->appconf == NULL) ||
687 ((((Ico_Uxf_conf_application *)(winmng->mng_process)->appconf)->
689 (winmng->mng_layer->attr.menuoverlap == 0)))) {
690 if ((winmng->mng_process)->attr.noicon == 0) newcontrol = 0;
693 /* request to Weston(Multi Window Manager) */
694 if (newcontrol == 0) {
695 i = ICO_WINDOW_MGR_VISIBLE_SHOW;
696 if (gIco_Uxf_Api_Mng.Win_Show_Anima)
697 i |= ICO_UXF_WITHANIMA;
700 i = ICO_WINDOW_MGR_VISIBLE_HIDE;
701 if (gIco_Uxf_Api_Mng.Win_Hide_Anima)
702 i |= ICO_UXF_WITHANIMA;
704 ico_uxf_window_visible_control(winmng, i,
705 ICO_WINDOW_MGR_V_NOCHANGE);
708 uifw_trace("ico_uxf_window_control: Leave(EOK) control=%x(%d) visible=%d",
709 winmng->attr.control, gIco_Uxf_Api_Mng.AppsCtlVisible,
710 winmng->attr.visible);
716 /*--------------------------------------------------------------------------*/
718 * @brief ico_uxf_window_control: target window control from AppsController
720 * @param[in] control Control Target(0=Hide/1=Show)
721 * @param[in] animation Animation(0=Without Animation/1=With Animation)
724 /*--------------------------------------------------------------------------*/
726 ico_uxf_window_animation_control(const int control, const int animation)
728 uifw_trace("ico_uxf_window_animation_control: %s to %s",
729 control ? "Show" : "Hide", animation ? "Animation" : "No Animation");
731 gIco_Uxf_Api_Mng.Win_Show_Anima = animation;
734 gIco_Uxf_Api_Mng.Win_Hide_Anima = animation;
738 /*--------------------------------------------------------------------------*/
740 * @brief ico_uxf_window_show: show a target window
741 * if target window's state is visible, do nothing and return success
743 * @param[in] window Window identity
745 * @retval ICO_UXF_EOK success
746 * @retval ICO_UXF_ESRCH error(not initialized)
747 * @retval ICO_UXF_ENOENT error(not exist)
749 /*--------------------------------------------------------------------------*/
751 ico_uxf_window_show(const int window)
753 Ico_Uxf_Mng_Window *winmng; /* window management table */
755 uifw_trace("ico_uxf_window_show: Enter(%08x)", window);
757 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
758 uifw_warn("ico_uxf_window_show: Leave(ESRCH)");
759 return ICO_UXF_ESRCH;
762 winmng = ico_uxf_mng_window(window, 0);
763 if ((! winmng) || (! winmng->mng_display)) {
764 uifw_warn("ico_uxf_window_show: Leave(ENOENT)");
765 return ICO_UXF_ENOENT;
767 winmng->attr.visible = 1;
769 if (winmng->attr.control == 0) {
770 /* request to display to Weston(Multi Window Manager) */
771 ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_SHOW,
772 ICO_WINDOW_MGR_V_NOCHANGE);
774 uifw_trace("ico_uxf_window_show: Leave(EOK) control=%x", winmng->attr.control);
778 /*--------------------------------------------------------------------------*/
780 * @brief ico_uxf_window_hide: hide a target window
781 * if target window's state is unvisible, do nothing and return success
783 * @param[in] window target window identity
785 * @retval ICO_UXF_EOK success
786 * @retval ICO_UXF_ESRCH error(not initialized)
787 * @retval ICO_UXF_ENOENT error(not exist)
789 /*--------------------------------------------------------------------------*/
791 ico_uxf_window_hide(const int window)
793 Ico_Uxf_Mng_Window *winmng; /* window management table */
795 uifw_trace("ico_uxf_window_hide: Enter(%08x)", window);
797 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
798 uifw_warn("ico_uxf_window_hide: Leave(ESRCH)");
799 return ICO_UXF_ESRCH;
802 winmng = ico_uxf_mng_window(window, 0);
803 if ((! winmng) || (! winmng->mng_display)) {
804 uifw_warn("ico_uxf_window_hide: Leave(ENOENT)");
805 return ICO_UXF_ENOENT;
807 winmng->attr.visible = 0;
809 /* request to hide to Weston(Multi Window Manager) */
810 ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_HIDE,
811 ICO_WINDOW_MGR_V_NOCHANGE);
813 uifw_trace("ico_uxf_window_hide: Leave(EOK)");
817 /*--------------------------------------------------------------------------*/
819 * @brief ico_uxf_window_visible_raise: control status of visible(show/hide)
820 * and order(raise/lower)
822 * @param[in] window target window identity
823 * @param[in] visible visible(1)/unvisible(0)/nochange(other)
824 * @param[in] raise forefront(1)/maximum back(0)/nochange(other)
826 * @retval ICO_UXF_EOK success
827 * @retval ICO_UXF_ESRCH error(not initialized)
828 * @retval ICO_UXF_ENOENT error(not exist)
830 /*--------------------------------------------------------------------------*/
832 ico_uxf_window_visible_raise(const int window, const int visible, const int raise)
834 Ico_Uxf_Mng_Window *winmng; /* window management table */
838 uifw_trace("ico_uxf_window_visible_raise: Enter(%08x,%d,%d)", window, visible, raise);
840 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
841 uifw_warn("ico_uxf_window_visible_raise: Leave(ESRCH)");
842 return ICO_UXF_ESRCH;
845 winmng = ico_uxf_mng_window(window, 0);
846 if ((! winmng) || (! winmng->mng_display)) {
847 uifw_warn("ico_uxf_window_visible_raise: Leave(ENOENT)");
848 return ICO_UXF_ENOENT;
852 winmng->attr.visible = 0;
853 vis = ICO_WINDOW_MGR_VISIBLE_HIDE;
856 winmng->attr.visible = 1;
857 vis = ICO_WINDOW_MGR_VISIBLE_SHOW;
858 if (gIco_Uxf_Api_Mng.AppsCtlVisible == 0) {
859 /* application screen */
860 if (winmng->attr.control != 0) {
861 uifw_trace("ico_uxf_window_visible_raise: change to hide(ctrl=%x menu=0)",
862 winmng->attr.control);
863 vis = ICO_WINDOW_MGR_VISIBLE_HIDE;
867 /* HomeScreen menu screen */
868 if ((winmng->mng_process)->attr.noicon != 0) {
869 uifw_trace("ico_uxf_window_visible_raise: change to hide(ctrl=%x menu=1)",
870 winmng->attr.control);
871 vis = ICO_WINDOW_MGR_VISIBLE_HIDE;
876 vis = ICO_WINDOW_MGR_V_NOCHANGE;
879 rai = ICO_WINDOW_MGR_RAISE_LOWER;
881 else if (raise == 1) {
882 rai = ICO_WINDOW_MGR_RAISE_RAISE;
885 rai = ICO_WINDOW_MGR_V_NOCHANGE;
888 if ((vis != ICO_WINDOW_MGR_V_NOCHANGE) ||
889 (rai != ICO_WINDOW_MGR_V_NOCHANGE)) {
890 /* request to visible status and order status to Weston(Multi Window Manager) */
891 ico_uxf_window_visible_control(winmng, vis, rai);
893 uifw_trace("ico_uxf_window_visible_raise: Leave(EOK)");
897 /*--------------------------------------------------------------------------*/
899 * @brief ico_uxf_window_visible_animation: show/hide a target window with animation
901 * @param[in] window Window identity
902 * @param[in] show Show(1)/Hide(0)
904 * @retval ICO_UXF_EOK success
905 * @retval ICO_UXF_ESRCH error(not initialized)
906 * @retval ICO_UXF_ENOENT error(not exist)
908 /*--------------------------------------------------------------------------*/
910 ico_uxf_window_visible_animation(const int window, const int show)
912 Ico_Uxf_Mng_Window *winmng; /* window management table */
914 uifw_trace("ico_uxf_window_visible_animation: Enter(%08x,%d)", window, show);
916 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
917 uifw_warn("ico_uxf_window_visible_animation: Leave(ESRCH)");
918 return ICO_UXF_ESRCH;
921 winmng = ico_uxf_mng_window(window, 0);
922 if ((! winmng) || (! winmng->mng_display)) {
923 uifw_warn("ico_uxf_window_visible_animation: Leave(ENOENT)");
924 return ICO_UXF_ENOENT;
926 winmng->attr.visible = show ? 1 : 0;
929 if (winmng->attr.control == 0) {
930 /* request to display to Weston(Multi Window Manager) */
931 ico_uxf_window_visible_control(winmng,
932 ICO_WINDOW_MGR_VISIBLE_SHOW|ICO_UXF_WITHANIMA,
933 ICO_WINDOW_MGR_V_NOCHANGE);
937 ico_uxf_window_visible_control(winmng,
938 ICO_WINDOW_MGR_VISIBLE_HIDE|ICO_UXF_WITHANIMA,
939 ICO_WINDOW_MGR_V_NOCHANGE);
941 uifw_trace("ico_uxf_window_visible_animation: Leave(EOK) control=%x",
942 winmng->attr.control);
946 /*--------------------------------------------------------------------------*/
948 * @brief ico_uxf_window_animation: set window animation
950 * @param[in] window Window identity
951 * @param[in] type Target animation type,
952 * @param[in] animation Animation name, if NULL, no change
953 * @param[in] time Animation time(ms), if 0, default time
955 * @retval ICO_UXF_EOK success
956 * @retval ICO_UXF_ESRCH error(not initialized)
957 * @retval ICO_UXF_ENOENT error(not exist)
959 /*--------------------------------------------------------------------------*/
961 ico_uxf_window_animation(const int window, const int type,
962 const char *animation, const int time)
964 Ico_Uxf_Mng_Window *winmng; /* window management table */
966 uifw_trace("ico_uxf_window_animation: Enter(%08x,%x,%s,%d)",
967 window, type, animation ? animation : "NULL", time);
969 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
970 uifw_warn("ico_uxf_window_animation: Leave(ESRCH)");
971 return ICO_UXF_ESRCH;
974 winmng = ico_uxf_mng_window(window, 0);
975 if ((! winmng) || (! winmng->mng_display)) {
976 uifw_warn("ico_uxf_window_animation: Leave(ENOENT)");
977 return ICO_UXF_ENOENT;
981 ico_window_mgr_set_animation(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
982 winmng->attr.window, type, animation, time);
985 ico_window_mgr_set_animation(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
986 winmng->attr.window, type, " ", time);
988 uifw_trace("ico_uxf_window_animation: Leave(EOK)");