2 * Copyright © 2010-2011 Intel Corporation
3 * Copyright © 2008-2011 Kristian Høgsberg
4 * Copyright © 2013 TOYOTA MOTOR CORPORATION.
6 * Permission to use, copy, modify, distribute, and sell this software and
7 * its documentation for any purpose is hereby granted without fee, provided
8 * that the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of the copyright holders not be used in
11 * advertising or publicity pertaining to distribution of the software
12 * without specific, written prior permission. The copyright holders make
13 * no representations about the suitability of this software for any
14 * purpose. It is provided "as is" without express or implied warranty.
16 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
21 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 * @brief Multi Window Manager (Weston(Wayland) PlugIn)
37 #include <linux/input.h>
43 #include <sys/types.h>
48 #include <wayland-server.h>
54 #include <GLES2/gl2.h>
55 #include <GLES2/gl2ext.h>
56 #include <GL/internal/dri_interface.h>
58 #include <weston/compositor.h>
59 #include <libdrm/intel_bufmgr.h>
61 /* detail debug log */
62 #define UIFW_DETAIL_OUT 0 /* 1=detail debug log/0=no detail log */
64 #include "ico_ivi_common_private.h"
65 #include "ico_ivi_shell_private.h"
66 #include "ico_window_mgr_private.h"
67 #include "ico_window_mgr.h"
68 #include "desktop-shell-server-protocol.h"
69 #include "ico_window_mgr-server-protocol.h"
72 #define INIT_SURFACE_IDS 1024 /* SurfaceId table initiale size */
73 #define ADD_SURFACE_IDS 512 /* SurfaceId table additional size */
74 #define SURCAFE_ID_MASK 0x0ffff /* SurfaceId bit mask pattern */
75 #define UIFW_HASH 64 /* Hash value (2's compliment) */
77 /* Internal fixed value */
78 #define ICO_WINDOW_MGR_APPID_FIXCOUNT 5 /* retry count of appid fix */
79 /* show/hide animation with position */
80 #define ICO_WINDOW_MGR_ANIMATION_POS 0x10000000
83 #define ICO_GPUTYPE_NOACCELERATION 0 /* Do not use GPU-dependent acceleration*/
84 #define ICO_GPUTYPE_INTEL_SANDYBRIDGE 1 /* Intel Sandybridge Mobile */
86 /* Code for Intel Sandybridge Mobile GPU dependent acceleration */
88 /* wl_drm_buffer (inport from mesa-9.1.3 & mesa-9.2.1/ */
89 /* src/egl/wayland/wayland-drm/wayland-drm.h) */
90 struct uifw_drm_buffer {
91 struct wl_resource *resource;
92 void *drm; /* struct wl_drm */
93 int32_t width, height;
95 const void *driver_format;
101 /* __DRIimage (inport from mesa-9.1.3/src/mesa/drivers/dri/intel/intel_regions.h */
102 /* mesa-9.2.1/src/mesa/drivers/dri/i915/intel_regions.h */
103 /* mesa-9.2.1/src/mesa/drivers/dri/i965/intel_regions.h) */
104 struct uifw_intel_region { /* struct intel_region for mesa 9.2.1 */
105 void *bo; /**< buffer manager's buffer */
106 uint32_t refcount; /**< Reference count for region */
107 uint32_t cpp; /**< bytes per pixel */
108 uint32_t width; /**< in pixels */
109 uint32_t height; /**< in pixels */
110 uint32_t pitch; /**< in bytes */
111 uint32_t tiling; /**< Which tiling mode the region is in */
112 uint32_t name; /**< Global name for the bo */
115 struct uifw_dri_image { /* struct __DRIimageRec */
116 struct uifw_intel_region *region;
123 void *planar_format; /* intel_image_format */
128 bool has_depthstencil; /* i965 only */
132 /* gl_surface_state (inport from weston-1.2.1/src/gl-renderer.c, */
133 /* weston-1.3.1/src/gl-renderer.c */
139 struct uifw_gl_surface_state { /* struct gl_surface_state */
141 struct gl_shader *shader;
145 int needs_full_upload;
146 pixman_region32_t texture_damage;
148 void *images[3]; /* EGLImageKHR */
152 struct weston_buffer_reference buffer_ref;
153 enum buffer_type buffer_type;
154 int pitch; /* in pixels */
155 int height; /* in pixels */
156 int y_inverted; /* add weston 1.3.x */
159 /* Multi Windiw Manager */
161 struct weston_compositor *compositor; /* Weston compositor */
162 void *shell; /* shell(ico_ivi_shell) table address */
163 int32_t surface_head; /* (HostID << 24) | (DisplayNo << 16) */
165 struct wl_list client_list; /* Clients */
166 struct wl_list manager_list; /* Manager(ex.HomeScreen) list */
167 int num_manager; /* Number of managers */
169 struct wl_list ivi_layer_list; /* Layer management table list */
170 struct uifw_win_layer *touch_layer; /* layer table for touch panel layer */
172 struct wl_list map_list; /* surface map list */
173 struct uifw_surface_map *free_maptable; /* free maped surface table list */
174 struct weston_animation map_animation[ICO_IVI_MAX_DISPLAY];
175 /* animation for map check */
176 struct wl_event_source *wait_mapevent; /* map event send wait timer */
178 struct uifw_win_surface *active_pointer_usurf; /* Active Pointer Surface */
179 struct uifw_win_surface *active_keyboard_usurf; /* Active Keyboard Surface */
181 struct uifw_win_surface *idhash[UIFW_HASH]; /* UIFW SerfaceID */
182 struct uifw_win_surface *wshash[UIFW_HASH]; /* Weston Surface */
184 uint32_t surfaceid_count; /* Number of surface id */
185 uint32_t surfaceid_max; /* Maximum number of surface id */
186 uint16_t *surfaceid_map; /* SurfaceId assign bit map */
188 char shell_init; /* shell initialize flag */
189 char res[3]; /* (unused) */
192 /* Internal macros */
194 #define MAKE_IDHASH(v) (((uint32_t)v) & (UIFW_HASH-1))
196 #define MAKE_WSHASH(v) ((((uint32_t)v) >> 5) & (UIFW_HASH-1))
198 /* function prototype */
199 /* get surface table from weston surface*/
200 static struct uifw_win_surface *find_uifw_win_surface_by_ws(
201 struct weston_surface *wsurf);
202 /* get client table from weston client */
203 static struct uifw_client* find_client_from_client(struct wl_client *client);
204 /* assign new surface id */
205 static uint32_t generate_id(void);
206 /* bind shell client */
207 static void win_mgr_bind_client(struct wl_client *client, void *shell);
208 /* unind shell client */
209 static void win_mgr_unbind_client(struct wl_client *client);
210 #if 0 /* work around: Walk through child processes until app ID is found */
212 static pid_t win_mgr_get_ppid(pid_t pid);
213 #endif /* work around: Walk through child processes until app ID is found */
214 /* get appid from pid */
215 static void win_mgr_get_client_appid(struct uifw_client *uclient);
216 /* create new surface */
217 static void win_mgr_register_surface(
218 int layertype, struct wl_client *client, struct wl_resource *resource,
219 struct weston_surface *surface, struct shell_surface *shsurf);
220 /* surface destroy */
221 static void win_mgr_destroy_surface(struct weston_surface *surface);
222 /* map new surface */
223 static void win_mgr_surface_map(struct weston_surface *surface, int32_t *width,
224 int32_t *height, int32_t *sx, int32_t *sy);
225 /* send surface change event to manager */
226 static void win_mgr_change_surface(struct weston_surface *surface,
227 const int to, const int manager);
228 /* window manager surface configure */
229 static void win_mgr_surface_configure(struct uifw_win_surface *usurf,
230 int x, int y, int width, int height);
231 /* shell surface configure */
232 static void win_mgr_shell_configure(struct weston_surface *surface);
234 static void win_mgr_select_surface(struct weston_surface *surface);
235 /* surface set title */
236 static char *win_mgr_set_title(struct weston_surface *surface, const char *title);
237 /* surface move request from shell */
238 static void win_mgr_surface_move(struct weston_surface *surface, int *dx, int *dy);
239 /* shell layer visible control */
240 static void win_mgr_show_layer(int layertype, int show, void *data);
241 /* shell full screen surface control */
242 static int win_mgr_fullscreen(int event, struct weston_surface *surface);
244 static void win_mgr_set_raise(struct uifw_win_surface *usurf, const int raise);
245 /* surface change from manager */
246 static int win_mgr_surface_change_mgr(struct weston_surface *surface, const int x,
247 const int y, const int width, const int height);
248 /* reset surface focus */
249 static void win_mgr_reset_focus(struct uifw_win_surface *usurf);
250 /* create new layer */
251 static struct uifw_win_layer *win_mgr_create_layer(struct uifw_win_surface *usurf,
252 const uint32_t layer, const int layertype);
253 /* set surface layer */
254 static void win_mgr_set_layer(struct uifw_win_surface *usurf, const uint32_t layer);
255 /* set active surface */
256 static void win_mgr_set_active(struct uifw_win_surface *usurf, const int target);
258 /* declare manager */
259 static void uifw_declare_manager(struct wl_client *client, struct wl_resource *resource,
261 /* set window layer */
262 static void uifw_set_window_layer(struct wl_client *client,
263 struct wl_resource *resource,
264 uint32_t surfaceid, uint32_t layer);
265 /* set surface size and position */
266 static void uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource,
267 uint32_t surfaceid, uint32_t node, int32_t x, int32_t y,
268 int32_t width, int32_t height, int32_t flags);
269 /* show/hide and raise/lower surface */
270 static void uifw_set_visible(struct wl_client *client, struct wl_resource *resource,
271 uint32_t surfaceid, int32_t visible, int32_t raise,
273 /* set surface animation */
274 static void uifw_set_animation(struct wl_client *client, struct wl_resource *resource,
275 uint32_t surfaceid, int32_t type,
276 const char *animation, int32_t time);
277 /* set surface attributes */
278 static void uifw_set_attributes(struct wl_client *client, struct wl_resource *resource,
279 uint32_t surfaceid, uint32_t attributes);
280 /* surface visibility control with animation*/
281 static void uifw_visible_animation(struct wl_client *client, struct wl_resource *resource,
282 uint32_t surfaceid, int32_t visible,
283 int32_t x, int32_t y, int32_t width, int32_t height);
284 /* set active surface (form HomeScreen) */
285 static void uifw_set_active(struct wl_client *client, struct wl_resource *resource,
286 uint32_t surfaceid, int32_t active);
287 /* layer visibility control */
288 static void uifw_set_layer_visible(struct wl_client *client, struct wl_resource *resource,
289 uint32_t layer, int32_t visible);
290 /* get application surfaces */
291 static void uifw_get_surfaces(struct wl_client *client, struct wl_resource *resource,
292 const char *appid, int32_t pid);
293 /* check and change all mapped surface */
294 static void win_mgr_check_mapsurface(struct weston_animation *animation,
295 struct weston_output *output, uint32_t msecs);
296 /* check timer of mapped surface */
297 static int win_mgr_timer_mapsurface(void *data);
298 /* check and change mapped surface */
299 static void win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event,
302 static void uifw_set_map_buffer(struct wl_client *client, struct wl_resource *resource,
303 const char *shmname, uint32_t bufsize, uint32_t bufnum);
304 /* map surface to system application */
305 static void uifw_map_surface(struct wl_client *client, struct wl_resource *resource,
306 uint32_t surfaceid, int32_t framerate);
308 static void uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource,
311 static void bind_ico_win_mgr(struct wl_client *client,
312 void *data, uint32_t version, uint32_t id);
314 static void unbind_ico_win_mgr(struct wl_resource *resource);
315 /* send event to manager */
316 static int ico_win_mgr_send_to_mgr(const int event, struct uifw_win_surface *usurf,
317 const int param1, const int param2, const int param3,
318 const int param4, const int param5);
319 /* set surface transform */
320 static int win_mgr_set_scale(struct uifw_win_surface *usurf);
321 /* convert animation name to Id value */
322 static int ico_get_animation_name(const char *animation);
323 /* hook for animation */
324 static int (*win_mgr_hook_animation)(const int op, void *data) = NULL;
325 /* hook for input region */
326 static void (*win_mgr_hook_change)(struct uifw_win_surface *usurf) = NULL;
327 static void (*win_mgr_hook_destory)(struct uifw_win_surface *usurf) = NULL;
328 static void (*win_mgr_hook_inputregion)(int set, struct uifw_win_surface *usurf,
329 int32_t x, int32_t y, int32_t width,
330 int32_t height, int32_t hotspot_x, int32_t hotspot_y,
331 int32_t cursor_x, int32_t cursor_y,
332 int32_t cursor_width, int32_t cursor_height,
333 uint32_t attr) = NULL;
336 /* Multi Window Manager interface */
337 static const struct ico_window_mgr_interface ico_window_mgr_implementation = {
338 uifw_declare_manager,
339 uifw_set_window_layer,
340 uifw_set_positionsize,
344 uifw_visible_animation,
346 uifw_set_layer_visible,
354 /* GPU driver name */
355 static const struct _ico_gputype_table {
356 int gpu_type; /* GPU type code */
357 char *gpu_name; /* GPU driver name */
358 } ico_window_mgr_gpu_type[] = {
359 { ICO_GPUTYPE_INTEL_SANDYBRIDGE, "Mesa DRI Intel(R) Sandybridge Mobile" },
363 /* plugin common value(without ico_plugin_loader) */
364 static int _ico_ivi_option_flag = 0; /* option flags */
365 static int _ico_ivi_debug_level = 3; /* debug Level */
366 static char *_ico_ivi_animation_name = NULL; /* default animation name */
367 static int _ico_ivi_animation_time = 500; /* default animation time */
368 static int _ico_ivi_animation_fps = 30; /* animation frame rate */
369 static char *_ico_ivi_inputpanel_animation = NULL; /* default animation name for input panel*/
370 static int _ico_ivi_inputpanel_anima_time = 0; /* default animation time for input panel*/
372 static int _ico_ivi_inputpanel_display = 0; /* input panel display number */
373 static int _ico_ivi_inputdeco_mag = 100; /* input panel magnification rate(%)*/
374 static int _ico_ivi_inputdeco_diff = 0; /* input panel difference from the bottom*/
376 static int _ico_ivi_background_layer = 0; /* background layer */
377 static int _ico_ivi_default_layer = 1; /* deafult layer id at surface create*/
378 static int _ico_ivi_touch_layer = 101; /* touch panel layer id */
379 static int _ico_ivi_cursor_layer = 102; /* cursor layer id */
380 static int _ico_ivi_startup_layer = 109; /* deafult layer id at system startup*/
382 static int _ico_ivi_gpu_type = 0; /* GPU type for get EGL buffer */
383 static int _ico_ivi_map_framerate_gpu = 30; /* framerate of map surface for GPU*/
384 static int _ico_ivi_map_framerate_shm = 2; /* framerate of map surface for shm buffer*/
385 static int _ico_ivi_map_framerate_pixel = 5; /* framerate of map surface for ReadPixels*/
387 /* static management table */
388 static struct ico_win_mgr *_ico_win_mgr = NULL;
389 static int _ico_num_nodes = 0;
390 static struct uifw_node_table _ico_node_table[ICO_IVI_MAX_DISPLAY];
391 static struct weston_seat *touch_check_seat = NULL;
394 /*--------------------------------------------------------------------------*/
396 * @brief ico_ivi_optionflag: get option flags
399 * @return option flags
401 /*--------------------------------------------------------------------------*/
403 ico_ivi_optionflag(void)
405 return _ico_ivi_option_flag;
408 /*--------------------------------------------------------------------------*/
410 * @brief ico_ivi_debuglevel: answer debug output level.
413 * @return debug output level
414 * @retval 0 No debug output
415 * @retval 1 Only error output
416 * @retval 2 Error and Warning output
417 * @retval 3 Error, Warning and information output
418 * @retval 4 Error, Warning, information and Debug Trace output
419 * @retval 5 All output with debug write
421 /*--------------------------------------------------------------------------*/
423 ico_ivi_debuglevel(void)
425 return (_ico_ivi_debug_level & 0x0ffff);
428 /*--------------------------------------------------------------------------*/
430 * @brief ico_ivi_debugflag: get debug flags
433 * @return debug flags
435 /*--------------------------------------------------------------------------*/
437 ico_ivi_debugflag(void)
439 return ((_ico_ivi_debug_level >> 16) & 0x0ffff);
442 /*--------------------------------------------------------------------------*/
444 * @brief ico_ivi_default_animation_name: get default animation name
447 * @return Default animation name
449 /*--------------------------------------------------------------------------*/
450 WL_EXPORT const char *
451 ico_ivi_default_animation_name(void)
453 return _ico_ivi_animation_name;
456 /*--------------------------------------------------------------------------*/
458 * @brief ico_ivi_default_animation_time: get default animation time
461 * @return Default animation time(miri sec)
463 /*--------------------------------------------------------------------------*/
465 ico_ivi_default_animation_time(void)
467 return _ico_ivi_animation_time;
470 /*--------------------------------------------------------------------------*/
472 * @brief ico_ivi_default_animation_fps: get default animation frame rate
475 * @return Default animation frame rate(frames/sec)
477 /*--------------------------------------------------------------------------*/
479 ico_ivi_default_animation_fps(void)
481 return _ico_ivi_animation_fps;
484 /*--------------------------------------------------------------------------*/
486 * @brief ico_ivi_get_mynode: Get my NodeId
489 * @return NodeId of my node
491 /*--------------------------------------------------------------------------*/
493 ico_ivi_get_mynode(void)
495 /* Reference Platform 0.90 only support 1 ECU */
499 /*--------------------------------------------------------------------------*/
501 * @brief ico_window_mgr_set_weston_surface: set weston surface
503 * @param[in] usurf UIFW surface
504 * @param[in] x X coordinate on screen
505 * @param[in] y Y coordinate on screen
506 * @param[in] width width
507 * @param[in] height height
510 /*--------------------------------------------------------------------------*/
512 ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf,
513 int x, int y, int width, int height)
515 struct weston_surface *es = usurf->surface;
516 int buf_width, buf_height;
519 uifw_trace("ico_window_mgr_set_weston_surface: usurf(%08x) has no surface",
524 if (es->buffer_ref.buffer != NULL) {
525 buf_width = weston_surface_buffer_width(es);
526 buf_height = weston_surface_buffer_height(es);
527 if ((width <= 0) || (height <= 0)) {
529 usurf->width = buf_width;
531 usurf->height = buf_height;
533 if ((usurf->width > buf_width) && (usurf->scalex <= 1.0f)) {
535 x += (usurf->width - buf_width)/2;
537 if ((usurf->height > buf_height) && (usurf->scaley <= 1.0f)) {
539 y += (usurf->height - buf_height)/2;
541 if (usurf->visible) {
542 x += usurf->node_tbl->disp_x;
543 y += usurf->node_tbl->disp_y;
546 x = ICO_IVI_MAX_COORDINATE+1;
547 y = ICO_IVI_MAX_COORDINATE+1;
549 if ((es->geometry.x != x) || (es->geometry.y != y) ||
550 (es->geometry.width != width) || (es->geometry.height != height)) {
551 weston_surface_damage_below(es);
552 win_mgr_surface_configure(usurf, x, y, width, height);
554 weston_surface_damage(es);
555 weston_compositor_schedule_repaint(_ico_win_mgr->compositor);
559 /*--------------------------------------------------------------------------*/
561 * @brief ico_window_mgr_set_weston_surface: set weston surface
563 * @param[in] usurf UIFW surface
564 * @param[in] x X coordinate on screen
565 * @param[in] y Y coordinate on screen
566 * @param[in] width width
567 * @param[in] height height
570 /*--------------------------------------------------------------------------*/
572 ico_window_mgr_change_surface(struct uifw_win_surface *usurf,
573 const int to, const int manager)
575 uifw_trace("ico_window_mgr_change_surface: Enter(%08x,%d,%d)",
576 usurf->surfaceid, to, manager);
577 win_mgr_change_surface(usurf->surface, to, manager);
578 uifw_trace("ico_window_mgr_change_surface: Leave");
581 /*--------------------------------------------------------------------------*/
583 * @brief ico_window_mgr_get_usurf: find UIFW surface by surface id
585 * @param[in] surfaceid UIFW surface id
586 * @return UIFW surface table address
587 * @retval !=NULL success(surface table address)
588 * @retval NULL error(surface id dose not exist)
590 /*--------------------------------------------------------------------------*/
591 WL_EXPORT struct uifw_win_surface *
592 ico_window_mgr_get_usurf(const uint32_t surfaceid)
594 struct uifw_win_surface *usurf;
596 usurf = _ico_win_mgr->idhash[MAKE_IDHASH(surfaceid)];
599 if (usurf->surfaceid == surfaceid) {
602 usurf = usurf->next_idhash;
604 uifw_trace("ico_window_mgr_get_usurf: NULL");
608 /*--------------------------------------------------------------------------*/
610 * @brief ico_window_mgr_get_usurf_client: find UIFW surface by surface id/or client
612 * @param[in] surfaceid UIFW surface id
613 * @param[in] client Wayland client
614 * @return UIFW surface table address
615 * @retval !=NULL success(surface table address)
616 * @retval NULL error(surface id or client dose not exist)
618 /*--------------------------------------------------------------------------*/
619 WL_EXPORT struct uifw_win_surface *
620 ico_window_mgr_get_usurf_client(const uint32_t surfaceid, struct wl_client *client)
622 struct uifw_win_surface *usurf;
623 struct uifw_client *uclient;
625 if (surfaceid == ICO_WINDOW_MGR_V_MAINSURFACE) {
626 uclient = find_client_from_client(client);
628 if (&uclient->surface_link != uclient->surface_link.next) {
629 usurf = container_of (uclient->surface_link.next,
630 struct uifw_win_surface, client_link);
641 usurf = ico_window_mgr_get_usurf(surfaceid);
646 /*--------------------------------------------------------------------------*/
648 * @brief find_uifw_win_surface_by_ws: find UIFW surface by weston surface
650 * @param[in] wsurf Weston surface
651 * @return UIFW surface table address
652 * @retval !=NULL success(surface table address)
653 * @retval NULL error(surface dose not exist)
655 /*--------------------------------------------------------------------------*/
656 static struct uifw_win_surface *
657 find_uifw_win_surface_by_ws(struct weston_surface *wsurf)
659 struct uifw_win_surface *usurf;
661 usurf = _ico_win_mgr->wshash[MAKE_WSHASH(wsurf)];
664 if (usurf->surface == wsurf) {
667 usurf = usurf->next_wshash;
669 uifw_trace("find_uifw_win_surface_by_ws: NULL");
673 /*--------------------------------------------------------------------------*/
675 * @brief find_client_from_client: find UIFW client by wayland client
677 * @param[in] client Wayland client
678 * @return UIFW client table address
679 * @retval !=NULL success(client table address)
680 * @retval NULL error(client dose not exist)
682 /*--------------------------------------------------------------------------*/
683 static struct uifw_client*
684 find_client_from_client(struct wl_client *client)
686 struct uifw_client *uclient;
688 wl_list_for_each (uclient, &_ico_win_mgr->client_list, link) {
689 if (uclient->client == client) {
693 uifw_trace("find_client_from_client: client.%08x is NULL", (int)client);
697 /*--------------------------------------------------------------------------*/
699 * @brief ico_window_mgr_get_appid: find application id by wayland client
701 * @param[in] client Wayland client
702 * @return application id
703 * @retval !=NULL success(application id)
704 * @retval NULL error(client dose not exist)
706 /*--------------------------------------------------------------------------*/
708 ico_window_mgr_get_appid(struct wl_client* client)
710 struct uifw_client *uclient;
712 uclient = find_client_from_client(client);
717 return uclient->appid;
720 /*--------------------------------------------------------------------------*/
722 * @brief ico_window_mgr_get_display_coordinate: get display coordinate
724 * @param[in] displayno display number
725 * @param[out] x relative X coordinate
726 * @param[out] y relative Y coordinate
729 /*--------------------------------------------------------------------------*/
731 ico_window_mgr_get_display_coordinate(int displayno, int *x, int *y)
733 if ((displayno <= _ico_num_nodes) || (displayno < 0)) {
736 *x = _ico_node_table[displayno].disp_x;
737 *y = _ico_node_table[displayno].disp_y;
740 /*--------------------------------------------------------------------------*/
742 * @brief generate_id: generate uniq id for UIFW surface id
745 * @return uniq id for UIFW surface id
747 /*--------------------------------------------------------------------------*/
758 _ico_win_mgr->surfaceid_count ++;
760 /* serach free id from bitmap */
761 for (rep = 0; rep < (int)(_ico_win_mgr->surfaceid_max/16); rep++) {
762 if (_ico_win_mgr->surfaceid_count >= _ico_win_mgr->surfaceid_max) {
763 _ico_win_mgr->surfaceid_count = 0;
765 if (_ico_win_mgr->surfaceid_map[_ico_win_mgr->surfaceid_count/16] != 0xffff) {
766 /* find free id from bitmap */
767 map = 1 << (_ico_win_mgr->surfaceid_count % 16);
768 for (i = (_ico_win_mgr->surfaceid_count % 16); i < 16; i++) {
769 if ((_ico_win_mgr->surfaceid_map[_ico_win_mgr->surfaceid_count/16] & map)
771 _ico_win_mgr->surfaceid_map[_ico_win_mgr->surfaceid_count/16] |= map;
772 _ico_win_mgr->surfaceid_count
773 = (_ico_win_mgr->surfaceid_count/16)*16 + i;
775 surfaceId = (_ico_win_mgr->surfaceid_count + 1)
776 | _ico_win_mgr->surface_head;
777 uifw_trace("generate_id: SurfaceId=%08x", surfaceId);
783 _ico_win_mgr->surfaceid_count += 16;
786 /* no free id in bitmap, extend bitmap */
787 if ((_ico_win_mgr->surfaceid_max + ADD_SURFACE_IDS) > SURCAFE_ID_MASK) {
788 /* too many surfaces, system error */
789 uifw_trace("generate_id: SurffaceId Overflow(%d, Max=%d), Abort",
790 _ico_win_mgr->surfaceid_max + ADD_SURFACE_IDS, SURCAFE_ID_MASK);
791 fprintf(stderr, "generate_id: SurffaceId Overflow(%d, Max=%d), Abort\n",
792 _ico_win_mgr->surfaceid_max + ADD_SURFACE_IDS, SURCAFE_ID_MASK);
796 new_map = (uint16_t *) malloc((_ico_win_mgr->surfaceid_max + ADD_SURFACE_IDS) / 8);
797 memcpy(new_map, _ico_win_mgr->surfaceid_map, _ico_win_mgr->surfaceid_max/8);
798 memset(&new_map[_ico_win_mgr->surfaceid_max/16], 0, ADD_SURFACE_IDS/8);
799 _ico_win_mgr->surfaceid_count = _ico_win_mgr->surfaceid_max;
800 new_map[_ico_win_mgr->surfaceid_count/16] |= 1;
801 _ico_win_mgr->surfaceid_max += ADD_SURFACE_IDS;
802 free(_ico_win_mgr->surfaceid_map);
803 _ico_win_mgr->surfaceid_map = new_map;
805 uifw_trace("generate_id: Extent SurfaceId=%d(Max.%d)",
806 _ico_win_mgr->surfaceid_count+1, _ico_win_mgr->surfaceid_max);
807 surfaceId = (_ico_win_mgr->surfaceid_count + 1) | _ico_win_mgr->surface_head;
809 uifw_trace("generate_id: SurfaceId=%08x", surfaceId);
813 /*--------------------------------------------------------------------------*/
815 * @brief win_mgr_bind_client: desktop_shell from client
817 * @param[in] client Wayland client
818 * @param[in] shell shell(ico_ivi_shell) table address
821 /*--------------------------------------------------------------------------*/
823 win_mgr_bind_client(struct wl_client *client, void *shell)
825 struct uifw_client *uclient;
831 uifw_trace("win_mgr_bind_client: Enter(client=%08x, shell=%08x)",
832 (int)client, (int)shell);
834 /* save shell table address */
836 _ico_win_mgr->shell = shell;
840 uclient = find_client_from_client(client);
842 /* client not exist, create client management table */
843 uifw_trace("win_mgr_bind_client: Create Client");
844 uclient = (struct uifw_client *)malloc(sizeof(struct uifw_client));
846 uifw_error("win_mgr_bind_client: Error, No Memory");
849 memset(uclient, 0, sizeof(struct uifw_client));
850 uclient->client = client;
851 wl_list_init(&uclient->surface_link);
857 wl_client_get_credentials(client, &pid, &uid, &gid);
858 uifw_trace("win_mgr_bind_client: client=%08x pid=%d uid=%d gid=%d",
859 (int)client, (int)pid, (int)uid, (int)gid);
861 uclient->pid = (int)pid;
862 /* get applicationId from AppCore(AUL) */
863 win_mgr_get_client_appid(uclient);
866 wl_list_insert(&_ico_win_mgr->client_list, &uclient->link);
870 uifw_trace("win_mgr_bind_client: client=%08x pid dose not exist", (int)client);
872 uifw_trace("win_mgr_bind_client: Leave");
875 /*--------------------------------------------------------------------------*/
877 * @brief win_mgr_unbind_client: unbind desktop_shell from client
879 * @param[in] client Wayland client
882 /*--------------------------------------------------------------------------*/
884 win_mgr_unbind_client(struct wl_client *client)
886 struct uifw_client *uclient;
888 uifw_trace("win_mgr_unbind_client: Enter(client=%08x)", (int)client);
890 uclient = find_client_from_client(client);
892 /* Client exist, Destory client management table */
893 wl_list_remove(&uclient->link);
896 uifw_trace("win_mgr_unbind_client: Leave");
899 #if 0 /* work around: Walk through child processes until app ID is found */
900 /*--------------------------------------------------------------------------*/
902 * @brief win_mgr_get_ppid: Get parent process ID.
904 * Similar to getppid(), except that this implementation accepts an
905 * arbitrary process ID.
907 * @param[in] pid Process ID of child process
908 * @return parent process ID on success, -1 on failure
910 /*--------------------------------------------------------------------------*/
912 win_mgr_get_ppid(pid_t pid)
915 char procpath[PATH_MAX] = { 0 };
917 snprintf(procpath, sizeof(procpath)-1, "/proc/%d/status", pid);
919 /* We better have read permissions! */
920 int const fd = open(procpath, O_RDONLY);
925 char buffer[1024] = { 0 };
927 ssize_t const size = read(fd, buffer, sizeof(buffer));
933 /* Find line containing the parent process ID. */
934 char const * const ppid_line = strstr(buffer, "PPid");
936 if (ppid_line != NULL)
937 sscanf(ppid_line, "PPid: %d", &ppid);
941 #endif /* work around: Walk through child processes until app ID is found */
943 /*--------------------------------------------------------------------------*/
945 * @brief win_mgr_get_client_appid: get applicationId from pid
947 * @param[in] uclient UIFW client management table
950 /*--------------------------------------------------------------------------*/
952 win_mgr_get_client_appid(struct uifw_client *uclient)
954 int status = AUL_R_ERROR;
956 memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH);
958 #if 0 /* work around: Walk through child processes until app ID is found */
960 * Walk the parent process chain until we find a parent process
965 for (pid = uclient->pid;
966 pid > 1 && status != AUL_R_OK;
967 pid = win_mgr_get_ppid(pid)) {
969 status = aul_app_get_appid_bypid(pid,
971 ICO_IVI_APPID_LENGTH);
973 uifw_trace("win_mgr_get_client_appid: aul_app_get_appid_bypid ret=%d "
974 "pid=%d appid=<%s>", status, pid, uclient->appid);
977 * Walk the child process chain as well since app ID was not yet found
979 if (status != AUL_R_OK) {
988 dr = opendir("/proc/");
991 wl_client_get_credentials(uclient->client, &tpid, &uid, &gid);
993 while(((de = readdir(dr)) != NULL) && (status != AUL_R_OK)) {
995 char fullpath[PATH_MAX] = { 0 };
999 snprintf(fullpath, sizeof(fullpath)-1, "/proc/%s", de->d_name);
1001 if (stat(fullpath, &ps) == -1) {
1005 /* find pid dirs for this user (uid) only */
1006 if (ps.st_uid != uid)
1009 pid = atoi(de->d_name);
1011 /* check if it's a valid child */
1012 if (pid < uclient->pid)
1015 /* scan up to pid to find if a chain exists */
1016 for (tmppid = pid; tmppid > uclient->pid;) {
1017 tmppid = win_mgr_get_ppid(tmppid);
1018 if (tmppid == uclient->pid)
1023 status = aul_app_get_appid_bypid(pid, uclient->appid,
1024 ICO_IVI_APPID_LENGTH);
1026 uifw_debug("win_mgr_get_client_appid: aul_app_get_appid_bypid "
1027 "ret=%d pid=%d appid=<%s>", status, pid,
1032 #else /* work around: Walk through child processes until app ID is found */
1033 status = aul_app_get_appid_bypid(uclient->pid, uclient->appid, ICO_IVI_APPID_LENGTH);
1034 uifw_trace("win_mgr_get_client_appid: aul_app_get_appid_bypid ret=%d "
1035 "pid=%d appid=<%s>", status, uclient->pid, uclient->appid);
1036 #endif /* work around: Walk through child processes until app ID is found */
1038 if (uclient->appid[0] != 0) {
1039 /* OK, end of get appid */
1040 uclient->fixed_appid = ICO_WINDOW_MGR_APPID_FIXCOUNT;
1043 /* client does not exist in AppCore, search Linux process table */
1051 uclient->fixed_appid ++;
1052 memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH);
1053 snprintf(procpath, sizeof(procpath)-1, "/proc/%d/cmdline", uclient->pid);
1054 fd = open(procpath, O_RDONLY);
1056 size = read(fd, procpath, sizeof(procpath));
1057 for (; size > 0; size--) {
1058 if (procpath[size-1]) break;
1061 /* get program base name */
1063 for (j = 0; j < size; j++) {
1064 if (procpath[j] == 0) break;
1065 if (procpath[j] == '/') i = j + 1;
1068 for (; i < size; i++) {
1069 uclient->appid[j] = procpath[i];
1070 if ((uclient->appid[j] == 0) ||
1071 (j >= (ICO_IVI_APPID_LENGTH-1))) break;
1074 /* search application number in apprication start option */
1075 if ((uclient->appid[j] == 0) && (j < (ICO_IVI_APPID_LENGTH-2))) {
1076 for (; i < size; i++) {
1077 if ((procpath[i] == 0) &&
1078 (procpath[i+1] == '@')) {
1079 strncpy(&uclient->appid[j], &procpath[i+1],
1080 ICO_IVI_APPID_LENGTH - j - 2);
1087 for (i = strlen(uclient->appid)-1; i >= 0; i--) {
1088 if (uclient->appid[i] != ' ') break;
1090 uclient->appid[i+1] = 0;
1091 if (uclient->appid[0]) {
1092 uifw_trace("win_mgr_get_client_appid: pid=%d appid=<%s> from "
1093 "Process table(%d)",
1094 uclient->pid, uclient->appid, uclient->fixed_appid );
1097 uifw_trace("win_mgr_get_client_appid: pid=%d dose not exist in Process table",
1099 sprintf(uclient->appid, "?%d?", uclient->pid);
1104 /*--------------------------------------------------------------------------*/
1106 * @brief ico_get_animation_name: convert animation name to Id value
1108 * @param[in] animation animation name
1109 * @return animation Id value
1111 /*--------------------------------------------------------------------------*/
1113 ico_get_animation_name(const char *animation)
1115 int anima = ICO_WINDOW_MGR_ANIMATION_NONE;
1117 if (strcasecmp(animation, "none") == 0) {
1118 return ICO_WINDOW_MGR_ANIMATION_NONE;
1121 if (win_mgr_hook_animation) {
1122 anima = (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_NAME, (void *)animation);
1125 anima = ICO_WINDOW_MGR_ANIMATION_NONE;
1130 /*--------------------------------------------------------------------------*/
1132 * @brief win_mgr_register_surface: create UIFW surface
1134 * @param[in] layertype surface layer type
1135 * @param[in] client Wayland client
1136 * @param[in] resource client resource
1137 * @param[in] surface Weston surface
1138 * @param[in] shsurf shell surface
1141 /*--------------------------------------------------------------------------*/
1143 win_mgr_register_surface(int layertype, struct wl_client *client,
1144 struct wl_resource *resource, struct weston_surface *surface,
1145 struct shell_surface *shsurf)
1147 struct uifw_win_surface *usurf;
1148 struct uifw_win_surface *phash;
1149 struct uifw_win_surface *bhash;
1153 uifw_trace("win_mgr_register_surface: Enter(surf=%08x,client=%08x,res=%08x,layertype=%x)",
1154 (int)surface, (int)client, (int)resource, layertype);
1156 /* check new surface */
1157 if (find_uifw_win_surface_by_ws(surface)) {
1158 /* surface exist, NOP */
1159 uifw_trace("win_mgr_register_surface: Leave(Already Exist)");
1163 /* set default color and shader */
1164 weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1);
1166 /* create UIFW surface management table */
1167 usurf = malloc(sizeof(struct uifw_win_surface));
1169 uifw_error("win_mgr_register_surface: No Memory");
1173 memset(usurf, 0, sizeof(struct uifw_win_surface));
1175 usurf->surfaceid = generate_id();
1176 usurf->surface = surface;
1177 usurf->shsurf = shsurf;
1178 usurf->layertype = layertype;
1179 usurf->node_tbl = &_ico_node_table[0]; /* set default node table (display no=0) */
1180 wl_list_init(&usurf->ivi_layer);
1181 wl_list_init(&usurf->client_link);
1182 wl_list_init(&usurf->animation.animation.link);
1183 wl_list_init(&usurf->surf_map);
1184 wl_list_init(&usurf->input_region);
1185 usurf->animation.hide_anima = ico_get_animation_name(ico_ivi_default_animation_name());
1186 usurf->animation.hide_time = ico_ivi_default_animation_time();
1187 usurf->animation.show_anima = usurf->animation.hide_anima;
1188 usurf->animation.show_time = usurf->animation.hide_time;
1189 usurf->animation.move_anima = usurf->animation.hide_anima;
1190 usurf->animation.move_time = usurf->animation.hide_time;
1191 usurf->animation.resize_anima = usurf->animation.hide_anima;
1192 usurf->animation.resize_time = usurf->animation.hide_time;
1193 if (layertype == LAYER_TYPE_INPUTPANEL) {
1194 usurf->attributes = ICO_WINDOW_MGR_ATTR_FIXED_ASPECT;
1195 usurf->animation.hide_anima = ico_get_animation_name(_ico_ivi_inputpanel_animation);
1196 usurf->animation.hide_time = _ico_ivi_inputpanel_anima_time;
1197 usurf->animation.show_anima = usurf->animation.hide_anima;
1198 usurf->animation.show_time = usurf->animation.hide_time;
1200 if ((layertype != LAYER_TYPE_INPUTPANEL) &&
1201 ((_ico_win_mgr->num_manager <= 0) ||
1202 (ico_ivi_optionflag() & ICO_IVI_OPTION_SHOW_SURFACE))) {
1203 uifw_trace("win_mgr_register_surface: No Manager, Force visible");
1207 uifw_trace("win_mgr_register_surface: Manager exist, Not visible");
1212 usurf->uclient = find_client_from_client(client);
1213 if (! usurf->uclient) {
1214 /* client not exist, create client management table */
1215 uifw_trace("win_mgr_register_surface: Create Client");
1216 win_mgr_bind_client(client, NULL);
1217 usurf->uclient = find_client_from_client(client);
1218 if (! usurf->uclient) {
1219 uifw_error("win_mgr_register_surface: No Memory");
1223 wl_list_insert(usurf->uclient->surface_link.prev, &usurf->client_link);
1225 /* make surface id hash table */
1226 hash = MAKE_IDHASH(usurf->surfaceid);
1227 phash = _ico_win_mgr->idhash[hash];
1231 phash = phash->next_idhash;
1234 bhash->next_idhash = usurf;
1237 _ico_win_mgr->idhash[hash] = usurf;
1240 /* make weston surface hash table */
1241 hash = MAKE_WSHASH(usurf->surface);
1242 phash = _ico_win_mgr->wshash[hash];
1246 phash = phash->next_wshash;
1249 bhash->next_wshash = usurf;
1252 _ico_win_mgr->wshash[hash] = usurf;
1255 /* set default layer id */
1256 switch (layertype) {
1257 case LAYER_TYPE_BACKGROUND:
1258 layer = _ico_ivi_background_layer;
1260 case LAYER_TYPE_TOUCH:
1261 layer = _ico_ivi_touch_layer;
1263 case LAYER_TYPE_CURSOR:
1264 layer = _ico_ivi_cursor_layer;
1267 if (_ico_win_mgr->num_manager > 0) {
1268 layer = _ico_ivi_default_layer;
1271 layer = _ico_ivi_startup_layer;
1275 win_mgr_set_layer(usurf, layer);
1277 uifw_trace("win_mgr_register_surface: Leave(surfaceId=%08x)", usurf->surfaceid);
1280 /*--------------------------------------------------------------------------*/
1282 * @brief win_mgr_surface_map: map surface to display
1284 * @param[in] surface Weston surface
1285 * @param[in] width surface width
1286 * @param[in] height surface height
1287 * @param[in] sx X coordinate on screen
1288 * @param[in] sy Y coordinate on screen
1291 /*--------------------------------------------------------------------------*/
1293 win_mgr_surface_map(struct weston_surface *surface, int32_t *width, int32_t *height,
1294 int32_t *sx, int32_t *sy)
1296 struct uifw_win_surface *usurf;
1298 uifw_trace("win_mgr_surface_map: Enter(%08x, x/y=%d/%d w/h=%d/%d)",
1299 (int)surface, *sx, *sy, *width, *height);
1301 usurf = find_uifw_win_surface_by_ws(surface);
1304 uifw_trace("win_mgr_surface_map: surf=%08x w/h=%d/%d vis=%d",
1305 usurf->surfaceid, usurf->width, usurf->height, usurf->visible);
1306 if ((usurf->width > 0) && (usurf->height > 0)) {
1307 uifw_trace("win_mgr_surface_map: HomeScreen registed, PositionSize"
1308 "(surf=%08x x/y=%d/%d w/h=%d/%d vis=%d",
1309 usurf->surfaceid, usurf->x, usurf->y, usurf->width, usurf->height,
1311 *width = usurf->width;
1312 *height = usurf->height;
1313 win_mgr_surface_configure(usurf, usurf->node_tbl->disp_x + usurf->x,
1314 usurf->node_tbl->disp_y + usurf->y,
1315 usurf->width, usurf->height);
1318 uifw_trace("win_mgr_surface_map: HomeScreen not regist Surface, "
1319 "Change PositionSize(surf=%08x x/y=%d/%d w/h=%d/%d)",
1320 usurf->surfaceid, *sx, *sy, *width, *height);
1321 usurf->width = *width;
1322 usurf->height = *height;
1325 if (usurf->x < 0) usurf->x = 0;
1326 if (usurf->y < 0) usurf->y = 0;
1327 if (usurf->layertype == LAYER_TYPE_INPUTPANEL) {
1329 usurf->node_tbl = &_ico_node_table[_ico_ivi_inputpanel_display];
1331 usurf->width = (float)usurf->surface->geometry.width
1332 * (float)_ico_ivi_inputdeco_mag / 100.0f;
1333 usurf->height = (float)usurf->surface->geometry.height
1334 * (float)_ico_ivi_inputdeco_mag / 100.0f;
1336 if ((usurf->width > (usurf->node_tbl->disp_width - 16)) ||
1337 (usurf->height > (usurf->node_tbl->disp_height - 16))) {
1338 usurf->x = (usurf->node_tbl->disp_width
1339 - usurf->surface->geometry.width) / 2;
1340 usurf->y = usurf->node_tbl->disp_height
1341 - usurf->surface->geometry.height - 16
1342 - _ico_ivi_inputdeco_diff;
1343 if (usurf->x < 0) usurf->x = 0;
1344 if (usurf->y < 0) usurf->y = 0;
1347 win_mgr_set_scale(usurf);
1349 usurf->x = (usurf->node_tbl->disp_width
1350 - usurf->width) / 2;
1351 usurf->y = usurf->node_tbl->disp_height
1352 - usurf->height - 16 - _ico_ivi_inputdeco_diff;
1353 if (usurf->x < 0) usurf->x = 0;
1354 if (usurf->y < 0) usurf->y = 0;
1356 uifw_trace("win_mgr_surface_map: set position %08x %d.%d/%d",
1357 usurf->surfaceid, usurf->node_tbl->node, usurf->x, usurf->y);
1359 if (((ico_ivi_optionflag() & ICO_IVI_OPTION_SHOW_SURFACE) == 0) &&
1360 (_ico_win_mgr->num_manager > 0)) {
1361 /* HomeScreen exist, coodinate set by HomeScreen */
1362 if (usurf->visible) {
1363 win_mgr_surface_configure(usurf, usurf->node_tbl->disp_x + usurf->x,
1364 usurf->node_tbl->disp_y + usurf->y,
1365 usurf->width, usurf->height);
1368 win_mgr_surface_configure(usurf, ICO_IVI_MAX_COORDINATE+1,
1369 ICO_IVI_MAX_COORDINATE+1,
1370 usurf->width, usurf->height);
1372 uifw_trace("win_mgr_surface_map: Change size/position x/y=%d/%d w/h=%d/%d",
1373 (int)surface->geometry.x, (int)surface->geometry.y,
1374 surface->geometry.width, surface->geometry.height);
1376 else if (usurf->layertype != LAYER_TYPE_INPUTPANEL) {
1377 uifw_trace("win_mgr_surface_map: No HomeScreen, chaneg to Visible");
1378 ico_window_mgr_set_visible(usurf, 1);
1381 if (usurf->visible) {
1382 win_mgr_surface_configure(usurf, usurf->node_tbl->disp_x + usurf->x,
1383 usurf->node_tbl->disp_y + usurf->y,
1384 usurf->width, usurf->height);
1387 win_mgr_surface_configure(usurf, ICO_IVI_MAX_COORDINATE+1,
1388 ICO_IVI_MAX_COORDINATE+1,
1389 usurf->width, usurf->height);
1394 if (usurf->visible) {
1395 ico_window_mgr_restack_layer(NULL);
1397 uifw_trace("win_mgr_surface_map: Leave");
1400 uifw_trace("win_mgr_surface_map: Leave(No UIFW Surface)");
1404 /*--------------------------------------------------------------------------*/
1406 * @brief ico_window_mgr_restack_layer: restack surface list
1408 * @param[in] usurf UIFW surface (if NULL, no surface)
1411 /*--------------------------------------------------------------------------*/
1413 ico_window_mgr_restack_layer(struct uifw_win_surface *usurf)
1415 struct uifw_win_surface *eu;
1416 struct uifw_win_layer *el;
1417 int32_t buf_width, buf_height;
1419 struct weston_layer *wlayer;
1420 struct weston_surface *surface, *surfacetmp;
1421 int num_visible = 0;
1424 /* make compositor surface list */
1425 wlayer = ico_ivi_shell_weston_layer();
1427 uifw_trace("ico_window_mgr_restack_layer: Enter(surf=%08x) layer=%08x",
1428 (int)usurf, (int)wlayer);
1430 /* remove all surfaces in panel_layer */
1431 wl_list_for_each_safe (surface, surfacetmp, &wlayer->surface_list, layer_link) {
1432 wl_list_remove(&surface->layer_link);
1433 wl_list_init(&surface->layer_link);
1435 wl_list_init(&wlayer->surface_list);
1437 wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) {
1438 wl_list_for_each (eu, &el->surface_list, ivi_layer) {
1439 if (eu->surface == NULL) continue;
1441 /* target only panel or unknown layer */
1442 layertype = ico_ivi_shell_layertype(eu->surface);
1443 if ((layertype != LAYER_TYPE_PANEL) && (layertype != LAYER_TYPE_INPUTPANEL) &&
1444 (layertype != LAYER_TYPE_FULLSCREEN) && (layertype != LAYER_TYPE_CURSOR) &&
1445 (layertype != LAYER_TYPE_UNKNOWN)) {
1448 wl_list_remove(&eu->surface->layer_link);
1449 wl_list_init(&eu->surface->layer_link);
1451 if (eu->mapped != 0) {
1452 if ((el->visible == FALSE) || (eu->visible == FALSE)) {
1453 new_x = (float)(ICO_IVI_MAX_COORDINATE+1);
1454 new_y = (float)(ICO_IVI_MAX_COORDINATE+1);
1456 else if (eu->surface->buffer_ref.buffer) {
1457 buf_width = weston_surface_buffer_width(eu->surface);
1458 buf_height = weston_surface_buffer_height(eu->surface);
1459 if ((eu->width > buf_width) && (eu->scalex <= 1.0f)) {
1460 new_x = (float)(eu->x +
1461 (eu->width - eu->surface->geometry.width)/2);
1464 new_x = (float)eu->x;
1466 if ((eu->height > buf_height) && (eu->scaley <= 1.0f)) {
1467 new_y = (float) (eu->y +
1468 (eu->height - eu->surface->geometry.height)/2);
1471 new_y = (float)eu->y;
1473 new_x += eu->node_tbl->disp_x + eu->xadd;
1474 new_y += eu->node_tbl->disp_y + eu->yadd;
1478 new_x = (float)(eu->x + eu->node_tbl->disp_x + eu->xadd);
1479 new_y = (float)(eu->y + eu->node_tbl->disp_y + eu->yadd);
1481 wl_list_insert(wlayer->surface_list.prev, &eu->surface->layer_link);
1482 if ((eu->restrain_configure == 0) &&
1483 ((new_x != eu->surface->geometry.x) ||
1484 (new_y != eu->surface->geometry.y))) {
1485 weston_surface_damage_below(eu->surface);
1486 weston_surface_set_position(eu->surface, (float)new_x, (float)new_y);
1487 weston_surface_damage(eu->surface);
1489 uifw_debug("ico_window_mgr_restack_layer:%3d(%d).%08x(%08x:%d) "
1490 "x/y=%d/%d w/h=%d/%d %x",
1491 el->layer, el->visible, eu->surfaceid, (int)eu->surface,
1492 eu->visible, (int)eu->surface->geometry.x,
1493 (int)eu->surface->geometry.y, eu->surface->geometry.width,
1494 eu->surface->geometry.height, eu->layertype);
1499 /* damage(redraw) target surfacem if target exist */
1501 weston_surface_damage(usurf->surface);
1504 /* composit and draw screen(plane) */
1505 weston_compositor_schedule_repaint(_ico_win_mgr->compositor);
1507 if ((_ico_win_mgr->shell_init == 0) && (num_visible > 0) &&
1508 (_ico_win_mgr->shell != NULL) && (_ico_win_mgr->num_manager > 0)) {
1509 /* start shell fade */
1510 _ico_win_mgr->shell_init = 1;
1511 ico_ivi_shell_startup(_ico_win_mgr->shell);
1513 uifw_trace("ico_window_mgr_restack_layer: Leave");
1516 /*--------------------------------------------------------------------------*/
1518 * @brief ico_window_mgr_touch_layer: touch panel layer control
1520 * @param[in] omit omit touch layer flag (TRUE=omit/FALSE=not omit)
1523 /*--------------------------------------------------------------------------*/
1525 ico_window_mgr_touch_layer(int omit)
1527 struct uifw_win_surface *eu;
1529 /* check current touch layer mode */
1530 if ((_ico_win_mgr->touch_layer == NULL) ||
1531 ((omit != FALSE) && (_ico_win_mgr->touch_layer->visible == FALSE))) {
1532 uifw_trace("ico_window_mgr_touch_layer: touch layer not exist or hide");
1536 wl_list_for_each (eu, &_ico_win_mgr->touch_layer->surface_list, ivi_layer) {
1537 if ((eu->surface == NULL) || (eu->mapped == 0)) continue;
1538 if (omit != FALSE) {
1539 eu->animation.pos_x = (int)eu->surface->geometry.x;
1540 eu->animation.pos_y = (int)eu->surface->geometry.y;
1541 eu->surface->geometry.x = (float)(ICO_IVI_MAX_COORDINATE+1);
1542 eu->surface->geometry.y = (float)(ICO_IVI_MAX_COORDINATE+1);
1545 eu->surface->geometry.x = (float)eu->animation.pos_x;
1546 eu->surface->geometry.y = (float)eu->animation.pos_y;
1551 /*--------------------------------------------------------------------------*/
1553 * @brief win_mgr_create_layer: create new layer
1555 * @param[in] usurf UIFW surface, (if need)
1556 * @param[in] layer layer id
1557 * @param[in] layertype layer type if need
1559 * @retval != NULL success(layer management table)
1560 * @retval == NULL error(No Memory)
1562 /*--------------------------------------------------------------------------*/
1563 static struct uifw_win_layer *
1564 win_mgr_create_layer(struct uifw_win_surface *usurf, const uint32_t layer,
1565 const int layertype)
1567 struct uifw_win_layer *el;
1568 struct uifw_win_layer *new_el;
1570 new_el = malloc(sizeof(struct uifw_win_layer));
1572 uifw_trace("win_mgr_create_layer: Leave(No Memory)");
1576 memset(new_el, 0, sizeof(struct uifw_win_layer));
1577 new_el->layer = layer;
1578 if ((int)layer == _ico_ivi_background_layer ) {
1579 new_el->layertype = LAYER_TYPE_BACKGROUND;
1581 else if ((int)layer == _ico_ivi_touch_layer ) {
1582 new_el->layertype = LAYER_TYPE_TOUCH;
1583 _ico_win_mgr->touch_layer = new_el;
1585 else if ((int)layer == _ico_ivi_cursor_layer ) {
1586 new_el->layertype = LAYER_TYPE_CURSOR;
1589 new_el->layertype = LAYER_TYPE_PANEL;
1591 new_el->visible = TRUE;
1592 wl_list_init(&new_el->surface_list);
1593 wl_list_init(&new_el->link);
1595 wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) {
1596 if (layer >= el->layer) break;
1598 if (&el->link == &_ico_win_mgr->ivi_layer_list) {
1599 wl_list_insert(_ico_win_mgr->ivi_layer_list.prev, &new_el->link);
1602 wl_list_insert(el->link.prev, &new_el->link);
1606 wl_list_remove(&usurf->ivi_layer);
1607 wl_list_insert(&new_el->surface_list, &usurf->ivi_layer);
1608 usurf->win_layer = new_el;
1609 if (new_el->layertype == LAYER_TYPE_CURSOR) {
1610 usurf->layertype = LAYER_TYPE_CURSOR;
1616 /*--------------------------------------------------------------------------*/
1618 * @brief win_mgr_set_layer: set(or change) surface layer
1620 * @param[in] usurf UIFW surface
1621 * @param[in] layer layer id
1624 /*--------------------------------------------------------------------------*/
1626 win_mgr_set_layer(struct uifw_win_surface *usurf, const uint32_t layer)
1628 struct uifw_win_layer *el;
1629 struct uifw_win_layer *new_el;
1632 uifw_trace("win_mgr_set_layer: Enter(%08x,%08x,%x)",
1633 usurf->surfaceid, (int)usurf->surface, layer);
1635 /* check if same layer */
1636 if (usurf->win_layer != NULL) {
1637 oldlayer = usurf->win_layer->layer ;
1638 if (oldlayer == layer) {
1639 uifw_trace("win_mgr_set_layer: Leave(Same Layer)");
1647 /* search existing layer */
1648 wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) {
1649 if (el->layer == layer) break;
1652 if (&el->link == &_ico_win_mgr->ivi_layer_list) {
1653 /* layer not exist, create new layer */
1654 uifw_trace("win_mgr_set_layer: New Layer %d(%d)", layer, usurf->layertype);
1655 new_el = win_mgr_create_layer(usurf, layer, usurf->layertype);
1657 uifw_trace("win_mgr_set_layer: Leave(No Memory)");
1662 uifw_trace("win_mgr_set_layer: Add surface to Layer %d", layer);
1663 usurf->win_layer = el;
1664 win_mgr_set_raise(usurf, 3);
1667 /* set input region */
1668 if (layer == (uint32_t)_ico_ivi_cursor_layer) {
1669 uifw_trace("win_mgr_set_layer: %08x cursor Change to cursor layer (%d,%d)-(%d,%d)",
1671 usurf->surface->input.extents.x1, usurf->surface->input.extents.y1,
1672 usurf->surface->input.extents.x2, usurf->surface->input.extents.y2);
1673 pixman_region32_fini(&usurf->surface->pending.input);
1674 pixman_region32_init_rect(&usurf->surface->pending.input,
1675 ICO_IVI_MAX_COORDINATE + 1, ICO_IVI_MAX_COORDINATE + 1,
1678 else if (oldlayer == (uint32_t)_ico_ivi_cursor_layer) {
1679 uifw_trace("win_mgr_set_layer: %08x cursor Change to normal layer (%d,%d)-(%d,%d)",
1681 usurf->surface->input.extents.x1, usurf->surface->input.extents.y1,
1682 usurf->surface->input.extents.x2, usurf->surface->input.extents.y2);
1683 pixman_region32_fini(&usurf->surface->pending.input);
1684 pixman_region32_init_rect(&usurf->surface->pending.input,
1685 INT32_MIN, INT32_MIN, UINT32_MAX, UINT32_MAX);
1688 /* rebild compositor surface list */
1689 if (usurf->visible) {
1690 ico_window_mgr_restack_layer(usurf);
1692 uifw_trace("win_mgr_set_layer: Leave");
1695 /*--------------------------------------------------------------------------*/
1697 * @brief win_mgr_set_active: set(or change) active surface
1699 * @param[in] usurf UIFW surface
1700 * @param[in] target target device
1703 /*--------------------------------------------------------------------------*/
1705 win_mgr_set_active(struct uifw_win_surface *usurf, const int target)
1707 struct weston_seat *seat;
1708 struct weston_surface *surface;
1709 int object = target;
1710 #if 0 /* pointer grab can not release */
1712 #endif /* pointer grab can not release */
1714 uifw_trace("win_mgr_set_active: Enter(%08x,%x)", (int)usurf, target);
1716 if ((usurf) && (usurf->shsurf) && (usurf->surface)) {
1717 surface = usurf->surface;
1718 if ((object & (ICO_WINDOW_MGR_ACTIVE_POINTER|ICO_WINDOW_MGR_ACTIVE_KEYBOARD)) == 0) {
1720 if (_ico_win_mgr->active_pointer_usurf == usurf) {
1721 object |= ICO_WINDOW_MGR_ACTIVE_POINTER;
1723 if (_ico_win_mgr->active_keyboard_usurf == usurf) {
1724 object |= ICO_WINDOW_MGR_ACTIVE_KEYBOARD;
1728 if (object & ICO_WINDOW_MGR_ACTIVE_POINTER) {
1729 _ico_win_mgr->active_pointer_usurf = usurf;
1731 if (object & ICO_WINDOW_MGR_ACTIVE_KEYBOARD) {
1732 _ico_win_mgr->active_keyboard_usurf = usurf;
1739 object = ICO_WINDOW_MGR_ACTIVE_POINTER | ICO_WINDOW_MGR_ACTIVE_KEYBOARD;
1741 if (object & ICO_WINDOW_MGR_ACTIVE_POINTER) {
1742 _ico_win_mgr->active_pointer_usurf = NULL;
1744 if (object & ICO_WINDOW_MGR_ACTIVE_KEYBOARD) {
1745 _ico_win_mgr->active_keyboard_usurf = NULL;
1749 wl_list_for_each (seat, &_ico_win_mgr->compositor->seat_list, link) {
1750 #if 0 /* pointer grab can not release */
1751 if (object & ICO_WINDOW_MGR_ACTIVE_POINTER) {
1753 if ((seat->pointer != NULL) && (seat->pointer->focus != surface)) {
1754 uifw_trace("win_mgr_set_active: pointer reset focus(%08x)",
1755 (int)seat->pointer->focus);
1756 if (seat->pointer->button_count > 0) {
1757 /* emulate button release */
1758 notify_button(seat, weston_compositor_get_time(),
1759 seat->pointer->grab_button,
1760 WL_POINTER_BUTTON_STATE_RELEASED);
1761 /* count up button, because real mouse botan release */
1762 seat->pointer->button_count ++;
1764 weston_pointer_set_focus(seat->pointer, NULL,
1765 wl_fixed_from_int(0), wl_fixed_from_int(0));
1768 uifw_trace("win_mgr_set_active: pointer nochange surface(%08x)",
1771 if ((seat->touch != NULL) && (seat->touch->focus != surface)) {
1772 uifw_trace("win_mgr_set_active: touch reset surface(%08x)",
1773 (int)seat->touch->focus);
1774 if (seat->num_tp > 10) {
1775 seat->num_tp = 0; /* safty gard */
1777 else if (seat->num_tp > 0) {
1778 /* emulate touch up */
1779 savetp = seat->num_tp;
1780 for (i = 0; i < savetp; i++) {
1781 notify_touch(seat, weston_compositor_get_time(), i+1,
1782 seat->touch->grab_x, seat->touch->grab_y,
1785 /* touch count up, becase real touch release */
1786 seat->num_tp = savetp;
1788 weston_touch_set_focus(seat, NULL);
1791 uifw_trace("win_mgr_set_active: touch nochange surface(%08x)",
1796 uifw_trace("win_mgr_set_active: pointer reset surface(%08x)",
1797 (int)seat->pointer->focus);
1798 if ((seat->pointer != NULL) && (seat->pointer->focus != NULL)) {
1799 if (seat->pointer->button_count > 0) {
1800 /* emulate button release */
1801 notify_button(seat, weston_compositor_get_time(),
1802 seat->pointer->grab_button,
1803 WL_POINTER_BUTTON_STATE_RELEASED);
1804 seat->pointer->button_count ++;
1806 weston_pointer_set_focus(seat->pointer, NULL,
1807 wl_fixed_from_int(0), wl_fixed_from_int(0));
1809 if ((seat->touch != NULL) && (seat->touch->focus != NULL)) {
1810 if (seat->num_tp > 10) {
1811 seat->num_tp = 0; /* safty gard */
1813 else if (seat->num_tp > 0) {
1814 /* emulate touch up */
1815 savetp = seat->num_tp;
1816 for (i = 0; i < savetp; i++) {
1817 notify_touch(seat, weston_compositor_get_time(), i+1,
1818 seat->touch->grab_x, seat->touch->grab_y,
1821 /* touch count up, becase real touch release */
1822 seat->num_tp = savetp;
1824 weston_touch_set_focus(seat, NULL);
1828 #endif /* pointer grab can not release */
1829 if ((object & ICO_WINDOW_MGR_ACTIVE_KEYBOARD) && (seat->keyboard)) {
1831 if (seat->keyboard->focus != surface) {
1832 weston_keyboard_set_focus(seat->keyboard, surface);
1833 uifw_trace("win_mgr_set_active: keyboard change surface(%08x=>%08x)",
1834 (int)seat->keyboard->focus, (int)surface);
1837 uifw_trace("win_mgr_set_active: keyboard nochange surface(%08x)",
1842 uifw_trace("win_mgr_set_active: keyboard reset surface(%08x)",
1843 (int)seat->keyboard);
1844 weston_keyboard_set_focus(seat->keyboard, NULL);
1848 uifw_trace("win_mgr_set_active: Leave(%08x)", (int)usurf);
1851 /*--------------------------------------------------------------------------*/
1853 * @brief ico_window_mgr_ismykeyboard: check active keyboard
1855 * @param[in] usurf UIFW surface
1856 * @return check result
1857 * @retval =1 usurf is active keyboard surface
1858 * @retval =0 usurf is not active
1860 /*--------------------------------------------------------------------------*/
1862 ico_window_mgr_ismykeyboard(struct uifw_win_surface *usurf)
1864 return (_ico_win_mgr->active_keyboard_usurf == usurf) ? 1 : 0;
1867 /*--------------------------------------------------------------------------*/
1869 * @brief uifw_declare_manager: declare manager(ex.SystemController) client
1871 * @param[in] client Weyland client
1872 * @param[in] resource resource of request
1873 * @param[in] manager manager(1=manager, 0=not manager)
1876 /*--------------------------------------------------------------------------*/
1878 uifw_declare_manager(struct wl_client *client, struct wl_resource *resource, int manager)
1880 struct uifw_manager* mgr;
1881 struct uifw_win_surface *usurf;
1882 struct uifw_client *uclient;
1883 struct uifw_win_layer *el;
1885 uifw_trace("uifw_declare_manager: Enter client=%08x manager=%d",
1886 (int)client, manager);
1888 uclient = find_client_from_client(client);
1890 uifw_trace("uifw_declare_manager: Leave(unknown client=%08x)", (int)client);
1894 uclient->manager = manager;
1896 /* client set to manager */
1897 _ico_win_mgr->num_manager = 0;
1898 wl_list_for_each (mgr, &_ico_win_mgr->manager_list, link) {
1899 if (mgr->resource == resource) {
1900 if (mgr->manager != manager) {
1901 uifw_trace("uifw_declare_manager: Event Client.%08x Callback %d=>%d",
1902 (int)client, mgr->manager, manager);
1903 mgr->manager = manager;
1906 wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) {
1907 wl_list_for_each (usurf, &el->surface_list, ivi_layer) {
1908 /* send window create event to manager */
1909 if (usurf->created != 0) {
1910 uifw_trace("uifw_declare_manager: Send manager(%08x) "
1911 "WINDOW_CREATED(surf=%08x,pid=%d,appid=%s)",
1912 (int)resource, usurf->surfaceid,
1913 usurf->uclient->pid, usurf->uclient->appid);
1914 ico_window_mgr_send_window_created(resource,
1917 usurf->uclient->pid,
1918 usurf->uclient->appid,
1919 usurf->layertype << 12);
1927 _ico_win_mgr->num_manager++;
1930 uifw_trace("uifw_declare_manager: Leave(managers=%d)", _ico_win_mgr->num_manager);
1933 /*--------------------------------------------------------------------------*/
1935 * @brief uifw_set_window_layer: set layer id to surface
1937 * @param[in] client Weyland client
1938 * @param[in] resource resource of request
1939 * @param[in] surfaceid UIFW surface id
1940 * @param[in] layer layer id
1943 /*--------------------------------------------------------------------------*/
1945 uifw_set_window_layer(struct wl_client *client, struct wl_resource *resource,
1946 uint32_t surfaceid, uint32_t layer)
1948 if (layer == ICO_WINDOW_MGR_LAYERTYPE_BACKGROUND) {
1949 layer = _ico_ivi_background_layer;
1951 else if (layer == ICO_WINDOW_MGR_LAYERTYPE_TOUCH) {
1952 layer = _ico_ivi_touch_layer;
1954 else if (layer == ICO_WINDOW_MGR_LAYERTYPE_CURSOR) {
1955 layer = _ico_ivi_cursor_layer;
1957 else if (layer == ICO_WINDOW_MGR_LAYERTYPE_STARTUP) {
1958 layer = _ico_ivi_startup_layer;
1961 uifw_trace("uifw_set_window_layer: Enter res=%08x surfaceid=%08x layer=%d",
1962 (int)resource, surfaceid, layer);
1964 struct uifw_win_surface *usurf = ico_window_mgr_get_usurf_client(surfaceid, client);
1967 uifw_trace("uifw_set_window_layer: Leave(No Surface(id=%08x))", surfaceid);
1971 if (usurf->win_layer->layer != layer) {
1972 win_mgr_set_layer(usurf, layer);
1973 win_mgr_change_surface(usurf->surface, -1, 1);
1975 uifw_trace("uifw_set_window_layer: Leave");
1978 /*--------------------------------------------------------------------------*/
1980 * @brief uifw_set_positionsize: set surface position and size
1982 * @param[in] client Weyland client
1983 * @param[in] resource resource of request
1984 * @param[in] surfaceid UIFW surface id
1985 * @param[in] node surface node id
1986 * @param[in] x X coordinate on screen(if bigger than 16383, no change)
1987 * @param[in] y Y coordinate on screen(if bigger than 16383, no change)
1988 * @param[in] width surface width(if bigger than 16383, no change)
1989 * @param[in] height surface height(if bigger than 16383, no change)
1990 * @param[in] flags with/without animation and client configure flag
1993 /*--------------------------------------------------------------------------*/
1995 uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource,
1996 uint32_t surfaceid, uint32_t node, int32_t x, int32_t y,
1997 int32_t width, int32_t height, int32_t flags)
1999 struct uifw_client *uclient;
2000 struct uifw_win_surface *usurf;
2001 struct weston_surface *es;
2005 struct uifw_node_table *oldnode;
2007 uifw_trace("uifw_set_positionsize: Enter surf=%08x node=%x x/y/w/h=%d/%d/%d/%d flag=%x",
2008 surfaceid, node, x, y, width, height, flags);
2010 usurf = ico_window_mgr_get_usurf_client(surfaceid, client);
2012 uifw_trace("uifw_set_positionsize: Leave(surf=%08x NOT Found)", surfaceid);
2017 oldnode = usurf->node_tbl;
2019 uclient = find_client_from_client(client);
2022 if (((int)node) >= _ico_num_nodes) {
2023 uifw_trace("uifw_set_positionsize: node=%d dose not exist(max=%d)",
2024 node, _ico_num_nodes);
2025 if ((ico_ivi_optionflag() & ICO_IVI_OPTION_SHOW_NODISP) == 0) {
2026 if (usurf->visible) {
2027 /* no display, change to hide */
2028 uifw_set_visible(client, resource, surfaceid, ICO_WINDOW_MGR_VISIBLE_HIDE,
2029 ICO_WINDOW_MGR_V_NOCHANGE, 0);
2035 usurf->node_tbl = &_ico_node_table[node];
2037 es = usurf->surface;
2039 /* weston surface exist */
2040 es = usurf->surface;
2041 retanima = ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA;
2043 /* if x,y,width,height bigger then ICO_IVI_MAX_COORDINATE, no change */
2044 if (x > ICO_IVI_MAX_COORDINATE) x = usurf->x;
2045 if (y > ICO_IVI_MAX_COORDINATE) y = usurf->y;
2046 if (width > ICO_IVI_MAX_COORDINATE) width = usurf->width;
2047 if (height > ICO_IVI_MAX_COORDINATE) height = usurf->height;
2049 /* check animation */
2050 if ((usurf->animation.restrain_configure != 0) &&
2051 (x == usurf->x) && (y == usurf->y) &&
2052 (width == usurf->width) && (height == usurf->height)) {
2053 uifw_trace("uifw_set_positionsize: Leave(same position size at animation)");
2058 if ((surfaceid != ICO_WINDOW_MGR_V_MAINSURFACE) &&
2059 (uclient->manager == 0) && (uclient->privilege == 0)) uclient = NULL;
2062 if ((usurf->width > 0) && (usurf->height > 0)) {
2063 win_mgr_surface_change_mgr(es, x, y, width, height);
2064 uifw_trace("uifw_set_positionsize: Leave(Request from App)");
2068 uifw_trace("uifw_set_positionsize: Initial Position/Size visible=%d",
2070 /* Initiale position is (0,0) */
2071 weston_surface_set_position(es, (float)(usurf->node_tbl->disp_x),
2072 (float)(usurf->node_tbl->disp_y));
2075 uifw_trace("uifw_set_positionsize: Old geometry x/y=%d/%d,w/h=%d/%d",
2076 (int)es->geometry.x, (int)es->geometry.y,
2077 (int)es->geometry.width, (int)es->geometry.height);
2079 usurf->animation.pos_x = usurf->x;
2080 usurf->animation.pos_y = usurf->y;
2081 usurf->animation.pos_width = usurf->width;
2082 usurf->animation.pos_height = usurf->height;
2083 usurf->animation.no_configure = (flags & ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE) ? 1 : 0;
2087 usurf->width = width;
2088 usurf->height = height;
2089 if (_ico_win_mgr->num_manager <= 0) {
2090 /* no manager(HomeScreen), set geometory */
2091 weston_surface_set_position(es, (float)(usurf->node_tbl->disp_x + x),
2092 (float)(usurf->node_tbl->disp_y + y));
2094 if ((es->output) && (es->buffer_ref.buffer) &&
2095 (es->geometry.width > 0) && (es->geometry.height > 0)) {
2096 uifw_trace("uifw_set_positionsize: Fixed Geometry, Change(Vis=%d)",
2098 if (usurf->visible) {
2099 if ((flags & ICO_WINDOW_MGR_FLAGS_ANIMATION) &&
2100 (win_mgr_hook_animation != NULL)) {
2101 /* with animation */
2102 if ((x != (usurf->surface->geometry.x - usurf->node_tbl->disp_x)) ||
2103 (y != (usurf->surface->geometry.y - usurf->node_tbl->disp_y))) {
2104 op = ICO_WINDOW_MGR_ANIMATION_OPMOVE;
2106 else if ((width != usurf->surface->geometry.width) ||
2107 (height != usurf->surface->geometry.height)) {
2108 op = ICO_WINDOW_MGR_ANIMATION_OPRESIZE;
2111 op = ICO_WINDOW_MGR_ANIMATION_OPNONE;
2113 if (((op == ICO_WINDOW_MGR_ANIMATION_OPMOVE) &&
2114 (usurf->animation.move_anima != ICO_WINDOW_MGR_ANIMATION_NONE)) ||
2115 ((op == ICO_WINDOW_MGR_ANIMATION_OPRESIZE) &&
2116 (usurf->animation.resize_anima != ICO_WINDOW_MGR_ANIMATION_NONE))) {
2117 retanima = (*win_mgr_hook_animation)(op, (void *)usurf);
2118 uifw_trace("uifw_set_positionsize: ret call anima = %d", retanima);
2121 if ((retanima == ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA) ||
2122 (retanima != ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL)) {
2123 ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y,
2124 usurf->width, usurf->height);
2128 if ((retanima == ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA) ||
2129 (retanima != ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL)) {
2130 win_mgr_change_surface(es,
2131 (flags & ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE) ? -1 : 0, 1);
2133 uifw_trace("uifw_set_positionsize: Leave(OK,output=%08x)", (int)es->output);
2138 usurf->width = width;
2139 usurf->height = height;
2140 uifw_trace("uifw_set_positionsize: Leave(OK, but no buffer)");
2143 /* if position change, call hook for input region */
2144 if (win_mgr_hook_change != NULL) {
2145 if ((oldx != usurf->x) || (oldy != usurf->y) || (oldnode != usurf->node_tbl)) {
2146 (*win_mgr_hook_change)(usurf);
2151 /*--------------------------------------------------------------------------*/
2153 * @brief uifw_set_visible: surface visible/raise control
2155 * @param[in] client Weyland client
2156 * @param[in] resource resource of request
2157 * @param[in] surfaceid UIFW surface id
2158 * @param[in] visible visible(1=show/0=hide/other=no change)
2159 * @param[in] raise raise(1=raise/0=lower/other=no change)
2160 * @param[in] flags with/without animation
2163 /*--------------------------------------------------------------------------*/
2165 uifw_set_visible(struct wl_client *client, struct wl_resource *resource,
2166 uint32_t surfaceid, int32_t visible, int32_t raise, int32_t flags)
2168 struct uifw_win_surface *usurf;
2169 struct uifw_client *uclient;
2174 uifw_trace("uifw_set_visible: Enter(surf=%08x,%d,%d,%x)",
2175 surfaceid, visible, raise, flags);
2177 usurf = ico_window_mgr_get_usurf_client(surfaceid, client);
2178 if ((! usurf) || (! usurf->surface)) {
2179 uifw_trace("uifw_set_visible: Leave(Surface Not Exist)");
2182 oldvisible = ico_window_mgr_is_visible(usurf);
2184 uclient = find_client_from_client(client);
2186 if ((surfaceid != ICO_WINDOW_MGR_V_MAINSURFACE) &&
2187 (uclient->manager == 0) && (uclient->privilege == 0)) {
2188 uifw_trace("uifw_set_visible: Request from App(%s), not Manager",
2193 uifw_trace("uifw_set_visible: Request from Manager(%s)", uclient->appid);
2197 uifw_trace("uifw_set_visible: Request from Unknown App, not Manager");
2202 if ((usurf->disable == 0) && (visible == ICO_WINDOW_MGR_VISIBLE_SHOW)) {
2204 #if PERFORMANCE_EVALUATIONS > 0
2205 if (! usurf->visible) {
2206 uifw_perf("SWAP_BUFFER Show appid=%s surface=%08x",
2207 usurf->uclient->appid, usurf->surfaceid);
2209 #endif /*PERFORMANCE_EVALUATIONS*/
2210 if ((! usurf->visible) ||
2211 (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE)) {
2213 uifw_trace("uifw_set_visible: Change to Visible");
2215 ico_ivi_shell_set_toplevel(usurf->shsurf);
2217 /* Weston surface configure */
2218 uifw_trace("uifw_set_visible: Visible to Weston WSurf=%08x,%d.%d/%d/%d/%d",
2219 (int)usurf->surface, usurf->node_tbl->node, usurf->x, usurf->y,
2220 usurf->width, usurf->height);
2221 ico_ivi_shell_set_surface_type(usurf->shsurf);
2222 ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y,
2223 usurf->width, usurf->height);
2225 restack = 1; /* need damage */
2227 if ((flags & (ICO_WINDOW_MGR_ANIMATION_POS|ICO_WINDOW_MGR_FLAGS_ANIMATION)) &&
2228 (usurf->animation.show_anima != ICO_WINDOW_MGR_ANIMATION_NONE) &&
2229 (win_mgr_hook_animation != NULL)) {
2230 usurf->animation.pos_x = usurf->x;
2231 usurf->animation.pos_y = usurf->y;
2232 usurf->animation.pos_width = usurf->width;
2233 usurf->animation.pos_height = usurf->height;
2234 usurf->animation.no_configure = 0;
2235 retanima = (*win_mgr_hook_animation)(
2236 (flags & ICO_WINDOW_MGR_ANIMATION_POS) ?
2237 ICO_WINDOW_MGR_ANIMATION_OPSHOWPOS :
2238 ICO_WINDOW_MGR_ANIMATION_OPSHOW,
2240 uifw_trace("uifw_set_visible: ret call anima = %d", retanima);
2243 else if ((raise != ICO_WINDOW_MGR_RAISE_LOWER) &&
2244 (raise != ICO_WINDOW_MGR_RAISE_RAISE)) {
2245 uifw_trace("uifw_set_visible: Leave(No Change)");
2249 else if (visible == ICO_WINDOW_MGR_VISIBLE_HIDE) {
2251 #if PERFORMANCE_EVALUATIONS > 0
2252 if (usurf->visible) {
2253 uifw_perf("SWAP_BUFFER Hide appid=%s surface=%08x",
2254 usurf->uclient->appid, usurf->surfaceid);
2256 #endif /*PERFORMANCE_EVALUATIONS*/
2257 if ((usurf->visible) ||
2258 (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE)) {
2261 win_mgr_reset_focus(usurf);
2263 /* Weston surface configure */
2264 weston_surface_damage_below(usurf->surface);
2265 ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y,
2266 usurf->width, usurf->height);
2268 retanima = ICO_WINDOW_MGR_ANIMATION_RET_ANIMA;
2269 if ((flags & (ICO_WINDOW_MGR_FLAGS_ANIMATION|ICO_WINDOW_MGR_ANIMATION_POS)) &&
2270 (usurf->animation.hide_anima != ICO_WINDOW_MGR_ANIMATION_NONE) &&
2271 (win_mgr_hook_animation != NULL)) {
2272 usurf->animation.pos_x = usurf->x;
2273 usurf->animation.pos_y = usurf->y;
2274 usurf->animation.pos_width = usurf->width;
2275 usurf->animation.pos_height = usurf->height;
2276 usurf->animation.no_configure = 0;
2277 retanima = (*win_mgr_hook_animation)(
2278 (flags & ICO_WINDOW_MGR_ANIMATION_POS) ?
2279 ICO_WINDOW_MGR_ANIMATION_OPHIDEPOS :
2280 ICO_WINDOW_MGR_ANIMATION_OPHIDE,
2283 if (retanima != ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL) {
2285 uifw_trace("uifw_set_visible: Change to UnVisible");
2286 /* change visible to unvisible, restack surface list */
2288 /* Weston surface configure */
2289 ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y,
2290 usurf->width, usurf->height);
2293 uifw_trace("uifw_set_visible: UnVisible but animation");
2296 else if ((raise != ICO_WINDOW_MGR_RAISE_LOWER) &&
2297 (raise != ICO_WINDOW_MGR_RAISE_RAISE)) {
2298 uifw_trace("uifw_set_visible: Leave(No Change)");
2302 else if ((raise != ICO_WINDOW_MGR_RAISE_LOWER) &&
2303 (raise != ICO_WINDOW_MGR_RAISE_RAISE)) {
2304 uifw_trace("uifw_set_visible: Leave(No Change)");
2309 if ((raise == ICO_WINDOW_MGR_RAISE_LOWER) || (raise == ICO_WINDOW_MGR_RAISE_RAISE)) {
2310 win_mgr_set_raise(usurf, raise);
2311 if (usurf->visible == 0) {
2316 raise = ICO_WINDOW_MGR_V_NOCHANGE;
2320 ico_window_mgr_restack_layer(usurf);
2323 /* send event(VISIBLE) to manager */
2325 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE,
2327 (visible == ICO_WINDOW_MGR_VISIBLE_SHOW) ? 1 :
2328 ((visible == ICO_WINDOW_MGR_VISIBLE_HIDE) ? 0 :
2329 ICO_WINDOW_MGR_V_NOCHANGE),
2330 raise, uclient ? 0 : 1, 0,0);
2333 /* if visible change, call hook for input region */
2334 if (win_mgr_hook_change != NULL) {
2335 if (oldvisible != ico_window_mgr_is_visible(usurf)) {
2336 (*win_mgr_hook_change)(usurf);
2339 uifw_trace("uifw_set_visible: Leave(OK)");
2342 /*--------------------------------------------------------------------------*/
2344 * @brief uifw_set_animation: set animation of surface visible/unvisible
2346 * @param[in] client Weyland client
2347 * @param[in] resource resource of request
2348 * @param[in] surfaceid UIFW surface id
2349 * @param[in] type how to change surface
2350 * @param[in] anmation animation name
2351 * @param[in] time animation time(ms), if 0, default time
2354 /*--------------------------------------------------------------------------*/
2356 uifw_set_animation(struct wl_client *client, struct wl_resource *resource,
2357 uint32_t surfaceid, int32_t type, const char *animation, int32_t time)
2360 struct uifw_win_surface *usurf = ico_window_mgr_get_usurf_client(surfaceid, client);
2362 uifw_trace("uifw_set_transition: surf=%08x,type=%x,anim=%s,time=%d",
2363 surfaceid, type, animation, time);
2366 if ((*animation != 0) && (*animation != ' ')) {
2367 animaid = ico_get_animation_name(animation);
2368 uifw_trace("uifw_set_animation: Leave(OK) type=%d", animaid);
2369 if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE) {
2370 if ((usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPHIDE) ||
2371 (usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPHIDEPOS)) {
2372 usurf->animation.next_anima = animaid;
2375 usurf->animation.hide_anima = animaid;
2378 if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW) {
2379 if ((usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPSHOW) ||
2380 (usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPSHOWPOS)) {
2381 usurf->animation.next_anima = animaid;
2384 usurf->animation.show_anima = animaid;
2387 if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE) {
2388 if (usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPMOVE) {
2389 usurf->animation.next_anima = animaid;
2392 usurf->animation.move_anima = animaid;
2395 if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE) {
2396 if (usurf->animation.type == ICO_WINDOW_MGR_ANIMATION_OPRESIZE) {
2397 usurf->animation.next_anima = animaid;
2400 usurf->animation.resize_anima = animaid;
2404 if ((time > 0) && (time != ICO_WINDOW_MGR_V_NOCHANGE)) {
2405 if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE) {
2406 usurf->animation.hide_time = time;
2408 if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW) {
2409 usurf->animation.show_time = time;
2411 if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE) {
2412 usurf->animation.move_time = time;
2414 if (type & ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE) {
2415 usurf->animation.resize_time = time;
2420 uifw_trace("uifw_set_animation: Surface(%08x) Not exist", surfaceid);
2424 /*--------------------------------------------------------------------------*/
2426 * @brief uifw_set_attributes: set surface attributes
2428 * @param[in] client Weyland client
2429 * @param[in] resource resource of request
2430 * @param[in] surfaceid UIFW surface id
2431 * @param[in] attributes surface attributes
2434 /*--------------------------------------------------------------------------*/
2436 uifw_set_attributes(struct wl_client *client, struct wl_resource *resource,
2437 uint32_t surfaceid, uint32_t attributes)
2439 struct uifw_win_surface *usurf = ico_window_mgr_get_usurf_client(surfaceid, client);
2441 uifw_trace("uifw_set_attributes: Enter(surf=%08x,attributes=%x)", surfaceid, attributes);
2444 usurf->attributes = attributes;
2445 if ((attributes & (ICO_WINDOW_MGR_ATTR_ALIGN_LEFT|ICO_WINDOW_MGR_ATTR_ALIGN_RIGHT)) ==
2446 (ICO_WINDOW_MGR_ATTR_ALIGN_LEFT|ICO_WINDOW_MGR_ATTR_ALIGN_RIGHT)) {
2447 usurf->attributes &=
2448 ~(ICO_WINDOW_MGR_ATTR_ALIGN_LEFT|ICO_WINDOW_MGR_ATTR_ALIGN_RIGHT);
2450 if ((attributes & (ICO_WINDOW_MGR_ATTR_ALIGN_TOP|ICO_WINDOW_MGR_ATTR_ALIGN_BOTTOM)) ==
2451 (ICO_WINDOW_MGR_ATTR_ALIGN_TOP|ICO_WINDOW_MGR_ATTR_ALIGN_BOTTOM)) {
2452 usurf->attributes &=
2453 ~(ICO_WINDOW_MGR_ATTR_ALIGN_TOP|ICO_WINDOW_MGR_ATTR_ALIGN_BOTTOM);
2456 uifw_trace("uifw_set_attributes: Leave");
2459 /*--------------------------------------------------------------------------*/
2461 * @brief uifw_visible_animation: surface visibility control with animation
2463 * @param[in] client Weyland client
2464 * @param[in] resource resource of request
2465 * @param[in] surfaceid surface id
2466 * @param[in] visible visible(1=show/0=hide)
2467 * @param[in] x X coordinate on screen(if bigger than 16383, no change)
2468 * @param[in] y Y coordinate on screen(if bigger than 16383, no change)
2469 * @param[in] width surface width(if bigger than 16383, no change)
2470 * @param[in] height surface height(if bigger than 16383, no change)
2473 /*--------------------------------------------------------------------------*/
2475 uifw_visible_animation(struct wl_client *client, struct wl_resource *resource,
2476 uint32_t surfaceid, int32_t visible,
2477 int32_t x, int32_t y, int32_t width, int32_t height)
2479 struct uifw_win_surface *usurf;
2481 uifw_trace("uifw_visible_animation: Enter(%08x,%d,x/y=%d/%d,w/h=%d/%d)",
2482 surfaceid, visible, x, y, width, height);
2484 usurf = ico_window_mgr_get_usurf_client(surfaceid, client);
2486 if ((! usurf) || (! usurf->surface)) {
2487 uifw_trace("uifw_visible_animation: Leave(Surface Not Exist)");
2491 usurf->animation.pos_x = x;
2492 usurf->animation.pos_y = y;
2493 if (width > 0) usurf->animation.pos_width = width;
2494 else usurf->animation.pos_width = 1;
2495 if (height > 0) usurf->animation.pos_height = height;
2496 else usurf->animation.pos_height = 1;
2497 usurf->animation.no_configure = 0;
2499 uifw_set_visible(client, resource, surfaceid, visible,
2500 ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_ANIMATION_POS);
2502 uifw_trace("uifw_visible_animation: Leave");
2505 /*--------------------------------------------------------------------------*/
2507 * @brief uifw_set_active: set active surface
2509 * @param[in] client Weyland client
2510 * @param[in] resource resource of request
2511 * @param[in] surfaceid UIFW surface id
2512 * @param[in] active target device
2515 /*--------------------------------------------------------------------------*/
2517 uifw_set_active(struct wl_client *client, struct wl_resource *resource,
2518 uint32_t surfaceid, int32_t active)
2520 struct uifw_win_surface *usurf;
2522 uifw_trace("uifw_set_active: Enter(surf=%08x,active=%x)", surfaceid, active);
2524 if ((surfaceid > 0) &&
2525 ((active & (ICO_WINDOW_MGR_ACTIVE_POINTER|ICO_WINDOW_MGR_ACTIVE_KEYBOARD)) != 0)) {
2526 usurf = ico_window_mgr_get_usurf_client(surfaceid, client);
2532 switch (active & (ICO_WINDOW_MGR_ACTIVE_POINTER|ICO_WINDOW_MGR_ACTIVE_KEYBOARD)) {
2533 case ICO_WINDOW_MGR_ACTIVE_POINTER:
2534 if (usurf != _ico_win_mgr->active_pointer_usurf) {
2535 uifw_trace("uifw_set_active: pointer active change %08x->%08x",
2536 _ico_win_mgr->active_pointer_usurf ?
2537 _ico_win_mgr->active_pointer_usurf->surfaceid : 0,
2538 usurf ? usurf->surfaceid : 0);
2539 if (_ico_win_mgr->active_pointer_usurf) {
2540 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
2541 _ico_win_mgr->active_pointer_usurf,
2542 (_ico_win_mgr->active_keyboard_usurf ==
2543 _ico_win_mgr->active_pointer_usurf) ?
2544 ICO_WINDOW_MGR_ACTIVE_KEYBOARD :
2545 ICO_WINDOW_MGR_ACTIVE_NONE,
2548 _ico_win_mgr->active_pointer_usurf = usurf;
2549 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
2551 ICO_WINDOW_MGR_ACTIVE_POINTER |
2552 (_ico_win_mgr->active_keyboard_usurf == usurf) ?
2553 ICO_WINDOW_MGR_ACTIVE_KEYBOARD : 0,
2555 win_mgr_set_active(usurf, ICO_WINDOW_MGR_ACTIVE_POINTER);
2558 case ICO_WINDOW_MGR_ACTIVE_KEYBOARD:
2559 if (usurf != _ico_win_mgr->active_keyboard_usurf) {
2560 uifw_trace("uifw_set_active: keyboard active change %08x->%08x",
2561 _ico_win_mgr->active_keyboard_usurf ?
2562 _ico_win_mgr->active_keyboard_usurf->surfaceid : 0,
2563 usurf ? usurf->surfaceid : 0);
2564 if (_ico_win_mgr->active_keyboard_usurf) {
2565 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
2566 _ico_win_mgr->active_keyboard_usurf,
2567 (_ico_win_mgr->active_keyboard_usurf ==
2568 _ico_win_mgr->active_pointer_usurf) ?
2569 ICO_WINDOW_MGR_ACTIVE_POINTER :
2570 ICO_WINDOW_MGR_ACTIVE_NONE,
2573 _ico_win_mgr->active_keyboard_usurf = usurf;
2574 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
2576 ICO_WINDOW_MGR_ACTIVE_KEYBOARD |
2577 (_ico_win_mgr->active_pointer_usurf == usurf) ?
2578 ICO_WINDOW_MGR_ACTIVE_POINTER : 0,
2580 win_mgr_set_active(usurf, ICO_WINDOW_MGR_ACTIVE_KEYBOARD);
2584 if ((usurf != _ico_win_mgr->active_pointer_usurf) ||
2585 (usurf != _ico_win_mgr->active_keyboard_usurf)) {
2586 uifw_trace("uifw_set_active: active change %08x/%08x->%08x",
2587 _ico_win_mgr->active_pointer_usurf ?
2588 _ico_win_mgr->active_pointer_usurf->surfaceid : 0,
2589 _ico_win_mgr->active_keyboard_usurf ?
2590 _ico_win_mgr->active_keyboard_usurf->surfaceid : 0,
2591 usurf ? usurf->surfaceid : 0);
2592 if (_ico_win_mgr->active_pointer_usurf) {
2593 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
2594 _ico_win_mgr->active_pointer_usurf,
2595 ICO_WINDOW_MGR_ACTIVE_NONE,
2597 if (_ico_win_mgr->active_keyboard_usurf ==
2598 _ico_win_mgr->active_pointer_usurf) {
2599 _ico_win_mgr->active_keyboard_usurf = NULL;
2602 if (_ico_win_mgr->active_keyboard_usurf) {
2603 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
2604 _ico_win_mgr->active_keyboard_usurf,
2605 ICO_WINDOW_MGR_ACTIVE_NONE,
2608 _ico_win_mgr->active_pointer_usurf = usurf;
2609 _ico_win_mgr->active_keyboard_usurf = usurf;
2610 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
2612 ICO_WINDOW_MGR_ACTIVE_POINTER |
2613 ICO_WINDOW_MGR_ACTIVE_KEYBOARD,
2615 win_mgr_set_active(usurf, ICO_WINDOW_MGR_ACTIVE_POINTER |
2616 ICO_WINDOW_MGR_ACTIVE_KEYBOARD);
2620 uifw_trace("uifw_set_active: Leave(Change Active)");
2623 win_mgr_set_active(NULL, active);
2624 uifw_trace("uifw_set_active: Leave(Reset active surface)");
2628 /*--------------------------------------------------------------------------*/
2630 * @brief uifw_set_layer_visible: layer visible control
2632 * @param[in] client Weyland client
2633 * @param[in] resource resource of request
2634 * @param[in] layer layer id
2635 * @param[in] visible visible(1=show/0=hide)
2638 /*--------------------------------------------------------------------------*/
2640 uifw_set_layer_visible(struct wl_client *client, struct wl_resource *resource,
2641 uint32_t layer, int32_t visible)
2643 struct uifw_win_layer *el;
2644 struct uifw_win_layer *new_el;
2645 struct uifw_win_surface *usurf;
2648 if ((layer == ICO_WINDOW_MGR_LAYERTYPE_BACKGROUND) ||
2649 (layer == (uint32_t)_ico_ivi_background_layer)) {
2650 layer = _ico_ivi_background_layer;
2651 layertype = LAYER_TYPE_BACKGROUND;
2653 else if ((layer == ICO_WINDOW_MGR_LAYERTYPE_TOUCH) ||
2654 (layer == (uint32_t)_ico_ivi_touch_layer)) {
2655 layer = _ico_ivi_touch_layer;
2656 layertype = LAYER_TYPE_TOUCH;
2658 else if ((layer == ICO_WINDOW_MGR_LAYERTYPE_CURSOR) ||
2659 (layer == (uint32_t)_ico_ivi_cursor_layer)) {
2660 layer = _ico_ivi_cursor_layer;
2661 layertype = LAYER_TYPE_CURSOR;
2663 else if (layer == ICO_WINDOW_MGR_LAYERTYPE_STARTUP) {
2664 layer = _ico_ivi_startup_layer;
2667 uifw_trace("uifw_set_layer_visible: Enter(layer=%d, visilbe=%d)", layer, visible);
2670 wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) {
2671 if (el->layer == layer) break;
2674 if (&el->link == &_ico_win_mgr->ivi_layer_list) {
2675 /* layer not exist, create new layer */
2676 uifw_trace("uifw_set_layer_visible: New Layer %d", layer);
2677 new_el = win_mgr_create_layer(NULL, layer, layertype);
2679 uifw_trace("uifw_set_layer_visible: Leave(No Memory)");
2682 new_el->visible = (visible != 0) ? TRUE : FALSE;
2683 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_LAYER_VISIBLE, NULL,
2684 layer, new_el->visible, 0,0,0);
2685 uifw_trace("uifw_set_layer_visible: Leave(new layer)");
2689 /* control all surface in layer */
2690 if ((el->visible != FALSE) && (visible == 0)) {
2691 /* layer change to NOT visible */
2692 uifw_trace("uifw_set_layer_visible: change to not visible");
2693 el->visible = FALSE;
2695 else if ((el->visible == FALSE) && (visible != 0)) {
2696 /* layer change to visible */
2697 uifw_trace("uifw_set_layer_visible: change to visible");
2702 uifw_trace("uifw_set_layer_visible: Leave(no Change %d=>%d)",
2703 el->visible, visible);
2707 /* set damege area */
2708 wl_list_for_each (usurf, &el->surface_list, ivi_layer) {
2709 if ((usurf->visible != FALSE) && (usurf->surface != NULL) &&
2710 (usurf->surface->output != NULL)) {
2711 /* Reset focus if hide */
2713 win_mgr_reset_focus(usurf);
2715 /* Damage(redraw) target surface */
2716 weston_surface_damage_below(usurf->surface);
2720 /* rebild compositor surface list */
2721 ico_window_mgr_restack_layer(NULL);
2723 /* send layer visible event to manager */
2724 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_LAYER_VISIBLE, NULL,
2725 layer, el->visible, 0,0,0);
2727 uifw_trace("uifw_set_layer_visible: Leave");
2730 /*--------------------------------------------------------------------------*/
2732 * @brief uifw_get_surfaces: get application surfaces
2734 * @param[in] client Weyland client
2735 * @param[in] resource resource of request
2736 * @param[in] appid application id
2737 * @param[in] pid process id
2740 /*--------------------------------------------------------------------------*/
2742 uifw_get_surfaces(struct wl_client *client, struct wl_resource *resource,
2743 const char *appid, int32_t pid)
2745 struct uifw_client *uclient;
2746 struct uifw_win_layer *el;
2747 struct uifw_win_surface *usurf;
2748 struct wl_array reply;
2751 uifw_trace("uifw_get_surfaces: Enter(appid=%s, pid=%d)", appid ? appid : " ", pid);
2753 wl_array_init(&reply);
2755 wl_list_for_each (uclient, &_ico_win_mgr->client_list, link) {
2756 if ((appid != NULL) && (*appid != ' ')) {
2757 if (strcmp(uclient->appid, appid) == 0) break;
2760 if (uclient->pid == pid) break;
2763 if (&uclient->link == &_ico_win_mgr->client_list) {
2764 uifw_trace("uifw_get_surfaces: appid=%s pid=%d dose not exist",
2765 appid ? appid : " ", pid);
2768 wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) {
2769 wl_list_for_each (usurf, &el->surface_list, ivi_layer) {
2770 if (usurf->uclient == uclient) {
2771 uifw_trace("uifw_get_surfaces: %s(%d) surf=%08x",
2772 uclient->appid, uclient->pid, usurf->surfaceid);
2773 up = (uint32_t *)wl_array_add(&reply, sizeof(uint32_t));
2775 *up = usurf->surfaceid;
2781 ico_window_mgr_send_app_surfaces(resource, uclient->appid, uclient->pid, &reply);
2783 wl_array_release(&reply);
2784 uifw_trace("uifw_get_surfaces: Leave");
2787 /*--------------------------------------------------------------------------*/
2789 * @brief win_mgr_check_mapsurface: check and change all surface
2791 * @param[in] animation weston animation table(unused)
2792 * @param[in] outout weston output table(unused)
2793 * @param[in] mseces current time(unused)
2796 /*--------------------------------------------------------------------------*/
2798 win_mgr_check_mapsurface(struct weston_animation *animation,
2799 struct weston_output *output, uint32_t msecs)
2801 struct uifw_surface_map *sm;
2803 int wait = 99999999;
2805 /* check touch down counter */
2806 if (touch_check_seat) {
2807 if (touch_check_seat->num_tp > 10) {
2808 uifw_trace("win_mgr_check_mapsurface: illegal touch counter(num=%d), reset",
2809 (int)touch_check_seat->num_tp);
2810 touch_check_seat->num_tp = 0;
2814 /* check all mapped surfaces */
2815 curtime = weston_compositor_get_time();
2816 wl_list_for_each (sm, &_ico_win_mgr->map_list, map_link) {
2817 uifw_detail("win_mgr_check_mapsurface: sm=%08x surf=%08x",
2818 (int)sm, sm->usurf->surfaceid);
2819 win_mgr_change_mapsurface(sm, 0, curtime);
2821 if (sm->interval < wait) {
2822 wait = sm->interval;
2827 /* check frame interval */
2834 wl_event_source_timer_update(_ico_win_mgr->wait_mapevent, wait);
2837 /*--------------------------------------------------------------------------*/
2839 * @brief win_mgr_timer_mapsurface: mapped surface check timer
2841 * @param[in] data user data(unused)
2844 /*--------------------------------------------------------------------------*/
2846 win_mgr_timer_mapsurface(void *data)
2848 win_mgr_check_mapsurface(NULL, NULL, 0);
2852 /*--------------------------------------------------------------------------*/
2854 * @brief win_mgr_change_mapsurface: check and change mapped surface
2856 * @param[in] sm map surface table
2857 * @param[in] event send event (if 0, send if changed)
2858 * @param[in] curtime current time(ms)
2861 /*--------------------------------------------------------------------------*/
2863 win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event, uint32_t curtime)
2865 struct uifw_drm_buffer *drm_buffer;
2866 struct uifw_dri_image *dri_image;
2867 struct uifw_intel_region *dri_region;
2868 struct uifw_gl_surface_state *gl_state;
2869 struct weston_surface *es;
2877 int delta, settime2;
2878 struct ico_uifw_image_buffer *p;
2880 uifw_detail("win_mgr_change_mapsurface: surf=%08x event=%d", sm->usurf->surfaceid, event);
2882 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS;
2885 /* check if buffered */
2887 es = sm->usurf->surface;
2889 ((sm->type == ICO_WINDOW_MGR_MAP_TYPE_EGL) &&
2890 ((es->buffer_ref.buffer == NULL) ||
2891 (es->buffer_ref.buffer->width <= 0) || (es->buffer_ref.buffer->height <= 0)))) {
2892 /* surface has no buffer */
2893 uifw_debug("win_mgr_change_mapsurface: surface(%08x) has no buffer %08x %08x",
2894 sm->usurf->surfaceid, (int)es,
2895 es ? (int)es->buffer_ref.buffer : 0);
2897 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP;
2903 else if (sm->type == ICO_WINDOW_MGR_MAP_TYPE_EGL) {
2904 if ((es->buffer_ref.buffer->legacy_buffer != NULL) && (es->renderer_state != NULL)) {
2905 drm_buffer = (struct uifw_drm_buffer *)wl_resource_get_user_data(
2906 (struct wl_resource *)es->buffer_ref.buffer->legacy_buffer);
2907 if ((drm_buffer != NULL) && (drm_buffer->driver_buffer == NULL)) {
2911 if (drm_buffer == NULL) {
2912 /* surface has no buffer */
2913 uifw_debug("win_mgr_change_mapsurface: surface(%08x) has no buffer",
2914 sm->usurf->surfaceid);
2916 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP;
2923 else if (sm->uclient->shmbuf == NULL) {
2924 /* no GPU acceleration but no buffer */
2925 uifw_debug("win_mgr_change_mapsurface: client has no shared memory buffer");
2927 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP;
2934 if ((event != 0) && (event != ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP)) {
2936 if (sm->type == ICO_WINDOW_MGR_MAP_TYPE_EGL) {
2937 gl_state = (struct uifw_gl_surface_state *)es->renderer_state;
2938 if (gl_state->buffer_type == BUFFER_TYPE_SHM) {
2939 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR;
2941 else if (gl_state->buffer_type != BUFFER_TYPE_EGL) {
2945 dri_image = (struct uifw_dri_image *)drm_buffer->driver_buffer;
2946 dri_region = dri_image->region;
2947 width = es->buffer_ref.buffer->width;
2948 height = es->buffer_ref.buffer->height;
2949 stride = drm_buffer->stride[0];
2950 if (drm_buffer->format == __DRI_IMAGE_FOURCC_XRGB8888) {
2951 format = EGL_TEXTURE_RGB;
2953 else if (drm_buffer->format == __DRI_IMAGE_FOURCC_ARGB8888) {
2954 format = EGL_TEXTURE_RGBA;
2957 /* unknown format, error */
2958 format = EGL_NO_TEXTURE;
2960 eglname = dri_region->name;
2962 if (drm_intel_bo_flink((drm_intel_bo *)dri_region->bo, &eglname)) {
2963 uifw_warn("win_mgr_change_mapsurface: drm_intel_bo_flink() Error");
2967 if ((sm->initflag == 0) && (eglname != 0) &&
2968 (width > 0) && (height > 0) && (stride > 0)) {
2970 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP;
2973 if ((eglname == 0) || (width <= 0) || (height <= 0) || (stride <= 0)) {
2976 else if (event == ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS) {
2977 if ((sm->width != width) || (sm->height != height) ||
2978 (sm->stride != stride) || (format != sm->format)) {
2979 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_RESIZE;
2981 else if (eglname != sm->eglname) {
2982 #if PERFORMANCE_EVALUATIONS > 0
2983 uifw_perf("SWAP_BUFFER appid=%s surface=%08x name=%d",
2984 sm->usurf->uclient->appid, sm->usurf->surfaceid,
2986 #endif /*PERFORMANCE_EVALUATIONS*/
2987 dtime = curtime - sm->lasttime;
2988 if ((sm->interval > 0) && (dtime < sm->interval)) {
2993 else if (sm->eventque) {
2994 dtime = curtime - sm->lasttime;
2995 if ((sm->interval > 0) && (dtime < sm->interval)) {
3005 sm->height = height;
3006 sm->stride = stride;
3007 sm->eglname = eglname;
3008 sm->format = format;
3012 if ((sm->type != ICO_WINDOW_MGR_MAP_TYPE_PIXEL) || (sm->eventque != 0) ||
3013 (es->buffer_ref.buffer == NULL) || (es->buffer_ref.buffer != sm->curbuf)) {
3014 sm->curbuf = es->buffer_ref.buffer;
3015 if (es->buffer_ref.buffer != NULL) {
3016 width = es->buffer_ref.buffer->width;
3017 height = es->buffer_ref.buffer->height;
3020 width = sm->usurf->client_width;
3021 height = sm->usurf->client_height;
3023 /* get shared memory buffer area */
3024 idx2 = sm->uclient->bufnum;
3025 settime2 = 0x7fffffff;
3026 for (idx = 0; idx < sm->uclient->bufnum; idx++) {
3027 p = (struct ico_uifw_image_buffer *)
3028 (((char *)sm->uclient->shmbuf) + idx * sm->uclient->bufsize);
3029 if (p->settime == p->reftime) break;
3030 delta = curtime - p->settime;
3032 delta = delta + 0x80000000;
3034 if ((delta > 3000) && (delta < settime2)) {
3036 settime2 = p->settime;
3039 uifw_detail("win_mgr_change_mapsurface: PIX %08x idx=%d idx2=%d w/h=%d/%d",
3040 sm->usurf->surfaceid, idx, idx2, width, height);
3041 if (idx >= sm->uclient->bufnum) {
3044 if (idx >= sm->uclient->bufnum) {
3045 uifw_debug("win_mgr_change_mapsurface: shared buffer full");
3050 else if ((sm->initflag == 0) && (width > 0) && (height > 0)) {
3052 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP;
3053 uifw_detail("win_mgr_change_mapsurface: PIX MAP event %08x",
3054 sm->usurf->surfaceid);
3057 if ((width <= 0) || (height <= 0)) {
3060 uifw_detail("win_mgr_change_mapsurface: PIX %08x w/h=0/0",
3061 sm->usurf->surfaceid);
3063 else if (event == ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS) {
3064 #if PERFORMANCE_EVALUATIONS > 0
3065 if (sm->type != ICO_WINDOW_MGR_MAP_TYPE_SHM) {
3066 uifw_perf("SWAP_BUFFER appid=%s surface=%08x",
3067 sm->usurf->uclient->appid, sm->usurf->surfaceid);
3069 #endif /*PERFORMANCE_EVALUATIONS*/
3070 if ((sm->width != width) || (sm->height != height)) {
3071 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_RESIZE;
3074 dtime = curtime - sm->lasttime;
3075 if ((sm->interval > 0) && (dtime < sm->interval)) {
3078 uifw_detail("win_mgr_change_mapsurface: PIX %08x new queue",
3079 sm->usurf->surfaceid);
3081 else if (sm->eventque) {
3082 dtime = curtime - sm->lasttime;
3083 if ((sm->interval > 0) && (dtime < sm->interval)) {
3085 uifw_detail("win_mgr_change_mapsurface: PIX %08x queued",
3086 sm->usurf->surfaceid);
3093 sm->height = height;
3095 sm->format = EGL_TEXTURE_RGBA;
3098 p = (struct ico_uifw_image_buffer *)
3099 (((char *)sm->uclient->shmbuf) + idx * sm->uclient->bufsize);
3100 height = (sm->uclient->bufsize - sizeof(struct ico_uifw_image_buffer))
3102 uifw_detail("win_mgr_change_mapsurface: PIX read buf=%08x height=%d(%d)",
3103 (int)p, height, sm->height);
3104 if ((height < sm->height) &&
3105 (sm->type == ICO_WINDOW_MGR_MAP_TYPE_SHM)) {
3106 uifw_warn("win_mgr_change_mapsurface: Buffer SHM, "
3107 "but buffer overflow(%d>%d)", sm->height, height);
3108 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR;
3112 if (height > sm->height) {
3113 height = sm->height;
3115 if ((*(_ico_win_mgr->compositor->renderer->read_surface_pixels))
3116 (es, PIXMAN_a8r8g8b8, p->image,
3117 0, 0, sm->width, height) != 0) {
3118 uifw_debug("win_mgr_change_mapsurface: Error read pixel %s.%08x",
3119 sm->usurf->uclient->appid, sm->usurf->surfaceid);
3120 event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR;
3124 uifw_detail("win_mgr_change_mapsurface: PIX read pixels(%d)",
3126 p->surfaceid = sm->usurf->surfaceid;
3127 p->settime = curtime;
3128 p->width = sm->width;
3130 sm->eglname = idx + 1;
3142 uifw_detail("win_mgr_change_mapsurface: send MAP event(ev=%d surf=%08x type=%d "
3143 "name=%d w/h/s=%d/%d/%d format=%x",
3144 event, sm->usurf->surfaceid, sm->type, sm->eglname,
3145 sm->width, sm->height, sm->stride, sm->format);
3146 sm->lasttime = curtime;
3148 ico_window_mgr_send_map_surface(sm->uclient->mgr->resource, event,
3149 sm->usurf->surfaceid, sm->type, sm->eglname,
3150 sm->width, sm->height, sm->stride, sm->format);
3151 if (event == ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR) {
3152 /* free map table if error */
3153 wl_list_remove(&sm->surf_link);
3154 wl_list_remove(&sm->map_link);
3155 sm->usurf = (struct uifw_win_surface *)_ico_win_mgr->free_maptable;
3156 _ico_win_mgr->free_maptable = sm;
3161 /*--------------------------------------------------------------------------*/
3163 * @brief uifw_set_map_buffer: set map surface image buffer
3165 * @param[in] client Weyland client
3166 * @param[in] resource resource of request
3167 * @param[in] shmname shared memory name(POSIX I/F)
3168 * @param[in] bufsize buffer size in byte
3169 * @param[in] bufnum number of buffers
3172 /*--------------------------------------------------------------------------*/
3174 uifw_set_map_buffer(struct wl_client *client, struct wl_resource *resource,
3175 const char *shmname, uint32_t bufsize, uint32_t bufnum)
3177 struct uifw_client *uclient;
3178 struct ico_uifw_image_buffer *p;
3183 uifw_trace("uifw_set_map_buffer: Enter(%s,%d,%d)",
3184 shmname ? shmname : "(null)", bufsize, bufnum);
3186 uclient = find_client_from_client(client);
3187 if ((! uclient) || (! uclient->mgr)) {
3188 /* client dose not exist, error */
3189 uifw_trace("uifw_set_map_buffer: Leave(client=%08x dose not exist)", (int)client);
3193 if ((shmname == NULL) || (*shmname == 0) || (*shmname == ' ') ||
3194 (bufsize == 0) || (bufnum == 0)) {
3195 /* delete shared memory buffer */
3196 if (uclient->shmbuf) {
3197 munmap(uclient->shmbuf, uclient->bufsize * uclient->bufnum);
3198 uclient->shmbuf = NULL;
3200 uifw_trace("uifw_set_map_buffer: Leave(delete shared memory buffer)");
3204 shmfd = shm_open(shmname, O_RDWR, 0600);
3206 /* shared memory dose not exist */
3207 uifw_trace("uifw_set_map_buffer: Leave(shared memory(%s) dose not exist)", shmname);
3211 shmbuf = (char *)mmap(NULL, bufsize * bufnum, PROT_READ|PROT_WRITE, MAP_SHARED, shmfd, 0);
3214 if (shmbuf == NULL) {
3215 /* can not map shared memory */
3216 uifw_trace("uifw_set_map_buffer: Leave(can not map shared memory(%s))", shmname);
3219 if (uclient->shmbuf) {
3220 munmap(uclient->shmbuf, uclient->bufsize * uclient->bufnum);
3223 uclient->shmbuf = shmbuf;
3224 uclient->bufsize = bufsize;
3225 uclient->bufnum = bufnum;
3226 for (i = 0; i < (int)bufnum; i++) {
3227 p = (struct ico_uifw_image_buffer *)(((char *)shmbuf) + bufsize * i);
3228 memset((char *)p, 0, sizeof(struct ico_uifw_image_buffer));
3229 memcpy((char *)&p->magich, ICO_UIFW_IMAGE_BUFFER_MAGICH, 4);
3230 memcpy((char *)&p->magict, ICO_UIFW_IMAGE_BUFFER_MAGICT, 4);
3232 uifw_trace("uifw_set_map_buffer: Leave(shm addr=%08x)", (int)uclient->shmbuf);
3235 /*--------------------------------------------------------------------------*/
3237 * @brief uifw_map_surface: mapped surface buffer to system application
3239 * @param[in] client Weyland client
3240 * @param[in] resource resource of request
3241 * @param[in] surfaceid surface id
3242 * @param[in] framerate frame rate of surface update(frame/sec)
3245 /*--------------------------------------------------------------------------*/
3247 uifw_map_surface(struct wl_client *client, struct wl_resource *resource,
3248 uint32_t surfaceid, int32_t framerate)
3250 struct uifw_win_surface *usurf;
3251 struct weston_surface *es;
3252 struct uifw_surface_map *sm;
3253 struct weston_buffer *buffer;
3254 struct uifw_client *uclient;
3255 struct uifw_drm_buffer *drm_buffer;
3256 struct uifw_gl_surface_state *gl_state;
3259 uifw_trace("uifw_map_surface: Enter(surface=%08x,fps=%d)", surfaceid, framerate);
3261 usurf = ico_window_mgr_get_usurf(surfaceid);
3263 /* surface dose not exist, error */
3264 ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR,
3265 surfaceid, 1, 0, 0, 0, 0, 0);
3266 uifw_trace("uifw_map_surface: Leave(surface=%08x dose not exist)", surfaceid);
3269 uclient = find_client_from_client(client);
3270 if ((! uclient) || (! uclient->mgr)) {
3271 /* client dose not exist, error */
3272 ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR,
3273 surfaceid, 2, 0, 0, 0, 0, 0);
3274 uifw_trace("uifw_map_surface: Leave(client=%08x dose not exist)", (int)client);
3278 /* check if buffered */
3279 es = usurf->surface;
3281 /* surface has no buffer, error */
3282 ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR,
3283 surfaceid, 3, 0, 0, 0, 0, 0);
3284 uifw_trace("uifw_map_surface: Leave(surface(%08x) has no surface)", surfaceid);
3288 /* check buffer type */
3289 gl_state = (struct uifw_gl_surface_state *)es->renderer_state;
3290 if ((_ico_ivi_gpu_type == ICO_GPUTYPE_NOACCELERATION) ||
3291 (gl_state == NULL) || (gl_state->buffer_type == BUFFER_TYPE_SHM)) {
3292 /* wl_shm_buffer support ReadPixels */
3293 if ((_ico_win_mgr->compositor->renderer == NULL) ||
3294 (_ico_win_mgr->compositor->renderer->read_surface_pixels == NULL)) {
3295 ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR,
3296 surfaceid, 4, 0, 0, 0, 0, 0);
3297 uifw_trace("uifw_map_surface: Leave(surface(%08x) not support ReadPixels)",
3301 else if ((gl_state != NULL) && (gl_state->buffer_type == BUFFER_TYPE_SHM) &&
3302 (es->buffer_ref.buffer != NULL)) {
3303 maptype = ICO_WINDOW_MGR_MAP_TYPE_SHM;
3306 maptype = ICO_WINDOW_MGR_MAP_TYPE_PIXEL;
3308 if (uclient->shmbuf == NULL) {
3309 /* ReadPixcels but client has no shared memory buffer */
3310 ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR,
3311 surfaceid, 5, 0, 0, 0, 0, 0);
3312 uifw_trace("uifw_map_surface: Leave(client has no shared memory buffer)");
3317 /* H/W(GPU) driver EGL buffer (Intel only) */
3318 maptype = ICO_WINDOW_MGR_MAP_TYPE_EGL;
3321 /* maximum framerate */
3322 if (maptype == ICO_WINDOW_MGR_MAP_TYPE_EGL) {
3323 if ((framerate <= 0) || (framerate > _ico_ivi_map_framerate_gpu))
3324 framerate = _ico_ivi_map_framerate_gpu;
3326 else if (maptype == ICO_WINDOW_MGR_MAP_TYPE_SHM) {
3327 if ((framerate <= 0) || (framerate > _ico_ivi_map_framerate_shm))
3328 framerate = _ico_ivi_map_framerate_shm;
3331 if ((framerate <= 0) || (framerate > _ico_ivi_map_framerate_pixel))
3332 framerate = _ico_ivi_map_framerate_pixel;
3335 /* check same surface */
3336 wl_list_for_each(sm, &usurf->surf_map, surf_link) {
3337 if ((sm->usurf == usurf) && (sm->uclient == uclient)) {
3342 if (&sm->surf_link == &usurf->surf_map) {
3343 /* create map table */
3344 sm = _ico_win_mgr->free_maptable;
3346 _ico_win_mgr->free_maptable = (struct uifw_surface_map *)sm->usurf;
3349 sm = (struct uifw_surface_map *)malloc(sizeof(struct uifw_surface_map));
3351 ico_window_mgr_send_map_surface(resource,
3352 ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR,
3353 surfaceid, 6, 0, 0, 0, 0, 0);
3354 uifw_trace("uifw_map_surface: Leave(malloc error)");
3358 memset(sm, 0, sizeof(struct uifw_surface_map));
3360 wl_list_init(&sm->map_link);
3361 wl_list_init(&sm->surf_link);
3363 sm->uclient = uclient;
3365 sm->framerate = framerate;
3366 sm->interval = (1000 / sm->framerate) - 1;
3367 wl_list_insert(_ico_win_mgr->map_list.next, &sm->map_link);
3368 wl_list_insert(usurf->surf_map.prev, &sm->surf_link);
3371 /* change frame rate */
3372 uifw_trace("uifw_map_surface: Leave(chagne frame rate %d->%d",
3373 sm->framerate, framerate);
3374 if (sm->framerate != framerate) {
3375 sm->framerate = framerate;
3376 sm->interval = (1000 / sm->framerate) - 1;
3377 win_mgr_change_mapsurface(sm, 0, weston_compositor_get_time());
3382 buffer = es->buffer_ref.buffer;
3383 if (buffer != NULL) {
3384 sm->width = buffer->width;
3385 sm->height = buffer->height;
3386 if (maptype != ICO_WINDOW_MGR_MAP_TYPE_EGL) {
3387 sm->stride = sm->width;
3388 sm->format = EGL_TEXTURE_RGBA;
3389 if ((sm->width > 0) && (sm->height > 0)) {
3392 uifw_debug("uifw_map_surface: map type=%d,surface=%08x,fps=%d,w/h=%d/%d",
3393 maptype, surfaceid, framerate, buffer->width, buffer->height);
3396 drm_buffer = (struct uifw_drm_buffer *)wl_resource_get_user_data(
3397 (struct wl_resource *)buffer->legacy_buffer);
3398 if (drm_buffer != NULL) {
3399 sm->stride = drm_buffer->stride[0];
3400 if (drm_buffer->format == __DRI_IMAGE_FOURCC_XRGB8888) {
3401 sm->format = EGL_TEXTURE_RGB;
3403 else if (drm_buffer->format == __DRI_IMAGE_FOURCC_ARGB8888) {
3404 sm->format = EGL_TEXTURE_RGBA;
3407 /* unknown format, error */
3408 sm->format = EGL_NO_TEXTURE;
3410 if ((sm->width > 0) && (sm->height > 0) && (sm->stride > 0) &&
3411 (gl_state != NULL)) {
3414 uifw_debug("uifw_map_surface: map EGL surface=%08x,fps=%d,w/h=%d/%d",
3415 surfaceid, framerate, buffer->width, buffer->height);
3418 uifw_debug("uifw_map_surface: map EGL but no buffer surface=%08x,fps=%d",
3419 surfaceid, framerate);
3423 else if (maptype != ICO_WINDOW_MGR_MAP_TYPE_EGL) {
3424 sm->width = usurf->client_width;
3425 sm->height = usurf->client_height;
3426 sm->stride = sm->width;
3427 sm->format = EGL_TEXTURE_RGBA;
3428 if ((sm->width > 0) && (sm->height > 0)) {
3431 uifw_debug("uifw_map_surface: map type=%d,surface=%08x,fps=%d,w/h=%d/%d",
3432 maptype, surfaceid, framerate, sm->width, sm->height);
3435 uifw_debug("uifw_map_surface: map EGL but no buffer surface=%08x,fps=%d",
3436 surfaceid, framerate);
3439 /* send map event */
3441 win_mgr_change_mapsurface(sm, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP,
3442 weston_compositor_get_time());
3444 uifw_trace("uifw_map_surface: Leave");
3447 /*--------------------------------------------------------------------------*/
3449 * @brief uifw_unmap_surface: unmap surface buffer
3451 * @param[in] client Weyland client
3452 * @param[in] resource resource of request
3453 * @param[in] surfaceid surface id
3456 /*--------------------------------------------------------------------------*/
3458 uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource,
3461 struct uifw_win_surface *usurf;
3462 struct uifw_surface_map *sm, *sm_tmp;
3463 struct uifw_client *uclient;
3464 struct ico_uifw_image_buffer *p;
3467 uifw_trace("uifw_unmap_surface: Enter(surface=%08x)", surfaceid);
3469 usurf = ico_window_mgr_get_usurf(surfaceid);
3471 /* surface dose not exist, error */
3472 uifw_trace("uifw_unmap_surface: Leave(surface=%08x dose not exist)", surfaceid);
3476 uclient = find_client_from_client(client);
3477 if ((! uclient) || (! uclient->mgr)) {
3478 /* client dose not exist, error */
3479 uifw_trace("uifw_unmap_surface: Leave(client=%08x dose not exist)", (int)client);
3485 wl_list_for_each (sm, &usurf->surf_map, surf_link) {
3486 if (sm->uclient->mgr != NULL) {
3487 uifw_trace("uifw_unmap_surface: send UNMAP event(ev=%d surf=%08x name=%08x "
3488 "w/h/s=%d/%d/%d format=%x",
3489 ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP, surfaceid,
3490 sm->eglname, sm->width, sm->height, sm->stride, sm->format);
3491 ico_window_mgr_send_map_surface(sm->uclient->mgr->resource,
3492 ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP,
3493 surfaceid, sm->type, sm->eglname, sm->width,
3494 sm->height, sm->stride, sm->format);
3499 wl_list_for_each_safe (sm, sm_tmp, &usurf->surf_map, surf_link) {
3500 if (((uclient != NULL) && (sm->uclient != uclient))) continue;
3501 /* send unmap event */
3502 if ((uclient != NULL) && (uclient->mgr != NULL)) {
3503 uifw_trace("uifw_unmap_surface: send UNMAP event(ev=%d surf=%08x name=%08x "
3504 "w/h/s=%d/%d/%d format=%x",
3505 ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP, surfaceid,
3506 sm->eglname, sm->width, sm->height, sm->stride, sm->format);
3507 ico_window_mgr_send_map_surface(uclient->mgr->resource,
3508 ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP,
3509 surfaceid, sm->type, sm->eglname, sm->width,
3510 sm->height, sm->stride, sm->format);
3512 if ((sm->type != ICO_WINDOW_MGR_MAP_TYPE_EGL) &&
3513 (sm->uclient->shmbuf != NULL)) {
3514 /* reset shared memory buffer */
3515 for (idx = 0; idx < sm->uclient->bufnum; idx++) {
3516 p = (struct ico_uifw_image_buffer *)
3517 (((char *)sm->uclient->shmbuf) + idx * sm->uclient->bufsize);
3518 if (p->surfaceid == surfaceid) {
3525 wl_list_remove(&sm->surf_link);
3526 wl_list_remove(&sm->map_link);
3527 sm->usurf = (struct uifw_win_surface *)_ico_win_mgr->free_maptable;
3528 _ico_win_mgr->free_maptable = sm;
3530 uifw_trace("uifw_unmap_surface: Leave");
3533 /*--------------------------------------------------------------------------*/
3535 * @brief win_mgr_surface_change_mgr: surface chagen from manager(HomeScreen)
3537 * @param[in] surface Weston surface
3538 * @param[in] x X coordinate on screen
3539 * @param[in] y Y coordinate on screen
3540 * @param[in] width surface width
3541 * @param[in] height surface height
3542 * @return number of managers
3543 * @retval > 0 number of managers
3544 * @retval 0 manager not exist
3546 /*--------------------------------------------------------------------------*/
3548 win_mgr_surface_change_mgr(struct weston_surface *surface,
3549 const int x, const int y, const int width, const int height)
3552 struct uifw_win_surface *usurf;
3554 uifw_trace("win_mgr_surface_change_mgr: Enter(%08x,x/y=%d/%d,w/h=%d/%d)",
3555 (int)surface, x, y, width, height);
3557 usurf = find_uifw_win_surface_by_ws(surface);
3559 uifw_trace("win_mgr_surface_change_mgr: Leave(Not Exist)");
3563 num_mgr = ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_CONFIGURE,
3564 usurf, x, y, width, height, 1);
3566 uifw_trace("win_mgr_surface_change_mgr: Leave(%d)", num_mgr);
3570 /*--------------------------------------------------------------------------*/
3572 * @brief win_mgr_change_surface: surface change
3574 * @param[in] surface Weston surface
3575 * @param[in] to destination(0=Client&Manager,1=Client,-1=Manager)
3576 * @param[in] manager request from manager(0=Client,1=Manager)
3579 /*--------------------------------------------------------------------------*/
3581 win_mgr_change_surface(struct weston_surface *surface, const int to, const int manager)
3583 struct uifw_win_surface *usurf;
3584 struct weston_surface *es;
3589 uifw_trace("win_mgr_change_surface: Enter(%08x,%d,%d)", (int)surface, to, manager);
3592 usurf = find_uifw_win_surface_by_ws(surface);
3594 uifw_trace("win_mgr_change_surface: Leave(Not Exist)");
3597 es = usurf->surface;
3599 uifw_trace("win_mgr_change_surface: Leave(No weston surface)");
3603 /* set surface size */
3604 uifw_debug("win_mgr_change_surface: set surface x/y=%d/%d=>%d/%d w/h=%d/%d=>%d/%d",
3605 (int)es->geometry.x, (int)es->geometry.y, usurf->x, usurf->y,
3606 usurf->width, usurf->height, es->geometry.width, es->geometry.height);
3607 if ((usurf->width <= 0) || (usurf->height <= 0)) {
3608 usurf->width = es->geometry.width;
3609 usurf->height = es->geometry.height;
3611 win_mgr_set_scale(usurf);
3612 if (usurf->visible) {
3613 weston_surface_set_position(usurf->surface,
3614 (float)(usurf->node_tbl->disp_x +
3615 usurf->x + usurf->xadd),
3616 (float)(usurf->node_tbl->disp_y +
3617 usurf->y + usurf->yadd));
3618 ico_window_mgr_restack_layer(usurf);
3621 weston_surface_set_position(usurf->surface, (float)(ICO_IVI_MAX_COORDINATE+1),
3622 (float)(ICO_IVI_MAX_COORDINATE+1));
3625 /* send wayland event to client */
3626 if ((to >= 0) && (usurf->shsurf != NULL) && (manager !=0) &&
3627 (usurf->width > 0) && (usurf->height > 0)) {
3628 if ((usurf->width != usurf->conf_width) ||
3629 (usurf->height != usurf->conf_height)) {
3630 usurf->conf_width = usurf->width;
3631 usurf->conf_height = usurf->height;
3632 uifw_trace("win_mgr_change_surface: SURFACE_CONFIGURE %08x(%08x),w/h=%d/%d ",
3633 usurf->surfaceid, (int)es, usurf->width, usurf->height);
3634 ico_ivi_shell_send_configure(es,
3635 WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,
3636 usurf->width, usurf->height);
3640 if (usurf->visible) {
3641 x = usurf->node_tbl->disp_x + usurf->x;
3642 y = usurf->node_tbl->disp_y + usurf->y;
3645 x = ICO_IVI_MAX_COORDINATE+1;
3646 y = ICO_IVI_MAX_COORDINATE+1;
3648 /* change geometry if request from manager */
3650 if ((usurf->width != es->geometry.width) ||
3651 (usurf->height != es->geometry.height) ||
3652 (es->geometry.x != (float)x) || (es->geometry.y != (float)y)) {
3653 win_mgr_surface_configure(usurf, (float)x, (float)y, usurf->width, usurf->height);
3658 /* send manager event to HomeScreen */
3661 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_CONFIGURE,
3662 usurf, usurf->x, usurf->y,
3663 usurf->width, usurf->height, 0);
3666 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_CONFIGURE,
3667 usurf, (int)es->geometry.x, (int)es->geometry.y,
3668 es->geometry.width, es->geometry.height, 1);
3672 /* change geometry if request from client */
3674 if ((usurf->width != es->geometry.width) || (usurf->height != es->geometry.height) ||
3675 (es->geometry.x != (float)x) || (es->geometry.y != (float)y)) {
3676 win_mgr_surface_configure(usurf, x, y, usurf->width, usurf->height);
3682 uifw_trace("win_mgr_change_surface: repaint");
3683 weston_compositor_schedule_repaint(_ico_win_mgr->compositor);
3685 uifw_trace("win_mgr_change_surface: Leave(OK)");
3688 /*--------------------------------------------------------------------------*/
3690 * @brief win_mgr_surface_configure: UIFW surface configure
3692 * @param[in] usurf UIFW surface
3693 * @param[in] x X coordinate on screen
3694 * @param[in] y Y coordinate on screen
3695 * @param[in] width surface width
3696 * @param[in] height surface height
3699 /*--------------------------------------------------------------------------*/
3701 win_mgr_surface_configure(struct uifw_win_surface *usurf,
3702 int x, int y, int width, int height)
3704 struct weston_surface *es;
3706 es = usurf->surface;
3707 if ((es != NULL) && (es->buffer_ref.buffer)) {
3708 if (usurf->client_width == 0) {
3709 usurf->client_width = es->geometry.width;
3710 if (usurf->client_width == 0)
3711 usurf->client_width = weston_surface_buffer_width(es);
3713 if (usurf->client_height == 0) {
3714 usurf->client_height = es->geometry.height;
3715 if (usurf->client_height == 0)
3716 usurf->client_height = weston_surface_buffer_height(es);
3719 /* not set geometry width/height */
3720 win_mgr_set_scale(usurf);
3721 weston_surface_set_position(es, x + usurf->xadd, y + usurf->yadd);
3725 /*--------------------------------------------------------------------------*/
3727 * @brief win_mgr_shell_configure: shell surface configure
3729 * @param[in] surface Weston surface
3732 /*--------------------------------------------------------------------------*/
3734 win_mgr_shell_configure(struct weston_surface *surface)
3736 struct uifw_win_surface *usurf;
3740 uifw_trace("win_mgr_shell_configure: Enter(%08x)", (int)surface);
3742 /* Find UIFW surface */
3743 usurf = find_uifw_win_surface_by_ws(surface);
3745 uifw_trace("win_mgr_shell_configure: Leave(Not Exist)");
3749 usurf->client_width = surface->geometry.width;
3750 usurf->client_height = surface->geometry.height;
3751 buf_width = weston_surface_buffer_width(surface);
3752 buf_height = weston_surface_buffer_height(surface);
3753 uifw_trace("win_mgr_shell_configure: %08x client w/h=%d/%d buf=%d/%d",
3755 usurf->client_width, usurf->client_height, buf_width, buf_height);
3756 if (usurf->client_width > buf_width) usurf->client_width = buf_width;
3757 if (usurf->client_height > buf_height) usurf->client_height = buf_height;
3759 /* send event to manager */
3760 win_mgr_change_surface(surface, -1, 0);
3762 uifw_trace("win_mgr_shell_configure: Leave");
3765 /*--------------------------------------------------------------------------*/
3767 * @brief win_mgr_select_surface: select surface by Bottun/Touch
3769 * @param[in] surface Weston surface
3772 /*--------------------------------------------------------------------------*/
3774 win_mgr_select_surface(struct weston_surface *surface)
3776 struct uifw_win_surface *usurf;
3778 uifw_trace("win_mgr_select_surface: Enter(%08x)", (int)surface);
3781 usurf = find_uifw_win_surface_by_ws(surface);
3783 uifw_trace("win_mgr_select_surface: Leave(Not Exist)");
3786 if (usurf != _ico_win_mgr->active_pointer_usurf) {
3788 /* send active event to manager */
3789 if (ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
3790 usurf, ICO_WINDOW_MGR_ACTIVE_SELECTED, 0,0,0,0) <= 0) {
3791 uifw_trace("win_mgr_select_surface: not found manager, set active");
3792 win_mgr_set_active(usurf, ICO_WINDOW_MGR_ACTIVE_POINTER |
3793 ICO_WINDOW_MGR_ACTIVE_KEYBOARD);
3796 uifw_trace("win_mgr_select_surface: Leave(OK)");
3799 /*--------------------------------------------------------------------------*/
3801 * @brief win_mgr_set_title: set tile name to surface
3803 * @param[in] surface weston surface
3804 * @param[in] title title name
3805 * @return title string
3806 * @retval != NULL title string
3807 * @retval NULL no title string
3809 /*--------------------------------------------------------------------------*/
3811 win_mgr_set_title(struct weston_surface *surface, const char *title)
3813 struct uifw_win_surface *usurf;
3814 char *optpoint, *ppoint, *bpoint, *cpoint;
3815 int layer, visible, raise, node, x, y, width, height, attribute;
3817 char wktitle[ICO_IVI_WINNAME_LENGTH + 256];
3819 uifw_trace("win_mgr_set_title: Enter(%08x) name=%s", (int)surface, title);
3821 usurf = find_uifw_win_surface_by_ws(surface);
3823 uifw_trace("win_mgr_set_title: Leave(Not Exist)");
3824 return (char *)title;
3837 strncpy(wktitle, title, ICO_IVI_WINNAME_LENGTH+256-1);
3838 wktitle[ICO_IVI_WINNAME_LENGTH+256-1] = 0;
3840 /* get option parameters */
3841 optpoint = strstr(wktitle, "@@");
3843 if (optpoint != NULL) {
3846 usurf->uclient->privilege = 1; /* privilege application */
3847 ppoint = optpoint + 2;
3849 bpoint = strtok(ppoint, "=;");
3851 if (! bpoint) break;
3852 if (strcasecmp(bpoint, "layer") == 0) {
3853 /* layer name or number */
3854 bpoint = strtok(ppoint, "=;");
3856 if (strcasecmp(bpoint, "background") == 0) {
3857 layer = _ico_ivi_background_layer;
3859 else if (strcasecmp(bpoint, "default") == 0) {
3860 layer = _ico_ivi_default_layer;
3862 else if (strcasecmp(bpoint, "touch") == 0) {
3863 layer = _ico_ivi_touch_layer;
3865 else if (strcasecmp(bpoint, "cursor") == 0) {
3866 layer = _ico_ivi_cursor_layer;
3868 else if (strcasecmp(bpoint, "startup") == 0) {
3869 layer = _ico_ivi_startup_layer;
3872 layer = strtol(bpoint, (char **)0, 0);
3876 else if (strcasecmp(bpoint, "show") == 0) {
3880 else if (strcasecmp(bpoint, "hide") == 0) {
3884 else if (strcasecmp(bpoint, "raise") == 0) {
3888 else if (strcasecmp(bpoint, "lower") == 0) {
3892 else if (strcasecmp(bpoint, "node") == 0) {
3894 bpoint = strtok(ppoint, ",");
3896 node = strtol(bpoint, (char **)0, 0);
3899 else if (strcasecmp(bpoint, "position") == 0) {
3901 bpoint = strtok(ppoint, ",");
3903 cpoint = strtok(ppoint, ";");
3905 x = strtol(bpoint, (char **)0, 0);
3906 y = strtol(cpoint, (char **)0, 0);
3910 else if (strcasecmp(bpoint, "size") == 0) {
3912 bpoint = strtok(ppoint, ",");
3914 cpoint = strtok(ppoint, ";");
3916 width = strtol(bpoint, (char **)0, 0);
3917 height = strtol(cpoint, (char **)0, 0);
3921 else if (strcasecmp(bpoint, "attribute") == 0) {
3922 /* attribute flags */
3923 bpoint = strtok(ppoint, ",");
3925 attribute = strtol(bpoint, (char **)0, 0);
3928 else if (strcasecmp(bpoint, "region") == 0) {
3929 /* set input region */
3930 bpoint = strtok(ppoint, ",");
3935 rx = strtol(bpoint, (char **)0, 0);
3936 bpoint = strtok(ppoint, ",");
3938 ry = strtol(bpoint, (char **)0, 0);
3940 bpoint = strtok(ppoint, ",");
3942 rw = strtol(bpoint, (char **)0, 0);
3944 bpoint = strtok(ppoint, ";");
3946 rh = strtol(bpoint, (char **)0, 0);
3948 if (win_mgr_hook_inputregion) {
3949 (*win_mgr_hook_inputregion)(1, usurf, rx, ry, rw, rh, 0, 0,
3954 else if (strcasecmp(bpoint, "unregion") == 0) {
3955 /* unset input region */
3956 bpoint = strtok(ppoint, ",");
3961 rx = strtol(bpoint, (char **)0, 0);
3962 bpoint = strtok(ppoint, ",");
3964 ry = strtol(bpoint, (char **)0, 0);
3966 bpoint = strtok(ppoint, ",");
3968 rw = strtol(bpoint, (char **)0, 0);
3970 bpoint = strtok(ppoint, ";");
3972 rh = strtol(bpoint, (char **)0, 0);
3974 if (win_mgr_hook_inputregion) {
3975 (*win_mgr_hook_inputregion)(0, usurf, rx, ry, rw, rh, 0, 0,
3983 if ((optpoint == NULL) || (wktitle[0] != 0)) {
3984 if (((usurf->width > 0) && (usurf->height > 0)) &&
3985 ((usurf->created == 0) ||
3986 (strncmp(wktitle, usurf->winname, ICO_IVI_WINNAME_LENGTH-1) != 0))) {
3987 strncpy(usurf->winname, wktitle, ICO_IVI_WINNAME_LENGTH-1);
3988 usurf->winname[ICO_IVI_WINNAME_LENGTH-1] = 0;
3989 if (usurf->created == 0) {
3990 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_CREATED, usurf, 0,0,0,0,0);
3994 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_NAME, usurf, 0,0,0,0,0);
3998 strncpy(usurf->winname, wktitle, ICO_IVI_WINNAME_LENGTH-1);
3999 usurf->winname[ICO_IVI_WINNAME_LENGTH-1] = 0;
4005 uifw_set_window_layer(usurf->uclient->client, NULL, usurf->surfaceid, layer);
4007 if (attribute >= 0) {
4008 uifw_set_attributes(usurf->uclient->client, NULL, usurf->surfaceid, attribute);
4010 if ((node >= 0) || (x >=0) || (y >= 0) || (width >=0) || (height >= 0)) {
4011 if (node < 0) node = usurf->node_tbl->node;
4012 if (x < 0) x = ICO_IVI_MAX_COORDINATE + 1;
4013 if (y < 0) y = ICO_IVI_MAX_COORDINATE + 1;
4014 if (width < 0) width = ICO_IVI_MAX_COORDINATE + 1;
4015 if (height < 0) height = ICO_IVI_MAX_COORDINATE + 1;
4016 uifw_set_positionsize(usurf->uclient->client, NULL, usurf->surfaceid,
4017 node, x, y, width, height, 0);
4019 if ((visible >= 0) || (raise >= 0)) {
4020 if (visible < 0) visible = ICO_WINDOW_MGR_V_NOCHANGE;
4021 if (raise < 0) raise = ICO_WINDOW_MGR_V_NOCHANGE;
4022 uifw_set_visible(usurf->uclient->client, NULL, usurf->surfaceid,
4026 uifw_trace("win_mgr_set_title: Leave");
4028 return usurf->winname;
4031 /*--------------------------------------------------------------------------*/
4033 * @brief win_mgr_surface_move: set tile name to surface
4035 * @param[in] surface weston surface
4036 * @param[in] title title name
4039 /*--------------------------------------------------------------------------*/
4041 win_mgr_surface_move(struct weston_surface *surface, int *dx, int *dy)
4043 struct uifw_win_surface *usurf;
4045 uifw_trace("win_mgr_surface_move: Enter(%08x) x/y=%d,%d", (int)surface, *dx, *dy);
4047 usurf = find_uifw_win_surface_by_ws(surface);
4049 uifw_trace("win_mgr_surface_move: Leave(Not Exist)");
4052 if (usurf->visible) {
4053 *dx = usurf->node_tbl->disp_x + usurf->x;
4054 *dy = usurf->node_tbl->disp_y + usurf->y;
4057 *dx = ICO_IVI_MAX_COORDINATE+1;
4058 *dy = ICO_IVI_MAX_COORDINATE+1;
4060 uifw_trace("win_mgr_surface_move: Leave(change to x/y=%d/%d)", *dx, *dy);
4063 /*--------------------------------------------------------------------------*/
4065 * @brief win_mgr_show_layer: shell layer visible control
4067 * @param[in] layertype shell layer type
4068 * @param[in] show show(1)/hide(0)
4069 * @param[in] data requested weston surface in show
4072 /*--------------------------------------------------------------------------*/
4074 win_mgr_show_layer(int layertype, int show, void *data)
4076 struct uifw_win_layer *el;
4077 struct uifw_win_surface *usurf;
4078 struct uifw_win_surface *inusurf = NULL;
4080 uifw_trace("win_mgr_show_layer: Enter(type=%d, show=%d, data=%08x)",
4081 layertype, show, (int)data);
4083 if (layertype != LAYER_TYPE_INPUTPANEL) {
4084 uifw_trace("win_mgr_show_layer: Leave(layertype npt InputPanel)");
4089 uifw_trace("win_mgr_show_layer: Leave(show but input surface not exist)");
4092 inusurf = find_uifw_win_surface_by_ws((struct weston_surface *)data);
4094 uifw_trace("win_mgr_show_layer: Leave(show but unknown input surface)");
4099 /* all input panel surface show/hide */
4100 wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) {
4101 if ((el->layertype == LAYER_TYPE_CURSOR) ||
4102 (el->layertype == LAYER_TYPE_TOUCH)) continue;
4103 wl_list_for_each (usurf, &el->surface_list, ivi_layer) {
4104 if ((usurf->layertype == LAYER_TYPE_INPUTPANEL) &&
4105 (usurf->surface != NULL) && (usurf->mapped != 0) &&
4106 (usurf->surface->buffer_ref.buffer != NULL)) {
4108 if ((inusurf != NULL) && (usurf->win_layer != inusurf->win_layer)) {
4109 win_mgr_set_layer(usurf, usurf->win_layer->layer);
4111 win_mgr_change_surface(usurf->surface, -1, 1);
4113 if ((show == 0) || (ico_ivi_optionflag() & ICO_IVI_OPTION_SHOW_INPUTLAYER)) {
4114 /* show input panel automatically */
4115 ico_window_mgr_set_visible(usurf, show | 2);
4118 /* send hint event to HomeScreen */
4119 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE,
4120 usurf, show, ICO_WINDOW_MGR_RAISE_RAISE, 1, 0,0);
4125 uifw_trace("win_mgr_show_layer: Leave");
4128 /*--------------------------------------------------------------------------*/
4130 * @brief win_mgr_fullscreen: shell full screen surface control
4132 * @param[in] event control event
4133 * @param[in] surface target weston surface
4136 /*--------------------------------------------------------------------------*/
4138 win_mgr_fullscreen(int event, struct weston_surface *surface)
4140 struct uifw_win_surface *usurf;
4141 struct uifw_win_surface *tmpusurf;
4142 struct uifw_win_layer *ulayer;
4146 uifw_trace("win_mgr_fullscreen: Enter(event=%d, surface=%08x)", event, (int)surface);
4148 if (event == SHELL_FULLSCREEN_HIDEALL) {
4149 /* hide all fullscreen srface */
4150 uifw_trace("win_mgr_fullscreen: SHELL_FULLSCREEN_HIDEALL");
4152 wl_list_for_each (ulayer, &_ico_win_mgr->ivi_layer_list, link) {
4153 if (ulayer->layertype >= LAYER_TYPE_TOUCH) continue;
4154 wl_list_for_each_safe (usurf, tmpusurf, &ulayer->surface_list, ivi_layer) {
4155 if (usurf->layertype == LAYER_TYPE_FULLSCREEN) {
4156 ico_window_mgr_set_visible(usurf, 2);
4157 usurf->layertype = usurf->old_layertype;
4158 win_mgr_set_layer(usurf, usurf->old_layer->layer);
4159 win_mgr_change_surface(usurf->surface, -1, 1);
4160 /* send event to HomeScreen */
4161 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_CONFIGURE,
4162 usurf, usurf->x, usurf->y,
4163 usurf->width, usurf->height, 0);
4167 uifw_trace("win_mgr_fullscreen: Leave");
4171 usurf = find_uifw_win_surface_by_ws(surface);
4173 uifw_trace("win_mgr_fullscreen: Leave(surface dose not exist)");
4178 case SHELL_FULLSCREEN_ISTOP: /* check if top surface */
4179 if (usurf->layertype == LAYER_TYPE_FULLSCREEN) {
4180 wl_list_for_each (ulayer, &_ico_win_mgr->ivi_layer_list, link) {
4181 if (ulayer->layertype >= LAYER_TYPE_TOUCH) continue;
4182 wl_list_for_each(tmpusurf, &ulayer->surface_list, ivi_layer) {
4183 if (usurf == tmpusurf) {
4184 uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_ISTOP"
4185 "(fullscreen surface)", usurf->surfaceid);
4188 if (tmpusurf->layertype == LAYER_TYPE_FULLSCREEN) {
4189 uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_ISTOP"
4190 "(fullscreen surface but not top)", usurf->surfaceid);
4196 uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_ISTOP"
4197 "(not fullscreen surface)", usurf->surfaceid);
4199 case SHELL_FULLSCREEN_SET: /* change surface to full screen */
4200 uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_SET", usurf->surfaceid);
4201 if (usurf->layertype != LAYER_TYPE_FULLSCREEN) {
4202 usurf->old_layertype = usurf->layertype;
4203 usurf->layertype = LAYER_TYPE_FULLSCREEN;
4204 usurf->old_layer = usurf->win_layer;
4205 /* send hint event to HomeScreen */
4206 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_CONFIGURE,
4207 usurf, usurf->x, usurf->y,
4208 usurf->width, usurf->height, 1);
4211 case SHELL_FULLSCREEN_STACK: /* change surface to top of layer */
4212 uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_STACK", usurf->surfaceid);
4213 if (usurf->mapped == 0) {
4214 uifw_trace("win_mgr_fullscreen: not map, change to map");
4215 width = usurf->node_tbl->disp_width;
4216 height = usurf->node_tbl->disp_height;
4219 win_mgr_surface_map(usurf->surface, &width, &height, &sx, &sy);
4221 if ((usurf->surface != NULL) && (usurf->mapped != 0) &&
4222 (usurf->surface->buffer_ref.buffer != NULL)) {
4223 /* fullscreen surface raise */
4224 win_mgr_set_raise(usurf, 1);
4227 case SHELL_FULLSCREEN_CONF: /* configure full screen surface */
4228 uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_CONF", usurf->surfaceid);
4229 if (usurf->mapped == 0) {
4230 width = usurf->node_tbl->disp_width;
4231 height = usurf->node_tbl->disp_height;
4234 win_mgr_surface_map(usurf->surface, &width, &height, &sx, &sy);
4238 uifw_trace("win_mgr_fullscreen: Leave(unknown event %d)", event);
4241 uifw_trace("win_mgr_fullscreen: Leave");
4245 /*--------------------------------------------------------------------------*/
4247 * @brief win_mgr_reset_focus: reset surface focus
4249 * @param[in] usurf UIFW surface
4252 /*--------------------------------------------------------------------------*/
4254 win_mgr_reset_focus(struct uifw_win_surface *usurf)
4256 struct weston_seat *seat;
4257 struct weston_surface *surface;
4259 uifw_trace("win_mgr_reset_focus: Enter(%08x)", usurf->surfaceid);
4261 seat = container_of (_ico_win_mgr->compositor->seat_list.next, struct weston_seat, link);
4262 surface = usurf->surface;
4263 if ((seat != NULL) && (surface != NULL)) {
4264 #if 0 /* pointer grab can not release */
4265 /* reset pointer focus */
4266 if ((seat->pointer != NULL) && (seat->pointer->focus == surface)) {
4267 weston_pointer_set_focus(seat->pointer, NULL,
4268 wl_fixed_from_int(0), wl_fixed_from_int(0));
4270 /* reset touch focus */
4271 if ((seat->touch != NULL) && (seat->touch->focus == surface)) {
4272 weston_touch_set_focus(seat, NULL);
4274 #endif /* pointer grab can not release */
4275 /* reset keyboard focus */
4276 if ((seat->keyboard != NULL) && (seat->keyboard->focus == surface)) {
4277 weston_keyboard_set_focus(seat->keyboard, NULL);
4280 uifw_trace("win_mgr_reset_focus: Leave");
4283 /*--------------------------------------------------------------------------*/
4285 * @brief ico_window_mgr_set_visible: change surface visibility
4287 * @param[in] usurf UIFW surface
4288 * @param[in] visible bit 0: visible(=1)/unvisible(=0)
4289 * bit 1: widht anima(=1)/without anima(=0)
4292 /*--------------------------------------------------------------------------*/
4294 ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible)
4299 if ((usurf->visible == 0) ||
4300 (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE)) {
4301 uifw_trace("ico_window_mgr_set_visible: Chagne to Visible(%08x) x/y=%d/%d",
4302 usurf->surfaceid, usurf->x, usurf->y);
4304 ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y,
4305 usurf->width, usurf->height);
4306 if ((visible & 2) && (win_mgr_hook_animation != NULL)) {
4307 usurf->animation.pos_x = usurf->x;
4308 usurf->animation.pos_y = usurf->y;
4309 usurf->animation.pos_width = usurf->width;
4310 usurf->animation.pos_height = usurf->height;
4311 usurf->animation.no_configure = 0;
4312 retanima = (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_OPSHOW,
4314 uifw_trace("ico_window_mgr_set_visible: show animation = %d", retanima);
4316 /* change unvisible to visible, restack surface list */
4317 ico_window_mgr_restack_layer(usurf);
4321 if ((usurf->visible != 0) ||
4322 (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE)) {
4324 uifw_trace("ico_window_mgr_set_visible: Chagne to Unvisible(%08x)",
4328 win_mgr_reset_focus(usurf);
4330 retanima = ICO_WINDOW_MGR_ANIMATION_RET_ANIMA;
4331 if ((visible & 2) && (win_mgr_hook_animation != NULL)) {
4332 usurf->animation.pos_x = usurf->x;
4333 usurf->animation.pos_y = usurf->y;
4334 usurf->animation.pos_width = usurf->width;
4335 usurf->animation.pos_height = usurf->height;
4336 usurf->animation.no_configure = 0;
4337 retanima = (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_OPHIDE,
4339 uifw_trace("ico_window_mgr_set_visible: hide animation = %d", retanima);
4340 if (retanima != ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL) {
4342 /* Weston surface configure */
4343 ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y,
4344 usurf->width, usurf->height);
4349 /* Weston surface configure */
4350 ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y,
4351 usurf->width, usurf->height);
4353 ico_window_mgr_restack_layer(usurf);
4356 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE,
4357 usurf, usurf->visible, usurf->raise, 0, 0, 0);
4360 /*--------------------------------------------------------------------------*/
4362 * @brief win_mgr_set_raise: change surface raise/lower
4364 * @param[in] usurf UIFW surface
4365 * @param[in] raise raise(=1)/lower(0)
4368 /*--------------------------------------------------------------------------*/
4370 win_mgr_set_raise(struct uifw_win_surface *usurf, const int raise)
4372 struct uifw_win_surface *eu;
4374 uifw_trace("win_mgr_set_raise: Enter(%08x,%d) layer=%d type=%x",
4375 (int)usurf, raise, (int)usurf->win_layer->layer, usurf->layertype);
4377 wl_list_remove(&usurf->ivi_layer);
4379 /* raise ... surface stack to top of layer */
4380 if (usurf->layertype == LAYER_TYPE_INPUTPANEL) {
4381 /* if input panel, top of surface list */
4382 uifw_trace("win_mgr_set_raise: Raise Link to Top(InputPanel)");
4383 wl_list_insert(&usurf->win_layer->surface_list, &usurf->ivi_layer);
4386 /* if not input panel, search not input panel */
4387 wl_list_for_each (eu, &usurf->win_layer->surface_list, ivi_layer) {
4388 if (eu->layertype != LAYER_TYPE_INPUTPANEL) break;
4390 uifw_trace("win_mgr_set_raise: Raise Link to Top(Normal)");
4391 wl_list_insert(eu->ivi_layer.prev, &usurf->ivi_layer);
4396 /* Lower ... surface stack to bottom of layer */
4397 if (usurf->layertype == LAYER_TYPE_INPUTPANEL) {
4398 /* if input panel, search not input panel */
4399 uifw_trace("win_mgr_set_raise: Lower Link to Bottom(InputPanel)");
4400 wl_list_for_each (eu, &usurf->win_layer->surface_list, ivi_layer) {
4401 if (eu->layertype != LAYER_TYPE_INPUTPANEL) break;
4403 wl_list_insert(eu->ivi_layer.prev, &usurf->ivi_layer);
4406 /* if not input panel, bottom of surface list */
4407 uifw_trace("win_mgr_set_raise: Lower Link to Bottom(Normal)");
4408 wl_list_insert(usurf->win_layer->surface_list.prev, &usurf->ivi_layer);
4413 /* rebild compositor surface list */
4414 if ((raise & 2) == 0) {
4415 if (usurf->visible) {
4416 ico_window_mgr_restack_layer(usurf);
4418 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE,
4419 usurf, usurf->visible, usurf->raise, 0, 0,0);
4421 uifw_trace("win_mgr_set_raise: Leave");
4424 /*--------------------------------------------------------------------------*/
4426 * @brief win_mgr_destroy_surface: surface destroy
4428 * @param[in] surface Weston surface
4431 /*--------------------------------------------------------------------------*/
4433 win_mgr_destroy_surface(struct weston_surface *surface)
4435 struct uifw_win_surface *usurf;
4436 struct uifw_win_surface *phash;
4437 struct uifw_win_surface *bhash;
4440 usurf = find_uifw_win_surface_by_ws(surface);
4442 uifw_trace("win_mgr_destroy_surface: UIFW surface Not Exist");
4445 uifw_trace("win_mgr_destroy_surface: Enter(%08x) %08x", (int)surface, usurf->surfaceid);
4448 win_mgr_reset_focus(usurf);
4450 /* destory input region */
4451 if (win_mgr_hook_destory) {
4452 (*win_mgr_hook_destory)(usurf);
4456 if (&usurf->surf_map != usurf->surf_map.next) {
4457 uifw_unmap_surface(NULL, NULL, usurf->surfaceid);
4460 /* destroy active surface */
4461 if (usurf == _ico_win_mgr->active_pointer_usurf) {
4462 _ico_win_mgr->active_pointer_usurf = NULL;
4464 if (usurf == _ico_win_mgr->active_keyboard_usurf) {
4465 _ico_win_mgr->active_keyboard_usurf = NULL;
4468 /* destroy animation extenson */
4469 if (win_mgr_hook_animation) {
4470 (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_DESTROY, (void *)usurf);
4473 /* delete from layer list */
4474 wl_list_remove(&usurf->ivi_layer);
4475 ico_window_mgr_restack_layer(NULL);
4477 /* delete from cleint list */
4478 wl_list_remove(&usurf->client_link);
4480 /* delete from hash table */
4481 hash = MAKE_IDHASH(usurf->surfaceid);
4482 phash = _ico_win_mgr->idhash[hash];
4484 while ((phash) && (phash != usurf)) {
4486 phash = phash->next_idhash;
4489 bhash->next_idhash = usurf->next_idhash;
4492 _ico_win_mgr->idhash[hash] = usurf->next_idhash;
4495 hash = MAKE_WSHASH(usurf->surface);
4496 phash = _ico_win_mgr->wshash[hash];
4498 while ((phash) && (phash != usurf)) {
4500 phash = phash->next_wshash;
4503 bhash->next_wshash = usurf->next_wshash;
4506 _ico_win_mgr->wshash[hash] = usurf->next_wshash;
4509 ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_DESTROYED,
4512 hash = usurf->surfaceid & SURCAFE_ID_MASK;
4513 _ico_win_mgr->surfaceid_map[(hash - 1)/16] &= ~(1 << ((hash - 1) % 16));
4516 uifw_trace("win_mgr_destroy_surface: Leave(OK)");
4519 /*--------------------------------------------------------------------------*/
4521 * @brief bind_ico_win_mgr: bind Multi Window Manager from client
4523 * @param[in] client client
4524 * @param[in] data user data(unused)
4525 * @param[in] version protocol version(unused)
4526 * @param[in] id client object id
4529 /*--------------------------------------------------------------------------*/
4531 bind_ico_win_mgr(struct wl_client *client,
4532 void *data, uint32_t version, uint32_t id)
4534 struct wl_resource *add_resource;
4535 struct uifw_manager *mgr;
4536 struct uifw_client *uclient;
4538 uifw_trace("bind_ico_win_mgr: Enter(client=%08x, id=%x)", (int)client, (int)id);
4540 add_resource = wl_resource_create(client, &ico_window_mgr_interface, 1, id);
4542 wl_resource_set_implementation(add_resource, &ico_window_mgr_implementation,
4543 _ico_win_mgr, unbind_ico_win_mgr);
4546 /* Create client management tabel */
4547 uclient = find_client_from_client(client);
4549 win_mgr_bind_client(client, NULL);
4550 uclient = find_client_from_client(client);
4554 mgr = (struct uifw_manager *)malloc(sizeof(struct uifw_manager));
4556 uifw_error("bind_ico_win_mgr: Error, No Memory");
4559 memset(mgr, 0, sizeof(struct uifw_manager));
4560 mgr->resource = add_resource;
4564 wl_list_insert(&_ico_win_mgr->manager_list, &mgr->link);
4566 uifw_trace("bind_ico_win_mgr: Leave");
4569 /*--------------------------------------------------------------------------*/
4571 * @brief unbind_ico_win_mgr: unbind Multi Window Manager from client
4573 * @param[in] resource client resource
4576 /*--------------------------------------------------------------------------*/
4578 unbind_ico_win_mgr(struct wl_resource *resource)
4580 struct uifw_manager *mgr, *itmp;
4582 uifw_trace("unbind_ico_win_mgr: Enter");
4584 /* Remove manager from manager list */
4585 _ico_win_mgr->num_manager = 0;
4586 wl_list_for_each_safe (mgr, itmp, &_ico_win_mgr->manager_list, link) {
4587 if (mgr->resource == resource) {
4588 wl_list_remove(&mgr->link);
4593 _ico_win_mgr->num_manager++;
4597 uifw_trace("unbind_ico_win_mgr: Leave");
4600 /*--------------------------------------------------------------------------*/
4602 * @brief ico_win_mgr_send_to_mgr: send event to manager(HomeScreen)
4604 * @param[in] event event code(if -1, not send event)
4605 * @param[in] usurf UIFW surface table
4606 * @param[in] param1 parameter 1
4608 * @param[in] param5 parameter 5
4609 * @return number of managers
4610 * @retval > 0 number of managers
4611 * @retval 0 manager not exist
4613 /*--------------------------------------------------------------------------*/
4615 ico_win_mgr_send_to_mgr(const int event, struct uifw_win_surface *usurf,
4616 const int param1, const int param2, const int param3,
4617 const int param4, const int param5)
4620 struct uifw_manager* mgr;
4622 /* if DESTROY and no send CREATE, Nop */
4623 if ((event == ICO_WINDOW_MGR_WINDOW_DESTROYED) &&
4624 (usurf != NULL) && (usurf->created == 0)) {
4628 /* if appid not fix, check and fix appid */
4629 if ((usurf != NULL) &&
4630 (usurf->uclient->fixed_appid < ICO_WINDOW_MGR_APPID_FIXCOUNT)) {
4631 win_mgr_get_client_appid(usurf->uclient);
4634 /* send created if not send created event */
4635 if ((usurf != NULL) && (usurf->created == 0) &&
4636 (((usurf->width > 0) && (usurf->height > 0)) ||
4637 ((event != ICO_WINDOW_MGR_WINDOW_CREATED) &&
4638 (event != ICO_WINDOW_MGR_WINDOW_NAME)))) {
4639 wl_list_for_each (mgr, &_ico_win_mgr->manager_list, link) {
4641 uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) WINDOW_CREATED"
4642 "(surf=%08x,name=%s,pid=%d,appid=%s,type=%x)", (int)mgr->resource,
4643 usurf->surfaceid, usurf->winname, usurf->uclient->pid,
4644 usurf->uclient->appid, usurf->layertype);
4645 ico_window_mgr_send_window_created(mgr->resource, usurf->surfaceid,
4646 usurf->winname, usurf->uclient->pid,
4647 usurf->uclient->appid,
4648 usurf->layertype << 12);
4654 wl_list_for_each (mgr, &_ico_win_mgr->manager_list, link) {
4659 case ICO_WINDOW_MGR_WINDOW_CREATED:
4660 /* Do nothing anymore because sended window create event */
4663 case ICO_WINDOW_MGR_WINDOW_NAME:
4664 uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) WINDOW_NAME"
4665 "(surf=%08x,name=%s)", (int)mgr->resource,
4666 usurf->surfaceid, usurf->winname);
4667 ico_window_mgr_send_window_name(mgr->resource, usurf->surfaceid,
4671 case ICO_WINDOW_MGR_WINDOW_DESTROYED:
4672 uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) DESTROYED"
4673 "(surf=%08x)", (int)mgr->resource, usurf->surfaceid);
4674 ico_window_mgr_send_window_destroyed(mgr->resource, usurf->surfaceid);
4677 case ICO_WINDOW_MGR_WINDOW_VISIBLE:
4678 uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) VISIBLE"
4679 "(surf=%08x,vis=%d,raise=%d,hint=%d)",
4680 (int)mgr->resource, usurf->surfaceid, param1, param2, param3);
4681 ico_window_mgr_send_window_visible(mgr->resource,
4682 usurf->surfaceid, param1, param2, param3);
4685 case ICO_WINDOW_MGR_WINDOW_CONFIGURE:
4686 uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) CONFIGURE"
4687 "(surf=%08x,app=%s,node=%x,type=%x,layer=%d,"
4688 "x/y=%d/%d,w/h=%d/%d,hint=%d)",
4689 (int)mgr->resource, usurf->surfaceid, usurf->uclient->appid,
4690 usurf->node_tbl->node, usurf->layertype,
4691 usurf->win_layer->layer, param1, param2, param3, param4, param5);
4692 ico_window_mgr_send_window_configure(mgr->resource, usurf->surfaceid,
4693 usurf->node_tbl->node,
4694 usurf->layertype << 12,
4695 usurf->win_layer->layer,
4696 param1, param2, param3, param4, param5);
4699 case ICO_WINDOW_MGR_WINDOW_ACTIVE:
4700 uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) ACTIVE"
4701 "(surf=%08x,active=%d)", (int)mgr->resource, usurf->surfaceid,
4703 ico_window_mgr_send_window_active(mgr->resource, usurf->surfaceid,
4707 case ICO_WINDOW_MGR_LAYER_VISIBLE:
4708 uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) LAYER_VISIBLE"
4709 "(layer=%d,visivle=%d)", (int)mgr->resource, param1, param2);
4710 ico_window_mgr_send_layer_visible(mgr->resource, (uint32_t)param1, param2);
4714 uifw_error("ico_win_mgr_send_to_mgr: Illegal event(%08x)", event);
4722 /*--------------------------------------------------------------------------*/
4724 * @brief win_mgr_set_scale: set surface transform scale
4726 * @param[in] usurf UIFW surface
4727 * @return chagne display
4728 * @retval =1 change display
4729 * @retval =0 no change
4731 /*--------------------------------------------------------------------------*/
4733 win_mgr_set_scale(struct uifw_win_surface *usurf)
4735 struct weston_surface *es;
4740 es = usurf->surface;
4741 if ((es != NULL) && (es->buffer_ref.buffer)) {
4742 if (usurf->client_width == 0) usurf->client_width = es->geometry.width;
4743 if (usurf->client_height == 0) usurf->client_height = es->geometry.height;
4744 if ((usurf->client_width > 0) && (usurf->client_height > 0)) {
4745 scalex = (float)usurf->width / (float)usurf->client_width;
4746 scaley = (float)usurf->height / (float)usurf->client_height;
4752 uifw_debug("win_mgr_set_scale: %08x X=%4.2f(%d/%d) Y=%4.2f(%d/%d)",
4753 usurf->surfaceid, scalex, usurf->width, usurf->client_width,
4754 scaley, usurf->height, usurf->client_height);
4757 if ((ico_ivi_optionflag() & ICO_IVI_OPTION_FIXED_ASPECT) ||
4758 (usurf->attributes & ICO_WINDOW_MGR_ATTR_FIXED_ASPECT)) {
4759 if (scalex > scaley) {
4761 if ((usurf->attributes & ICO_WINDOW_MGR_ATTR_ALIGN_LEFT) == 0) {
4762 usurf->xadd = (float)usurf->width - ((float)usurf->client_width * scalex);
4763 if ((usurf->attributes & ICO_WINDOW_MGR_ATTR_ALIGN_RIGHT) == 0) {
4768 else if (scalex < scaley) {
4770 if ((usurf->attributes & ICO_WINDOW_MGR_ATTR_ALIGN_TOP) == 0) {
4771 usurf->yadd = (float)usurf->height - ((float)usurf->client_height * scaley);
4772 if ((usurf->attributes & ICO_WINDOW_MGR_ATTR_ALIGN_BOTTOM) == 0) {
4777 uifw_trace("win_mgr_set_scale: %08x fixed aspect x/yadd=%d/%d",
4778 usurf->surfaceid, usurf->xadd, usurf->yadd);
4780 if ((scalex != usurf->scalex) || (scaley != usurf->scaley)) {
4781 usurf->scalex = scalex;
4782 usurf->scaley = scaley;
4783 if ((scalex != 1.0f) || (scaley != 1.0f)) {
4784 weston_matrix_init(&usurf->transform.matrix);
4785 weston_matrix_scale(&usurf->transform.matrix, scalex, scaley, 1.0f);
4786 uifw_trace("win_mgr_set_scale: change scale(%d)", usurf->set_transform);
4787 if (usurf->set_transform == 0) {
4788 usurf->set_transform = 1;
4789 wl_list_init(&usurf->transform.link);
4790 wl_list_insert(&es->geometry.transformation_list, &usurf->transform.link);
4793 else if (usurf->set_transform != 0) {
4794 uifw_trace("win_mgr_set_scale: reset transform");
4795 usurf->set_transform = 0;
4796 wl_list_remove(&usurf->transform.link);
4798 weston_surface_geometry_dirty(es);
4799 weston_surface_update_transform(es);
4800 weston_surface_damage_below(es);
4801 weston_surface_damage(es);
4808 /*--------------------------------------------------------------------------*/
4810 * @brief ico_window_mgr_get_uclient: get UIFW client table
4812 * @param[in] appid application Id
4813 * @return UIFW client table
4814 * @retval !=NULL success(UIFW client table address)
4815 * @retval = NULL error(appid not exist)
4817 /*--------------------------------------------------------------------------*/
4818 WL_EXPORT struct uifw_client *
4819 ico_window_mgr_get_uclient(const char *appid)
4821 struct uifw_client *uclient;
4823 wl_list_for_each (uclient, &_ico_win_mgr->client_list, link) {
4824 if (strcmp(uclient->appid, appid) == 0) {
4831 /*--------------------------------------------------------------------------*/
4833 * @brief ico_window_mgr_get_client_usurf: get client UIFW surface table
4835 * @param[in] target surface window name and application Id(winname@appid)
4836 * @return UIFW surface table
4837 * @retval !=NULL success(UIFW surface table address)
4838 * @retval = NULL error(appid or winname not exist)
4840 /*--------------------------------------------------------------------------*/
4841 WL_EXPORT struct uifw_win_surface *
4842 ico_window_mgr_get_client_usurf(const char *target)
4844 struct uifw_client *uclient;
4845 struct uifw_win_surface *usurf;
4847 char winname[ICO_IVI_WINNAME_LENGTH];
4848 char appid[ICO_IVI_APPID_LENGTH];
4850 /* get window name and application id */
4852 for (i = 0; target[i]; i++) {
4853 if (target[i] == '@') {
4854 if (target[i+1] != '@') break;
4857 if (j < (ICO_IVI_WINNAME_LENGTH-1)) {
4858 winname[j++] = target[i];
4862 if (target[i] == '@') {
4870 for ( ; target[i]; i++) {
4871 if ((target[i] == '@') && (target[i+1] == '@')) i ++;
4872 if (j < (ICO_IVI_APPID_LENGTH-1)) {
4873 appid[j++] = target[i];
4877 uifw_debug("ico_window_mgr_get_client_usurf: target=<%s> appid=<%s> win=<%s>",
4878 target, appid, winname);
4880 wl_list_for_each (uclient, &_ico_win_mgr->client_list, link) {
4881 if (strcmp(uclient->appid, appid) == 0) {
4882 wl_list_for_each (usurf, &uclient->surface_link, client_link) {
4883 if ((winname[0] == 0) ||
4884 (strcmp(winname, usurf->winname) == 0)) {
4893 /*--------------------------------------------------------------------------*/
4895 * @brief ico_window_mgr_is_visible: check surface visible
4897 * @param[in] usurf UIFW surface
4898 * @return visibility
4899 * @retval =1 visible
4900 * @retval =0 not visible
4901 * @retval =-1 surface visible but layer not vlsible
4902 * @retval =-2 surface visible but lower(currently not support)
4904 /*--------------------------------------------------------------------------*/
4906 ico_window_mgr_is_visible(struct uifw_win_surface *usurf)
4908 if ((usurf->visible == 0) || (usurf->surface == NULL) || (usurf->mapped == 0)) {
4911 if (usurf->win_layer->visible == 0) {
4917 /*--------------------------------------------------------------------------*/
4919 * @brief ico_window_mgr_active_surface: set active surface
4921 * @param[in] surface Weston surface
4924 /*--------------------------------------------------------------------------*/
4926 ico_window_mgr_active_surface(struct weston_surface *surface)
4928 struct uifw_win_surface *usurf;
4931 usurf = find_uifw_win_surface_by_ws(surface);
4933 uifw_trace("ico_window_mgr_active_surface: Enter(%08x)", (int)surface);
4934 uifw_trace("ico_window_mgr_active_surface: Leave(Not Exist)");
4937 uifw_trace("ico_window_mgr_active_surface: Enter(%08x)", usurf->surfaceid);
4939 if ((usurf != _ico_win_mgr->active_pointer_usurf) ||
4940 (usurf != _ico_win_mgr->active_keyboard_usurf)) {
4942 /* set weston active surface */
4943 win_mgr_set_active(usurf, ICO_WINDOW_MGR_ACTIVE_POINTER |
4944 ICO_WINDOW_MGR_ACTIVE_KEYBOARD);
4945 /* send active event to manager */
4946 (void) ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE,
4947 usurf, ICO_WINDOW_MGR_ACTIVE_SELECTED, 0,0,0,0);
4949 uifw_trace("ico_window_mgr_active_surface: Leave(OK)");
4952 /*--------------------------------------------------------------------------*/
4954 * @brief ico_window_mgr_set_hook_animation: set animation hook routine
4956 * @param[in] hook_animation hook routine
4959 /*--------------------------------------------------------------------------*/
4961 ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data))
4963 win_mgr_hook_animation = hook_animation;
4966 /*--------------------------------------------------------------------------*/
4968 * @brief ico_window_mgr_set_hook_change: set input region hook routine
4970 * @param[in] hook_change hook routine
4973 /*--------------------------------------------------------------------------*/
4975 ico_window_mgr_set_hook_change(void (*hook_change)(struct uifw_win_surface *usurf))
4977 win_mgr_hook_change = hook_change;
4980 /*--------------------------------------------------------------------------*/
4982 * @brief ico_window_mgr_set_hook_destory: set input region hook routine
4984 * @param[in] hook_destroy hook routine
4987 /*--------------------------------------------------------------------------*/
4989 ico_window_mgr_set_hook_destory(void (*hook_destroy)(struct uifw_win_surface *usurf))
4991 win_mgr_hook_destory = hook_destroy;
4994 /*--------------------------------------------------------------------------*/
4996 * @brief ico_window_mgr_set_hook_inputregion: set input region hook routine
4998 * @param[in] hook_inputregion hook routine
5001 /*--------------------------------------------------------------------------*/
5003 ico_window_mgr_set_hook_inputregion(
5004 void (*hook_inputregion)(int set, struct uifw_win_surface *usurf,
5005 int32_t x, int32_t y, int32_t width,
5006 int32_t height, int32_t hotspot_x, int32_t hotspot_y,
5007 int32_t cursor_x, int32_t cursor_y, int32_t cursor_width,
5008 int32_t cursor_height, uint32_t attr))
5010 win_mgr_hook_inputregion = hook_inputregion;
5013 /*--------------------------------------------------------------------------*/
5015 * @brief module_init: initialize ico_window_mgr
5016 * this function called from ico_pluign_loader
5018 * @param[in] es weston compositor
5019 * @param[in] argc number of arguments(unused)
5020 * @param[in] argv argument list(unused)
5025 /*--------------------------------------------------------------------------*/
5027 module_init(struct weston_compositor *ec, int *argc, char *argv[])
5032 struct weston_output *output;
5033 struct weston_config_section *section;
5034 char *displayno = NULL;
5037 struct wl_event_loop *loop;
5039 uifw_info("ico_window_mgr: Enter(module_init)");
5041 /* get ivi debug level */
5042 section = weston_config_get_section(ec->config, "ivi-option", NULL, NULL);
5044 weston_config_section_get_int(section, "flag", &_ico_ivi_option_flag, 0);
5045 weston_config_section_get_int(section, "log", &_ico_ivi_debug_level, 3);
5048 /* get display number */
5049 section = weston_config_get_section(ec->config, "ivi-display", NULL, NULL);
5051 weston_config_section_get_string(section, "displayno", &displayno, NULL);
5052 weston_config_section_get_int(section, "inputpanel",
5053 &_ico_ivi_inputpanel_display, 0);
5057 section = weston_config_get_section(ec->config, "ivi-layer", NULL, NULL);
5059 weston_config_section_get_int(section, "default", &_ico_ivi_default_layer, 1);
5060 weston_config_section_get_int(section, "background", &_ico_ivi_background_layer, 0);
5061 weston_config_section_get_int(section, "touch", &_ico_ivi_touch_layer, 101);
5062 weston_config_section_get_int(section, "cursor", &_ico_ivi_cursor_layer, 102);
5063 weston_config_section_get_int(section, "startup", &_ico_ivi_startup_layer, 103);
5064 weston_config_section_get_string(section, "inputpaneldeco", &wrkstrp, NULL);
5066 p = strtok(wrkstrp, ";,");
5068 _ico_ivi_inputdeco_mag = strtol(p, (char **)0, 0);
5069 p = strtok(NULL, ";,");
5071 _ico_ivi_inputdeco_diff = strtol(p, (char **)0, 0);
5077 if (_ico_ivi_inputdeco_mag < 20) _ico_ivi_inputdeco_mag = 100;
5079 /* get animation default */
5080 section = weston_config_get_section(ec->config, "ivi-animation", NULL, NULL);
5082 weston_config_section_get_string(section, "default", &_ico_ivi_animation_name, NULL);
5083 weston_config_section_get_string(section, "inputpanel",
5084 &_ico_ivi_inputpanel_animation, NULL);
5085 weston_config_section_get_int(section, "time", &_ico_ivi_animation_time, 500);
5086 weston_config_section_get_int(section, "fps", &_ico_ivi_animation_fps, 30);
5087 if (_ico_ivi_animation_name) {
5088 p = strtok(_ico_ivi_animation_name, ";,");
5090 p = strtok(NULL, ";.");
5092 _ico_ivi_animation_time = strtol(p, (char **)0, 0);
5093 p = strtok(NULL, ";.");
5095 _ico_ivi_animation_fps = strtol(p, (char **)0, 0);
5100 if (_ico_ivi_inputpanel_animation) {
5101 p = strtok(_ico_ivi_inputpanel_animation, ";,");
5103 p = strtok(NULL, ",;");
5105 _ico_ivi_inputpanel_anima_time = strtol(p, (char **)0, 0);
5110 if (_ico_ivi_animation_name == NULL)
5111 _ico_ivi_animation_name = (char *)"fade";
5112 if (_ico_ivi_inputpanel_animation == NULL)
5113 _ico_ivi_inputpanel_animation = (char *)"fade";
5114 if (_ico_ivi_animation_time < 100) _ico_ivi_animation_time = 500;
5115 if (_ico_ivi_animation_fps < 3) _ico_ivi_animation_fps = 30;
5116 if (_ico_ivi_inputpanel_anima_time < 100)
5117 _ico_ivi_inputpanel_anima_time = _ico_ivi_animation_time;
5119 /* get thumbnail maximum frame rate */
5120 section = weston_config_get_section(ec->config, "ivi-thumbnail", NULL, NULL);
5122 weston_config_section_get_int(section, "gpu_accel_fps",
5123 &_ico_ivi_map_framerate_gpu, 30);
5124 if ((_ico_ivi_map_framerate_gpu <= 0) || (_ico_ivi_map_framerate_gpu > 60)) {
5125 _ico_ivi_map_framerate_gpu = 30;
5127 weston_config_section_get_int(section, "shm_buffer_fps",
5128 &_ico_ivi_map_framerate_shm, 5);
5129 if ((_ico_ivi_map_framerate_shm <= 0) || (_ico_ivi_map_framerate_shm > 10)) {
5130 _ico_ivi_map_framerate_shm = 5;
5132 weston_config_section_get_int(section, "no_accel_fps",
5133 &_ico_ivi_map_framerate_pixel, 10);
5134 if ((_ico_ivi_map_framerate_pixel <= 0) || (_ico_ivi_map_framerate_pixel > 20)) {
5135 _ico_ivi_map_framerate_pixel = 10;
5139 /* create ico_window_mgr management table */
5140 _ico_win_mgr = (struct ico_win_mgr *)malloc(sizeof(struct ico_win_mgr));
5141 if (_ico_win_mgr == NULL) {
5142 uifw_error("ico_window_mgr: malloc failed");
5146 memset(_ico_win_mgr, 0, sizeof(struct ico_win_mgr));
5147 _ico_win_mgr->surfaceid_map = (uint16_t *) malloc(INIT_SURFACE_IDS/8);
5148 if (! _ico_win_mgr->surfaceid_map) {
5149 uifw_error("ico_window_mgr: malloc failed");
5152 memset(_ico_win_mgr->surfaceid_map, 0, INIT_SURFACE_IDS/8);
5154 _ico_win_mgr->compositor = ec;
5156 _ico_win_mgr->surfaceid_max = INIT_SURFACE_IDS;
5157 _ico_win_mgr->surfaceid_count = INIT_SURFACE_IDS;
5159 uifw_trace("ico_window_mgr: wl_global_create(bind_ico_win_mgr)");
5160 if (wl_global_create(ec->wl_display, &ico_window_mgr_interface, 1,
5161 _ico_win_mgr, bind_ico_win_mgr) == NULL) {
5162 uifw_error("ico_window_mgr: Error(wl_global_create)");
5166 wl_list_init(&_ico_win_mgr->client_list);
5167 wl_list_init(&_ico_win_mgr->manager_list);
5168 wl_list_init(&_ico_win_mgr->ivi_layer_list);
5169 wl_list_init(&_ico_win_mgr->map_list);
5171 _ico_win_mgr->free_maptable = NULL;
5173 /* create display list */
5174 if (displayno != NULL) {
5181 wl_list_for_each (output, &ec->output_list, link) {
5182 wl_list_init(&_ico_win_mgr->map_animation[_ico_num_nodes].link);
5183 _ico_win_mgr->map_animation[_ico_num_nodes].frame = win_mgr_check_mapsurface;
5184 wl_list_insert(output->animation_list.prev,
5185 &_ico_win_mgr->map_animation[_ico_num_nodes].link);
5187 if (_ico_num_nodes >= ICO_IVI_MAX_DISPLAY) break;
5189 memset(&_ico_node_table[0], 0, sizeof(_ico_node_table));
5191 wl_list_for_each (output, &ec->output_list, link) {
5194 idx = strtol(p, (char **)0, 0);
5195 uifw_trace("ico_window_mgr: config Display.%d is weston display.%d", i, idx);
5197 if ((idx < 0) || (idx >= _ico_num_nodes)) {
5204 if (_ico_node_table[idx].node) {
5205 for (idx = 0; idx < _ico_num_nodes; idx++) {
5206 if (_ico_node_table[idx].node == 0) break;
5208 if (idx >= _ico_num_nodes) {
5209 uifw_error("ico_window_mgr: number of display overflow");
5213 _ico_node_table[idx].node = idx + 0x100;
5214 _ico_node_table[idx].displayno = i;
5215 _ico_node_table[idx].output = output;
5216 _ico_node_table[idx].disp_x = output->x;
5217 _ico_node_table[idx].disp_y = output->y;
5218 _ico_node_table[idx].disp_width = output->width;
5219 _ico_node_table[idx].disp_height = output->height;
5221 if (i >= _ico_num_nodes) break;
5224 for (i = 0; i < _ico_num_nodes; i++) {
5225 _ico_node_table[i].node &= 0x0ff;
5226 uifw_info("ico_window_mgr: Display.%d no=%d x/y=%d/%d w/h=%d/%d",
5227 i, _ico_node_table[i].displayno,
5228 _ico_node_table[i].disp_x, _ico_node_table[i].disp_y,
5229 _ico_node_table[i].disp_width, _ico_node_table[i].disp_height);
5231 if (displayno) free(displayno);
5233 if (_ico_ivi_inputpanel_display >= _ico_num_nodes) {
5234 _ico_ivi_inputpanel_display = 0;
5236 uifw_info("ico_window_mgr: inputpanel_display=%d", _ico_ivi_inputpanel_display);
5238 /* set default display to ico_ivi_shell */
5239 ivi_shell_set_default_display(_ico_node_table[_ico_ivi_inputpanel_display].output);
5241 /* my node Id ... this version fixed 0 */
5242 nodeId = ico_ivi_get_mynode();
5244 _ico_win_mgr->surface_head = ICO_IVI_SURFACEID_BASE(nodeId);
5245 uifw_trace("ico_window_mgr: NoedId=%04x SurfaceIdBase=%08x",
5246 nodeId, _ico_win_mgr->surface_head);
5248 /* get seat for touch down counter check */
5249 touch_check_seat = container_of(ec->seat_list.next, struct weston_seat, link);
5250 loop = wl_display_get_event_loop(ec->wl_display);
5251 _ico_win_mgr->wait_mapevent =
5252 wl_event_loop_add_timer(loop, win_mgr_timer_mapsurface, NULL);
5253 wl_event_source_timer_update(_ico_win_mgr->wait_mapevent, 1000);
5255 /* Hook to IVI-Shell */
5256 ico_ivi_shell_hook_bind(win_mgr_bind_client);
5257 ico_ivi_shell_hook_unbind(win_mgr_unbind_client);
5258 ico_ivi_shell_hook_create(win_mgr_register_surface);
5259 ico_ivi_shell_hook_destroy(win_mgr_destroy_surface);
5260 ico_ivi_shell_hook_map(win_mgr_surface_map);
5261 ico_ivi_shell_hook_configure(win_mgr_shell_configure);
5262 ico_ivi_shell_hook_select(win_mgr_select_surface);
5263 ico_ivi_shell_hook_title(win_mgr_set_title);
5264 ico_ivi_shell_hook_move(win_mgr_surface_move);
5265 ico_ivi_shell_hook_show_layer(win_mgr_show_layer);
5266 ico_ivi_shell_hook_fullscreen(win_mgr_fullscreen);
5268 uifw_info("ico_window_mgr: animation name=%s/%s time=%d/%d fps=%d",
5269 _ico_ivi_animation_name, _ico_ivi_inputpanel_animation,
5270 _ico_ivi_animation_time, _ico_ivi_inputpanel_anima_time,
5271 _ico_ivi_animation_fps);
5272 uifw_info("ico_window_mgr: input panel mag=%d%% diff=%d",
5273 _ico_ivi_inputdeco_mag,_ico_ivi_inputdeco_diff);
5274 uifw_info("ico_window_mgr: layer default=%d background=%d",
5275 _ico_ivi_default_layer, _ico_ivi_background_layer);
5276 uifw_info("ico_window_mgr: layer touch=%d cursor=%d startup=%d",
5277 _ico_ivi_touch_layer, _ico_ivi_cursor_layer, _ico_ivi_startup_layer);
5278 uifw_info("ico_window_mgr: thumbnail framerate gpu_accel=%d shm_buff=%d no_accel=%d",
5279 _ico_ivi_map_framerate_gpu, _ico_ivi_map_framerate_shm,
5280 _ico_ivi_map_framerate_pixel);
5281 uifw_info("ico_window_mgr: option flag=0x%04x log level=%d debug flag=0x%04x",
5282 _ico_ivi_option_flag, _ico_ivi_debug_level & 0x0ffff,
5283 (_ico_ivi_debug_level >> 16) & 0x0ffff);
5285 /* get GPU type for H/W support of the thumbnail acquisition */
5286 if (ico_ivi_optionflag() & ICO_IVI_OPTION_GPU_NODEPEND) {
5287 /* can not use GPU H/W dependent acceleration */
5288 _ico_ivi_gpu_type = ICO_GPUTYPE_NOACCELERATION;
5289 uifw_info("ico_window_mgr: GPU type=No Acceleration by option flag");
5291 else if (ico_ivi_optionflag() & ICO_IVI_OPTION_GPU_DEPENDINTEL) {
5292 /* use Intel GPU H/W dependent acceleration */
5293 _ico_ivi_gpu_type = ICO_GPUTYPE_INTEL_SANDYBRIDGE;
5294 uifw_info("ico_window_mgr: GPU type=Acceleration Intel GPU by option flag");
5297 _ico_ivi_gpu_type = ICO_GPUTYPE_NOACCELERATION;
5299 p = (char *)glGetString(GL_RENDERER);
5301 uifw_info("ico_window_mgr: Renderer=<%s>", p);
5302 for (i = 0; ico_window_mgr_gpu_type[i].gpu_type; i++) {
5303 if (strncmp(p, ico_window_mgr_gpu_type[i].gpu_name,
5304 strlen(ico_window_mgr_gpu_type[i].gpu_name)) == 0) {
5305 _ico_ivi_gpu_type = ico_window_mgr_gpu_type[i].gpu_type;
5306 uifw_info("ico_window_mgr: GPU type=Acceleration %d", _ico_ivi_gpu_type);
5311 if (_ico_ivi_gpu_type == ICO_GPUTYPE_NOACCELERATION) {
5312 uifw_info("ico_window_mgr: GPU type=No Acceleration(can not find GPU)");
5315 uifw_info("ico_window_mgr: Leave(module_init)");