From 44db6cdebe1960b6f4af21635e7d5379a9dac881 Mon Sep 17 00:00:00 2001 From: Hayato Nakamura Date: Wed, 6 Nov 2013 18:23:03 +0900 Subject: [PATCH] Bug fix : TIVI-1758, 1841, 1956, 1996 and 1997. Change-Id: I1e440656f9c24a1aa0470591d6f15973e0efade3 Signed-off-by: Hayato Nakamura --- packaging/ico-uxf-weston-plugin.changes | 13 +- packaging/ico-uxf-weston-plugin.spec | 8 +- protocol/ico_window_mgr.xml | 20 +- settings/weston.ini | 44 +- src/Makefile.am | 6 +- src/ico_input_mgr.c | 226 +++-- src/ico_ivi_common.h | 6 +- src/ico_ivi_shell.c | 456 +++++++--- src/ico_ivi_shell.h | 34 +- src/ico_plugin_loader.c | 2 +- src/ico_window_animation.c | 9 +- src/ico_window_mgr.c | 1381 +++++++++++++++++++++++++------ src/ico_window_mgr.h | 25 +- tests/test-homescreen.c | 23 +- tests/testdata/hs_alltest.dat | 184 ++-- tests/testdata/hs_mapsurf.dat | 7 +- tests/weston-plugin-test.map | 2 + tests/weston.ini | 48 +- 18 files changed, 1892 insertions(+), 602 deletions(-) mode change 100755 => 100644 settings/weston.ini diff --git a/packaging/ico-uxf-weston-plugin.changes b/packaging/ico-uxf-weston-plugin.changes index a984331..ccb988d 100644 --- a/packaging/ico-uxf-weston-plugin.changes +++ b/packaging/ico-uxf-weston-plugin.changes @@ -1,8 +1,19 @@ +* Wed Nov 06 2013 Shibata Makoto accepted/tizen/20131010.203258@58015fa +- 0.9.07 release. +-- fix for: TIVI-1758 - Weston VKB is not stable for MiniBrowser +-- fix for: TIVI-1841 - virtual keyboard cannot triggered on ICO UI + Supported virtual keyboard(weekeyboard) which worked in input panel layer +-- fix for: TIVI-1956 - Error occurs when running weston-plugin-test testing + Multi Input Manager was not able to use the plural logical devices in one Device Input Controller Daemon +-- fix for: TIVI-1996 - App shortcut doesn't work after switching app for many times +-- fix for: TIVI-1997 - Touch doesn't work in ico homescreen after some operations + When a history of application activity gesture was canceled, the liberation of the grab fell out +-- support: Support of Mesa 9.2.1 + * Tue Oct 08 2013 Shibata Makoto accepted/tizen/20131004.165200@60ccba2 - 0.9.06 release. -- addition: Notice of the operation event to application except the application history flick operation at HomeScreen. - * Thu Sep 26 2013 Shibata Makoto accepted/tizen/20130919.204240@80cee2e - 0.9.05 release -- fix for - surface of the fullscreen is not displayed. diff --git a/packaging/ico-uxf-weston-plugin.spec b/packaging/ico-uxf-weston-plugin.spec index e00ff9a..ae0acbe 100644 --- a/packaging/ico-uxf-weston-plugin.spec +++ b/packaging/ico-uxf-weston-plugin.spec @@ -1,13 +1,13 @@ Name: ico-uxf-weston-plugin Summary: Weston Plugins for IVI -Version: 0.9.06 +Version: 0.9.07 Release: 1.1 Group: Graphics & UI Framework/Automotive UI License: MIT URL: "" Source0: %{name}-%{version}.tar.bz2 -BuildRequires: pkgconfig(weston) >= 1.2.1 +BuildRequires: pkgconfig(weston) = 1.2.2 BuildRequires: pkgconfig(pixman-1) BuildRequires: pkgconfig(xkbcommon) >= 0.0.578 BuildRequires: pkgconfig(eina) @@ -15,10 +15,10 @@ BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(eina) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ecore-wayland) -BuildRequires: mesa-devel BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(ecore) -Requires: weston >= 1.2.1 +BuildRequires: mesa-devel +Requires: weston = 1.2.2 Requires: weekeyboard %description diff --git a/protocol/ico_window_mgr.xml b/protocol/ico_window_mgr.xml index 7538eb6..a77d10f 100644 --- a/protocol/ico_window_mgr.xml +++ b/protocol/ico_window_mgr.xml @@ -11,9 +11,6 @@ - - - @@ -106,6 +103,19 @@ + + + Surafce layer type. + + + + + + + + + + Set manager application(ex.SystemController). @@ -195,6 +205,7 @@ Get surfaces of the application. + @@ -220,6 +231,7 @@ + @@ -253,6 +265,7 @@ + @@ -282,6 +295,7 @@ Reply of app_surfaces request. + diff --git a/settings/weston.ini b/settings/weston.ini old mode 100755 new mode 100644 index c6db4a0..237a75a --- a/settings/weston.ini +++ b/settings/weston.ini @@ -24,33 +24,39 @@ mode=off modules=ico_ivi_shell.so,ico_window_mgr.so,ico_window_animation.so,ico_input_mgr.so [ivi-display] +# logical display number list displayno=1,0 +# default input panel display +inputpanel=0 [ivi-layer] -# default layer id -default=1 -# layer id at the time of the system startup -startup=109 # background layer id background=0 -# input layer id -input=101 +# default(panel) layer id +default=1 +# touch panel layer id +touch=101 # cursor layer id cursor=102 +# layer id at the time of the system startup +startup=103 +# input panel layer decoration (magnification rate(%);difference from the bottom) +inputpaneldeco=120;132 [ivi-animation] -# default animation -default=fade -# animation time (ms) -time=500 -# animation frame rate(frame/sec) -fps=30 - -[ivi-debug] -# debug flags -# bit.0 0=hide on surface create(for with HomeScreen)/1=show on surface create -# bit.1 0=not show if display not exist/1=show if display not exist -flag=0 - +# default animation name;time;rate(frame/sec) +default=fade;500;30 +# input panel surface animation(name;time) +inputpanel=fade;200 + +[ivi-option] +# option flags +# bit.0 1=show surface at screen create if HomeScreen exist/0=not show surface at create +# bit.1 1=1=show if display not exist/0=not show if display not exist +# bit.2 1=show input panel automatically/0=not show automaticaly +# bit.8 1=surface fixed aspect rate/0=not fixed aspect rate +flag=0x0004 + +# debug log output level # 0=no debug log write(1=err/2=warn/3=info/4=trace/5=debug) log=4 diff --git a/src/Makefile.am b/src/Makefile.am index 9a4a7f4..f4c1dba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,7 @@ pkginclude_HEADERS = \ ico_input_mgr-client-protocol.h \ ico_input_mgr.h -libico_uxf_weston_plugin_la_LIBADD = -lrt -lm +libico_uxf_weston_plugin_la_LIBADD = -ldrm_intel -lrt -lm libico_uxf_weston_plugin_la_LDFLAGS = -version-info 0:9:0 libico_uxf_weston_plugin_la_SOURCES = \ desktop-shell-protocol.c \ @@ -67,8 +67,8 @@ ico_ivi_shell_la_SOURCES = \ # Multi Window Manager ico_window_mgr = ico_window_mgr.la ico_window_mgr_la_LDFLAGS = -module -avoid-version -ico_window_mgr_la_LIBADD = $(PLUGIN_LIBS) $(AUL_LIBS) -ico_window_mgr_la_CFLAGS = $(GCC_CFLAGS) $(EXT_CFLAGS) $(PLUGIN_CFLAGS) +ico_window_mgr_la_LIBADD = -ldrm_intel $(PLUGIN_LIBS) $(AUL_LIBS) +ico_window_mgr_la_CFLAGS = -I/usr/include/libdrm $(GCC_CFLAGS) $(EXT_CFLAGS) $(PLUGIN_CFLAGS) ico_window_mgr_la_SOURCES = \ ico_window_mgr.c \ ico_window_mgr.h \ diff --git a/src/ico_input_mgr.c b/src/ico_input_mgr.c index 178fd9a..4988d4d 100644 --- a/src/ico_input_mgr.c +++ b/src/ico_input_mgr.c @@ -125,6 +125,7 @@ struct uifw_input_device { int pend_y; /* pending Y coordinate */ uint16_t pending; /* pending flag */ char res[2]; /* (unused) */ + struct weston_surface *grab; /* current grab surface */ }; /* Input Region Table */ @@ -448,14 +449,15 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, wl_fixed_t fix_x; /* wayland X coordinate */ wl_fixed_t fix_y; /* wayland Y coordinate */ wl_fixed_t dx, dy; /* relative coordinate (dummy) */ - struct weston_surface *grabnew; /* new grab surface */ struct weston_surface *grabsave; /* real grab surface */ int keyboard_active; /* keyborad active surface flag */ - uifw_trace("ico_mgr_send_input_event: Enter(target=%s surf=%x dev=%d.%d " +#if 0 /* too many log */ + uifw_debug("ico_mgr_send_input_event: Enter(target=%s surf=%x dev=%d.%d " "time=%d code=%x value=%d)", target ? target : "(NULL)", surfaceid, type, deviceno, time, code, value); +#endif /* search pseudo input device */ wl_list_for_each (dev, &pInputMgr->dev_list, link) { @@ -582,7 +584,9 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, } if (event == EVENT_PENDING) { - uifw_trace("ico_mgr_send_input_event: Leave(event pending)"); +#if 0 /* too many log */ + uifw_debug("ico_mgr_send_input_event: Leave(event pending)"); +#endif return; } @@ -600,83 +604,144 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, /* disable the event transmission to a input layer */ if (type == ICO_INPUT_MGR_DEVICE_TYPE_TOUCH) { - ico_window_mgr_input_layer(TRUE); + ico_window_mgr_touch_layer(TRUE); } - if ((event == EVENT_TOUCH) && (pInputMgr->seat->touch == NULL)) { - /* system has no touch, change to pointer event */ - if (pInputMgr->seat->pointer == NULL) { - uifw_trace("ico_mgr_send_input_event: Leave(no touch & no pointerr)"); - return; - } - event = EVENT_BUTTON; - code = BTN_LEFT; - } - else if ((event == EVENT_BUTTON) && (pInputMgr->seat->pointer == NULL)) { - /* system has no pointer, change to touch event */ - if (pInputMgr->seat->touch == NULL) { - uifw_trace("ico_mgr_send_input_event: Leave(no touch & no pointerr)"); - return; - } - event = EVENT_TOUCH; - } + if ((event == EVENT_TOUCH) && (pInputMgr->seat->touch == NULL)) { + /* system has no touch, change to pointer event */ + if (pInputMgr->seat->pointer == NULL) { + uifw_trace("ico_mgr_send_input_event: Leave(no touch & no pointerr)"); + return; + } + event = EVENT_BUTTON; + code = BTN_LEFT; + } + else if ((event == EVENT_BUTTON) && (pInputMgr->seat->pointer == NULL)) { + /* system has no pointer, change to touch event */ + if (pInputMgr->seat->touch == NULL) { + uifw_trace("ico_mgr_send_input_event: Leave(no touch & no pointerr)"); + return; + } + event = EVENT_TOUCH; + } switch (event) { case EVENT_MOTION: if ((type == ICO_INPUT_MGR_DEVICE_TYPE_TOUCH) && - (pInputMgr->seat->touch)) { - uifw_trace("ico_mgr_send_input_event: notify_touch(MOTION=%d/%d)", - fix_x/256, fix_y/256); + (pInputMgr->seat->touch)) { + if (pInputMgr->seat->num_tp > 10) { + uifw_debug("ico_mgr_send_input_event: num=%d reset", + pInputMgr->seat->num_tp); + pInputMgr->seat->num_tp = 0; /* safty gard */ + } grabsave = pInputMgr->seat->touch->focus; - weston_touch_set_focus(pInputMgr->seat, - weston_compositor_pick_surface( - pInputMgr->compositor, fix_x, fix_y, &dx, &dy)); + uifw_debug("ico_mgr_send_input_event: MOTION(%d/%d) grab %08x org %08x", + fix_x/256, fix_y/256, (int)dev->grab, (int)grabsave); + if ((grabsave != dev->grab) && (dev->grab != NULL)) { + weston_touch_set_focus(pInputMgr->seat, dev->grab); + } notify_touch(pInputMgr->seat, ctime, 0, fix_x, fix_y, WL_TOUCH_MOTION); - weston_touch_set_focus(pInputMgr->seat, grabsave); + if ((grabsave != dev->grab) && (dev->grab != NULL)) { + weston_touch_set_focus(pInputMgr->seat, grabsave); + } } - else if (pInputMgr->seat->pointer) { - uifw_trace("ico_mgr_send_input_event: notify_motion_absolute(%d/%d)", + else if (pInputMgr->seat->pointer) { +#if 0 /* too many log */ + uifw_debug("ico_mgr_send_input_event: notify_motion_absolute(%d/%d)", fix_x/256, fix_y/256); - grabsave = pInputMgr->seat->pointer->focus; - grabnew = weston_compositor_pick_surface( - pInputMgr->compositor, fix_x, fix_y, &dx, &dy); - weston_pointer_set_focus(pInputMgr->seat->pointer, grabnew, dx, dy); +#endif notify_motion_absolute(pInputMgr->seat, ctime, fix_x, fix_y); - weston_pointer_set_focus(pInputMgr->seat->pointer, grabsave, dx, dy); } break; case EVENT_BUTTON: uifw_trace("ico_mgr_send_input_event: notify_button(%d,%d)", code, value); - if (pInputMgr->seat->pointer) { - grabsave = pInputMgr->seat->pointer->focus; - grabnew = weston_compositor_pick_surface( - pInputMgr->compositor, fix_x, fix_y, &dx, &dy); - weston_pointer_set_focus(pInputMgr->seat->pointer, grabnew, dx, dy); - notify_button(pInputMgr->seat, ctime, code, - value ? WL_POINTER_BUTTON_STATE_PRESSED : - WL_POINTER_BUTTON_STATE_RELEASED); - weston_pointer_set_focus(pInputMgr->seat->pointer, grabsave, dx, dy); - } + if (pInputMgr->seat->pointer) { + if (value) { + dev->grab = weston_compositor_pick_surface( + pInputMgr->compositor, fix_x, fix_y, &dx, &dy); + weston_pointer_set_focus(pInputMgr->seat->pointer, dev->grab, dx, dy); + ico_window_mgr_active_surface(dev->grab); + } + else { + dev->grab = NULL; + } + notify_button(pInputMgr->seat, ctime, code, + value ? WL_POINTER_BUTTON_STATE_PRESSED : + WL_POINTER_BUTTON_STATE_RELEASED); + } break; case EVENT_TOUCH: - if (value) { - uifw_trace("ico_mgr_send_input_event: notify_touch(DOWN=%d/%d)", - fix_x/256, fix_y/256); + if (value >= 7) { + grabsave = pInputMgr->seat->touch->focus; + uifw_trace("ico_mgr_send_input_event: notify_touch(UnGrab dev=%08x sys=%08x)", + (int)dev->grab, (int)grabsave); + dev->grab = NULL; + if (pInputMgr->seat->num_tp > 0) { + if (value == 7) { + if (pInputMgr->seat->num_tp > 1) { + uifw_debug("ico_mgr_send_input_event: num=%d Up is true", + pInputMgr->seat->num_tp); + value = 0; + } + else { + uifw_debug("ico_mgr_send_input_event: num=%d Up is false", + pInputMgr->seat->num_tp); + } + } + if (value != 7) { + if (pInputMgr->seat->touch->grab) { + notify_touch(pInputMgr->seat, ctime, + 0, fix_x, fix_y, WL_TOUCH_UP); + } + else { + uifw_debug("ico_mgr_send_input_event: reset num count down(%d)", + pInputMgr->seat->num_tp); + pInputMgr->seat->num_tp --; + } + } + } + if (pInputMgr->seat->num_tp > 10) { + uifw_debug("ico_mgr_send_input_event: num=%d reset", + pInputMgr->seat->num_tp); + pInputMgr->seat->num_tp = 0; /* safty gard */ + } + } + if ((value > 0) && (value != 9) && (value != 7)) { grabsave = pInputMgr->seat->touch->focus; - weston_touch_set_focus(pInputMgr->seat, - weston_compositor_pick_surface( - pInputMgr->compositor, fix_x, fix_y, &dx, &dy)); + dev->grab = weston_compositor_pick_surface( + pInputMgr->compositor, fix_x, fix_y, &dx, &dy); + uifw_trace("ico_mgr_send_input_event: notify_touch(DOWN=%d/%d) " + "grab=%08x org=%08x", fix_x/256, fix_y/256, + (int)dev->grab, (int)grabsave); + if (grabsave != dev->grab) { + weston_touch_set_focus(pInputMgr->seat, dev->grab); + } notify_touch(pInputMgr->seat, ctime, 0, fix_x, fix_y, WL_TOUCH_DOWN); - weston_touch_set_focus(pInputMgr->seat, grabsave); + ico_window_mgr_active_surface(dev->grab); + if (pInputMgr->seat->num_tp == 0) { + uifw_debug("ico_mgr_send_input_event: touch_down illegal num, modify"); + pInputMgr->seat->num_tp = 1; /* safty gard */ + } + } + else if (value == 7) { + dev->grab = NULL; } else { - uifw_trace("ico_mgr_send_input_event: notify_touch(UP)"); grabsave = pInputMgr->seat->touch->focus; - weston_touch_set_focus(pInputMgr->seat, - weston_compositor_pick_surface( - pInputMgr->compositor, fix_x, fix_y, &dx, &dy)); + uifw_trace("ico_mgr_send_input_event: notify_touch(UP) org=%08x", + (int)grabsave); + if ((grabsave != dev->grab) && (dev->grab != NULL)) { + weston_touch_set_focus(pInputMgr->seat, dev->grab); + } notify_touch(pInputMgr->seat, ctime, 0, 0, 0, WL_TOUCH_UP); + if (grabsave == dev->grab) grabsave = NULL; weston_touch_set_focus(pInputMgr->seat, grabsave); + dev->grab = NULL; + if (pInputMgr->seat->num_tp > 10) { + uifw_debug("ico_mgr_send_input_event: num=%d reset", + pInputMgr->seat->num_tp); + pInputMgr->seat->num_tp = 0; /* safty gard */ + } } break; case EVENT_KEY: @@ -691,7 +756,7 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, } /* enable the event transmission to a input layer */ if (type == ICO_INPUT_MGR_DEVICE_TYPE_TOUCH) { - ico_window_mgr_input_layer(FALSE); + ico_window_mgr_touch_layer(FALSE); } } else { @@ -787,7 +852,9 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, break; } } - uifw_trace("ico_mgr_send_input_event: Leave"); +#if 0 /* too many log */ + uifw_debug("ico_mgr_send_input_event: Leave"); +#endif } /*--------------------------------------------------------------------------*/ @@ -836,7 +903,7 @@ ico_mgr_set_input_region(struct wl_client *client, struct wl_resource *resource, } if (wl_list_empty(&pInputMgr->free_region)) { - p = malloc(sizeof(struct uifw_region_mng)*50); + p = malloc(sizeof(struct uifw_region_mng) * 50); if (! p) { uifw_error("ico_mgr_set_input_region: No Memory"); return; @@ -1105,23 +1172,44 @@ ico_device_configure_input(struct wl_client *client, struct wl_resource *resourc swname ? swname : "(NULL)", input, code, codename ? codename : " "); struct ico_ictl_mgr *pIctlMgr; + struct ico_ictl_mgr *psameIctlMgr; struct ico_ictl_input *pInput; struct ico_app_mgr *pAppMgr; pIctlMgr = find_ictlmgr_by_device(device); if (! pIctlMgr) { /* search binded table */ + psameIctlMgr = NULL; wl_list_for_each (pIctlMgr, &pInputMgr->ictl_list, link) { if (pIctlMgr->client == client) { - uifw_trace("ico_device_configure_input: setup pIctlMgr(mgr=%08x,input=%d)", - (int)pIctlMgr, input); - strncpy(pIctlMgr->device, device, sizeof(pIctlMgr->device)-1); - break; + uifw_trace("ico_device_configure_input: set pIctlMgr" + "(mgr=%08x,input=%d,dev=%s)", (int)pIctlMgr, + input, pIctlMgr->device); + if (pIctlMgr->device[0] != 0) { + /* save same device */ + psameIctlMgr = pIctlMgr; + } + else { + /* first device */ + strncpy(pIctlMgr->device, device, sizeof(pIctlMgr->device)-1); + psameIctlMgr = NULL; + break; + } } } - if (&pIctlMgr->link == &pInputMgr->ictl_list) { - uifw_error("ico_device_configure_input: Leave(not found client)"); - return; + if (psameIctlMgr) { + /* client(device input controller) exist, but other device */ + pIctlMgr = (struct ico_ictl_mgr *)malloc(sizeof(struct ico_ictl_mgr)); + if (pIctlMgr == NULL) { + uifw_error("ico_device_bind: Leave(No Memory)"); + return; + } + memset(pIctlMgr, 0, sizeof(struct ico_ictl_mgr)); + wl_list_init(&pIctlMgr->ico_ictl_input); + pIctlMgr->client = psameIctlMgr->client; + pIctlMgr->mgr_resource = psameIctlMgr->mgr_resource; + + wl_list_insert(pInputMgr->ictl_list.prev, &pIctlMgr->link); } } @@ -1166,6 +1254,7 @@ ico_device_configure_input(struct wl_client *client, struct wl_resource *resourc uifw_trace("ico_device_configure_input: Leave(table create)"); return; } + pIctlMgr->client = client; /* send to application and manager(ex.HomeScreen) */ wl_list_for_each (pAppMgr, &pInputMgr->app_list, link) { @@ -1280,7 +1369,7 @@ ico_device_input_event(struct wl_client *client, struct wl_resource *resource, /* find input devcie by client */ pIctlMgr = find_ictlmgr_by_device(device); if (! pIctlMgr) { - uifw_error("ico_device_input_event: Leave(Unknown client(%08x))", (int)client); + uifw_error("ico_device_input_event: Leave(Unknown device(%s))", device); return; } /* find input switch by input Id */ @@ -1389,7 +1478,7 @@ ico_control_unbind(struct wl_resource *resource) * * @param[in] client client(Device Input Controller) * @param[in] data data(unused) - * @param[in] version protocol version(unused) + * @param[in] version protocol version * @param[in] id client object id * @return none */ @@ -1593,6 +1682,7 @@ find_ictlmgr_by_device(const char *device) struct ico_ictl_mgr *pIctlMgr; wl_list_for_each (pIctlMgr, &pInputMgr->ictl_list, link) { + uifw_debug("find_ictlmgr_by_device: <%s> vs <%s>", device, pIctlMgr->device); if (strcmp(pIctlMgr->device, device) == 0) { return pIctlMgr; } diff --git a/src/ico_ivi_common.h b/src/ico_ivi_common.h index b5dfabc..b11d45a 100644 --- a/src/ico_ivi_common.h +++ b/src/ico_ivi_common.h @@ -57,8 +57,10 @@ #endif /* Debug flags */ -#define ICO_IVI_DEBUG_SHOW_SURFACE 0x01 /* new surface show on create */ -#define ICO_IVI_DEBUG_SHOW_NODISP 0x02 /* show if display not exist */ +#define ICO_IVI_DEBUG_SHOW_SURFACE 0x0001 /* new surface show on create */ +#define ICO_IVI_DEBUG_SHOW_NODISP 0x0002 /* show if display not exist */ +#define ICO_IVI_DEBUG_SHOW_INPUTLAYER 0x0004 /* show input panel layer */ +#define ICO_IVI_DEBUG_FIXED_ASPECT 0x0100 /* surface fixed aspect rate */ /* Function prototype */ int ico_ivi_get_mynode(void); /* Get my node numner */ diff --git a/src/ico_ivi_shell.c b/src/ico_ivi_shell.c index 735a493..0a74799 100644 --- a/src/ico_ivi_shell.c +++ b/src/ico_ivi_shell.c @@ -197,8 +197,7 @@ struct shell_surface { int32_t saved_x, saved_y; bool saved_position_valid; bool saved_rotation_valid; - char layer_type; /* surface layer type */ - int layer_serial; + char layertype; /* surface layer type */ int unresponsive; struct { @@ -301,12 +300,15 @@ shell_fade_startup(struct desktop_shell *shell); /* shell management table */ static struct desktop_shell *_ico_ivi_shell = NULL; -static int _layer_serial = 0; + /* shell program path for ico-ivi */ static char *shell_exe = NULL; #define DEFAULT_DEBUG_LEVEL 4 static int ico_debug_level = DEFAULT_DEBUG_LEVEL; /* Debug Level */ +/* default display */ +static struct weston_output *default_inputpanel = NULL; + /* debug log macros */ #define uifw_debug(fmt,...) \ { if (ico_debug_level >= 5) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } @@ -322,7 +324,8 @@ static int ico_debug_level = DEFAULT_DEBUG_LEVEL; /* Debug Level /* hook functions */ static void (*shell_hook_bind)(struct wl_client *client, void *shell) = NULL; static void (*shell_hook_unbind)(struct wl_client *client) = NULL; -static void (*shell_hook_create)(struct wl_client *client, struct wl_resource *resource, +static void (*shell_hook_create)(int layertype, + struct wl_client *client, struct wl_resource *resource, struct weston_surface *surface, struct shell_surface *shsurf) = NULL; static void (*shell_hook_destroy)(struct weston_surface *surface) = NULL; @@ -332,15 +335,22 @@ static void (*shell_hook_configure)(struct weston_surface *surface) = NULL; static void (*shell_hook_select)(struct weston_surface *surface) = NULL; static void (*shell_hook_title)(struct weston_surface *surface, const char *title) = NULL; static void (*shell_hook_move)(struct weston_surface *surface, int *dx, int *dy) = NULL; +static void (*shell_hook_show_layer)(int layertype, int show, void *data) = NULL; +static int (*shell_hook_fullscreen)(int event, struct weston_surface *surface) = NULL; static bool shell_surface_is_top_fullscreen(struct shell_surface *shsurf) { + if (shell_hook_fullscreen) { + return (*shell_hook_fullscreen)(SHELL_FULLSCREEN_ISTOP, shsurf->surface); + } + struct desktop_shell *shell; struct weston_surface *top_fs_es; shell = shell_surface_get_shell(shsurf); + uifw_debug("shell_surface_is_top_fullscreen: "); if (wl_list_empty(&shell->fullscreen_layer.surface_list)) return false; @@ -501,7 +511,7 @@ shell_configuration(struct desktop_shell *shell) weston_log("ws=%d exe=%s\n", shell->workspaces.num, shell_exe); /* get debug level for ivi debug */ - section = weston_config_get_section(shell->compositor->config, "ivi-debug", NULL, NULL); + section = weston_config_get_section(shell->compositor->config, "ivi-option", NULL, NULL); if (section) { weston_config_section_get_int(section, "log", &ico_debug_level, DEFAULT_DEBUG_LEVEL); @@ -1685,6 +1695,10 @@ shell_surface_set_class(struct wl_client *client, static struct weston_output * get_default_output(struct weston_compositor *compositor) { + /* support multi display, default fullscreen output display */ + if (default_inputpanel) { + return default_inputpanel; + } return container_of(compositor->output_list.next, struct weston_output, link); } @@ -1712,6 +1726,9 @@ static void shell_unset_fullscreen(struct shell_surface *shsurf) { struct workspace *ws; + + uifw_debug("shell_unset_fullscreen: "); + /* undo all fullscreen things here */ if (shsurf->fullscreen.type == WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER && shell_surface_is_top_fullscreen(shsurf)) { @@ -1742,6 +1759,9 @@ static void shell_unset_maximized(struct shell_surface *shsurf) { struct workspace *ws; + + uifw_debug("shell_unset_maximized: "); + /* undo all maximized things here */ shsurf->output = get_default_output(shsurf->surface->compositor); weston_surface_set_position(shsurf->surface, @@ -1813,6 +1833,12 @@ set_surface_type(struct shell_surface *shsurf) weston_surface_geometry_dirty(shsurf->surface); shsurf->saved_rotation_valid = true; } + if (shsurf->type == SHELL_SURFACE_FULLSCREEN) { + uifw_debug("set_surface_type: set fullscreen"); + if (shell_hook_fullscreen) { + (*shell_hook_fullscreen)(SHELL_FULLSCREEN_SET, surface); + } + } break; case SHELL_SURFACE_XWAYLAND: @@ -1907,9 +1933,9 @@ shell_surface_set_maximized(struct wl_client *client, shsurf->output = wl_resource_get_user_data(output_resource); else if (es->output) shsurf->output = es->output; - else + else { shsurf->output = get_default_output(es->compositor); - + } shell = shell_surface_get_shell(shsurf); panel_height = get_output_panel_height(shell, shsurf->output); edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT; @@ -1934,6 +1960,7 @@ create_black_surface(struct weston_compositor *ec, { struct weston_surface *surface = NULL; + uifw_debug("create_black_surface: fullscreen"); surface = weston_surface_create(ec); if (surface == NULL) { weston_log("no memory\n"); @@ -1959,6 +1986,13 @@ create_black_surface(struct weston_compositor *ec, static void shell_configure_fullscreen(struct shell_surface *shsurf) { + uifw_debug("shell_configure_fullscreen: "); + + if (shell_hook_fullscreen) { + (*shell_hook_fullscreen)(SHELL_FULLSCREEN_CONF, shsurf->surface); + return; + } + struct weston_output *output = shsurf->fullscreen_output; struct weston_surface *surface = shsurf->surface; struct weston_matrix *matrix; @@ -2059,6 +2093,13 @@ shell_configure_fullscreen(struct shell_surface *shsurf) static void shell_stack_fullscreen(struct shell_surface *shsurf) { + uifw_debug("shell_stack_fullscreen: "); + + if (shell_hook_fullscreen) { + (*shell_hook_fullscreen)(SHELL_FULLSCREEN_STACK, shsurf->surface); + return; + } + struct weston_output *output = shsurf->fullscreen_output; struct weston_surface *surface = shsurf->surface; struct desktop_shell *shell = shell_surface_get_shell(shsurf); @@ -2085,6 +2126,7 @@ shell_stack_fullscreen(struct shell_surface *shsurf) static void shell_map_fullscreen(struct shell_surface *shsurf) { + uifw_debug("shell_map_fullscreen: "); shell_stack_fullscreen(shsurf); shell_configure_fullscreen(shsurf); } @@ -2097,20 +2139,20 @@ set_fullscreen(struct shell_surface *shsurf, { struct weston_surface *es = shsurf->surface; + uifw_debug("set_fullscreen: "); + if (output) shsurf->output = output; else if (es->output) shsurf->output = es->output; - else + else { shsurf->output = get_default_output(es->compositor); - + } shsurf->fullscreen_output = shsurf->output; shsurf->fullscreen.type = method; shsurf->fullscreen.framerate = framerate; shsurf->next_type = SHELL_SURFACE_FULLSCREEN; - uifw_debug("set_fullscreen: send %08x 0 w/h=%d/%d", - (int)shsurf->surface, shsurf->output->width, shsurf->output->height); shsurf->client->send_configure(shsurf->surface, 0, shsurf->output->width, shsurf->output->height); @@ -2126,6 +2168,8 @@ shell_surface_set_fullscreen(struct wl_client *client, struct shell_surface *shsurf = wl_resource_get_user_data(resource); struct weston_output *output; + uifw_debug("shell_surface_set_fullscreen: "); + if (output_resource) output = wl_resource_get_user_data(output_resource); else @@ -2514,10 +2558,10 @@ create_shell_surface(void *shell, struct weston_surface *surface, } static void -shell_get_shell_surface(struct wl_client *client, - struct wl_resource *resource, - uint32_t id, - struct wl_resource *surface_resource) +shell_get_shell_surface_layertype(int layertype, struct wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct wl_resource *surface_resource) { struct weston_surface *surface = wl_resource_get_user_data(surface_resource); @@ -2538,7 +2582,7 @@ shell_get_shell_surface(struct wl_client *client, "surface->configure already set"); return; } - + shsurf->layertype = layertype; shsurf->resource = wl_resource_create(client, &wl_shell_surface_interface, 1, id); @@ -2548,10 +2592,20 @@ shell_get_shell_surface(struct wl_client *client, /* if ico_window_mgr hook, call hook routine */ if (shell_hook_create) { - (*shell_hook_create)(client, resource, surface, shsurf); + (*shell_hook_create)(layertype, client, resource, surface, shsurf); } } +static void +shell_get_shell_surface(struct wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct wl_resource *surface_resource) +{ + shell_get_shell_surface_layertype(LAYER_TYPE_PANEL, + client, resource, id, surface_resource); +} + static const struct wl_shell_interface shell_implementation = { shell_get_shell_surface }; @@ -2781,7 +2835,8 @@ resume_desktop(struct desktop_shell *shell) &shell->fullscreen_layer.link); wl_list_insert(&shell->fullscreen_layer.link, &shell->panel_layer.link); - if (shell->showing_input_panels) { + if ((! shell_hook_configure) && + (shell->showing_input_panels)) { wl_list_insert(&shell->panel_layer.link, &shell->input_panel_layer.link); wl_list_insert(&shell->input_panel_layer.link, @@ -3157,6 +3212,11 @@ rotate_binding(struct weston_seat *seat, uint32_t time, uint32_t button, static void lower_fullscreen_layer(struct desktop_shell *shell) { + if (shell_hook_fullscreen) { + (*shell_hook_fullscreen)(SHELL_FULLSCREEN_HIDEALL, NULL); + return; + } + struct workspace *ws; struct weston_surface *surface, *prev; @@ -3232,10 +3292,19 @@ click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t butt struct weston_surface *focus; struct weston_surface *main_surface; - focus = (struct weston_surface *) seat->pointer->focus; - if (!focus) + uifw_debug("click_to_activate_binding: mouse=%08x(%08x) touch=%08x(%08x)", + (int)seat->pointer, seat->pointer ? (int)seat->pointer->focus : 0, + (int)seat->touch, seat->touch ? (int)seat->touch->focus : 0); + if (seat->pointer == NULL) { + uifw_debug("click_to_activate_binding: system has no mouse, Skip"); return; + } + focus = (struct weston_surface *) seat->pointer->focus; + if (!focus) { + uifw_debug("click_to_activate_binding: no focus, Skip"); + return; + } if (is_black_surface(focus, &main_surface)) focus = main_surface; @@ -3253,6 +3322,44 @@ click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t butt } static void +touch_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button, + void *data) +{ + struct weston_seat *ws = (struct weston_seat *) seat; + struct desktop_shell *shell = data; + struct weston_surface *focus; + struct weston_surface *main_surface; + + uifw_debug("touch_to_activate_binding: mouse=%08x(%08x) touch=%08x(%08x)", + (int)seat->pointer, seat->pointer ? (int)seat->pointer->focus : 0, + (int)seat->touch, seat->touch ? (int)seat->touch->focus : 0); + if (seat->touch == NULL) { + uifw_debug("touch_to_activate_binding: system has no touch panel, Skip"); + return; + } + + focus = (struct weston_surface *) seat->touch->focus; + if (!focus) { + uifw_debug("touch_to_activate_binding: no focus, Skip"); + return; + } + if (is_black_surface(focus, &main_surface)) + focus = main_surface; + + main_surface = weston_surface_get_main_surface(focus); + if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE) + return; + + if (seat->touch->grab == &seat->touch->default_grab) + activate(shell, focus, ws); + + /* if ico_window_mgr hook, call hook routine */ + if (shell_hook_select) { + (*shell_hook_select)(focus); + } +} + +static void lock(struct desktop_shell *shell) { struct workspace *ws = get_current_workspace(shell); @@ -3270,7 +3377,8 @@ lock(struct desktop_shell *shell) wl_list_remove(&shell->panel_layer.link); wl_list_remove(&shell->fullscreen_layer.link); - if (shell->showing_input_panels) + if ((! shell_hook_configure) && + (shell->showing_input_panels)) wl_list_remove(&shell->input_panel_layer.link); wl_list_remove(&ws->layer.link); wl_list_insert(&shell->compositor->cursor_layer.link, @@ -3474,8 +3582,15 @@ show_input_panels(struct wl_listener *listener, void *data) if (shell->showing_input_panels) return; + uifw_debug("show_input_panels: input.surface=%08x", (int)shell->text_input.surface); + shell->showing_input_panels = true; + /* if ico_window_mgr hook, call hook routine */ + if (shell_hook_show_layer) { + (*shell_hook_show_layer)(LAYER_TYPE_INPUTPANEL, 1, data); + return; + } if (!shell->locked) wl_list_insert(&shell->panel_layer.link, &shell->input_panel_layer.link); @@ -3485,8 +3600,10 @@ show_input_panels(struct wl_listener *listener, void *data) ws = surface->surface; if (!ws->buffer_ref.buffer) continue; - wl_list_insert(&shell->input_panel_layer.surface_list, - &ws->layer_link); + if (! shell_hook_configure) { + wl_list_insert(&shell->input_panel_layer.surface_list, + &ws->layer_link); + } weston_surface_geometry_dirty(ws); weston_surface_update_transform(ws); weston_surface_damage(ws); @@ -3505,8 +3622,16 @@ hide_input_panels(struct wl_listener *listener, void *data) if (!shell->showing_input_panels) return; + uifw_debug("hide_input_panels: input.surface=%08x", (int)shell->text_input.surface); + shell->showing_input_panels = false; + /* if ico_window_mgr hook, call hook routine */ + if (shell_hook_show_layer) { + (*shell_hook_show_layer)(LAYER_TYPE_INPUTPANEL, 0, NULL); + return; + } + if (!shell->locked) wl_list_remove(&shell->input_panel_layer.link); @@ -3575,6 +3700,7 @@ weston_surface_set_initial_position (struct weston_surface *surface, if (!target_output) { weston_surface_set_position(surface, 10 + random() % 400, 10 + random() % 400); + uifw_debug("weston_surface_set_initial_position: no tagret"); return; } @@ -3584,19 +3710,20 @@ weston_surface_set_initial_position (struct weston_surface *surface, */ panel_height = get_output_panel_height(shell, target_output); range_x = target_output->width - surface->geometry.width; - range_y = (target_output->height - panel_height) - - surface->geometry.height; + range_y = target_output->height - surface->geometry.height; - if (range_x > 0) + if (range_x > 0) { dx = random() % range_x; - else + } + else { dx = 0; - - if (range_y > 0) + } + if (range_y > 0) { dy = panel_height + random() % range_y; - else + } + else { dy = panel_height; - + } x = target_output->x + dx; y = target_output->y + dy; @@ -3616,21 +3743,27 @@ map(struct desktop_shell *shell, struct weston_surface *surface, int panel_height = 0; int32_t surf_x, surf_y; - uifw_trace("map: %08x sx/sy=%d/%d w/h=%d/%d", (int)surface, sx, sy, width, height); + uifw_trace("map: %08x sx/sy=%d/%d w/h=%d/%d type=%d", + (int)surface, sx, sy, width, height, (int)surface_type); + surface->geometry.width = width; surface->geometry.height = height; weston_surface_geometry_dirty(surface); /* initial positioning, see also configure() */ + switch (surface_type) { case SHELL_SURFACE_TOPLEVEL: + uifw_debug("map: surface TOPLEVEL"); weston_surface_set_initial_position(surface, shell); break; case SHELL_SURFACE_FULLSCREEN: + uifw_debug("map: surface FULLSCREEN"); center_on_output(surface, shsurf->fullscreen_output); shell_map_fullscreen(shsurf); break; case SHELL_SURFACE_MAXIMIZED: + uifw_debug("map: surface MAXIMIZED"); /* use surface configure to set the geometry */ panel_height = get_output_panel_height(shell,surface->output); surface_subsurfaces_boundingbox(shsurf->surface, &surf_x, &surf_y, @@ -3639,14 +3772,22 @@ map(struct desktop_shell *shell, struct weston_surface *surface, shsurf->output->y + panel_height - surf_y); break; case SHELL_SURFACE_POPUP: + uifw_debug("map: surface POPUP"); shell_map_popup(shsurf); break; case SHELL_SURFACE_NONE: - weston_surface_set_position(surface, - surface->geometry.x + sx, - surface->geometry.y + sy); + uifw_debug("map: surface NONE"); + if (shsurf->layertype == LAYER_TYPE_INPUTPANEL) { + weston_surface_set_initial_position(surface, shell); + } + else { + weston_surface_set_position(surface, + surface->geometry.x + sx, + surface->geometry.y + sy); + } break; default: + uifw_debug("map: surface unknown type(%d)", surface_type); ; } @@ -3708,6 +3849,8 @@ map(struct desktop_shell *shell, struct weston_surface *surface, /* if ico_window_mgr hook, call hook routine */ if (shell_hook_map) { + sx = surface->geometry.x; + sy = surface->geometry.y; (*shell_hook_map)(surface, &width, &height, &sx, &sy); } if (shell_hook_configure) { @@ -4002,24 +4145,27 @@ input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy, in float x, y; uint32_t show_surface = 0; - if (width == 0) + if (width == 0) { + uifw_debug("input_panel_configure: configure %08x width=0, Skip", (int)surface); return; - + } if (!weston_surface_is_mapped(surface)) { - if (!shell->showing_input_panels) + if (!shell->showing_input_panels) { + uifw_debug("input_panel_configure: configure %08x not show, Skip", (int)surface); return; - + } show_surface = 1; } - fprintf(stderr, "%s panel: %d, output: %p\n", __FUNCTION__, ip_surface->panel, ip_surface->output); - if (ip_surface->panel) { x = shell->text_input.surface->geometry.x + shell->text_input.cursor_rectangle.x2; y = shell->text_input.surface->geometry.y + shell->text_input.cursor_rectangle.y2; } else { x = ip_surface->output->x + (ip_surface->output->width - width) / 2; y = ip_surface->output->y + ip_surface->output->height - height; + if (! shell_hook_map) { + y -= 132.0f; + } } uifw_debug("input_panel_configure: configure %08x x/y=%d/%d w/h=%d/%d", @@ -4029,17 +4175,38 @@ input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy, in width, height); if (show_surface) { - wl_list_insert(&shell->input_panel_layer.surface_list, - &surface->layer_link); + /* if ico_window_mgr hook, call hook routine */ + if (! shell_hook_configure) { + wl_list_insert(&shell->input_panel_layer.surface_list, + &surface->layer_link); + } weston_surface_update_transform(surface); weston_surface_damage(surface); weston_slide_run(surface, surface->geometry.height, 0, NULL, NULL); } + + /* if ico_window_mgr hook, call hook routine */ + /* set default color and shader because weston original bug(some time crash weston) */ + weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1); + if (shell_hook_map) { + int wx, wy; + wx = (int)x; + wy = (int)y; + (*shell_hook_map)(surface, &width, &height, &wx, &wy); + } + if (shell_hook_configure) { + (*shell_hook_configure)(surface); + } } static void destroy_input_panel_surface(struct input_panel_surface *input_panel_surface) { + uifw_debug("destroy_input_panel_surface: "); + if (shell_hook_create) { + return; + } + wl_signal_emit(&input_panel_surface->destroy_signal, input_panel_surface); wl_list_remove(&input_panel_surface->surface_destroy_listener.link); @@ -4063,6 +4230,11 @@ get_input_panel_surface(struct weston_surface *surface) static void input_panel_handle_surface_destroy(struct wl_listener *listener, void *data) { + uifw_debug("input_panel_handle_surface_destroy: "); + if (shell_hook_create) { + return; + } + struct input_panel_surface *ipsurface = container_of(listener, struct input_panel_surface, surface_destroy_listener); @@ -4078,6 +4250,11 @@ static struct input_panel_surface * create_input_panel_surface(struct desktop_shell *shell, struct weston_surface *surface) { + uifw_debug("create_input_panel_surface: "); + if (shell_hook_create) { + return NULL; + } + struct input_panel_surface *input_panel_surface; input_panel_surface = calloc(1, sizeof *input_panel_surface); @@ -4107,6 +4284,11 @@ input_panel_surface_set_toplevel(struct wl_client *client, struct wl_resource *output_resource, uint32_t position) { + uifw_debug("input_panel_surface_set_toplevel: "); + if (shell_hook_create) { + return; + } + struct input_panel_surface *input_panel_surface = wl_resource_get_user_data(resource); struct desktop_shell *shell = input_panel_surface->shell; @@ -4122,6 +4304,11 @@ static void input_panel_surface_set_overlay_panel(struct wl_client *client, struct wl_resource *resource) { + uifw_debug("input_panel_surface_set_overlay_panel: "); + if (shell_hook_create) { + return; + } + struct input_panel_surface *input_panel_surface = wl_resource_get_user_data(resource); struct desktop_shell *shell = input_panel_surface->shell; @@ -4152,33 +4339,43 @@ input_panel_get_input_panel_surface(struct wl_client *client, uint32_t id, struct wl_resource *surface_resource) { - struct weston_surface *surface = - wl_resource_get_user_data(surface_resource); - struct desktop_shell *shell = wl_resource_get_user_data(resource); - struct input_panel_surface *ipsurf; + if (shell_hook_create) { + uifw_debug("input_panel_get_input_panel_surface: weston_surface=%08x", + (int)wl_resource_get_user_data(surface_resource)); - if (get_input_panel_surface(surface)) { - wl_resource_post_error(surface_resource, - WL_DISPLAY_ERROR_INVALID_OBJECT, - "wl_input_panel::get_input_panel_surface already requested"); - return; + shell_get_shell_surface_layertype(LAYER_TYPE_INPUTPANEL, + client, resource, id, surface_resource); } + else { + struct weston_surface *surface = + wl_resource_get_user_data(surface_resource); + struct desktop_shell *shell = wl_resource_get_user_data(resource); + struct input_panel_surface *ipsurf; + + if (get_input_panel_surface(surface)) { + wl_resource_post_error(surface_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "wl_input_panel::get_input_panel_surface already requested"); + return; + } - ipsurf = create_input_panel_surface(shell, surface); - if (!ipsurf) { - wl_resource_post_error(surface_resource, - WL_DISPLAY_ERROR_INVALID_OBJECT, - "surface->configure already set"); - return; - } + ipsurf = create_input_panel_surface(shell, surface); + if (!ipsurf) { + wl_resource_post_error(surface_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "surface->configure already set"); + return; + } + uifw_debug("input_panel_get_input_panel_surface: weston_surface=%08x", (int)surface); - ipsurf->resource = - wl_resource_create(client, - &wl_input_panel_surface_interface, 1, id); - wl_resource_set_implementation(ipsurf->resource, - &input_panel_surface_implementation, - ipsurf, - destroy_input_panel_surface_resource); + ipsurf->resource = + wl_resource_create(client, + &wl_input_panel_surface_interface, 1, id); + wl_resource_set_implementation(ipsurf->resource, + &input_panel_surface_implementation, + ipsurf, + destroy_input_panel_surface_resource); + } } static const struct wl_input_panel_interface input_panel_implementation = { @@ -4645,6 +4842,9 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) weston_compositor_add_button_binding(ec, BTN_LEFT, 0, click_to_activate_binding, shell); + weston_compositor_add_button_binding(ec, BTN_TOUCH, 0, + touch_to_activate_binding, + shell); weston_compositor_add_axis_binding(ec, WL_POINTER_AXIS_VERTICAL_SCROLL, MODIFIER_SUPER | MODIFIER_ALT, surface_opacity_binding, NULL); @@ -4908,86 +5108,46 @@ ico_ivi_shell_startup(void *shell) /*--------------------------------------------------------------------------*/ /** - * @brief ico_ivi_shell_set_layertype: set layer type + * @brief ico_ivi_shell_layertype: get layer type * - * @param none - * @return none + * @param[in] surface weston surface + * @return layer type */ /*--------------------------------------------------------------------------*/ -WL_EXPORT void -ico_ivi_shell_set_layertype(void) +WL_EXPORT int +ico_ivi_shell_layertype(struct weston_surface *surface) { - struct weston_surface *es; - - _layer_serial ++; - wl_list_for_each(es, &_ico_ivi_shell->panel_layer.surface_list, layer_link) { - if (es->configure == shell_surface_configure) { - ((struct shell_surface *)es->configure_private)->layer_type - = LAYER_TYPE_PANEL; - ((struct shell_surface *)es->configure_private)->layer_serial = _layer_serial; - } - } - wl_list_for_each(es, &_ico_ivi_shell->fullscreen_layer.surface_list, layer_link) { - if (es->configure == shell_surface_configure) { - ((struct shell_surface *)es->configure_private)->layer_type - = LAYER_TYPE_FULLSCREEN; - ((struct shell_surface *)es->configure_private)->layer_serial = _layer_serial; - } - } - wl_list_for_each(es, &_ico_ivi_shell->background_layer.surface_list, layer_link) { - if (es->configure == shell_surface_configure) { - ((struct shell_surface *)es->configure_private)->layer_type - = LAYER_TYPE_BACKGROUND; - ((struct shell_surface *)es->configure_private)->layer_serial = _layer_serial; - } - } - wl_list_for_each(es, &_ico_ivi_shell->compositor->cursor_layer.link, layer_link) { - if (es->configure == shell_surface_configure) { - ((struct shell_surface *)es->configure_private)->layer_type - = LAYER_TYPE_CURSOR; - ((struct shell_surface *)es->configure_private)->layer_serial = _layer_serial; - } - } - wl_list_for_each(es, &_ico_ivi_shell->compositor->fade_layer.link, layer_link) { - if (es->configure == shell_surface_configure) { - ((struct shell_surface *)es->configure_private)->layer_type - = LAYER_TYPE_FADE; - ((struct shell_surface *)es->configure_private)->layer_serial = _layer_serial; - } - } - wl_list_for_each(es, &_ico_ivi_shell->lock_layer.surface_list, layer_link) { - if (es->configure == shell_surface_configure) { - ((struct shell_surface *)es->configure_private)->layer_type - = LAYER_TYPE_LOCK; - ((struct shell_surface *)es->configure_private)->layer_serial = _layer_serial; - } - } - wl_list_for_each(es, &_ico_ivi_shell->input_panel_layer.surface_list, layer_link) { - if (es->configure == shell_surface_configure) { - ((struct shell_surface *)es->configure_private)->layer_type - = LAYER_TYPE_INPUTPANEL; - ((struct shell_surface *)es->configure_private)->layer_serial = _layer_serial; - } + if (surface->configure == shell_surface_configure) { + return ((struct shell_surface *)surface->configure_private)->layertype; } + return LAYER_TYPE_UNKNOWN; } /*--------------------------------------------------------------------------*/ /** - * @brief ico_ivi_shell_layertype: get layer type + * @brief ivi_shell_set_surface_initial_position: initialize surface position * * @param[in] surface weston surface - * @return layer type + * @return none */ /*--------------------------------------------------------------------------*/ -WL_EXPORT int -ico_ivi_shell_layertype(struct weston_surface *surface) +WL_EXPORT void +ivi_shell_set_surface_initial_position(struct weston_surface *surface) { - if ((surface->configure == shell_surface_configure) && - (((struct shell_surface *)surface->configure_private)->layer_serial - == _layer_serial)) { - return ((struct shell_surface *)surface->configure_private)->layer_type; - } - return LAYER_TYPE_UNKNOWN; + weston_surface_set_initial_position (surface, _ico_ivi_shell); +} +/*--------------------------------------------------------------------------*/ +/** + * @brief ivi_shell_set_default_display: set default display + * + * @param[in] inputpanel default display of input panel surface + * @return none + */ +/*--------------------------------------------------------------------------*/ +WL_EXPORT void +ivi_shell_set_default_display(struct weston_output *inputpanel) +{ + default_inputpanel = inputpanel; } /*--------------------------------------------------------------------------*/ @@ -5027,7 +5187,8 @@ ico_ivi_shell_hook_unbind(void (*hook_unbind)(struct wl_client *client)) */ /*--------------------------------------------------------------------------*/ WL_EXPORT void -ico_ivi_shell_hook_create(void (*hook_create)(struct wl_client *client, +ico_ivi_shell_hook_create(void (*hook_create)(int layertype, + struct wl_client *client, struct wl_resource *resource, struct weston_surface *surface, struct shell_surface *shsurf)) @@ -5124,3 +5285,32 @@ ico_ivi_shell_hook_move(void (*hook_move)(struct weston_surface *surface, int *d shell_hook_move = hook_move; } +/*--------------------------------------------------------------------------*/ +/** + * @brief ico_ivi_shell_hook_show_layer: layer visible control + * + * @param[in] hook_show hook function(if NULL, reset hook function) + * @return none + */ +/*--------------------------------------------------------------------------*/ +WL_EXPORT void +ico_ivi_shell_hook_show_layer(void (*hook_show)(int layertype, int show, void *data)) +{ + shell_hook_show_layer = hook_show; +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief ico_ivi_shell_hook_fullscreen: fullscreen surface control + * + * @param[in] hook_fullscreen hook function(if NULL, reset hook function) + * @return none + */ +/*--------------------------------------------------------------------------*/ +WL_EXPORT void +ico_ivi_shell_hook_fullscreen(int (*hook_fullscreen) + (int event, struct weston_surface *surface)) +{ + shell_hook_fullscreen = hook_fullscreen; +} + diff --git a/src/ico_ivi_shell.h b/src/ico_ivi_shell.h index c2be398..5211ec5 100644 --- a/src/ico_ivi_shell.h +++ b/src/ico_ivi_shell.h @@ -30,6 +30,8 @@ #ifndef _ICO_IVI_SHELL_H_ #define _ICO_IVI_SHELL_H_ +#include "ico_window_mgr-server-protocol.h" + struct shell_surface; /* surface type */ @@ -45,13 +47,23 @@ enum shell_surface_type { /* weston layer type */ #define LAYER_TYPE_UNKNOWN 0 -#define LAYER_TYPE_LOCK 1 -#define LAYER_TYPE_BACKGROUND 2 -#define LAYER_TYPE_PANEL 3 -#define LAYER_TYPE_FULLSCREEN 4 -#define LAYER_TYPE_INPUTPANEL 5 -#define LAYER_TYPE_CURSOR 6 -#define LAYER_TYPE_FADE 7 +#define LAYER_TYPE_BACKGROUND (ICO_WINDOW_MGR_LAYERTYPE_BACKGROUND >> 12) +#define LAYER_TYPE_PANEL (ICO_WINDOW_MGR_LAYERTYPE_NORMAL >> 12) +#define LAYER_TYPE_FULLSCREEN (ICO_WINDOW_MGR_LAYERTYPE_FULLSCREEN >> 12) +#define LAYER_TYPE_INPUTPANEL (ICO_WINDOW_MGR_LAYERTYPE_INPUTPANEL >> 12) +#define LAYER_TYPE_TOUCH (ICO_WINDOW_MGR_LAYERTYPE_TOUCH >> 12) +#define LAYER_TYPE_CURSOR (ICO_WINDOW_MGR_LAYERTYPE_CURSOR >> 12) +#define LAYER_TYPE_LOCK 0xe +#define LAYER_TYPE_FADE 0xf + +/* fullscreen surface control */ +enum shell_fullscreen_control { + SHELL_FULLSCREEN_ISTOP, + SHELL_FULLSCREEN_SET, + SHELL_FULLSCREEN_STACK, + SHELL_FULLSCREEN_CONF, + SHELL_FULLSCREEN_HIDEALL +}; /* Prototype for get/set function */ struct weston_layer *ico_ivi_shell_weston_layer(void); @@ -61,13 +73,14 @@ void ico_ivi_shell_set_surface_type(struct shell_surface *shsurf); void ico_ivi_shell_send_configure(struct weston_surface *surface, const uint32_t edges, const int width, const int height); void ico_ivi_shell_startup(void *shell); -void ico_ivi_shell_set_layertype(void); int ico_ivi_shell_layertype(struct weston_surface *surface); +void ivi_shell_set_surface_initial_position(struct weston_surface *surface); +void ivi_shell_set_default_display(struct weston_output *inputpanel); /* Prototypr for hook routine */ void ico_ivi_shell_hook_bind(void (*hook_bind)(struct wl_client *client, void *shell)); void ico_ivi_shell_hook_unbind(void (*hook_unbind)(struct wl_client *client)); -void ico_ivi_shell_hook_create(void (*hook_create)(struct wl_client *client, +void ico_ivi_shell_hook_create(void (*hook_create)(int layertype, struct wl_client *client, struct wl_resource *resource, struct weston_surface *surface, struct shell_surface *shsurf)); void ico_ivi_shell_hook_destroy(void (*hook_destroy)(struct weston_surface *surface)); @@ -79,6 +92,9 @@ void ico_ivi_shell_hook_title(void (*hook_title)(struct weston_surface *surface, const char *title)); void ico_ivi_shell_hook_move(void (*hook_move)(struct weston_surface *surface, int *dx, int *dy)); +void ico_ivi_shell_hook_show_layer(void (*hook_show)(int layertype, int show, void *data)); +void ico_ivi_shell_hook_fullscreen(int (*hook_fullscreen) + (int event, struct weston_surface *surface)); #endif /*_ICO_IVI_SHELL_H_*/ diff --git a/src/ico_plugin_loader.c b/src/ico_plugin_loader.c index e9ce14f..404b5f5 100644 --- a/src/ico_plugin_loader.c +++ b/src/ico_plugin_loader.c @@ -156,7 +156,7 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) uifw_info("ico_plugin_loader: Enter(module_init)"); /* get ivi debug level */ - section = weston_config_get_section(ec->config, "ivi-debug", NULL, NULL); + section = weston_config_get_section(ec->config, "ivi-option", NULL, NULL); if (section) { weston_config_section_get_int(section, "log", &debug_level, 3); } diff --git a/src/ico_window_animation.c b/src/ico_window_animation.c index 5db60eb..0be76d8 100644 --- a/src/ico_window_animation.c +++ b/src/ico_window_animation.c @@ -454,7 +454,7 @@ animation_end(struct uifw_win_surface *usurf, const int disp) weston_surface_damage(usurf->surface); } weston_surface_geometry_dirty(usurf->surface); - ico_window_mgr_restack_layer(usurf, 0); + ico_window_mgr_restack_layer(usurf); } usurf->animation.visible = ANIMA_NOCONTROL_AT_END; if (usurf->animation.next_anima != ICO_WINDOW_MGR_ANIMATION_NONE) { @@ -485,7 +485,7 @@ animation_end(struct uifw_win_surface *usurf, const int disp) } usurf->animation.type = ICO_WINDOW_MGR_ANIMATION_OPNONE; if (! disp) { - ico_window_mgr_restack_layer(usurf, 0); + ico_window_mgr_restack_layer(usurf); } } @@ -944,6 +944,7 @@ animation_fade(struct weston_animation *animation, usurf->width, usurf->height); ico_window_mgr_change_surface(usurf, usurf->animation.no_configure ? -1 : 0, 1); + ico_window_mgr_restack_layer(usurf); } } else { @@ -954,8 +955,8 @@ animation_fade(struct weston_animation *animation, else if (es->alpha > 1.0) es->alpha = 1.0; uifw_debug("animation_fade: %08x count=%d %d%% alpha=%1.2f anima=%d state=%d", - usurf->surfaceid, animation->frame_counter, par, es->alpha, - usurf->animation.anima, usurf->animation.state); + usurf->surfaceid, animation->frame_counter, par, + es->alpha, usurf->animation.anima, usurf->animation.state); if ((es->output) && (es->buffer_ref.buffer) && (es->geometry.width > 0) && (es->geometry.height > 0)) { diff --git a/src/ico_window_mgr.c b/src/ico_window_mgr.c index 6ff4db3..be7ddbc 100644 --- a/src/ico_window_mgr.c +++ b/src/ico_window_mgr.c @@ -42,21 +42,36 @@ #include #include #include +#include #include +#include #include #include #include +#include #include #include +#include + +/* inport Mesa version */ +#if EGL_EGLEXT_VERSION >= 16 +#define MESA_VERSION 921 +#else +#define MESA_VERSION 913 +#endif #include +#if MESA_VERSION >= 921 +#include +#endif #include "ico_ivi_common.h" #include "ico_ivi_shell.h" #include "ico_window_mgr.h" #include "desktop-shell-server-protocol.h" #include "ico_window_mgr-server-protocol.h" + /* SurfaceID */ #define INIT_SURFACE_IDS 1024 /* SurfaceId table initiale size */ #define ADD_SURFACE_IDS 512 /* SurfaceId table additional size */ @@ -75,7 +90,8 @@ struct uifw_wl_buffer { /* struct wl_buffer */ uint32_t busy_count; }; -/* wl_drm_buffer (inport from mesa-9.1.3/src/egl/wayland/wayland-drm/wayland-drm.h) */ +/* wl_drm_buffer (inport from mesa-9.1.3 & mesa-9.2.1/ */ +/* src/egl/wayland/wayland-drm/wayland-drm.h) */ struct uifw_drm_buffer { struct uifw_wl_buffer buffer; void *drm; /* struct wl_drm */ @@ -86,7 +102,21 @@ struct uifw_drm_buffer { void *driver_buffer; }; -/* __DRIimage (inport from mesa-9.1.3/src/mesa/drivers/dri/intel/intel_regions.h) */ +/* __DRIimage (inport from mesa-9.1.3/src/mesa/drivers/dri/intel/intel_regions.h */ +/* mesa-9.2.1/src/mesa/drivers/dri/i915/intel_regions.h */ +/* mesa-9.2.1/src/mesa/drivers/dri/i965/intel_regions.h) */ +#if MESA_VERSION >= 920 +struct uifw_intel_region { /* struct intel_region for mesa 9.2.1 */ + void *bo; /**< buffer manager's buffer */ + uint32_t refcount; /**< Reference count for region */ + uint32_t cpp; /**< bytes per pixel */ + uint32_t width; /**< in pixels */ + uint32_t height; /**< in pixels */ + uint32_t pitch; /**< in bytes */ + uint32_t tiling; /**< Which tiling mode the region is in */ + uint32_t name; /**< Global name for the bo */ +}; +#else /*MESA_VERSION < 920*/ struct uifw_intel_region { /* struct intel_region */ void *bo; /**< buffer manager's buffer */ uint32_t refcount; /**< Reference count for region */ @@ -100,6 +130,8 @@ struct uifw_intel_region { /* struct intel_region */ uint32_t name; /**< Global name for the bo */ void *screen; /* screen */ }; +#endif /*MESA_VERSION*/ + struct uifw_dri_image { /* struct __DRIimageRec */ struct uifw_intel_region *region; int internal_format; @@ -109,6 +141,13 @@ struct uifw_dri_image { /* struct __DRIimageRec */ uint32_t strides[3]; uint32_t offsets[3]; void *planar_format; /* intel_image_format */ +#if MESA_VERSION >= 920 + uint32_t width; + uint32_t height; + uint32_t tile_x; + uint32_t tile_y; + bool has_depthstencil; /* i965 only */ +#endif /*MESA_VERSION*/ void *data; }; @@ -146,13 +185,18 @@ struct ico_win_mgr { struct wl_list client_list; /* Clients */ struct wl_list manager_list; /* Manager(ex.HomeScreen) list */ int num_manager; /* Number of managers */ + struct wl_list ivi_layer_list; /* Layer management table list */ - struct uifw_win_layer *input_layer; /* layer table for input layer */ + struct uifw_win_layer *touch_layer; /* layer table for touch panel layer */ struct uifw_win_layer *cursor_layer; /* layer table for cursor layer */ + struct wl_list map_list; /* surface map list */ struct uifw_surface_map *free_maptable; /* free maped surface table list */ struct weston_animation map_animation[ICO_IVI_MAX_DISPLAY]; /* animation for map check */ + struct wl_event_source *wait_mapevent; /* map event send wait timer */ + int waittime; /* minimaum send wait time(ms) */ + struct uifw_win_surface *active_pointer_usurf; /* Active Pointer Surface */ struct uifw_win_surface *active_keyboard_usurf; /* Active Keyboard Surface */ @@ -164,7 +208,7 @@ struct ico_win_mgr { uint16_t *surfaceid_map; /* SurfaceId assign bit map */ char shell_init; /* shell initialize flag */ - char res; /* (unused) */ + char res[3]; /* (unused) */ }; /* Internal macros */ @@ -185,11 +229,15 @@ static uint32_t generate_id(void); static void win_mgr_bind_client(struct wl_client *client, void *shell); /* unind shell client */ static void win_mgr_unbind_client(struct wl_client *client); +#if 0 /* work around: Walk through child processes until app ID is found */ + /* get parent pid */ +static pid_t win_mgr_get_ppid(pid_t pid); +#endif /* work around: Walk through child processes until app ID is found */ /* get appid from pid */ static void win_mgr_get_client_appid(struct uifw_client *uclient); /* create new surface */ static void win_mgr_register_surface( - struct wl_client *client, struct wl_resource *resource, + int layertype, struct wl_client *client, struct wl_resource *resource, struct weston_surface *surface, struct shell_surface *shsurf); /* surface destroy */ static void win_mgr_destroy_surface(struct weston_surface *surface); @@ -210,14 +258,20 @@ static void win_mgr_select_surface(struct weston_surface *surface); static void win_mgr_set_title(struct weston_surface *surface, const char *title); /* surface move request from shell */ static void win_mgr_surface_move(struct weston_surface *surface, int *dx, int *dy); + /* shell layer visible control */ +static void win_mgr_show_layer(int layertype, int show, void *data); + /* shell full screen surface control */ +static int win_mgr_fullscreen(int event, struct weston_surface *surface); /* set raise */ static void win_mgr_set_raise(struct uifw_win_surface *usurf, const int raise); /* surface change from manager */ static int win_mgr_surface_change_mgr(struct weston_surface *surface, const int x, const int y, const int width, const int height); + /* reset surface focus */ +static void win_mgr_reset_focus(struct uifw_win_surface *usurf); /* create new layer */ static struct uifw_win_layer *win_mgr_create_layer(struct uifw_win_surface *usurf, - const uint32_t layer); + const uint32_t layer, const int layertype); /* set surface layer */ static void win_mgr_set_layer(struct uifw_win_surface *usurf, const uint32_t layer); /* set active surface */ @@ -257,12 +311,15 @@ static void uifw_set_layer_visible(struct wl_client *client, struct wl_resource uint32_t layer, int32_t visible); /* get application surfaces */ static void uifw_get_surfaces(struct wl_client *client, struct wl_resource *resource, - const char *appid); + const char *appid, int32_t pid); /* check and change all mapped surface */ -static void win_mgr_check_surfacemap(struct weston_animation *animation, +static void win_mgr_check_mapsurrace(struct weston_animation *animation, struct weston_output *output, uint32_t msecs); + /* check timer of mapped surface */ +static int win_mgr_timer_mapsurrace(void *data); /* check and change mapped surface */ -static void win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event); +static void win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event, + uint32_t curtime); /* map surface to system application */ static void uifw_map_surface(struct wl_client *client, struct wl_resource *resource, uint32_t surfaceid, int32_t framerate); @@ -306,21 +363,29 @@ static const struct ico_window_mgr_interface ico_window_mgr_implementation = { }; /* plugin common value(without ico_plugin_loader) */ -static int _ico_ivi_debug_flag = 0; /* Debug flags */ -static int _ico_ivi_debug_level = 3; /* Debug Level */ -static char *_ico_ivi_animation_name = NULL; /* Default animation name */ -static int _ico_ivi_animation_time = 500; /* Default animation time */ -static int _ico_ivi_animation_fps = 15; /* Animation frame rate */ -static int _ico_ivi_background_layer = 0; /* Background layer */ -static int _ico_ivi_default_layer = 1; /* Deafult layer id at surface create*/ -static int _ico_ivi_input_layer = 101; /* Input layer id */ -static int _ico_ivi_cursor_layer = 102; /* Cursor layer id */ -static int _ico_ivi_startup_layer = 109; /* Deafult layer id at system startup*/ +static int _ico_ivi_debug_flag = 0; /* debug flags */ +static int _ico_ivi_debug_level = 3; /* debug Level */ +static char *_ico_ivi_animation_name = NULL; /* default animation name */ +static int _ico_ivi_animation_time = 500; /* default animation time */ +static int _ico_ivi_animation_fps = 30; /* animation frame rate */ +static char *_ico_ivi_inputpanel_animation = NULL; /* default animation name for input panel*/ +static int _ico_ivi_inputpanel_anima_time = 0; /* default animation time for input panel*/ + +static int _ico_ivi_inputpanel_display = 0; /* input panel display number */ +static int _ico_ivi_inputdeco_mag = 100; /* input panel magnification rate(%)*/ +static int _ico_ivi_inputdeco_diff = 0; /* input panel difference from the bottom*/ + +static int _ico_ivi_background_layer = 0; /* background layer */ +static int _ico_ivi_default_layer = 1; /* deafult layer id at surface create*/ +static int _ico_ivi_touch_layer = 101; /* touch panel layer id */ +static int _ico_ivi_cursor_layer = 102; /* cursor layer id */ +static int _ico_ivi_startup_layer = 109; /* deafult layer id at system startup*/ /* static management table */ static struct ico_win_mgr *_ico_win_mgr = NULL; static int _ico_num_nodes = 0; static struct uifw_node_table _ico_node_table[ICO_IVI_MAX_DISPLAY]; +static struct weston_seat *touch_check_seat = NULL; /*--------------------------------------------------------------------------*/ @@ -447,11 +512,11 @@ ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, height = buf_height; usurf->height = buf_height; } - if (usurf->width > buf_width) { + if ((usurf->width > buf_width) && (usurf->scalex <= 1.0f)) { width = buf_width; x += (usurf->width - buf_width)/2; } - if (usurf->height > buf_height) { + if ((usurf->height > buf_height) && (usurf->scaley <= 1.0f)) { height = buf_height; y += (usurf->height - buf_height)/2; } @@ -543,8 +608,8 @@ ico_window_mgr_get_usurf_client(const uint32_t surfaceid, struct wl_client *clie uclient = find_client_from_client(client); if (uclient) { if (&uclient->surface_link != uclient->surface_link.next) { - usurf = container_of(uclient->surface_link.next, - struct uifw_win_surface, client_link); + usurf = container_of (uclient->surface_link.next, + struct uifw_win_surface, client_link); } else { usurf = NULL; @@ -779,12 +844,7 @@ win_mgr_bind_client(struct wl_client *client, void *shell) /* get applicationId from AppCore(AUL) */ win_mgr_get_client_appid(uclient); - /* weston internal client, not manage */ - if (strcmp(uclient->appid, "weston") == 0) { - free(uclient); - uifw_trace("win_mgr_bind_client: client=%08x is internal, delete", (int)client); - } - else if (newclient > 0) { + if (newclient > 0) { wl_list_insert(&_ico_win_mgr->client_list, &uclient->link); } } @@ -818,6 +878,50 @@ win_mgr_unbind_client(struct wl_client *client) uifw_trace("win_mgr_unbind_client: Leave"); } +#if 0 /* work around: Walk through child processes until app ID is found */ +/*--------------------------------------------------------------------------*/ +/** + * @brief win_mgr_get_ppid: Get parent process ID. + * + * Similar to getppid(), except that this implementation accepts an + * arbitrary process ID. + * + * @param[in] pid Process ID of child process + * @return parent process ID on success, -1 on failure + */ +/*--------------------------------------------------------------------------*/ +static pid_t +win_mgr_get_ppid(pid_t pid) +{ + pid_t ppid = -1; + char procpath[PATH_MAX] = { 0 }; + + snprintf(procpath, sizeof(procpath)-1, "/proc/%d/status", pid); + + /* We better have read permissions! */ + int const fd = open(procpath, O_RDONLY); + + if (fd < 0) + return ppid; + + char buffer[1024] = { 0 }; + + ssize_t const size = read(fd, buffer, sizeof(buffer)); + close(fd); + + if (size <= 0) + return ppid; + + /* Find line containing the parent process ID. */ + char const * const ppid_line = strstr(buffer, "PPid"); + + if (ppid_line != NULL) + sscanf(ppid_line, "PPid: %d", &ppid); + + return ppid; +} +#endif /* work around: Walk through child processes until app ID is found */ + /*--------------------------------------------------------------------------*/ /** * @brief win_mgr_get_client_appid: get applicationId from pid @@ -829,22 +933,103 @@ win_mgr_unbind_client(struct wl_client *client) static void win_mgr_get_client_appid(struct uifw_client *uclient) { - int fd; - int size; - int i; - int j; - char procpath[128]; + int status = AUL_R_ERROR; memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH); - i = aul_app_get_appid_bypid(uclient->pid, uclient->appid, ICO_IVI_APPID_LENGTH); + +#if 0 /* work around: Walk through child processes until app ID is found */ + /* + * Walk the parent process chain until we find a parent process + * with an app ID. + */ + int pid; + + for (pid = uclient->pid; + pid > 1 && status != AUL_R_OK; + pid = win_mgr_get_ppid(pid)) { + + status = aul_app_get_appid_bypid(pid, + uclient->appid, + ICO_IVI_APPID_LENGTH); + + uifw_trace("win_mgr_get_client_appid: aul_app_get_appid_bypid ret=%d " + "pid=%d appid=<%s>", status, pid, uclient->appid); + } + /* + * Walk the child process chain as well since app ID was not yet found + */ + if (status != AUL_R_OK) { + + DIR *dr; + struct dirent *de; + struct stat ps; + pid_t tpid; + uid_t uid; + gid_t gid; + + dr = opendir("/proc/"); + + /* get uid */ + wl_client_get_credentials(uclient->client, &tpid, &uid, &gid); + + while(((de = readdir(dr)) != NULL) && (status != AUL_R_OK)) { + + char fullpath[PATH_MAX] = { 0 }; + int is_child = 0; + int tmppid; + + snprintf(fullpath, sizeof(fullpath)-1, "/proc/%s", de->d_name); + + if (stat(fullpath, &ps) == -1) { + continue; + } + + /* find pid dirs for this user (uid) only */ + if (ps.st_uid != uid) + continue; + + pid = atoi(de->d_name); + + /* check if it's a valid child */ + if (pid < uclient->pid) + continue; + + /* scan up to pid to find if a chain exists */ + for (tmppid = pid; tmppid > uclient->pid;) { + tmppid = win_mgr_get_ppid(tmppid); + if (tmppid == uclient->pid) + is_child = 1; + } + + if (is_child) { + status = aul_app_get_appid_bypid(pid, uclient->appid, + ICO_IVI_APPID_LENGTH); + + uifw_debug("win_mgr_get_client_appid: aul_app_get_appid_bypid " + "ret=%d pid=%d appid=<%s>", status, pid, + uclient->appid); + } + } + } +#else /* work around: Walk through child processes until app ID is found */ + status = aul_app_get_appid_bypid(uclient->pid, uclient->appid, ICO_IVI_APPID_LENGTH); uifw_trace("win_mgr_get_client_appid: aul_app_get_appid_bypid ret=%d " - "pid=%d appid=<%s>", i, uclient->pid, uclient->appid); + "pid=%d appid=<%s>", status, uclient->pid, uclient->appid); +#endif /* work around: Walk through child processes until app ID is found */ + if (uclient->appid[0] != 0) { /* OK, end of get appid */ uclient->fixed_appid = ICO_WINDOW_MGR_APPID_FIXCOUNT; } else { - /* client dose not exist in AppCore, search Linux process table */ + /* client does not exist in AppCore, search Linux process table */ + + int fd; + int size; + int i; + int j; + char procpath[128]; + uclient->fixed_appid ++; memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH); snprintf(procpath, sizeof(procpath)-1, "/proc/%d/cmdline", uclient->pid); @@ -887,7 +1072,8 @@ win_mgr_get_client_appid(struct uifw_client *uclient) uclient->appid[i+1] = 0; if (uclient->appid[0]) { uifw_trace("win_mgr_get_client_appid: pid=%d appid=<%s> from " - "Process table", uclient->pid, uclient->appid); + "Process table(%d)", + uclient->pid, uclient->appid, uclient->fixed_appid ); } else { uifw_trace("win_mgr_get_client_appid: pid=%d dose not exist in Process table", @@ -927,6 +1113,7 @@ ico_get_animation_name(const char *animation) /** * @brief win_mgr_register_surface: create UIFW surface * + * @param[in] layertype surface layer type * @param[in] client Wayland client * @param[in] resource client resource * @param[in] surface Weston surface @@ -935,16 +1122,18 @@ ico_get_animation_name(const char *animation) */ /*--------------------------------------------------------------------------*/ static void -win_mgr_register_surface(struct wl_client *client, struct wl_resource *resource, - struct weston_surface *surface, struct shell_surface *shsurf) +win_mgr_register_surface(int layertype, struct wl_client *client, + struct wl_resource *resource, struct weston_surface *surface, + struct shell_surface *shsurf) { struct uifw_win_surface *usurf; struct uifw_win_surface *phash; struct uifw_win_surface *bhash; + int layer; uint32_t hash; - uifw_trace("win_mgr_register_surface: Enter(surf=%08x,client=%08x,res=%08x)", - (int)surface, (int)client, (int)resource); + uifw_trace("win_mgr_register_surface: Enter(surf=%08x,client=%08x,res=%08x,layer=%x)", + (int)surface, (int)client, (int)resource, layertype); /* check new surface */ if (find_uifw_win_surface_by_ws(surface)) { @@ -968,6 +1157,7 @@ win_mgr_register_surface(struct wl_client *client, struct wl_resource *resource, usurf->surfaceid = generate_id(); usurf->surface = surface; usurf->shsurf = shsurf; + usurf->layertype = layertype; usurf->node_tbl = &_ico_node_table[0]; /* set default node table (display no=0) */ wl_list_init(&usurf->ivi_layer); wl_list_init(&usurf->client_link); @@ -982,9 +1172,16 @@ win_mgr_register_surface(struct wl_client *client, struct wl_resource *resource, usurf->animation.move_time = usurf->animation.hide_time; usurf->animation.resize_anima = usurf->animation.hide_anima; usurf->animation.resize_time = usurf->animation.hide_time; - - if ((_ico_win_mgr->num_manager <= 0) || - (ico_ivi_debugflag() & ICO_IVI_DEBUG_SHOW_SURFACE)) { + if (layertype == LAYER_TYPE_INPUTPANEL) { + usurf->attributes = ICO_WINDOW_MGR_ATTR_FIXED_ASPECT; + usurf->animation.hide_anima = ico_get_animation_name(_ico_ivi_inputpanel_animation); + usurf->animation.hide_time = _ico_ivi_inputpanel_anima_time; + usurf->animation.show_anima = usurf->animation.hide_anima; + usurf->animation.show_time = usurf->animation.hide_time; + } + if ((layertype != LAYER_TYPE_INPUTPANEL) && + ((_ico_win_mgr->num_manager <= 0) || + (ico_ivi_debugflag() & ICO_IVI_DEBUG_SHOW_SURFACE))) { uifw_trace("win_mgr_register_surface: No Manager, Force visible"); usurf->visible = 1; } @@ -1037,8 +1234,27 @@ win_mgr_register_surface(struct wl_client *client, struct wl_resource *resource, _ico_win_mgr->wshash[hash] = usurf; } /* set default layer id */ - win_mgr_set_layer(usurf, (_ico_win_mgr->num_manager > 0) ? _ico_ivi_default_layer : - _ico_ivi_startup_layer); + switch (layertype) { + case LAYER_TYPE_BACKGROUND: + layer = _ico_ivi_background_layer; + break; + case LAYER_TYPE_TOUCH: + layer = _ico_ivi_touch_layer; + break; + case LAYER_TYPE_CURSOR: + layer = _ico_ivi_cursor_layer; + break; + default: + if (_ico_win_mgr->num_manager > 0) { + layer = _ico_ivi_default_layer; + } + else { + layer = _ico_ivi_startup_layer; + } + break; + } + win_mgr_set_layer(usurf, layer); + uifw_trace("win_mgr_register_surface: Leave(surfaceId=%08x)", usurf->surfaceid); } @@ -1089,8 +1305,40 @@ win_mgr_map_surface(struct weston_surface *surface, int32_t *width, int32_t *hei usurf->y = *sy; if (usurf->x < 0) usurf->x = 0; if (usurf->y < 0) usurf->y = 0; - - if (_ico_win_mgr->num_manager > 0) { + if (usurf->layertype == LAYER_TYPE_INPUTPANEL) { + /* set position */ + usurf->node_tbl = &_ico_node_table[_ico_ivi_inputpanel_display]; + + usurf->width = (float)usurf->surface->geometry.width + * (float)_ico_ivi_inputdeco_mag / 100.0f; + usurf->height = (float)usurf->surface->geometry.height + * (float)_ico_ivi_inputdeco_mag / 100.0f; + + if ((usurf->width > (usurf->node_tbl->disp_width - 16)) || + (usurf->height > (usurf->node_tbl->disp_height - 16))) { + usurf->x = (usurf->node_tbl->disp_width + - usurf->surface->geometry.width) / 2; + usurf->y = usurf->node_tbl->disp_height + - usurf->surface->geometry.height - 16 + - _ico_ivi_inputdeco_diff; + if (usurf->x < 0) usurf->x = 0; + if (usurf->y < 0) usurf->y = 0; + } + else { + win_mgr_set_scale(usurf); + + usurf->x = (usurf->node_tbl->disp_width + - usurf->width) / 2; + usurf->y = usurf->node_tbl->disp_height + - usurf->height - 16 - _ico_ivi_inputdeco_diff; + if (usurf->x < 0) usurf->x = 0; + if (usurf->y < 0) usurf->y = 0; + } + uifw_trace("win_mgr_map_surface: set position %08x %d.%d/%d", + usurf->surfaceid, usurf->node_tbl->node, usurf->x, usurf->y); + } + if (((ico_ivi_debugflag() & ICO_IVI_DEBUG_SHOW_SURFACE) == 0) && + (_ico_win_mgr->num_manager > 0)) { /* HomeScreen exist, coodinate set by HomeScreen */ if (usurf->visible) { win_mgr_surface_configure(usurf, usurf->node_tbl->disp_x + usurf->x, @@ -1106,15 +1354,26 @@ win_mgr_map_surface(struct weston_surface *surface, int32_t *width, int32_t *hei (int)surface->geometry.x, (int)surface->geometry.y, surface->geometry.width, surface->geometry.height); } - if ((_ico_win_mgr->num_manager <= 0) || - (ico_ivi_debugflag() & ICO_IVI_DEBUG_SHOW_SURFACE)) { - uifw_trace("win_mgr_map_surface: Np HomeScreen, chaneg to Visible"); + else if (usurf->layertype != LAYER_TYPE_INPUTPANEL) { + uifw_trace("win_mgr_map_surface: No HomeScreen, chaneg to Visible"); ico_window_mgr_set_visible(usurf, 1); } + else { + if (usurf->visible) { + win_mgr_surface_configure(usurf, usurf->node_tbl->disp_x + usurf->x, + usurf->node_tbl->disp_y + usurf->y, + usurf->width, usurf->height); + } + else { + win_mgr_surface_configure(usurf, ICO_IVI_MAX_COORDINATE+1, + ICO_IVI_MAX_COORDINATE+1, + usurf->width, usurf->height); + } + } } usurf->mapped = 1; if (usurf->visible) { - ico_window_mgr_restack_layer(NULL, FALSE); + ico_window_mgr_restack_layer(NULL); } uifw_trace("win_mgr_map_surface: Leave"); } @@ -1128,12 +1387,11 @@ win_mgr_map_surface(struct weston_surface *surface, int32_t *width, int32_t *hei * @brief ico_window_mgr_restack_layer: restack surface list * * @param[in] usurf UIFW surface (if NULL, no surface) - * @param[in] omit_touch omit touch layer flag (TRUE=omit/FALSE=not omit) * @return none */ /*--------------------------------------------------------------------------*/ WL_EXPORT void -ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touch) +ico_window_mgr_restack_layer(struct uifw_win_surface *usurf) { struct uifw_win_surface *eu; struct uifw_win_layer *el; @@ -1142,7 +1400,7 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc struct weston_layer *wlayer; struct weston_surface *surface, *surfacetmp; int num_visible = 0; - int layer_type; + int layertype; int old_visible; /* save current visible */ @@ -1150,53 +1408,49 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc old_visible = ico_window_mgr_is_visible(usurf); } - /* set layer type */ - ico_ivi_shell_set_layertype(); - /* make compositor surface list */ wlayer = ico_ivi_shell_weston_layer(); - uifw_trace("ico_window_mgr_restack_layer: Enter(surf=%08x,omit=%d) layer=%08x", - (int)usurf, omit_touch, (int)wlayer); + uifw_trace("ico_window_mgr_restack_layer: Enter(surf=%08x) layer=%08x", + (int)usurf, (int)wlayer); /* remove all surfaces in panel_layer */ - wl_list_for_each_safe(surface, surfacetmp, &wlayer->surface_list, layer_link) { + wl_list_for_each_safe (surface, surfacetmp, &wlayer->surface_list, layer_link) { wl_list_remove(&surface->layer_link); wl_list_init(&surface->layer_link); } wl_list_init(&wlayer->surface_list); wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) { - if (el->layer_type == ICO_WINDOW_MGR_LAYER_TYPE_CURSOR) continue; + if (el->layertype == LAYER_TYPE_CURSOR) continue; wl_list_for_each (eu, &el->surface_list, ivi_layer) { if (eu->surface == NULL) continue; /* target only panel or unknown layer */ - layer_type = ico_ivi_shell_layertype(eu->surface); - if ((layer_type != LAYER_TYPE_PANEL) && (layer_type != LAYER_TYPE_UNKNOWN)) { + layertype = ico_ivi_shell_layertype(eu->surface); + if ((layertype != LAYER_TYPE_PANEL) && (layertype != LAYER_TYPE_INPUTPANEL) && + (layertype != LAYER_TYPE_FULLSCREEN) && (layertype != LAYER_TYPE_UNKNOWN)) { continue; } wl_list_remove(&eu->surface->layer_link); wl_list_init(&eu->surface->layer_link); if (eu->mapped != 0) { - if ((el->visible == FALSE) || (eu->visible == FALSE) || - ((omit_touch != FALSE) && - (el->layer_type == ICO_WINDOW_MGR_LAYER_TYPE_INPUT))) { + if ((el->visible == FALSE) || (eu->visible == FALSE)) { new_x = (float)(ICO_IVI_MAX_COORDINATE+1); new_y = (float)(ICO_IVI_MAX_COORDINATE+1); } else if (eu->surface->buffer_ref.buffer) { buf_width = weston_surface_buffer_width(eu->surface); buf_height = weston_surface_buffer_height(eu->surface); - if (eu->width > buf_width) { + if ((eu->width > buf_width) && (eu->scalex <= 1.0f)) { new_x = (float)(eu->x + (eu->width - eu->surface->geometry.width)/2); } else { new_x = (float)eu->x; } - if (eu->height > buf_height) { + if ((eu->height > buf_height) && (eu->scaley <= 1.0f)) { new_y = (float) (eu->y + (eu->height - eu->surface->geometry.height)/2); } @@ -1219,14 +1473,12 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc weston_surface_set_position(eu->surface, (float)new_x, (float)new_y); weston_surface_damage(eu->surface); } -#if 0 /* too many debug log */ - uifw_trace("ico_window_mgr_restack_layer:%3d(%d).%08x(%08x:%d) " - "x/y=%d/%d w/h=%d/%d", + uifw_debug("ico_window_mgr_restack_layer:%3d(%d).%08x(%08x:%d) " + "x/y=%d/%d w/h=%d/%d %x", el->layer, el->visible, eu->surfaceid, (int)eu->surface, eu->visible, (int)eu->surface->geometry.x, (int)eu->surface->geometry.y, eu->surface->geometry.width, - eu->surface->geometry.height); -#endif + eu->surface->geometry.height, eu->layertype); } } } @@ -1237,15 +1489,13 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc } /* composit and draw screen(plane) */ - if (omit_touch == FALSE) { - weston_compositor_schedule_repaint(_ico_win_mgr->compositor); + weston_compositor_schedule_repaint(_ico_win_mgr->compositor); - if ((_ico_win_mgr->shell_init == 0) && (num_visible > 0) && - (_ico_win_mgr->shell != NULL) && (_ico_win_mgr->num_manager > 0)) { - /* start shell fade */ - _ico_win_mgr->shell_init = 1; - ico_ivi_shell_startup(_ico_win_mgr->shell); - } + if ((_ico_win_mgr->shell_init == 0) && (num_visible > 0) && + (_ico_win_mgr->shell != NULL) && (_ico_win_mgr->num_manager > 0)) { + /* start shell fade */ + _ico_win_mgr->shell_init = 1; + ico_ivi_shell_startup(_ico_win_mgr->shell); } /* if visible change, call hook for input region */ @@ -1259,27 +1509,26 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc /*--------------------------------------------------------------------------*/ /** - * @brief ico_window_mgr_input_layer: input layer control + * @brief ico_window_mgr_touch_layer: touch panel layer control * - * @param[in] omit omit input layer flag (TRUE=omit/FALSE=not omit) + * @param[in] omit omit touch layer flag (TRUE=omit/FALSE=not omit) * @return none */ /*--------------------------------------------------------------------------*/ WL_EXPORT void -ico_window_mgr_input_layer(int omit) +ico_window_mgr_touch_layer(int omit) { struct uifw_win_surface *eu; - /* check current input layer mode */ - if ((_ico_win_mgr->input_layer == NULL) || - ((omit != FALSE) && (_ico_win_mgr->input_layer->visible == FALSE))) { - uifw_trace("ico_window_mgr_input_layer: input layer not exist or hide"); + /* check current touch layer mode */ + if ((_ico_win_mgr->touch_layer == NULL) || + ((omit != FALSE) && (_ico_win_mgr->touch_layer->visible == FALSE))) { + uifw_trace("ico_window_mgr_touch_layer: touch layer not exist or hide"); return; } - wl_list_for_each (eu, &_ico_win_mgr->input_layer->surface_list, ivi_layer) { + wl_list_for_each (eu, &_ico_win_mgr->touch_layer->surface_list, ivi_layer) { if ((eu->surface == NULL) || (eu->mapped == 0)) continue; - if (omit != FALSE) { eu->animation.pos_x = (int)eu->surface->geometry.x; eu->animation.pos_y = (int)eu->surface->geometry.y; @@ -1299,13 +1548,15 @@ ico_window_mgr_input_layer(int omit) * * @param[in] usurf UIFW surface, (if need) * @param[in] layer layer id + * @param[in] layertype layer type if need * @return new layer * @retval != NULL success(layer management table) * @retval == NULL error(No Memory) */ /*--------------------------------------------------------------------------*/ static struct uifw_win_layer * -win_mgr_create_layer(struct uifw_win_surface *usurf, const uint32_t layer) +win_mgr_create_layer(struct uifw_win_surface *usurf, const uint32_t layer, + const int layertype) { struct uifw_win_layer *el; struct uifw_win_layer *new_el; @@ -1319,18 +1570,21 @@ win_mgr_create_layer(struct uifw_win_surface *usurf, const uint32_t layer) memset(new_el, 0, sizeof(struct uifw_win_layer)); new_el->layer = layer; if ((int)layer == _ico_ivi_background_layer ) { - new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_BACKGROUND; + new_el->layertype = LAYER_TYPE_BACKGROUND; } - else if ((int)layer == _ico_ivi_input_layer ) { - new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_INPUT; - _ico_win_mgr->input_layer = new_el; + else if ((int)layer == _ico_ivi_touch_layer ) { + new_el->layertype = LAYER_TYPE_TOUCH; + _ico_win_mgr->touch_layer = new_el; } else if ((int)layer == _ico_ivi_cursor_layer ) { - new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_CURSOR; + new_el->layertype = LAYER_TYPE_CURSOR; _ico_win_mgr->cursor_layer = new_el; } + else if(layertype != 0) { + new_el->layertype = layertype; + } else { - new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_NORMAL; + new_el->layertype = LAYER_TYPE_PANEL; } new_el->visible = TRUE; wl_list_init(&new_el->surface_list); @@ -1385,8 +1639,8 @@ win_mgr_set_layer(struct uifw_win_surface *usurf, const uint32_t layer) if (&el->link == &_ico_win_mgr->ivi_layer_list) { /* layer not exist, create new layer */ - uifw_trace("win_mgr_set_layer: New Layer %d", layer); - new_el = win_mgr_create_layer(usurf, layer); + uifw_trace("win_mgr_set_layer: New Layer %d(%d)", layer, usurf->layertype); + new_el = win_mgr_create_layer(usurf, layer, usurf->layertype); if (! new_el) { uifw_trace("win_mgr_set_layer: Leave(No Memory)"); return; @@ -1394,14 +1648,12 @@ win_mgr_set_layer(struct uifw_win_surface *usurf, const uint32_t layer) } else { uifw_trace("win_mgr_set_layer: Add surface to Layer %d", layer); - wl_list_remove(&usurf->ivi_layer); - wl_list_insert(&el->surface_list, &usurf->ivi_layer); usurf->win_layer = el; + win_mgr_set_raise(usurf, 3); } - /* rebild compositor surface list */ if (usurf->visible) { - ico_window_mgr_restack_layer(usurf, 0); + ico_window_mgr_restack_layer(usurf); } uifw_trace("win_mgr_set_layer: Leave"); } @@ -1420,14 +1672,16 @@ win_mgr_set_active(struct uifw_win_surface *usurf, const int target) { struct weston_seat *seat; struct weston_surface *surface; - int object = target; - wl_fixed_t sx, sy; + int object = target; +#if 0 /* pointer grab can not release */ + int savetp, i; +#endif /* pointer grab can not release */ uifw_trace("win_mgr_set_active: Enter(%08x,%x)", (int)usurf, target); if ((usurf) && (usurf->shsurf) && (usurf->surface)) { surface = usurf->surface; - if ((target & (ICO_WINDOW_MGR_ACTIVE_POINTER|ICO_WINDOW_MGR_ACTIVE_KEYBOARD)) == 0) { + if ((object & (ICO_WINDOW_MGR_ACTIVE_POINTER|ICO_WINDOW_MGR_ACTIVE_KEYBOARD)) == 0) { surface = NULL; if (_ico_win_mgr->active_pointer_usurf == usurf) { object |= ICO_WINDOW_MGR_ACTIVE_POINTER; @@ -1447,7 +1701,7 @@ win_mgr_set_active(struct uifw_win_surface *usurf, const int target) } else { surface = NULL; - if (target == 0) { + if (object == 0) { object = ICO_WINDOW_MGR_ACTIVE_POINTER | ICO_WINDOW_MGR_ACTIVE_KEYBOARD; } if (object & ICO_WINDOW_MGR_ACTIVE_POINTER) { @@ -1458,30 +1712,86 @@ win_mgr_set_active(struct uifw_win_surface *usurf, const int target) } } - wl_list_for_each(seat, &_ico_win_mgr->compositor->seat_list, link) { - if ((object & ICO_WINDOW_MGR_ACTIVE_POINTER) && (seat->pointer)) { + wl_list_for_each (seat, &_ico_win_mgr->compositor->seat_list, link) { +#if 0 /* pointer grab can not release */ + if (object & ICO_WINDOW_MGR_ACTIVE_POINTER) { if (surface) { - if (seat->pointer->focus != surface) { - uifw_trace("win_mgr_set_active: pointer change surface(%08x=>%08x)", - (int)seat->pointer->focus, (int)surface); - weston_surface_from_global_fixed(surface, - seat->pointer->x, - seat->pointer->y, - &sx, &sy); - weston_pointer_set_focus(seat->pointer, surface, sx, sy); + if ((seat->pointer != NULL) && (seat->pointer->focus != surface)) { + uifw_trace("win_mgr_set_active: pointer reset focus(%08x)", + (int)seat->pointer->focus); + if (seat->pointer->button_count > 0) { + /* emulate button release */ + notify_button(seat, weston_compositor_get_time(), + seat->pointer->grab_button, + WL_POINTER_BUTTON_STATE_RELEASED); + /* count up button, because real mouse botan release */ + seat->pointer->button_count ++; + } + weston_pointer_set_focus(seat->pointer, NULL, + wl_fixed_from_int(0), wl_fixed_from_int(0)); } else { uifw_trace("win_mgr_set_active: pointer nochange surface(%08x)", (int)surface); } + if ((seat->touch != NULL) && (seat->touch->focus != surface)) { + uifw_trace("win_mgr_set_active: touch reset surface(%08x)", + (int)seat->touch->focus); + if (seat->num_tp > 10) { + seat->num_tp = 0; /* safty gard */ + } + else if (seat->num_tp > 0) { + /* emulate touch up */ + savetp = seat->num_tp; + for (i = 0; i < savetp; i++) { + notify_touch(seat, weston_compositor_get_time(), i+1, + seat->touch->grab_x, seat->touch->grab_y, + WL_TOUCH_UP); + } + /* touch count up, becase real touch release */ + seat->num_tp = savetp; + } + weston_touch_set_focus(seat, NULL); + } + else { + uifw_trace("win_mgr_set_active: touch nochange surface(%08x)", + (int)surface); + } } else { uifw_trace("win_mgr_set_active: pointer reset surface(%08x)", (int)seat->pointer->focus); - weston_pointer_set_focus(seat->pointer, NULL, - wl_fixed_from_int(0), wl_fixed_from_int(0)); + if ((seat->pointer != NULL) && (seat->pointer->focus != NULL)) { + if (seat->pointer->button_count > 0) { + /* emulate button release */ + notify_button(seat, weston_compositor_get_time(), + seat->pointer->grab_button, + WL_POINTER_BUTTON_STATE_RELEASED); + seat->pointer->button_count ++; + } + weston_pointer_set_focus(seat->pointer, NULL, + wl_fixed_from_int(0), wl_fixed_from_int(0)); + } + if ((seat->touch != NULL) && (seat->touch->focus != NULL)) { + if (seat->num_tp > 10) { + seat->num_tp = 0; /* safty gard */ + } + else if (seat->num_tp > 0) { + /* emulate touch up */ + savetp = seat->num_tp; + for (i = 0; i < savetp; i++) { + notify_touch(seat, weston_compositor_get_time(), i+1, + seat->touch->grab_x, seat->touch->grab_y, + WL_TOUCH_UP); + } + /* touch count up, becase real touch release */ + seat->num_tp = savetp; + } + weston_touch_set_focus(seat, NULL); + } } } +#endif /* pointer grab can not release */ if ((object & ICO_WINDOW_MGR_ACTIVE_KEYBOARD) && (seat->keyboard)) { if (surface) { if (seat->keyboard->focus != surface) { @@ -1571,7 +1881,8 @@ uifw_declare_manager(struct wl_client *client, struct wl_resource *resource, int usurf->surfaceid, usurf->winname, usurf->uclient->pid, - usurf->uclient->appid); + usurf->uclient->appid, + usurf->layertype << 12); } } } @@ -1600,13 +1911,16 @@ static void uifw_set_window_layer(struct wl_client *client, struct wl_resource *resource, uint32_t surfaceid, uint32_t layer) { - if (layer == ICO_WINDOW_MGR_V_LAYER_INPUT) { - layer = _ico_ivi_input_layer; + if (layer == ICO_WINDOW_MGR_LAYERTYPE_BACKGROUND) { + layer = _ico_ivi_background_layer; + } + else if (layer == ICO_WINDOW_MGR_LAYERTYPE_TOUCH) { + layer = _ico_ivi_touch_layer; } - else if (layer == ICO_WINDOW_MGR_V_LAYER_CURSOR) { + else if (layer == ICO_WINDOW_MGR_LAYERTYPE_CURSOR) { layer = _ico_ivi_cursor_layer; } - else if (layer == ICO_WINDOW_MGR_V_LAYER_STARTUP) { + else if (layer == ICO_WINDOW_MGR_LAYERTYPE_STARTUP) { layer = _ico_ivi_startup_layer; } @@ -1669,7 +1983,7 @@ uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource, if (((int)node) >= _ico_num_nodes) { uifw_trace("uifw_set_positionsize: node=%d dose not exist(max=%d)", node, _ico_num_nodes); - if ((ico_ivi_debugflag() & ICO_IVI_DEBUG_SHOW_SURFACE) == 0) { + if ((ico_ivi_debugflag() & ICO_IVI_DEBUG_SHOW_NODISP) == 0) { if (usurf->visible) { /* no display, change to hide */ uifw_set_visible(client, resource, surfaceid, ICO_WINDOW_MGR_VISIBLE_HIDE, @@ -1838,7 +2152,8 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource, if ((usurf->disable == 0) && (visible == ICO_WINDOW_MGR_VISIBLE_SHOW)) { - if (! usurf->visible) { + if ((! usurf->visible) || + (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE)) { usurf->visible = 1; uifw_trace("uifw_set_visible: Change to Visible"); @@ -1878,7 +2193,11 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource, } else if (visible == ICO_WINDOW_MGR_VISIBLE_HIDE) { - if (usurf->visible) { + if ((usurf->visible) || + (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE)) { + + /* Reset focus */ + win_mgr_reset_focus(usurf); /* Weston surface configure */ weston_surface_damage_below(usurf->surface); @@ -1937,7 +2256,7 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource, } if (restack) { - ico_window_mgr_restack_layer(usurf, 0); + ico_window_mgr_restack_layer(usurf); } /* send event(VISIBLE) to manager */ @@ -1972,7 +2291,7 @@ uifw_set_animation(struct wl_client *client, struct wl_resource *resource, int animaid; struct uifw_win_surface *usurf = ico_window_mgr_get_usurf_client(surfaceid, client); - uifw_trace("uifw_set_transition: Enter(surf=%08x,type=%x,anim=%s,time=%d)", + uifw_trace("uifw_set_transition: surf=%08x,type=%x,anim=%s,time=%d", surfaceid, type, animation, time); if (usurf) { @@ -2030,7 +2349,7 @@ uifw_set_animation(struct wl_client *client, struct wl_resource *resource, } } else { - uifw_trace("uifw_set_animation: Leave(Surface(%08x) Not exist)", surfaceid); + uifw_trace("uifw_set_animation: Surface(%08x) Not exist", surfaceid); } } @@ -2145,6 +2464,10 @@ uifw_set_active(struct wl_client *client, struct wl_resource *resource, switch (active & (ICO_WINDOW_MGR_ACTIVE_POINTER|ICO_WINDOW_MGR_ACTIVE_KEYBOARD)) { case ICO_WINDOW_MGR_ACTIVE_POINTER: if (usurf != _ico_win_mgr->active_pointer_usurf) { + uifw_trace("uifw_set_active: pointer active change %08x->%08x", + _ico_win_mgr->active_pointer_usurf ? + _ico_win_mgr->active_pointer_usurf->surfaceid : 0, + usurf ? usurf->surfaceid : 0); if (_ico_win_mgr->active_pointer_usurf) { ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE, _ico_win_mgr->active_pointer_usurf, @@ -2166,6 +2489,10 @@ uifw_set_active(struct wl_client *client, struct wl_resource *resource, break; case ICO_WINDOW_MGR_ACTIVE_KEYBOARD: if (usurf != _ico_win_mgr->active_keyboard_usurf) { + uifw_trace("uifw_set_active: keyboard active change %08x->%08x", + _ico_win_mgr->active_keyboard_usurf ? + _ico_win_mgr->active_keyboard_usurf->surfaceid : 0, + usurf ? usurf->surfaceid : 0); if (_ico_win_mgr->active_keyboard_usurf) { ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE, _ico_win_mgr->active_keyboard_usurf, @@ -2188,6 +2515,12 @@ uifw_set_active(struct wl_client *client, struct wl_resource *resource, default: if ((usurf != _ico_win_mgr->active_pointer_usurf) || (usurf != _ico_win_mgr->active_keyboard_usurf)) { + uifw_trace("uifw_set_active: active change %08x/%08x->%08x", + _ico_win_mgr->active_pointer_usurf ? + _ico_win_mgr->active_pointer_usurf->surfaceid : 0, + _ico_win_mgr->active_keyboard_usurf ? + _ico_win_mgr->active_keyboard_usurf->surfaceid : 0, + usurf ? usurf->surfaceid : 0); if (_ico_win_mgr->active_pointer_usurf) { ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE, _ico_win_mgr->active_pointer_usurf, @@ -2242,14 +2575,21 @@ uifw_set_layer_visible(struct wl_client *client, struct wl_resource *resource, struct uifw_win_layer *el; struct uifw_win_layer *new_el; struct uifw_win_surface *usurf; + int layertype = 0; - if (layer == ICO_WINDOW_MGR_V_LAYER_INPUT) { - layer = _ico_ivi_input_layer; + if (layer == ICO_WINDOW_MGR_LAYERTYPE_BACKGROUND) { + layer = _ico_ivi_background_layer; + layertype = LAYER_TYPE_BACKGROUND; + } + else if (layer == ICO_WINDOW_MGR_LAYERTYPE_TOUCH) { + layer = _ico_ivi_touch_layer; + layertype = LAYER_TYPE_TOUCH; } - else if (layer == ICO_WINDOW_MGR_V_LAYER_CURSOR) { + else if (layer == ICO_WINDOW_MGR_LAYERTYPE_CURSOR) { layer = _ico_ivi_cursor_layer; + layertype = LAYER_TYPE_CURSOR; } - else if (layer == ICO_WINDOW_MGR_V_LAYER_STARTUP) { + else if (layer == ICO_WINDOW_MGR_LAYERTYPE_STARTUP) { layer = _ico_ivi_startup_layer; } @@ -2263,7 +2603,7 @@ uifw_set_layer_visible(struct wl_client *client, struct wl_resource *resource, if (&el->link == &_ico_win_mgr->ivi_layer_list) { /* layer not exist, create new layer */ uifw_trace("uifw_set_layer_visible: New Layer %d", layer); - new_el = win_mgr_create_layer(NULL, layer); + new_el = win_mgr_create_layer(NULL, layer, layertype); if (! new_el) { uifw_trace("uifw_set_layer_visible: Leave(No Memory)"); return; @@ -2297,13 +2637,17 @@ uifw_set_layer_visible(struct wl_client *client, struct wl_resource *resource, wl_list_for_each (usurf, &el->surface_list, ivi_layer) { if ((usurf->visible != FALSE) && (usurf->surface != NULL) && (usurf->surface->output != NULL)) { + /* Reset focus if hide */ + if (visible == 0) { + win_mgr_reset_focus(usurf); + } /* Damage(redraw) target surface */ weston_surface_damage_below(usurf->surface); } } /* rebild compositor surface list */ - ico_window_mgr_restack_layer(NULL, 0); + ico_window_mgr_restack_layer(NULL); /* send layer visible event to manager */ ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_LAYER_VISIBLE, NULL, @@ -2319,11 +2663,13 @@ uifw_set_layer_visible(struct wl_client *client, struct wl_resource *resource, * @param[in] client Weyland client * @param[in] resource resource of request * @param[in] appid application id + * @param[in] pid process id * @return none */ /*--------------------------------------------------------------------------*/ static void -uifw_get_surfaces(struct wl_client *client, struct wl_resource *resource, const char *appid) +uifw_get_surfaces(struct wl_client *client, struct wl_resource *resource, + const char *appid, int32_t pid) { struct uifw_client *uclient; struct uifw_win_layer *el; @@ -2331,21 +2677,28 @@ uifw_get_surfaces(struct wl_client *client, struct wl_resource *resource, const struct wl_array reply; uint32_t *up; - uifw_trace("uifw_get_surfaces: Enter(appid=%s)", appid); + uifw_trace("uifw_get_surfaces: Enter(appid=%s, pid=%d)", appid ? appid : " ", pid); wl_array_init(&reply); wl_list_for_each (uclient, &_ico_win_mgr->client_list, link) { - if (strcmp(uclient->appid, appid) == 0) break; + if ((appid != NULL) && (*appid != ' ')) { + if (strcmp(uclient->appid, appid) == 0) break; + } + if (pid != 0) { + if (uclient->pid == pid) break; + } } if (&uclient->link == &_ico_win_mgr->client_list) { - uifw_trace("uifw_get_surfaces: appid=%s dose not exist", appid); + uifw_trace("uifw_get_surfaces: appid=%s pid=%d dose not exist", + appid ? appid : " ", pid); } else { wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) { wl_list_for_each (usurf, &el->surface_list, ivi_layer) { if (usurf->uclient == uclient) { - uifw_trace("uifw_get_surfaces: %s surf=%08x", appid, usurf->surfaceid); + uifw_trace("uifw_get_surfaces: %s(%d) surf=%08x", + uclient->appid, uclient->pid, usurf->surfaceid); up = (uint32_t *)wl_array_add(&reply, sizeof(uint32_t)); if (up) { *up = usurf->surfaceid; @@ -2354,7 +2707,7 @@ uifw_get_surfaces(struct wl_client *client, struct wl_resource *resource, const } } } - ico_window_mgr_send_app_surfaces(resource, appid, &reply); + ico_window_mgr_send_app_surfaces(resource, uclient->appid, uclient->pid, &reply); wl_array_release(&reply); uifw_trace("uifw_get_surfaces: Leave"); @@ -2362,25 +2715,69 @@ uifw_get_surfaces(struct wl_client *client, struct wl_resource *resource, const /*--------------------------------------------------------------------------*/ /** - * @brief win_mgr_check_surfacemap: check and change all surface + * @brief win_mgr_check_mapsurrace: check and change all surface * * @param[in] animation weston animation table(unused) - * @param[in] outout weston output table + * @param[in] outout weston output table(unused) * @param[in] mseces current time(unused) * @return none */ /*--------------------------------------------------------------------------*/ static void -win_mgr_check_surfacemap(struct weston_animation *animation, - struct weston_output *output, uint32_t msecs) +win_mgr_check_mapsurrace(struct weston_animation *animation, + struct weston_output *output, uint32_t msecs) { struct uifw_surface_map *sm; + uint32_t curtime; + int wait = 99999999; + + /* check touch down counter */ + if (touch_check_seat) { + if (touch_check_seat->num_tp > 10) { + uifw_trace("win_mgr_change_mapsurface: illegal touch counter(num=%d), reset", + (int)touch_check_seat->num_tp); + touch_check_seat->num_tp = 0; + } + } - wl_list_for_each(sm, &_ico_win_mgr->map_list, map_link) { - if (sm->usurf->surface->output == output) { - win_mgr_change_mapsurface(sm, 0); + /* check all mapped surfaces */ + curtime = weston_compositor_get_time(); + wl_list_for_each (sm, &_ico_win_mgr->map_list, map_link) { + win_mgr_change_mapsurface(sm, 0, curtime); + if (sm->eventque) { + if (sm->interval < wait) { + wait = sm->interval; + } } } + + /* check frame interval */ + if (wait < 99999999) { + wait = wait / 2; + } + else { + wait = 1000; + } + if (wait != _ico_win_mgr->waittime) { + _ico_win_mgr->waittime = wait; + wl_event_source_timer_update(_ico_win_mgr->wait_mapevent, + _ico_win_mgr->waittime); + } +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief win_mgr_timer_mapsurrace: mapped surface check timer + * + * @param[in] data user data(unused) + * @return none + */ +/*--------------------------------------------------------------------------*/ +static int +win_mgr_timer_mapsurrace(void *data) +{ + win_mgr_check_mapsurrace(NULL, NULL, 0); + return 1; } /*--------------------------------------------------------------------------*/ @@ -2389,22 +2786,24 @@ win_mgr_check_surfacemap(struct weston_animation *animation, * * @param[in] sm map surface table * @param[in] event send event (if 0, send if changed) + * @param[in] curtime current time(ms) * @return none */ /*--------------------------------------------------------------------------*/ static void -win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event) +win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event, uint32_t curtime) { struct uifw_drm_buffer *drm_buffer; struct uifw_dri_image *dri_image; struct uifw_intel_region *dri_region; struct uifw_gl_surface_state *gl_state; struct weston_surface *es; - uint32_t eglname = 0; + uint32_t eglname; int width; int height; int stride; uint32_t format; + uint32_t dtime; /* check if buffered */ es = sm->usurf->surface; @@ -2416,11 +2815,6 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event) /* surface has no buffer, error */ uifw_trace("win_mgr_change_mapsurface: surface(%08x) has no buffer", sm->usurf->surfaceid); - sm->width = 0; - sm->height = 0; - sm->stride = 0; - sm->eglname = 0; - sm->format = 0; if (sm->initflag) { event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP; } @@ -2443,10 +2837,10 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event) width = es->buffer_ref.buffer->width; height = es->buffer_ref.buffer->height; stride = drm_buffer->stride[0]; - if (drm_buffer->format == 0x34325258) { + if (drm_buffer->format == __DRI_IMAGE_FOURCC_XRGB8888) { format = EGL_TEXTURE_RGB; } - else if (drm_buffer->format == 0x34325241) { + else if (drm_buffer->format == __DRI_IMAGE_FOURCC_ARGB8888) { format = EGL_TEXTURE_RGBA; } else { @@ -2454,22 +2848,47 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event) format = EGL_NO_TEXTURE; } eglname = dri_region->name; - - if ((sm->initflag == 0) && (width > 0) && (height > 0) && (stride > 0)) { +#if MESA_VERSION >= 921 + if (eglname == 0) { + if (drm_intel_bo_flink((drm_intel_bo *)dri_region->bo, &eglname)) { + uifw_warn("win_mgr_change_mapsurface: drm_intel_bo_flink() Error"); + eglname = 0; + } + } +#endif + if ((sm->initflag == 0) && (eglname != 0) && + (width > 0) && (height > 0) && (stride > 0)) { sm->initflag = 1; event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP; } else { - if ((width <= 0) || (height <= 0) || (stride <= 0)) { + if ((eglname == 0) || (width <= 0) || (height <= 0) || (stride <= 0)) { event = 0; } else if (event == 0) { if ((sm->width != width) || (sm->height != height) || - (sm->stride != stride)) { + (sm->stride != stride) || (format != sm->format)) { event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_RESIZE; } - else if ((eglname != sm->eglname) || (format != sm->format)) { - event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS; + else if (eglname != sm->eglname) { +#if 1 /* log for speed test */ + uifw_debug("win_mgr_change_mapsurface: SWAPBUFFER(surf=%08x name=%d)", + sm->usurf->surfaceid, sm->eglname); +#endif + dtime = curtime - sm->lasttime; + if ((sm->interval > 0) && (dtime < sm->interval)) { + sm->eventque = 1; + event = 0; + } + else { + event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS; + } + } + else if (sm->eventque) { + dtime = curtime - sm->lasttime; + if ((sm->interval == 0) || (dtime >= sm->interval)) { + event = ICO_WINDOW_MGR_MAP_SURFACE_EVENT_CONTENTS; + } } } } @@ -2478,17 +2897,18 @@ win_mgr_change_mapsurface(struct uifw_surface_map *sm, int event) sm->stride = stride; sm->eglname = eglname; sm->format = format; - sm->eglname = eglname; } } if (event != 0) { -#if 0 /* too many log */ - uifw_trace("win_mgr_change_mapsurface: send MAP event(ev=%d surf=%08x name=%08x " +#if 0 /* too many logs */ + uifw_debug("win_mgr_change_mapsurface: send MAP event(ev=%d surf=%08x name=%d " "w/h/s=%d/%d/%d format=%x", - event, sm->usurf->surfaceid, sm->eglname, sm->width, sm->height, - sm->stride, sm->format); + event, sm->usurf->surfaceid, sm->eglname, + sm->width, sm->height, sm->stride, sm->format); #endif + sm->lasttime = curtime; + sm->eventque = 0; ico_window_mgr_send_map_surface(sm->uclient->mgr->resource, event, sm->usurf->surfaceid, sm->type, sm->eglname, sm->width, sm->height, sm->stride, sm->format); @@ -2544,14 +2964,13 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource, return; } - es = usurf->surface; - /* check if buffered */ - if ((es == NULL) || (es->buffer_ref.buffer == NULL)) { + es = usurf->surface; + if (es == NULL) { /* surface has no buffer, error */ ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR, surfaceid, 3, 0, 0, 0, 0, 0); - uifw_trace("uifw_map_surface: Leave(surface(%08x) has no buffer)", surfaceid); + uifw_trace("uifw_map_surface: Leave(surface(%08x) has no surface)", surfaceid); return; } @@ -2566,43 +2985,70 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource, return; } - /* create map table */ - sm = _ico_win_mgr->free_maptable; - if (sm) { - _ico_win_mgr->free_maptable = (struct uifw_surface_map *)sm->usurf; + /* check same surface */ + wl_list_for_each(sm, &usurf->surf_map, surf_link) { + if ((sm->usurf == usurf) && (sm->uclient == uclient)) { + break; + } + } + + if (&sm->surf_link == &usurf->surf_map) { + /* create map table */ + sm = _ico_win_mgr->free_maptable; + if (sm) { + _ico_win_mgr->free_maptable = (struct uifw_surface_map *)sm->usurf; + } + else { + sm = (struct uifw_surface_map *)malloc(sizeof(struct uifw_surface_map)); + if (! sm) { + ico_window_mgr_send_map_surface(resource, + ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR, + surfaceid, 5, 0, 0, 0, 0, 0); + uifw_trace("uifw_map_surface: Leave(malloc error)"); + return; + } + } + memset(sm, 0, sizeof(struct uifw_surface_map)); + + wl_list_init(&sm->map_link); + wl_list_init(&sm->surf_link); + sm->usurf = usurf; + sm->uclient = uclient; + sm->type = ICO_WINDOW_MGR_MAP_TYPE_EGL; + sm->framerate = framerate; + if (sm->framerate > 60) sm->framerate = 60; + if (sm->framerate > 0) { + sm->interval = (1000 / sm->framerate) - 1; + } + wl_list_insert(_ico_win_mgr->map_list.next, &sm->map_link); + wl_list_insert(usurf->surf_map.prev, &sm->surf_link); } else { - sm = (struct uifw_surface_map *)malloc(sizeof(struct uifw_surface_map)); - if (! sm) { - ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR, - surfaceid, 5, 0, 0, 0, 0, 0); - uifw_trace("uifw_map_surface: Leave(malloc error)"); - return; + /* change frame rate */ + uifw_trace("uifw_map_surface: Leave(chagne frame rate %d->%d", + sm->framerate, framerate); + if (sm->framerate != framerate) { + sm->framerate = framerate; + if (sm->framerate > 60) sm->framerate = 60; + if (sm->framerate > 0) { + sm->interval = (1000 / sm->framerate) - 1; + } + win_mgr_change_mapsurface(sm, 0, weston_compositor_get_time()); } + return; } - memset(sm, 0, sizeof(struct uifw_surface_map)); - - wl_list_init(&sm->map_link); - wl_list_init(&sm->surf_link); - sm->usurf = usurf; - sm->uclient = uclient; - sm->type = ICO_WINDOW_MGR_MAP_TYPE_EGL; - sm->eglname = 0; - sm->framerate = framerate; - wl_list_insert(_ico_win_mgr->map_list.next, &sm->map_link); - wl_list_insert(usurf->surf_map.prev, &sm->surf_link); buffer = es->buffer_ref.buffer; - if (gl_state->buffer_type == BUFFER_TYPE_EGL) { + if ((buffer != NULL) && (gl_state->buffer_type == BUFFER_TYPE_EGL)) { sm->width = buffer->width; sm->height = buffer->height; drm_buffer = (struct uifw_drm_buffer *)buffer->legacy_buffer; if (drm_buffer != NULL) { sm->stride = drm_buffer->stride[0]; - if (drm_buffer->format == 0x34325258) { + if (drm_buffer->format == __DRI_IMAGE_FOURCC_XRGB8888) { sm->format = EGL_TEXTURE_RGB; } - else if (drm_buffer->format == 0x34325241) { + else if (drm_buffer->format == __DRI_IMAGE_FOURCC_ARGB8888) { sm->format = EGL_TEXTURE_RGBA; } else { @@ -2618,7 +3064,8 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource, /* send map event */ if (sm->initflag) { - win_mgr_change_mapsurface(sm, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP); + win_mgr_change_mapsurface(sm, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_MAP, + weston_compositor_get_time()); } uifw_trace("uifw_map_surface: Leave"); } @@ -2659,7 +3106,7 @@ uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource, } else { uclient = NULL; - wl_list_for_each(sm, &usurf->surf_map, surf_link) { + wl_list_for_each (sm, &usurf->surf_map, surf_link) { if (sm->uclient->mgr != NULL) { uifw_trace("uifw_unmap_surface: send UNMAP event(ev=%d surf=%08x name=%08x " "w/h/s=%d/%d/%d format=%x", @@ -2673,7 +3120,7 @@ uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource, } } - wl_list_for_each_safe(sm, sm_tmp, &usurf->surf_map, surf_link) { + wl_list_for_each_safe (sm, sm_tmp, &usurf->surf_map, surf_link) { if (((uclient != NULL) && (sm->uclient != uclient))) continue; /* send unmap event */ if ((uclient != NULL) && (uclient->mgr != NULL)) { @@ -2779,7 +3226,7 @@ win_mgr_change_surface(struct weston_surface *surface, const int to, const int m usurf->x + usurf->xadd), (float)(usurf->node_tbl->disp_y + usurf->y + usurf->yadd)); - ico_window_mgr_restack_layer(usurf, 0); + ico_window_mgr_restack_layer(usurf); } else { weston_surface_set_position(usurf->surface, (float)(ICO_IVI_MAX_COORDINATE+1), @@ -3035,34 +3482,297 @@ win_mgr_surface_move(struct weston_surface *surface, int *dx, int *dy) /*--------------------------------------------------------------------------*/ /** + * @brief win_mgr_show_layer: shell layer visible control + * + * @param[in] layertype shell layer type + * @param[in] show show(1)/hide(0) + * @param[in] data requested weston surface in show + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +win_mgr_show_layer(int layertype, int show, void *data) +{ + struct uifw_win_layer *el; + struct uifw_win_surface *usurf; + struct uifw_win_surface *inusurf = NULL; + + uifw_trace("win_mgr_show_layer: Enter(type=%d, show=%d, data=%08x)", + layertype, show, (int)data); + + if (layertype != LAYER_TYPE_INPUTPANEL) { + uifw_trace("win_mgr_show_layer: Leave(layertype npt InputPanel)"); + return; + } + if (show) { + if (data == NULL) { + uifw_trace("win_mgr_show_layer: Leave(show but input surface not exist)"); + return; + } + inusurf = find_uifw_win_surface_by_ws((struct weston_surface *)data); + if (! inusurf) { + uifw_trace("win_mgr_show_layer: Leave(show but unknown input surface)"); + return; + } + } + + /* all input panel surface show/hide */ + wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) { + if ((el->layertype == LAYER_TYPE_CURSOR) || + (el->layertype == LAYER_TYPE_TOUCH)) continue; + wl_list_for_each (usurf, &el->surface_list, ivi_layer) { + if ((usurf->layertype == LAYER_TYPE_INPUTPANEL) && + (usurf->surface != NULL) && (usurf->mapped != 0) && + (usurf->surface->buffer_ref.buffer != NULL)) { + + if ((inusurf != NULL) && (usurf->win_layer != inusurf->win_layer)) { + win_mgr_set_layer(usurf, usurf->win_layer->layer); + usurf->raise = 1; + win_mgr_change_surface(usurf->surface, -1, 1); + } + if ((show == 0) || (ico_ivi_debugflag() & ICO_IVI_DEBUG_SHOW_INPUTLAYER)) { + /* show input panel automatically */ + ico_window_mgr_set_visible(usurf, show | 2); + } + else { + /* send hint event to HomeScreen */ + ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE, + usurf, show, ICO_WINDOW_MGR_RAISE_RAISE, 1, 0,0); + } + } + } + } + uifw_trace("win_mgr_show_layer: Leave"); +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief win_mgr_fullscreen: shell full screen surface control + * + * @param[in] event control event + * @param[in] surface target weston surface + * @return result + */ +/*--------------------------------------------------------------------------*/ +static int +win_mgr_fullscreen(int event, struct weston_surface *surface) +{ + struct uifw_win_surface *usurf; + struct uifw_win_surface *tmpusurf; + struct uifw_win_layer *ulayer; + int width, height; + int sx, sy; + + uifw_trace("win_mgr_fullscreen: Enter(event=%d, surface=%08x)", event, (int)surface); + + if (event == SHELL_FULLSCREEN_HIDEALL) { + /* hide all fullscreen srface */ + uifw_trace("win_mgr_fullscreen: SHELL_FULLSCREEN_HIDEALL"); + + wl_list_for_each (ulayer, &_ico_win_mgr->ivi_layer_list, link) { + if (ulayer->layertype >= LAYER_TYPE_TOUCH) continue; + wl_list_for_each_safe (usurf, tmpusurf, &ulayer->surface_list, ivi_layer) { + if (usurf->layertype == LAYER_TYPE_FULLSCREEN) { + ico_window_mgr_set_visible(usurf, 2); + usurf->layertype = usurf->old_layertype; + win_mgr_set_layer(usurf, usurf->old_layer->layer); + win_mgr_change_surface(usurf->surface, -1, 1); + /* send event to HomeScreen */ + ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_CONFIGURE, + usurf, usurf->x, usurf->y, + usurf->width, usurf->height, 0); + } + } + } + uifw_trace("win_mgr_fullscreen: Leave"); + return 0; + } + + usurf = find_uifw_win_surface_by_ws(surface); + if (! usurf) { + uifw_trace("win_mgr_fullscreen: Leave(surface dose not exist)"); + return -1; + } + + switch(event) { + case SHELL_FULLSCREEN_ISTOP: /* check if top surrace */ + if (usurf->layertype == LAYER_TYPE_FULLSCREEN) { + wl_list_for_each (ulayer, &_ico_win_mgr->ivi_layer_list, link) { + if (ulayer->layertype >= LAYER_TYPE_TOUCH) continue; + wl_list_for_each(tmpusurf, &ulayer->surface_list, ivi_layer) { + if (usurf == tmpusurf) { + uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_ISTOP" + "(fullscreen surface)", usurf->surfaceid); + return 1; + } + if (tmpusurf->layertype == LAYER_TYPE_FULLSCREEN) { + uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_ISTOP" + "(fullscreen surface but not top)", usurf->surfaceid); + return 0; + } + } + } + } + uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_ISTOP" + "(not fullscreen surface)", usurf->surfaceid); + return 0; + case SHELL_FULLSCREEN_SET: /* change surface to full screen */ + uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_SET", usurf->surfaceid); + if (usurf->layertype != LAYER_TYPE_FULLSCREEN) { + usurf->old_layertype = usurf->layertype; + usurf->layertype = LAYER_TYPE_FULLSCREEN; + usurf->old_layer = usurf->win_layer; + /* send hint event to HomeScreen */ + ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_CONFIGURE, + usurf, usurf->x, usurf->y, + usurf->width, usurf->height, 1); + } + break; + case SHELL_FULLSCREEN_STACK: /* change surface to top of layer */ + uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_STACK", usurf->surfaceid); + if (usurf->mapped == 0) { + uifw_trace("win_mgr_fullscreen: not map, change to map"); + width = usurf->node_tbl->disp_width; + height = usurf->node_tbl->disp_height; + sx = 0; + sy = 0; + win_mgr_map_surface(usurf->surface, &width, &height, &sx, &sy); + } + if ((usurf->surface != NULL) && (usurf->mapped != 0) && + (usurf->surface->buffer_ref.buffer != NULL)) { + /* fullscreen surface raise */ + win_mgr_set_raise(usurf, 1); + } + break; + case SHELL_FULLSCREEN_CONF: /* configure full screen surface */ + uifw_trace("win_mgr_fullscreen: %08x SHELL_FULLSCREEN_CONF", usurf->surfaceid); + if (usurf->mapped == 0) { + width = usurf->node_tbl->disp_width; + height = usurf->node_tbl->disp_height; + sx = 0; + sy = 0; + win_mgr_map_surface(usurf->surface, &width, &height, &sx, &sy); + } + break; + default: + uifw_trace("win_mgr_fullscreen: Leave(unknown event %d)", event); + return -1; + } + uifw_trace("win_mgr_fullscreen: Leave"); + return 0; +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief win_mgr_reset_focus: reset surface focus + * + * @param[in] usurf UIFW surface + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +win_mgr_reset_focus(struct uifw_win_surface *usurf) +{ + struct weston_seat *seat; + struct weston_surface *surface; + + uifw_trace("win_mgr_reset_focus: Enter(%08x)", usurf->surfaceid); + + seat = container_of (_ico_win_mgr->compositor->seat_list.next, struct weston_seat, link); + surface = usurf->surface; + if ((seat != NULL) && (surface != NULL)) { + /* reset pointer focus */ + if ((seat->pointer != NULL) && (seat->pointer->focus == surface)) { + weston_pointer_set_focus(seat->pointer, NULL, + wl_fixed_from_int(0), wl_fixed_from_int(0)); + } + /* reset touch focus */ + if ((seat->touch != NULL) && (seat->touch->focus == surface)) { + weston_touch_set_focus(seat, NULL); + } + /* reset keyboard focus */ + if ((seat->keyboard != NULL) && (seat->keyboard->focus == surface)) { + weston_keyboard_set_focus(seat->keyboard, NULL); + } + } + uifw_trace("win_mgr_reset_focus: Leave"); +} + +/*--------------------------------------------------------------------------*/ +/** * @brief ico_window_mgr_set_visible: change surface visibility * * @param[in] usurf UIFW surface - * @param[in] visible visible(=1)/unvisible(0) + * @param[in] visible bit 0: visible(=1)/unvisible(=0) + * bit 1: widht anima(=1)/without anima(=0) * @return none */ /*--------------------------------------------------------------------------*/ WL_EXPORT void ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible) { - if (visible) { - if (usurf->visible == 0) { - uifw_trace("ico_window_mgr_set_visible: Chagne to Visible(%08x)", (int)usurf); + int retanima; + + if (visible & 1) { + if ((usurf->visible == 0) || + (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE)) { + uifw_trace("ico_window_mgr_set_visible: Chagne to Visible(%08x) x/y=%d/%d", + usurf->surfaceid, usurf->x, usurf->y); usurf->visible = 1; + ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y, + usurf->width, usurf->height); + if ((visible & 2) && (win_mgr_hook_animation != NULL)) { + usurf->animation.pos_x = usurf->x; + usurf->animation.pos_y = usurf->y; + usurf->animation.pos_width = usurf->width; + usurf->animation.pos_height = usurf->height; + usurf->animation.no_configure = 0; + retanima = (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_OPSHOW, + (void *)usurf); + uifw_trace("ico_window_mgr_set_visible: show animation = %d", retanima); + } /* change unvisible to visible, restack surface list */ - ico_window_mgr_restack_layer(usurf, 0); + ico_window_mgr_restack_layer(usurf); } } else { - if (usurf->visible != 0) { - uifw_trace("ico_window_mgr_set_visible: Chagne to Unvisible(%08x)", (int)usurf); - usurf->visible = 0; - /* change visible to unvisible, restack surface list */ - ico_window_mgr_restack_layer(usurf, 0); + if ((usurf->visible != 0) || + (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE)) { + + uifw_trace("ico_window_mgr_set_visible: Chagne to Unvisible(%08x)", + usurf->surfaceid); + + /* Reset focus */ + win_mgr_reset_focus(usurf); + + retanima = ICO_WINDOW_MGR_ANIMATION_RET_ANIMA; + if ((visible & 2) && (win_mgr_hook_animation != NULL)) { + usurf->animation.pos_x = usurf->x; + usurf->animation.pos_y = usurf->y; + usurf->animation.pos_width = usurf->width; + usurf->animation.pos_height = usurf->height; + usurf->animation.no_configure = 0; + retanima = (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_OPHIDE, + (void *)usurf); + uifw_trace("ico_window_mgr_set_visible: hide animation = %d", retanima); + if (retanima != ICO_WINDOW_MGR_ANIMATION_RET_ANIMANOCTL) { + usurf->visible = 0; + /* Weston surface configure */ + ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y, + usurf->width, usurf->height); + } + } + else { + usurf->visible = 0; + /* Weston surface configure */ + ico_window_mgr_set_weston_surface(usurf, usurf->x, usurf->y, + usurf->width, usurf->height); + } + ico_window_mgr_restack_layer(usurf); } } ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE, - usurf, usurf->visible, usurf->raise, 0, 0,0); + usurf, usurf->visible, usurf->raise, 0, 0, 0); } /*--------------------------------------------------------------------------*/ @@ -3077,30 +3787,55 @@ ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible) static void win_mgr_set_raise(struct uifw_win_surface *usurf, const int raise) { - uifw_trace("win_mgr_set_raise: Enter(%08x,%d) layer=%x", - (int)usurf, raise, (int)usurf->win_layer->layer); + struct uifw_win_surface *eu; + + uifw_trace("win_mgr_set_raise: Enter(%08x,%d) layer=%x type=%d", + (int)usurf, raise, (int)usurf->win_layer->layer, usurf->layertype); wl_list_remove(&usurf->ivi_layer); - if (raise) { + if (raise & 1) { /* raise ... surface stack to top of layer */ - wl_list_insert(&usurf->win_layer->surface_list, &usurf->ivi_layer); + if (usurf->layertype == LAYER_TYPE_INPUTPANEL) { + /* if input panel, top of surface list */ + uifw_trace("win_mgr_set_raise: Raise Link to Top(InputPanel)"); + wl_list_insert(&usurf->win_layer->surface_list, &usurf->ivi_layer); + } + else { + /* if not input panel, search not input panel */ + wl_list_for_each (eu, &usurf->win_layer->surface_list, ivi_layer) { + if (eu->layertype != LAYER_TYPE_INPUTPANEL) break; + } + uifw_trace("win_mgr_set_raise: Raise Link to Top(Normal)"); + wl_list_insert(eu->ivi_layer.prev, &usurf->ivi_layer); + } usurf->raise = 1; - uifw_trace("win_mgr_set_raise: Raise Link to Top"); } else { /* Lower ... surface stack to bottom of layer */ - wl_list_insert(usurf->win_layer->surface_list.prev, &usurf->ivi_layer); + if (usurf->layertype == LAYER_TYPE_INPUTPANEL) { + /* if input panel, search not input panel */ + uifw_trace("win_mgr_set_raise: Lower Link to Bottom(InputPanel)"); + wl_list_for_each (eu, &usurf->win_layer->surface_list, ivi_layer) { + if (eu->layertype != LAYER_TYPE_INPUTPANEL) break; + } + wl_list_insert(eu->ivi_layer.prev, &usurf->ivi_layer); + } + else { + /* if not input panel, bottom of surface list */ + uifw_trace("win_mgr_set_raise: Lower Link to Bottom(Normal)"); + wl_list_insert(usurf->win_layer->surface_list.prev, &usurf->ivi_layer); + } usurf->raise = 0; - uifw_trace("win_mgr_set_raise: Lower Link to Bottom"); } /* rebild compositor surface list */ - if (usurf->visible) { - ico_window_mgr_restack_layer(usurf, 0); + if ((raise & 2) == 0) { + if (usurf->visible) { + ico_window_mgr_restack_layer(usurf); + } + ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE, + usurf, usurf->visible, usurf->raise, 0, 0,0); } - ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE, - usurf, usurf->visible, usurf->raise, 0, 0,0); - uifw_trace("win_mgr_set_raise: Leave"); } @@ -3127,6 +3862,9 @@ win_mgr_destroy_surface(struct weston_surface *surface) } uifw_trace("win_mgr_destroy_surface: Enter(%08x) %08x", (int)surface, usurf->surfaceid); + /* Reset focus */ + win_mgr_reset_focus(usurf); + /* destory input region */ if (win_mgr_hook_destory) { (*win_mgr_hook_destory)(usurf); @@ -3152,7 +3890,7 @@ win_mgr_destroy_surface(struct weston_surface *surface) /* delete from layer list */ wl_list_remove(&usurf->ivi_layer); - ico_window_mgr_restack_layer(NULL, 0); + ico_window_mgr_restack_layer(NULL); /* delete from cleint list */ wl_list_remove(&usurf->client_link); @@ -3313,12 +4051,13 @@ ico_win_mgr_send_to_mgr(const int event, struct uifw_win_surface *usurf, wl_list_for_each (mgr, &_ico_win_mgr->manager_list, link) { if (mgr->manager) { uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) WINDOW_CREATED" - "(surf=%08x,name=%s,pid=%d,appid=%s)", (int)mgr->resource, + "(surf=%08x,name=%s,pid=%d,appid=%s,type=%x)", (int)mgr->resource, usurf->surfaceid, usurf->winname, usurf->uclient->pid, - usurf->uclient->appid); + usurf->uclient->appid, usurf->layertype); ico_window_mgr_send_window_created(mgr->resource, usurf->surfaceid, usurf->winname, usurf->uclient->pid, - usurf->uclient->appid); + usurf->uclient->appid, + usurf->layertype << 12); } } usurf->created = 1; @@ -3357,12 +4096,14 @@ ico_win_mgr_send_to_mgr(const int event, struct uifw_win_surface *usurf, case ICO_WINDOW_MGR_WINDOW_CONFIGURE: uifw_trace("ico_win_mgr_send_to_mgr: Send Manager(%08x) CONFIGURE" - "(surf=%08x,app=%s,node=%x,layer=%x,x/y=%d/%d,w/h=%d/%d,hint=%d)", + "(surf=%08x,app=%s,node=%x,type=%x,layer=%x," + "x/y=%d/%d,w/h=%d/%d,hint=%d)", (int)mgr->resource, usurf->surfaceid, usurf->uclient->appid, - usurf->node_tbl->node, usurf->win_layer->layer, - param1, param2, param3, param4, param5); + usurf->node_tbl->node, usurf->layertype, + usurf->win_layer->layer, param1, param2, param3, param4, param5); ico_window_mgr_send_window_configure(mgr->resource, usurf->surfaceid, usurf->node_tbl->node, + usurf->layertype << 12, usurf->win_layer->layer, param1, param2, param3, param4, param5); break; @@ -3412,14 +4153,21 @@ win_mgr_set_scale(struct uifw_win_surface *usurf) if ((es != NULL) && (es->buffer_ref.buffer)) { if (usurf->client_width == 0) usurf->client_width = es->geometry.width; if (usurf->client_height == 0) usurf->client_height = es->geometry.height; - scalex = (float)usurf->width / (float)usurf->client_width; - scaley = (float)usurf->height / (float)usurf->client_height; + if ((usurf->client_width > 0) && (usurf->client_height > 0)) { + scalex = (float)usurf->width / (float)usurf->client_width; + scaley = (float)usurf->height / (float)usurf->client_height; + } + else { + scalex = 1.0f; + scaley = 1.0f; + } uifw_debug("win_mgr_set_scale: %08x X=%4.2f(%d/%d) Y=%4.2f(%d/%d)", usurf->surfaceid, scalex, usurf->width, usurf->client_width, scaley, usurf->height, usurf->client_height); usurf->xadd = 0; usurf->yadd = 0; - if (usurf->attributes & ICO_WINDOW_MGR_ATTR_FIXED_ASPECT) { + if ((ico_ivi_debugflag() & ICO_IVI_DEBUG_FIXED_ASPECT) || + (usurf->attributes & ICO_WINDOW_MGR_ATTR_FIXED_ASPECT)) { if (scalex > scaley) { scalex = scaley; if ((usurf->attributes & ICO_WINDOW_MGR_ATTR_ALIGN_LEFT) == 0) { @@ -3538,10 +4286,8 @@ ico_window_mgr_get_client_usurf(const char *target) } } appid[j] = 0; -#if 0 /* too many debug log */ uifw_debug("ico_window_mgr_get_client_usurf: target=<%s> appid=<%s> win=<%s>", target, appid, winname); -#endif wl_list_for_each (uclient, &_ico_win_mgr->client_list, link) { if (strcmp(uclient->appid, appid) == 0) { @@ -3583,6 +4329,41 @@ ico_window_mgr_is_visible(struct uifw_win_surface *usurf) /*--------------------------------------------------------------------------*/ /** + * @brief ico_window_mgr_active_surface: set active surface + * + * @param[in] surface Weston surface + * @return none + */ +/*--------------------------------------------------------------------------*/ +WL_EXPORT void +ico_window_mgr_active_surface(struct weston_surface *surface) +{ + struct uifw_win_surface *usurf; + + /* find surface */ + usurf = find_uifw_win_surface_by_ws(surface); + if (! usurf) { + uifw_trace("ico_window_mgr_active_surface: Enter(%08x)", (int)surface); + uifw_trace("ico_window_mgr_active_surface: Leave(Not Exist)"); + return; + } + uifw_trace("ico_window_mgr_active_surface: Enter(%08x)", usurf->surfaceid); + + if ((usurf != _ico_win_mgr->active_pointer_usurf) || + (usurf != _ico_win_mgr->active_keyboard_usurf)) { + + /* set weston active surface */ + win_mgr_set_active(usurf, ICO_WINDOW_MGR_ACTIVE_POINTER | + ICO_WINDOW_MGR_ACTIVE_KEYBOARD); + /* send active event to manager */ + (void) ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_ACTIVE, + usurf, ICO_WINDOW_MGR_ACTIVE_SELECTED, 0,0,0,0); + } + uifw_trace("ico_window_mgr_active_surface: Leave(OK)"); +} + +/*--------------------------------------------------------------------------*/ +/** * @brief ico_window_mgr_set_hook_animation: set animation hook routine * * @param[in] hook_animation hook routine @@ -3642,45 +4423,92 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) int nodeId; int i; int idx; - char *p; struct weston_output *output; struct weston_config_section *section; char *displayno = NULL; + char *p; + char *wrkstrp; + struct wl_event_loop *loop; uifw_info("ico_window_mgr: Enter(module_init)"); /* get ivi debug level */ - section = weston_config_get_section(ec->config, "ivi-debug", NULL, NULL); + section = weston_config_get_section(ec->config, "ivi-option", NULL, NULL); if (section) { weston_config_section_get_int(section, "flag", &_ico_ivi_debug_flag, 0); weston_config_section_get_int(section, "log", &_ico_ivi_debug_level, 3); } - /* get display number list */ + /* get display number */ section = weston_config_get_section(ec->config, "ivi-display", NULL, NULL); if (section) { weston_config_section_get_string(section, "displayno", &displayno, NULL); + weston_config_section_get_int(section, "inputpanel", + &_ico_ivi_inputpanel_display, 0); } /* get layer id */ section = weston_config_get_section(ec->config, "ivi-layer", NULL, NULL); if (section) { weston_config_section_get_int(section, "default", &_ico_ivi_default_layer, 1); - weston_config_section_get_int(section, "startup", &_ico_ivi_startup_layer, 109); - weston_config_section_get_int(section, "input", &_ico_ivi_input_layer, 101); - weston_config_section_get_int(section, "cursor", &_ico_ivi_cursor_layer, 102); weston_config_section_get_int(section, "background", &_ico_ivi_background_layer, 0); + weston_config_section_get_int(section, "touch", &_ico_ivi_touch_layer, 101); + weston_config_section_get_int(section, "cursor", &_ico_ivi_cursor_layer, 102); + weston_config_section_get_int(section, "startup", &_ico_ivi_startup_layer, 103); + weston_config_section_get_string(section, "inputpaneldeco", &wrkstrp, NULL); + if (wrkstrp) { + p = strtok(wrkstrp, ";,"); + if (p) { + _ico_ivi_inputdeco_mag = strtol(p, (char **)0, 0); + p = strtok(NULL, ";,"); + if (p) { + _ico_ivi_inputdeco_diff = strtol(p, (char **)0, 0); + } + } + free(wrkstrp); + } } + if (_ico_ivi_inputdeco_mag < 20) _ico_ivi_inputdeco_mag = 100; /* get animation default */ section = weston_config_get_section(ec->config, "ivi-animation", NULL, NULL); if (section) { weston_config_section_get_string(section, "default", &_ico_ivi_animation_name, NULL); - weston_config_section_get_int(section, "time", &_ico_ivi_animation_time, 600); - weston_config_section_get_int(section, "fps", &_ico_ivi_animation_fps, 15); + weston_config_section_get_string(section, "inputpanel", + &_ico_ivi_inputpanel_animation, NULL); + weston_config_section_get_int(section, "time", &_ico_ivi_animation_time, 500); + weston_config_section_get_int(section, "fps", &_ico_ivi_animation_fps, 30); + if (_ico_ivi_animation_name) { + p = strtok(_ico_ivi_animation_name, ";,"); + if (p) { + p = strtok(NULL, ";."); + if (p) { + _ico_ivi_animation_time = strtol(p, (char **)0, 0); + p = strtok(NULL, ";."); + if (p) { + _ico_ivi_animation_fps = strtol(p, (char **)0, 0); + } + } + } + } + if (_ico_ivi_inputpanel_animation) { + p = strtok(_ico_ivi_inputpanel_animation, ";,"); + if (p) { + p = strtok(NULL, ",;"); + if (p) { + _ico_ivi_inputpanel_anima_time = strtol(p, (char **)0, 0); + } + } + } } - if (_ico_ivi_animation_time < 100) _ico_ivi_animation_time = 600; - if (_ico_ivi_animation_fps < 2) _ico_ivi_animation_fps = 15; + if (_ico_ivi_animation_name == NULL) + _ico_ivi_animation_name = (char *)"fade"; + if (_ico_ivi_inputpanel_animation == NULL) + _ico_ivi_inputpanel_animation = (char *)"fade"; + if (_ico_ivi_animation_time < 100) _ico_ivi_animation_time = 500; + if (_ico_ivi_animation_fps < 3) _ico_ivi_animation_fps = 30; + if (_ico_ivi_inputpanel_anima_time < 100) + _ico_ivi_inputpanel_anima_time = _ico_ivi_animation_time; /* create ico_window_mgr management table */ _ico_win_mgr = (struct ico_win_mgr *)malloc(sizeof(struct ico_win_mgr)); @@ -3695,7 +4523,6 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) uifw_error("ico_window_mgr: malloc failed"); return -1; } - uifw_debug("ico_window_mgr: table=%08x", (int)_ico_win_mgr); memset(_ico_win_mgr->surfaceid_map, 0, INIT_SURFACE_IDS/8); _ico_win_mgr->compositor = ec; @@ -3725,9 +4552,9 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) p = NULL; } _ico_num_nodes = 0; - wl_list_for_each(output, &ec->output_list, link) { + wl_list_for_each (output, &ec->output_list, link) { wl_list_init(&_ico_win_mgr->map_animation[_ico_num_nodes].link); - _ico_win_mgr->map_animation[_ico_num_nodes].frame = win_mgr_check_surfacemap; + _ico_win_mgr->map_animation[_ico_num_nodes].frame = win_mgr_check_mapsurrace; wl_list_insert(output->animation_list.prev, &_ico_win_mgr->map_animation[_ico_num_nodes].link); _ico_num_nodes++; @@ -3735,11 +4562,11 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) } memset(&_ico_node_table[0], 0, sizeof(_ico_node_table)); i = 0; - wl_list_for_each(output, &ec->output_list, link) { + wl_list_for_each (output, &ec->output_list, link) { p = strtok(p, ","); if (p) { idx = strtol(p, (char **)0, 0); - uifw_trace("ico_window_mgr: config Display.%d is %d", i, idx); + uifw_trace("ico_window_mgr: config Display.%d is weston display.%d", i, idx); p = NULL; if ((idx < 0) || (idx >= _ico_num_nodes)) { idx = i; @@ -3759,6 +4586,7 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) } _ico_node_table[idx].node = idx + 0x100; _ico_node_table[idx].displayno = i; + _ico_node_table[idx].output = output; _ico_node_table[idx].disp_x = output->x; _ico_node_table[idx].disp_y = output->y; _ico_node_table[idx].disp_width = output->width; @@ -3769,13 +4597,21 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) idx = 0; for (i = 0; i < _ico_num_nodes; i++) { _ico_node_table[i].node &= 0x0ff; - uifw_trace("ico_window_mgr: Display.%d no=%d x/y=%d/%d w/h=%d/%d", - i, _ico_node_table[i].displayno, - _ico_node_table[i].disp_x, _ico_node_table[i].disp_y, - _ico_node_table[i].disp_width, _ico_node_table[i].disp_height); + uifw_info("ico_window_mgr: Display.%d no=%d x/y=%d/%d w/h=%d/%d", + i, _ico_node_table[i].displayno, + _ico_node_table[i].disp_x, _ico_node_table[i].disp_y, + _ico_node_table[i].disp_width, _ico_node_table[i].disp_height); } if (displayno) free(displayno); + if (_ico_ivi_inputpanel_display >= _ico_num_nodes) { + _ico_ivi_inputpanel_display = 0; + } + uifw_info("ico_window_mgr: inputpanel_display=%d", _ico_ivi_inputpanel_display); + + /* set default display to ico_ivi_shell */ + ivi_shell_set_default_display(_ico_node_table[_ico_ivi_inputpanel_display].output); + /* my node Id ... this version fixed 0 */ nodeId = ico_ivi_get_mynode(); @@ -3783,6 +4619,14 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) uifw_trace("ico_window_mgr: NoedId=%04x SurfaceIdBase=%08x", nodeId, _ico_win_mgr->surface_head); + /* get seat for touch down counter check */ + touch_check_seat = container_of(ec->seat_list.next, struct weston_seat, link); + _ico_win_mgr->waittime = 1000; + loop = wl_display_get_event_loop(ec->wl_display); + _ico_win_mgr->wait_mapevent = + wl_event_loop_add_timer(loop, win_mgr_timer_mapsurrace, NULL); + wl_event_source_timer_update(_ico_win_mgr->wait_mapevent, 1000); + /* Hook to IVI-Shell */ ico_ivi_shell_hook_bind(win_mgr_bind_client); ico_ivi_shell_hook_unbind(win_mgr_unbind_client); @@ -3793,18 +4637,23 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) ico_ivi_shell_hook_select(win_mgr_select_surface); ico_ivi_shell_hook_title(win_mgr_set_title); ico_ivi_shell_hook_move(win_mgr_surface_move); - - uifw_info("ico_window_mgr: animation name=%s time=%d fps=%d", - _ico_ivi_animation_name, _ico_ivi_animation_time, _ico_ivi_animation_fps); - uifw_info("ico_window_mgr: layer default=%d startup=%d background=%d", - _ico_ivi_default_layer, _ico_ivi_startup_layer, _ico_ivi_background_layer); - uifw_info("ico_window_mgr: layer input=%d cursor=%d", - _ico_ivi_input_layer, _ico_ivi_cursor_layer); - uifw_info("ico_window_mgr: debug flag=%x log level=%d", + ico_ivi_shell_hook_show_layer(win_mgr_show_layer); + ico_ivi_shell_hook_fullscreen(win_mgr_fullscreen); + + uifw_info("ico_window_mgr: animation name=%s/%s time=%d/%d fps=%d", + _ico_ivi_animation_name, _ico_ivi_inputpanel_animation, + _ico_ivi_animation_time, _ico_ivi_inputpanel_anima_time, + _ico_ivi_animation_fps); + uifw_info("ico_window_mgr: input panel mag=%d%% diff=%d", + _ico_ivi_inputdeco_mag,_ico_ivi_inputdeco_diff); + uifw_info("ico_window_mgr: layer default=%d background=%d", + _ico_ivi_default_layer, _ico_ivi_background_layer); + uifw_info("ico_window_mgr: layer touch=%d cursor=%d startup=%d", + _ico_ivi_touch_layer, _ico_ivi_cursor_layer, _ico_ivi_startup_layer); + uifw_info("ico_window_mgr: option flag=0x%04x log level=%d", _ico_ivi_debug_flag, _ico_ivi_debug_level); uifw_info("ico_window_mgr: Leave(module_init)"); return 0; } - diff --git a/src/ico_window_mgr.h b/src/ico_window_mgr.h index 44b6a4e..74bf5d4 100644 --- a/src/ico_window_mgr.h +++ b/src/ico_window_mgr.h @@ -55,6 +55,7 @@ struct uifw_client { struct uifw_node_table { uint16_t node; /* node Id */ uint16_t displayno; /* weston display number */ + struct weston_output *output; /* weston output */ int disp_x; /* display frame buffer X-coordinate */ int disp_y; /* display frame buffer Y-coordinate */ int disp_width; /* display width */ @@ -65,7 +66,7 @@ struct uifw_node_table { struct uifw_win_layer { uint32_t layer; /* Layer Id */ char visible; /* visibility */ - char layer_type; /* layer type */ + char layertype; /* layer type */ char res[2]; /* (unused) */ struct wl_list surface_list; /* Surfacae list */ struct wl_list link; /* Link pointer for layer list */ @@ -83,10 +84,13 @@ struct uifw_surface_map { uint16_t height; /* height */ uint16_t stride; /* stride */ uint16_t framerate; /* update frame rate (frame/sec) */ + uint16_t interval; /* interval time (ms) */ + uint32_t lasttime; /* last event time (ms) */ char initflag; /* map event send flag(0=no/1=yes) */ - char res; /* (unused) */ - struct wl_list map_link; /* map list */ - struct wl_list surf_link; /* map list from UIFW surface */ + char eventque; /* send event queue flag */ + char res[2]; /* (unused) */ + struct wl_list map_link; /* surface map list */ + struct wl_list surf_link; /* surface map list from UIFW surface */ }; /* UIFW surface */ @@ -95,6 +99,7 @@ struct uifw_win_surface { uint32_t surfaceid; /* UIFW SurfaceId */ struct uifw_node_table *node_tbl; /* Node manager of ico_window_mgr */ struct uifw_win_layer *win_layer; /* surface layer */ + struct uifw_win_layer *old_layer; /* saved surface layer for change full screen*/ struct weston_surface *surface; /* Weston surface */ struct shell_surface *shsurf; /* Shell(IVI-Shell) surface */ struct uifw_client *uclient; /* Client */ @@ -120,7 +125,9 @@ struct uifw_win_surface { char mapped; /* end of map */ char restrain_configure; /* restrant configure event */ char set_transform; /* surface transform flag */ - char res; /* (unused) */ + char layertype; /* surface layer type */ + char old_layertype; /* surface old layer type */ + char res[3]; /* (unused) */ struct _uifw_win_surface_animation { /* wndow animation */ struct weston_animation animation; /* weston animation control */ uint16_t type; /* current animation type */ @@ -216,11 +223,13 @@ struct uifw_win_surface *ico_window_mgr_get_usurf_client(const uint32_t surfacei /* get application surface */ struct uifw_win_surface *ico_window_mgr_get_client_usurf(const char *target); /* rebuild surface layer list */ -void ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touch); - /* input layer ccontrol for input manager*/ -void ico_window_mgr_input_layer(int omit); +void ico_window_mgr_restack_layer(struct uifw_win_surface *usurf); + /* touch layer control for input manager*/ +void ico_window_mgr_touch_layer(int omit); /* chek surface visibility */ int ico_window_mgr_is_visible(struct uifw_win_surface *usurf); + /* set active surface */ +void ico_window_mgr_active_surface(struct weston_surface *surface); /* set window animation hook */ void ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data)); /* set surface visible change hook */ diff --git a/tests/test-homescreen.c b/tests/test-homescreen.c index 40bf037..458a5b9 100644 --- a/tests/test-homescreen.c +++ b/tests/test-homescreen.c @@ -526,7 +526,8 @@ search_surfaceid(struct display *display, const int surfaceid) static void window_created(void *data, struct ico_window_mgr *ico_window_mgr, - uint32_t surfaceid, const char *winname, int32_t pid, const char *appid) + uint32_t surfaceid, const char *winname, int32_t pid, + const char *appid, int32_t layertype) { struct display *display = data; struct surface_name *p; @@ -541,12 +542,14 @@ window_created(void *data, struct ico_window_mgr *ico_window_mgr, p = p->next; } if (p) { - print_log("HOMESCREEN: Event[window_created] surface=%08x(app=%s,name=%s) exist", - (int)surfaceid, appid, winname); + print_log("HOMESCREEN: Event[window_created] " + "surface=%08x(app=%s,name=%s,type=%x) exist", + (int)surfaceid, appid, winname, layertype); } else { - print_log("HOMESCREEN: Event[window_created] new surface=%08x(app=%s) winname=%s", - (int)surfaceid, appid, winname); + print_log("HOMESCREEN: Event[window_created] " + "new surface=%08x(app=%s) winname=%s layertype=%x", + (int)surfaceid, appid, winname, layertype); p = malloc(sizeof(struct surface_name)); if (! p) { return; @@ -650,15 +653,15 @@ window_visible(void *data, struct ico_window_mgr *ico_window_mgr, static void window_configure(void *data, struct ico_window_mgr *ico_window_mgr, - uint32_t surfaceid, uint32_t node, uint32_t layer, + uint32_t surfaceid, uint32_t node, int32_t layertype, uint32_t layer, int32_t x, int32_t y, int32_t width, int32_t height, int32_t hint) { struct display *display = data; struct surface_name *p; print_log("HOMESCREEN: Event[window_configure] surface=%08x " - "node=%x x/y=%d/%d w/h=%d/%d hint=%d", - (int)surfaceid, node, x, y, width, height, hint); + "node=%x layer=%x.%x x/y=%d/%d w/h=%d/%d hint=%d", + (int)surfaceid, node, layertype, layer, x, y, width, height, hint); p = search_surfaceid(display, (int)surfaceid); if (! p) { @@ -692,9 +695,9 @@ window_active(void *data, struct ico_window_mgr *ico_window_mgr, static void window_surfaces(void *data, struct ico_window_mgr *ico_window_mgr, - const char *appid, struct wl_array *surfaces) + const char *appid, int32_t pid, struct wl_array *surfaces) { - print_log("HOMESCREEN: Event[app_surfaces] app=%s", appid); + print_log("HOMESCREEN: Event[app_surfaces] app=%s pid=%d", appid, pid); } static void diff --git a/tests/testdata/hs_alltest.dat b/tests/testdata/hs_alltest.dat index 03b5e36..f1592a3 100644 --- a/tests/testdata/hs_alltest.dat +++ b/tests/testdata/hs_alltest.dat @@ -4,6 +4,7 @@ # 1. Launch Application (and app create surface) launch ../tests/test-client < ../tests/testdata/cl_surface1.dat 2> ../tests/testlog/test-client01.log 1>&2 waitcreate 2 +move test-client 250 150 show test-client sleep 4 waitdestroy 60 @@ -87,20 +88,28 @@ sleep 1 hide test-client 1 sleep 2 # -### zoom and show/hide -##animation test-client zoom 400 -##show test-client 1 -##sleep 1 -##hide test-client 1 -##sleep 3 +# zoom and show/hide +show test-client +sleep 1 +animation test-client zoom 600 +show test-client 1 +sleep 2 +hide test-client 1 +sleep 2 # -# fade and move +# zoom and move +animation test-client zoom 1000 show test-client sleep 1 -animation test-client fade 600 -move test-client 600 200 0 1 -sleep 1.5 -move test-client 500 300 0 1 +move test-client 100 50 0 1 +sleep 2 +move test-client 500 400 0 1 +sleep 2 +# +# zoom and resize +resize test-client 80 50 1 +sleep 2 +resize test-client 300 200 1 sleep 2 # # slide and move @@ -122,9 +131,90 @@ animation test-client slide 600 resize test-client 80 50 1 sleep 1.5 resize test-client 300 200 1 -sleep 3 +sleep 1 # -waitdestroy 60 +kill test-client +waitdestroy 5 +sleep 1 +# +launch ../tests/test-eflapp @1 -color=0xe02040ff 2> ../tests/testlog/test-eflapp.log 1>&2 +waitcreate 2 +# +hide test-eflapp@1 +move test-eflapp@1 0 150 +sleep 1 +animation test-eflapp@1 wipe.toleft 800 +show test-eflapp@1 1 +sleep 1 +hide test-eflapp@1 1 +sleep 1 +# +move test-eflapp@1 920 250 +hide test-eflapp@1 +sleep 1 +animation test-eflapp@1 wipe.toright 800 +show test-eflapp@1 1 +sleep 1 +hide test-eflapp@1 1 +sleep 1 +# +move test-eflapp@1 400 0 +hide test-eflapp@1 +sleep 1 +animation test-eflapp@1 wipe.tobottom 800 +show test-eflapp@1 1 +sleep 1 +hide test-eflapp@1 1 +sleep 1 +# +move test-eflapp@1 400 520 +hide test-eflapp@1 +sleep 1 +animation test-eflapp@1 wipe.totop 800 +show test-eflapp@1 1 +sleep 1 +hide test-eflapp@1 1 +sleep 1 +# +move test-eflapp@1 0 150 +hide test-eflapp@1 +sleep 1 +animation test-eflapp@1 swing.toleft 800 +show test-eflapp@1 1 +sleep 1 +hide test-eflapp@1 1 +sleep 1 +# +move test-eflapp@1 920 250 +hide test-eflapp@1 +sleep 1 +animation test-eflapp@1 swing.toright 800 +show test-eflapp@1 1 +sleep 1 +hide test-eflapp@1 1 +sleep 1 +# +move test-eflapp@1 400 0 +hide test-eflapp@1 +sleep 1 +animation test-eflapp@1 swing.tobottom 800 +show test-eflapp@1 1 +sleep 1 +hide test-eflapp@1 1 +sleep 1 +# +move test-eflapp@1 400 520 +hide test-eflapp@1 +sleep 1 +animation test-eflapp@1 swing.totop 800 +show test-eflapp@1 1 +sleep 1 +hide test-eflapp@1 1 +sleep 1 +# +kill test-eflapp@1 +sleep 1 +waitdestroy 5 sleep 1 # # 4. Launch Weston sample client @@ -179,95 +269,95 @@ sleep 1 # 5. Set Layer launch ../tests/test-eflapp @1 -color=0xe02040ff > ../tests/testlog/test-eflapp1.log 1>&2 waitcreate 2 -layer test-eflapp@1 101 +layer test-eflapp@1 51 move test-eflapp@1 100 200 show test-eflapp@1 -sleep 0.5 +sleep 0.2 launch ../tests/test-eflapp @2 -color=0xd020ff40 > ../tests/testlog/test-eflapp2.log 1>&2 waitcreate 2 -layer test-eflapp@2 103 +layer test-eflapp@2 53 move test-eflapp@2 200 300 show test-eflapp@2 -sleep 0.5 +sleep 0.2 launch ../tests/test-eflapp @3 -color=0xc0ff2040 > ../tests/testlog/test-eflapp3.log 1>&2 waitcreate 2 -layer test-eflapp@3 102 +layer test-eflapp@3 52 move test-eflapp@3 300 400 show test-eflapp@3 -sleep 0.5 +sleep 0.2 launch ../tests/test-eflapp @4 -color=0xb0808080 > ../tests/testlog/test-eflapp4.log 1>&2 waitcreate 2 -layer test-eflapp@4 102 +layer test-eflapp@4 52 move test-eflapp@4 400 500 show test-eflapp@4 -sleep 0.5 +sleep 0.2 launch ../tests/test-eflapp @5 -color=0xa040a060 > ../tests/testlog/test-eflapp5.log 1>&2 waitcreate 2 -layer test-eflapp@5 102 +layer test-eflapp@5 52 move test-eflapp@5 500 600 show test-eflapp@5 sleep 1 hide test-eflapp@2 sleep 1 show test-eflapp@2 -sleep 2 +sleep 1 # # resize EFL application resize test-eflapp@2 300 300 -sleep 1 +sleep 0.5 resize test-eflapp@3 720 520 -sleep 1 +sleep 0.5 resize test-eflapp@3 520 380 -sleep 1 +sleep 0.5 resize test-eflapp@2 520 380 -sleep 2 +sleep 1 # # 6. Raise/Lower raise test-eflapp@3 -sleep 1 +sleep 0.5 raise test-eflapp@4 -sleep 1 +sleep 0.5 raise test-eflapp@5 -sleep 1 +sleep 0.5 lower test-eflapp@5 -sleep 1 +sleep 0.5 lower test-eflapp@4 -sleep 1 +sleep 0.5 lower test-eflapp@3 -sleep 2 +sleep 1 # # 7. Layer Change -layer test-eflapp@1 100 +layer test-eflapp@1 50 +sleep 0.5 +layer test-eflapp@2 50 sleep 1 -layer test-eflapp@2 100 -sleep 2 # # 8. layer visibility control -layer_visible 102 0 -sleep 1 -layer_visible 102 1 +layer_visible 52 0 +sleep 0.5 +layer_visible 52 1 sleep 1 # 9. kill eflapp's kill test-eflapp@1 -sleep 0.5 +sleep 0.3 kill test-eflapp@2 -sleep 0.5 +sleep 0.3 kill test-eflapp@3 -sleep 0.5 +sleep 0.3 kill test-eflapp@4 -sleep 0.5 +sleep 0.3 kill test-eflapp@5 -sleep 2 +sleep 1 # # 10. Input test launch ../tests/test-client @1 -color=0xe0ff2020 -postsleep=60 < ../tests/testdata/cl_surface3.dat 2> ../tests/testlog/test-client11.log 1>&2 waitcreate 2 sleep 0.3 -layer test-client@1 101 +layer test-client@1 51 move test-client@1 100 200 1 show test-client@1 sleep 0.5 @@ -281,7 +371,7 @@ sleep 0.2 launch ../tests/test-client @2 -color=0xc020ff20 -postsleep=60 < ../tests/testdata/cl_surface3.dat 2> ../tests/testlog/test-client12.log 1>&2 waitcreate 2 sleep 0.3 -layer test-client@2 101 +layer test-client@2 51 move test-client@2 250 300 1 show test-client@2 sleep 0.5 @@ -295,7 +385,7 @@ sleep 0.2 launch ../tests/test-client @3 -color=0xa02020ff -postsleep=60 < ../tests/testdata/cl_surface3.dat 2> ../tests/testlog/test-client13.log 1>&2 waitcreate 2 sleep 0.3 -layer test-client@3 101 +layer test-client@3 51 move test-client@3 400 400 1 show test-client@3 sleep 0.5 diff --git a/tests/testdata/hs_mapsurf.dat b/tests/testdata/hs_mapsurf.dat index eb17d1c..9add39d 100644 --- a/tests/testdata/hs_mapsurf.dat +++ b/tests/testdata/hs_mapsurf.dat @@ -6,6 +6,7 @@ # launch ../tests/test-client < ../tests/testdata/cl_surface5.dat 2> ../tests/testlog/test-client01.log 1>&2 waitcreate 2 +move test-client 300 200 show test-client sleep 1 # map surface @@ -14,7 +15,7 @@ map test-client 0 sleep 1 launch ../tests/test-eflapp @1 -color=0xe02040ff 2> ../tests/testlog/test-eflapp.log 1>&2 waitcreate 2 -move test-eflapp@1 100 150 +move test-eflapp@1 100 50 show test-eflapp@1 sleep 1 # @@ -26,10 +27,10 @@ sleep 2 unmap test-eflapp@1 unmap test-client # -sleep 2 +sleep 1 kill test-client kill test-eflapp@1 -sleep 1 +sleep 0.5 # # 2. End of Test bye diff --git a/tests/weston-plugin-test.map b/tests/weston-plugin-test.map index 83af7b2..e86c5d7 100755 --- a/tests/weston-plugin-test.map +++ b/tests/weston-plugin-test.map @@ -26,6 +26,8 @@ export LD_LIBRARY_PATH=../src/.libs:$LD_LIBRARY_PATH # 6 Start test-homescreen ../tests/test-homescreen < ../tests/testdata/hs_mapsurf.dat 2> ../tests/testlog/test-homescreen.log +##echo "../tests/test-homescreen < ../tests/testdata/hs_mapsurf.dat 2> ../tests/testlog/test-homescreen.log" +##gdb test-homescreen # 7 End of Test sleep 2 diff --git a/tests/weston.ini b/tests/weston.ini index cf21610..664d600 100644 --- a/tests/weston.ini +++ b/tests/weston.ini @@ -6,8 +6,8 @@ modules=error_but_no_problem_for_test.so num-workspaces=1 shell-exe= -#[input-method] -#path=/bin/weekeyboard +[input-method] +path=/bin/weekeyboard #[output] #name=HDMI1 @@ -25,33 +25,39 @@ shell-exe= modules=ico_ivi_shell.so,ico_window_mgr.so,ico_window_animation.so,ico_input_mgr.so [ivi-display] +# logical display number list displayno=1,0 +# default input panel display +inputpanel=0 [ivi-layer] -# default layer id -default=1 -# layer id at the time of the system startup -startup=109 # background layer id background=0 -# input layer id -input=101 +# default(panel) layer id +default=1 +# touch panel layer id +touch=101 # cursor layer id cursor=102 +# layer id at the time of the system startup +startup=103 +# input panel layer decoration (magnification rate(%);difference from the bottom) +inputpaneldeco=120;132 [ivi-animation] -# default animation -default=fade -# animation time (ms) -time=500 -# animation frame rate(frame/sec) -fps=30 - -[ivi-debug] -# debug flags -# bit.0 0=hide on surface create(for with HomeScreen)/1=show on surface create -# bit.1 0=not show if display not exist/1=show if display not exist -flag=0 - +# default animation name;time;rate(frame/sec) +default=fade;500;30 +# input panel surface animation(name;time) +inputpanel=fade;200 + +[ivi-option] +# option flags +# bit.0 1=show surface at screen create if HomeScreen exist/0=not show surface at create +# bit.1 1=1=show if display not exist/0=not show if display not exist +# bit.2 1=show input panel automatically/0=not show automaticaly +# bit.8 1=surface fixed aspect rate/0=not fixed aspect rate +flag=0x0006 + +# debug log output level # 0=no debug log write(1=err/2=warn/3=info/4=trace/5=debug) log=5 -- 2.7.4