From c0ddb023649b0d9d58e36f022cf5eef374aadde4 Mon Sep 17 00:00:00 2001 From: Nakamura Hayato Date: Fri, 30 Aug 2013 20:21:41 +0900 Subject: [PATCH] The change of the configuration and the implementation of the event input. Change-Id: Ic38eaff32bba49a264ac224ed9e5c2407b6d202a Signed-off-by: Nakamura Hayato --- packaging/ico-uxf-weston-plugin.changes | 5 + packaging/ico-uxf-weston-plugin.spec | 4 +- settings/weston.ini | 15 +- src/ico_input_mgr.c | 299 +++++++++++++++- src/ico_ivi_common.h | 9 +- src/ico_ivi_shell.c | 14 +- src/ico_window_mgr.c | 386 ++++++++++++++------- src/ico_window_mgr.h | 23 +- tests/test-client.c | 63 +++- tests/test-homescreen.c | 193 ++++++++++- tests/testdata/cl_surface2.dat | 2 +- tests/testdata/cl_surface4.dat | 2 +- tests/testdata/hs_animatest_all.dat | 67 ---- tests/testdata/hs_mapsurf.dat | 1 - tests/testdata/hs_sendinput.dat | 229 ++++++++++++ ...n-plugin-vbox => weston-plugin-test.send_input} | 11 +- tests/weston.ini | 16 +- tests/weston.ini.fullhd | 64 ---- 18 files changed, 1100 insertions(+), 303 deletions(-) delete mode 100644 tests/testdata/hs_animatest_all.dat create mode 100644 tests/testdata/hs_sendinput.dat rename tests/{weston-plugin-vbox => weston-plugin-test.send_input} (77%) delete mode 100644 tests/weston.ini.fullhd diff --git a/packaging/ico-uxf-weston-plugin.changes b/packaging/ico-uxf-weston-plugin.changes index e22a885..82ad280 100644 --- a/packaging/ico-uxf-weston-plugin.changes +++ b/packaging/ico-uxf-weston-plugin.changes @@ -1,3 +1,8 @@ +* Fri Aug 30 2013 Shibata Makoto submit/tizen/20130828.211548@4cf16ef +- 0.9.01 release +-- The change of the configuration(weston.ini) with the version up of HomeScreen(0.7.x->0.9.x). +-- The implementation of the event input from application. + * Tue Aug 27 2013 Shibata Makoto submit/tizen/20130823.164747@50fc72f - 0.7.03 release -- A correction with version up of weston(1.2.0->1.2.1). diff --git a/packaging/ico-uxf-weston-plugin.spec b/packaging/ico-uxf-weston-plugin.spec index 427e61b..c36fdfb 100644 --- a/packaging/ico-uxf-weston-plugin.spec +++ b/packaging/ico-uxf-weston-plugin.spec @@ -1,7 +1,7 @@ Name: ico-uxf-weston-plugin Summary: Weston Plugins for IVI -Version: 0.7.03 -Release: 1.2 +Version: 0.9.01 +Release: 1.1 Group: Graphics & UI Framework/Automotive UI License: MIT URL: "" diff --git a/settings/weston.ini b/settings/weston.ini index bab9fdc..bd71def 100644 --- a/settings/weston.ini +++ b/settings/weston.ini @@ -12,7 +12,12 @@ shell-exe= name=HDMI3 #mode=1680x945 mode=173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync -#transform=90 +transform=90 + +[output] +name=HDMI2 +#mode=1280x480 +mode=100.00 1280 1300 1400 1400 480 500 600 700 -hsync +vsync #[output] #name=LVDS1 @@ -39,7 +44,9 @@ displayno=1,0 # default layer id default=1 # layer id at the time of the system startup -startup=101 +startup=109 +# background layer id +background=0 # input layer id input=101 # cursor layer id @@ -51,13 +58,13 @@ default=fade # animation time (ms) time=500 # animation frame rate(frame/sec) -fps=15 +fps=30 [ivi-debug] # debug flags # bit.0 0=hide on surface create(for with HomeScreen)/1=show on surface create flag=0 -# 0=no debug log write(1=err/2=warn/3=info/4=debug) +# 0=no debug log write(1=err/2=warn/3=info/4=trace/5=debug) log=4 diff --git a/src/ico_input_mgr.c b/src/ico_input_mgr.c index 609e226..8ea1a4a 100644 --- a/src/ico_input_mgr.c +++ b/src/ico_input_mgr.c @@ -58,6 +58,8 @@ struct ico_input_mgr { struct weston_compositor *compositor; /* Weston Compositor */ struct wl_list ictl_list; /* Input Controller List */ struct wl_list app_list; /* application List */ + struct wl_list dev_list; /* pseudo device List */ + struct weston_seat *seat; /* input seat */ struct wl_resource *inputmgr; }; @@ -96,6 +98,29 @@ struct ico_app_mgr { char appid[ICO_IVI_APPID_LENGTH]; /* application id */ }; +/* Pseudo Input Device Control Flags */ +#define EVENT_MOTION 0x01 /* motion event */ +#define EVENT_BUTTON 0x02 /* button event */ +#define EVENT_TOUCH 0x03 /* touch event */ +#define EVENT_KEY 0x04 /* key event */ +#define EVENT_PENDING 0xff /* pending event input */ + +#define PENDING_X 0x01 /* pending X coordinate */ +#define PENDING_Y 0x02 /* pending Y coordinate */ + +/* Pseudo Input Device Table */ +struct uifw_input_device { + struct wl_list link; /* link to next device */ + uint16_t type; /* device type */ + uint16_t no; /* device number */ + int x; /* current X coordinate */ + int y; /* current Y coordinate */ + int pend_x; /* pending X coordinate */ + int pend_y; /* pending Y coordinate */ + uint16_t pending; /* pending flag */ + char res[2]; /* (unused) */ +}; + /* prototype of static function */ /* bind input manager form manager */ static void ico_control_bind(struct wl_client *client, void *data, @@ -380,9 +405,275 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, const char *appid, uint32_t surfaceid, int32_t type, int32_t deviceno, int32_t code, int32_t value) { - uifw_trace("ico_mgr_send_input_event: Enter(app=%s surf=%08x dev=%d code=%x value=%d)", - appid ? appid : "(NULL)", surfaceid, deviceno, code, value); + struct uifw_win_surface *usurf; /* UIFW surface */ + struct uifw_input_device *dev; /* device control table */ + struct wl_resource *cres; /* event send client resource */ + uint32_t ctime; /* current time(ms) */ + uint32_t serial; /* event serial number */ + int event; /* event flag */ + wl_fixed_t fix_x; /* wayland X coordinate */ + wl_fixed_t fix_y; /* wayland Y coordinate */ + + uifw_trace("ico_mgr_send_input_event: Enter(app=%s surf=%08x dev=%d.%d code=%x value=%d)", + appid ? appid : "(NULL)", surfaceid, type, deviceno, code, value); + + /* search pseudo input device */ + wl_list_for_each (dev, &pInputMgr->dev_list, link) { + if ((dev->type == type) && (dev->no == deviceno)) break; + } + if (&dev->link == &pInputMgr->dev_list) { + /* device not exist, create new device */ + uifw_trace("ico_mgr_send_input_event: new device=%d no=%d", type, deviceno); + dev = malloc(sizeof(struct uifw_input_device)); + if (! dev) { + uifw_error("ico_mgr_send_input_event: Leave(No Memory)"); + return; + } + memset(dev, 0, sizeof(struct uifw_input_device)); + dev->type = type; + dev->no = deviceno; + wl_list_insert(pInputMgr->dev_list.prev, &dev->link); + } + + /* convert pending event */ + event = 0; + if ((code & 0xffff0000) != (EV_REL << 16)) { + code &= 0x0000ffff; + } + switch (type) { + case ICO_INPUT_MGR_DEVICE_TYPE_POINTER: /* mouse */ + case ICO_INPUT_MGR_DEVICE_TYPE_TOUCH: /* touch panel */ + case ICO_INPUT_MGR_DEVICE_TYPE_HAPTIC: /* haptic */ + switch (code) { + case ABS_X: + if (dev->pending & PENDING_Y) { + dev->x = value; + dev->y = dev->pend_y; + dev->pending = 0; + dev->pend_x = 0; + dev->pend_y = 0; + event = EVENT_MOTION; + } + else { + dev->pend_x = value; + dev->pending |= PENDING_X; + event = EVENT_PENDING; + } + break; + case ABS_Y: + if (dev->pending & PENDING_X) { + dev->x = dev->pend_x; + dev->y = value; + dev->pending = 0; + dev->pend_x = 0; + dev->pend_y = 0; + event = EVENT_MOTION; + } + else { + dev->pend_y = value; + dev->pending |= PENDING_Y; + event = EVENT_PENDING; + } + break; + case ABS_Z: + dev->x = (short)(value >> 16); + dev->y = (short)(value & 0x0ffff); + dev->pending = 0; + dev->pend_x = 0; + dev->pend_y = 0; + event = EVENT_MOTION; + break; + case ((EV_REL << 16) | REL_X): + if (dev->pending & PENDING_Y) { + dev->x += value; + dev->y = dev->pend_y; + dev->pending = 0; + dev->pend_x = 0; + dev->pend_y = 0; + event = EVENT_MOTION; + } + else { + dev->pend_x = dev->x + value; + dev->pending |= PENDING_X; + event = EVENT_PENDING; + } + break; + case ((EV_REL << 16) | REL_Y): + if (dev->pending & PENDING_X) { + dev->x = dev->pend_x; + dev->y += value; + dev->pending = 0; + dev->pend_x = 0; + dev->pend_y = 0; + event = EVENT_MOTION; + } + else { + dev->pend_x = dev->y + value; + dev->pending |= PENDING_Y; + event = EVENT_PENDING; + } + break; + case ((EV_REL << 16) | REL_Z): + dev->x += (short)(value >> 16); + dev->y += (short)(value & 0x0ffff); + dev->pending = 0; + dev->pend_x = 0; + dev->pend_y = 0; + event = EVENT_MOTION; + break; + default: + if (type == ICO_INPUT_MGR_DEVICE_TYPE_TOUCH) { + event = EVENT_TOUCH; + } + else { + event = EVENT_BUTTON; + } + break; + } + break; + default: + event = EVENT_KEY; + break; + } + + if (event == EVENT_PENDING) { + uifw_trace("ico_mgr_send_input_event: Leave(event pending)"); + return; + } + ctime = weston_compositor_get_time(); + fix_x = wl_fixed_from_int(dev->x); + fix_y = wl_fixed_from_int(dev->y); + + if ((surfaceid == 0) && ((appid == NULL) || (*appid == 0) || (*appid == ' '))) { + /* send event to surface via weston */ + + /* disable the event transmission to a touch layer */ + ico_window_mgr_restack_layer(NULL, TRUE); + + switch (event) { + case EVENT_MOTION: + if (type == ICO_INPUT_MGR_DEVICE_TYPE_TOUCH) { + uifw_trace("ico_mgr_send_input_event: notify_touch(%d,%d)", fix_x, fix_y); + notify_touch(pInputMgr->seat, ctime, 0, fix_x, fix_y, WL_TOUCH_MOTION); + } + else { + uifw_trace("ico_mgr_send_input_event: notify_motion_absolute(%d,%d)", + fix_x, fix_y); + notify_motion_absolute(pInputMgr->seat, ctime, fix_x, fix_y); + } + break; + case EVENT_BUTTON: + uifw_trace("ico_mgr_send_input_event: notify_button(%d,%d)", code, value); + 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(%d,%d,DOWN)", + fix_x, fix_y); + notify_touch(pInputMgr->seat, ctime, 0, fix_x, fix_y, WL_TOUCH_DOWN); + } + else { + uifw_trace("ico_mgr_send_input_event: notify_touch(UP)"); + notify_touch(pInputMgr->seat, ctime, 0, 0, 0, WL_TOUCH_UP); + } + break; + case EVENT_KEY: + uifw_trace("ico_mgr_send_input_event: notify_key(%d,%d)", code, value); + notify_key(pInputMgr->seat, ctime, code, + value ? WL_KEYBOARD_KEY_STATE_PRESSED : + WL_KEYBOARD_KEY_STATE_RELEASED, STATE_UPDATE_NONE); + break; + default: + uifw_trace("ico_mgr_send_input_event: unknown event=%d", event); + break; + } + /* enable the event transmission to a touch layer */ + ico_window_mgr_restack_layer(NULL, FALSE); + } + else { + if ((appid != NULL) && (*appid != 0) && (*appid != ' ')) { + /* send event to fixed application */ + + /* get application surface */ + usurf = ico_window_mgr_get_client_usurf(appid, NULL); + if (! usurf) { + uifw_trace("ico_mgr_send_input_event: Leave(app=%s dose not exist)", appid); + return; + } + } + else { + /* get UIFW surface */ + usurf = ico_window_mgr_get_usurf(surfaceid); + if (! usurf) { + uifw_trace("ico_mgr_send_input_event: Leave(surface dose not exist)"); + return; + } + } + + /* send event */ + switch (event) { + case EVENT_MOTION: + if (type == ICO_INPUT_MGR_DEVICE_TYPE_TOUCH) { + cres = wl_resource_find_for_client( + &pInputMgr->seat->touch->resource_list, + wl_resource_get_client(usurf->surface->resource)); + if (cres) { + wl_touch_send_motion(cres, ctime, 0, fix_x, fix_y); + } + } + else { + cres = wl_resource_find_for_client( + &pInputMgr->seat->pointer->resource_list, + wl_resource_get_client(usurf->surface->resource)); + if (cres) { + wl_pointer_send_motion(cres, ctime, fix_x, fix_y); + } + } + break; + case EVENT_BUTTON: + cres = wl_resource_find_for_client( + &pInputMgr->seat->pointer->resource_list, + wl_resource_get_client(usurf->surface->resource)); + if (cres) { + serial = wl_display_next_serial(pInputMgr->compositor->wl_display); + wl_pointer_send_button(cres, serial, ctime, code, + value ? WL_POINTER_BUTTON_STATE_PRESSED : + WL_POINTER_BUTTON_STATE_RELEASED); + } + break; + case EVENT_TOUCH: + cres = wl_resource_find_for_client( + &pInputMgr->seat->touch->resource_list, + wl_resource_get_client(usurf->surface->resource)); + if (cres) { + serial = wl_display_next_serial(pInputMgr->compositor->wl_display); + if (value) { + wl_touch_send_down(cres, serial, ctime, usurf->surface->resource, 0, + fix_x, fix_y); + } + else { + wl_touch_send_up(cres, serial, ctime, 0); + } + } + break; + case EVENT_KEY: + cres = wl_resource_find_for_client( + &pInputMgr->seat->keyboard->resource_list, + wl_resource_get_client(usurf->surface->resource)); + if (cres) { + serial = wl_display_next_serial(pInputMgr->compositor->wl_display); + wl_keyboard_send_key(cres, serial, ctime, code, + value ? WL_KEYBOARD_KEY_STATE_PRESSED : + WL_KEYBOARD_KEY_STATE_RELEASED); + } + break; + default: + break; + } + } uifw_trace("ico_mgr_send_input_event: Leave"); } @@ -991,6 +1282,10 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) /* initialize list */ wl_list_init(&pInputMgr->ictl_list); wl_list_init(&pInputMgr->app_list); + wl_list_init(&pInputMgr->dev_list); + + /* found input seat */ + pInputMgr->seat = container_of(ec->seat_list.next, struct weston_seat, link); uifw_info("ico_input_mgr: Leave(module_init)"); return 0; diff --git a/src/ico_ivi_common.h b/src/ico_ivi_common.h index adb518e..64e2ef1 100644 --- a/src/ico_ivi_common.h +++ b/src/ico_ivi_common.h @@ -41,7 +41,7 @@ #define ICO_IVI_SURFACEID_BASE(nodeid) (((unsigned int)nodeid) << 16) /* System limit */ -#define ICO_IVI_MAX_DISPLAY (8) /* Maximum display number of one ECU */ +#define ICO_IVI_MAX_DISPLAY (8) /* Maximum numer of displays in a ECU */ #define ICO_IVI_APPID_LENGTH (128) /* Maximum length of applicationId(AppCore) */ /* (with terminate NULL) */ #define ICO_IVI_WINNAME_LENGTH (32) /* Maximum length of window name (with NULL)*/ @@ -73,16 +73,17 @@ int ico_ivi_default_animation_fps(void); /* Get animation frame rate(fps) #define UIFW_DEBUG_OUT 1 /* 1=Debug Print/0=No Debug Print */ #if UIFW_DEBUG_OUT > 0 +#define uifw_debug(fmt,...) \ + { if (ico_ivi_debuglevel() >= 5) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } #define uifw_trace(fmt,...) \ - { if (ico_ivi_debuglevel() >= 4) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } + { if (ico_ivi_debuglevel() >= 4) {weston_log("TRC>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } #else /*UIFW_DEBUG_OUT*/ +#define uifw_debug(fmt,...) #define uifw_trace(fmt,...) #endif /*UIFW_DEBUG_OUT*/ #define uifw_info(fmt,...) \ { if (ico_ivi_debuglevel() >= 3) {weston_log("INF>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } -#define uifw_msg(fmt,...) \ - { if (ico_ivi_debuglevel() >= 3) {weston_log("INF>"fmt"\n",##__VA_ARGS__);} } #define uifw_warn(fmt,...) \ { if (ico_ivi_debuglevel() >= 2) {weston_log("WRN>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } #define uifw_error(fmt,...) \ diff --git a/src/ico_ivi_shell.c b/src/ico_ivi_shell.c index 8bc0757..25e8698 100644 --- a/src/ico_ivi_shell.c +++ b/src/ico_ivi_shell.c @@ -303,8 +303,10 @@ static char *shell_exe = NULL; static int ico_debug_level = DEFAULT_DEBUG_LEVEL; /* Debug Level */ /* debug log macros */ +#define uifw_debug(fmt,...) \ + { if (ico_debug_level >= 5) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } #define uifw_trace(fmt,...) \ - { if (ico_debug_level >= 4) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } + { if (ico_debug_level >= 4) {weston_log("TRC>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } #define uifw_info(fmt,...) \ { if (ico_debug_level >= 3) {weston_log("INF>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} } #define uifw_warn(fmt,...) \ @@ -366,6 +368,11 @@ shell_grab_start(struct shell_grab *grab, { struct desktop_shell *shell = shsurf->shell; + /* if ico_window_mgr hook, not change grab */ + if (shell_hook_select) { + return; + } + popup_grab_end(pointer); grab->grab.interface = interface; @@ -3169,6 +3176,11 @@ activate(struct desktop_shell *shell, struct weston_surface *es, wl_list_remove(&state->surface_destroy_listener.link); wl_signal_add(&es->destroy_signal, &state->surface_destroy_listener); + /* if ico_window_mgr hook, not change surface stack */ + if (shell_hook_select) { + return; + } + switch (get_shell_surface_type(main_surface)) { case SHELL_SURFACE_FULLSCREEN: /* should on top of panels */ diff --git a/src/ico_window_mgr.c b/src/ico_window_mgr.c index 814c1f3..608f842 100644 --- a/src/ico_window_mgr.c +++ b/src/ico_window_mgr.c @@ -64,8 +64,7 @@ #define UIFW_HASH 64 /* Hash value (2's compliment) */ /* Internal fixed value */ - /* map buffer, buffsize bound */ -#define ICO_WINDOW_MGR_BUFBOUND 4096 +#define ICO_WINDOW_MGR_APPID_FIXCOUNT 5 /* retry count of appid fix */ /* show/hide animation with position */ #define ICO_WINDOW_MGR_ANIMATION_POS 0x10000000 @@ -171,8 +170,6 @@ struct ico_win_mgr { #define MAKE_WSHASH(v) ((((uint32_t)v) >> 5) & (UIFW_HASH-1)) /* function prototype */ - /* get surface table from surfece id */ -static struct uifw_win_surface *find_uifw_win_surface_by_id(uint32_t surfaceid); /* get surface table from weston surface*/ static struct uifw_win_surface *find_uifw_win_surface_by_ws( struct weston_surface *wsurf); @@ -184,6 +181,8 @@ 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); + /* 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, @@ -212,8 +211,6 @@ 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); - /* restack surface list */ -static void win_mgr_restack_ivi_layer(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); @@ -305,11 +302,13 @@ static const struct ico_window_mgr_interface ico_window_mgr_implementation = { 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 = 600; /* Default animation time */ +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_startup_layer = 101; /* Deafult layer id at system startup*/ +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 management table */ static struct ico_win_mgr *_ico_win_mgr = NULL; @@ -419,7 +418,7 @@ ico_ivi_get_mynode(void) * @return none */ /*--------------------------------------------------------------------------*/ -WL_EXPORT void +WL_EXPORT void ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, int x, int y, int width, int height) { @@ -479,7 +478,7 @@ ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, * @return none */ /*--------------------------------------------------------------------------*/ -WL_EXPORT void +WL_EXPORT void ico_window_mgr_change_surface(struct uifw_win_surface *usurf, const int to, const int manager) { @@ -491,7 +490,7 @@ ico_window_mgr_change_surface(struct uifw_win_surface *usurf, /*--------------------------------------------------------------------------*/ /** - * @brief find_uifw_win_surface_by_id: find UIFW surface by surface id + * @brief ico_window_mgr_get_usurf: find UIFW surface by surface id * * @param[in] surfaceid UIFW surface id * @return UIFW surface table address @@ -499,8 +498,8 @@ ico_window_mgr_change_surface(struct uifw_win_surface *usurf, * @retval NULL error(surface id dose not exist) */ /*--------------------------------------------------------------------------*/ -static struct uifw_win_surface * -find_uifw_win_surface_by_id(uint32_t surfaceid) +WL_EXPORT struct uifw_win_surface * +ico_window_mgr_get_usurf(const uint32_t surfaceid) { struct uifw_win_surface *usurf; @@ -512,7 +511,7 @@ find_uifw_win_surface_by_id(uint32_t surfaceid) } usurf = usurf->next_idhash; } - uifw_trace("find_uifw_win_surface_by_id: NULL"); + uifw_trace("ico_window_mgr_get_usurf: NULL"); return NULL; } @@ -680,11 +679,6 @@ win_mgr_bind_client(struct wl_client *client, void *shell) pid_t pid; uid_t uid; gid_t gid; - int fd; - int size; - int i; - int j; - char procpath[128]; uifw_trace("win_mgr_bind_client: Enter(client=%08x, shell=%08x)", (int)client, (int)shell); @@ -706,6 +700,7 @@ win_mgr_bind_client(struct wl_client *client, void *shell) } memset(uclient, 0, sizeof(struct uifw_client)); uclient->client = client; + wl_list_init(&uclient->surface_link); newclient = 1; } else { @@ -717,75 +712,16 @@ win_mgr_bind_client(struct wl_client *client, void *shell) if (pid > 0) { uclient->pid = (int)pid; /* get applicationId from AppCore(AUL) */ - memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH); - aul_app_get_appid_bypid(uclient->pid, uclient->appid, ICO_IVI_APPID_LENGTH); - uifw_trace("win_mgr_bind_client: client=%08x pid=%d appid=<%s>", - (int)client, uclient->pid, uclient->appid); - if (uclient->appid[0] == 0) { - /* client dose not exist in AppCore, search Linux process table */ - uifw_trace("win_mgr_bind_client: pid=%d dose not exist in AppCore(AUL)", - uclient->pid); + win_mgr_get_client_appid(uclient); - memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH); - snprintf(procpath, sizeof(procpath)-1, "/proc/%d/cmdline", uclient->pid); - fd = open(procpath, O_RDONLY); - if (fd >= 0) { - size = read(fd, procpath, sizeof(procpath)); - for (; size > 0; size--) { - if (procpath[size-1]) break; - } - if (size > 0) { - /* get program base name */ - i = 0; - for (j = 0; j < size; j++) { - if (procpath[j] == 0) break; - if (procpath[j] == '/') i = j + 1; - } - j = 0; - for (; i < size; i++) { - uclient->appid[j] = procpath[i]; - if ((uclient->appid[j] == 0) || - (j >= (ICO_IVI_APPID_LENGTH-1))) break; - j++; - } - /* search application number in apprication start option */ - if ((uclient->appid[j] == 0) && (j < (ICO_IVI_APPID_LENGTH-2))) { - for (; i < size; i++) { - if ((procpath[i] == 0) && - (procpath[i+1] == '@')) { - strncpy(&uclient->appid[j], &procpath[i+1], - ICO_IVI_APPID_LENGTH - j - 2); - } - } - } - } - close(fd); - } - for (i = strlen(uclient->appid)-1; i >= 0; i--) { - if (uclient->appid[i] != ' ') break; - } - uclient->appid[i+1] = 0; - if (uclient->appid[0]) { - uifw_trace("win_mgr_bind_client: client=%08x pid=%d appid=<%s> from " - "Process table", (int)client, uclient->pid, uclient->appid); - /* weston internal client, not manage */ - if (strcmp(uclient->appid, "weston") == 0) { - newclient = -newclient; - } - } - else { - uifw_trace("win_mgr_bind_client: pid=%d dose not exist in Process table", - uclient->pid); - sprintf(uclient->appid, "?%d?", uclient->pid); - } - } - if (newclient > 0) { - wl_list_insert(&_ico_win_mgr->client_list, &uclient->link); - } - else if (newclient < 0) { + /* 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) { + wl_list_insert(&_ico_win_mgr->client_list, &uclient->link); + } } else { uifw_trace("win_mgr_bind_client: client=%08x pid dose not exist", (int)client); @@ -819,6 +755,92 @@ win_mgr_unbind_client(struct wl_client *client) /*--------------------------------------------------------------------------*/ /** + * @brief win_mgr_get_client_appid: get applicationId from pid + * + * @param[in] uclient UIFW client management table + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +win_mgr_get_client_appid(struct uifw_client *uclient) +{ + int fd; + int size; + int i; + int j; + char procpath[128]; + + uifw_trace("win_mgr_get_client_appid: Enter(pid=%d)", uclient->pid); + + memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH); + i = 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); + if (uclient->appid[0] != 0) { + /* OK, end of get appid */ + uclient->fixed_appid = ICO_WINDOW_MGR_APPID_FIXCOUNT; + } + else { + uclient->fixed_appid ++; + /* client dose not exist in AppCore, search Linux process table */ + uifw_trace("win_mgr_get_client_appid: pid=%d dose not exist in AppCore(AUL)", + uclient->pid); + + memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH); + snprintf(procpath, sizeof(procpath)-1, "/proc/%d/cmdline", uclient->pid); + fd = open(procpath, O_RDONLY); + if (fd >= 0) { + size = read(fd, procpath, sizeof(procpath)); + for (; size > 0; size--) { + if (procpath[size-1]) break; + } + if (size > 0) { + /* get program base name */ + i = 0; + for (j = 0; j < size; j++) { + if (procpath[j] == 0) break; + if (procpath[j] == '/') i = j + 1; + } + j = 0; + for (; i < size; i++) { + uclient->appid[j] = procpath[i]; + if ((uclient->appid[j] == 0) || + (j >= (ICO_IVI_APPID_LENGTH-1))) break; + j++; + } + /* search application number in apprication start option */ + if ((uclient->appid[j] == 0) && (j < (ICO_IVI_APPID_LENGTH-2))) { + for (; i < size; i++) { + if ((procpath[i] == 0) && + (procpath[i+1] == '@')) { + strncpy(&uclient->appid[j], &procpath[i+1], + ICO_IVI_APPID_LENGTH - j - 2); + } + } + } + } + close(fd); + } + for (i = strlen(uclient->appid)-1; i >= 0; i--) { + if (uclient->appid[i] != ' ') break; + } + 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); + } + else { + uifw_trace("win_mgr_get_client_appid: pid=%d dose not exist in Process table", + uclient->pid); + sprintf(uclient->appid, "?%d?", uclient->pid); + } + } + uifw_trace("win_mgr_get_client_appid: Leave(pid=%d,appid=%s)", + uclient->pid, uclient->appid); +} + +/*--------------------------------------------------------------------------*/ +/** * @brief ico_get_animation_name: convert animation name to Id value * * @param[in] animation animation name @@ -890,6 +912,7 @@ win_mgr_register_surface(struct wl_client *client, struct wl_resource *resource, usurf->shsurf = shsurf; 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); wl_list_init(&usurf->animation.animation.link); wl_list_init(&usurf->surf_map); usurf->animation.hide_anima = ico_get_animation_name(ico_ivi_default_animation_name()); @@ -923,6 +946,7 @@ win_mgr_register_surface(struct wl_client *client, struct wl_resource *resource, return; } } + wl_list_insert(usurf->uclient->surface_link.prev, &usurf->client_link); /* make surface id hash table */ hash = MAKE_IDHASH(usurf->surfaceid); @@ -1031,7 +1055,7 @@ win_mgr_map_surface(struct weston_surface *surface, int32_t *width, int32_t *hei } usurf->mapped = 1; if (usurf->visible) { - win_mgr_restack_ivi_layer(NULL); + ico_window_mgr_restack_layer(NULL, FALSE); } uifw_trace("win_mgr_map_surface: Leave"); } @@ -1042,14 +1066,15 @@ win_mgr_map_surface(struct weston_surface *surface, int32_t *width, int32_t *hei /*--------------------------------------------------------------------------*/ /** - * @brief win_mgr_restack_ivi_layer: restack surface list + * @brief ico_window_mgr_restack_layer: restack surface list * - * @param[in] usurf UIFW surface + * @param[in] usurf UIFW surface (if NULL, no surface) + * @param[in] omit_touch omit touch layer flag (TRUE=omit/FALSE=not omit) * @return none */ /*--------------------------------------------------------------------------*/ -static void -win_mgr_restack_ivi_layer(struct uifw_win_surface *usurf) +WL_EXPORT void +ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touch) { struct uifw_win_surface *es; struct uifw_win_layer *el; @@ -1058,7 +1083,8 @@ win_mgr_restack_ivi_layer(struct uifw_win_surface *usurf) struct weston_layer *wlayer; int num_visible = 0; - uifw_trace("win_mgr_restack_ivi_layer: Enter(surf=%08x)", (int)usurf); + uifw_trace("ico_window_mgr_restack_layer: Enter(surf=%08x,omit=%d)", + (int)usurf, omit_touch); /* make compositor surface list */ wlayer = ico_ivi_shell_current_layer(); @@ -1067,7 +1093,10 @@ win_mgr_restack_ivi_layer(struct uifw_win_surface *usurf) wl_list_for_each (el, &_ico_win_mgr->ivi_layer_list, link) { wl_list_for_each (es, &el->surface_list, ivi_layer) { if ((es->mapped != 0) && (es->surface != NULL)) { - if ((el->visible == FALSE) || (es->visible == FALSE)) { + if ((el->visible == FALSE) || (es->visible == FALSE) || + ((omit_touch != FALSE) && + ((el->layer_type == ICO_WINDOW_MGR_LAYER_TYPE_INPUT) || + (el->layer_type == ICO_WINDOW_MGR_LAYER_TYPE_CURSOR)))) { new_x = (float)(ICO_IVI_MAX_COORDINATE+1); new_y = (float)(ICO_IVI_MAX_COORDINATE+1); } @@ -1104,7 +1133,7 @@ win_mgr_restack_ivi_layer(struct uifw_win_surface *usurf) weston_surface_damage(es->surface); } #if 0 /* too many debug log */ - uifw_trace("win_mgr_restack_ivi_layer: %08x x/y=%d/%d w/h=%d/%d", + uifw_trace("ico_window_mgr_restack_layer: %08x x/y=%d/%d w/h=%d/%d", es->surfaceid, (int)es->surface->geometry.x, (int)es->surface->geometry.y, es->surface->geometry.width, es->surface->geometry.height); @@ -1119,15 +1148,17 @@ win_mgr_restack_ivi_layer(struct uifw_win_surface *usurf) } /* composit and draw screen(plane) */ - weston_compositor_schedule_repaint(_ico_win_mgr->compositor); + if (omit_touch == FALSE) { + 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); + } } - uifw_trace("win_mgr_restack_ivi_layer: Leave"); + uifw_trace("ico_window_mgr_restack_layer: Leave"); } /*--------------------------------------------------------------------------*/ @@ -1155,6 +1186,18 @@ 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; + } + else if ((int)layer == _ico_ivi_input_layer ) { + new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_INPUT; + } + else if ((int)layer == _ico_ivi_cursor_layer ) { + new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_CURSOR; + } + else { + new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_NORMAL; + } new_el->visible = TRUE; wl_list_init(&new_el->surface_list); wl_list_init(&new_el->link); @@ -1224,7 +1267,7 @@ win_mgr_set_layer(struct uifw_win_surface *usurf, const uint32_t layer) /* rebild compositor surface list */ if (usurf->visible) { - win_mgr_restack_ivi_layer(usurf); + ico_window_mgr_restack_layer(usurf, 0); } uifw_trace("win_mgr_set_layer: Leave"); } @@ -1410,7 +1453,7 @@ uifw_set_window_layer(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_set_window_layer: Enter res=%08x surfaceid=%08x layer=%d", (int)resource, surfaceid, layer); - struct uifw_win_surface *usurf = find_uifw_win_surface_by_id(surfaceid); + struct uifw_win_surface *usurf = ico_window_mgr_get_usurf(surfaceid); if (! usurf) { uifw_trace("uifw_set_window_layer: Leave(No Surface(id=%08x))", surfaceid); @@ -1458,7 +1501,7 @@ uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource, node, _ico_num_nodes); node = 0; } - struct uifw_win_surface *usurf = find_uifw_win_surface_by_id(surfaceid); + struct uifw_win_surface *usurf = ico_window_mgr_get_usurf(surfaceid); if (usurf && (usurf->surface)) { /* weston surface exist */ @@ -1602,7 +1645,7 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_set_visible: Request from Unknown App, not Manager"); } - usurf = find_uifw_win_surface_by_id(surfaceid); + usurf = ico_window_mgr_get_usurf(surfaceid); if ((! usurf) || (! usurf->surface)) { uifw_trace("uifw_set_visible: Leave(Surface Not Exist)"); @@ -1715,7 +1758,7 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource, weston_surface_damage(usurf->surface); } else if(restack & 2) { - win_mgr_restack_ivi_layer(usurf); + ico_window_mgr_restack_layer(usurf, 0); } /* send event(VISIBLE) to manager */ @@ -1748,7 +1791,7 @@ uifw_set_animation(struct wl_client *client, struct wl_resource *resource, uint32_t surfaceid, int32_t type, const char *animation, int32_t time) { int animaid; - struct uifw_win_surface *usurf = find_uifw_win_surface_by_id(surfaceid); + struct uifw_win_surface *usurf = ico_window_mgr_get_usurf(surfaceid); uifw_trace("uifw_set_transition: Enter(surf=%08x,type=%x,anim=%s,time=%d)", surfaceid, type, animation, time); @@ -1827,7 +1870,7 @@ static void uifw_set_attributes(struct wl_client *client, struct wl_resource *resource, uint32_t surfaceid, uint32_t attributes) { - struct uifw_win_surface *usurf = find_uifw_win_surface_by_id(surfaceid); + struct uifw_win_surface *usurf = ico_window_mgr_get_usurf(surfaceid); uifw_trace("uifw_set_attributes: Enter(surf=%08x,attributes=%x)", surfaceid, attributes); @@ -1872,7 +1915,7 @@ uifw_visible_animation(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_visible_animation: Enter(%08x,%d,x/y=%d/%d,w/h=%d/%d)", surfaceid, visible, x, y, width, height); - usurf = find_uifw_win_surface_by_id(surfaceid); + usurf = ico_window_mgr_get_usurf(surfaceid); if ((! usurf) || (! usurf->surface)) { uifw_trace("uifw_visible_animation: Leave(Surface Not Exist)"); @@ -1914,7 +1957,7 @@ uifw_set_active(struct wl_client *client, struct wl_resource *resource, if ((surfaceid > 0) && ((active & (ICO_WINDOW_MGR_ACTIVE_POINTER|ICO_WINDOW_MGR_ACTIVE_KEYBOARD)) != 0)) { - usurf = find_uifw_win_surface_by_id(surfaceid); + usurf = ico_window_mgr_get_usurf(surfaceid); } else { usurf = NULL; @@ -2071,7 +2114,7 @@ uifw_set_layer_visible(struct wl_client *client, struct wl_resource *resource, } /* rebild compositor surface list */ - win_mgr_restack_ivi_layer(NULL); + ico_window_mgr_restack_layer(NULL, 0); /* send layer visible event to manager */ ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_LAYER_VISIBLE, NULL, @@ -2294,7 +2337,7 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_map_surface: Enter(surface=%08x,fps=%d)", surfaceid, framerate); - usurf = find_uifw_win_surface_by_id(surfaceid); + usurf = ico_window_mgr_get_usurf(surfaceid); if (! usurf) { /* surface dose not exist, error */ ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR, @@ -2413,7 +2456,7 @@ uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_unmap_surface: Enter(surface=%08x)", surfaceid); - usurf = find_uifw_win_surface_by_id(surfaceid); + usurf = ico_window_mgr_get_usurf(surfaceid); if (! usurf) { /* surface dose not exist, error */ uifw_trace("uifw_unmap_surface: Leave(surface=%08x dose not exist)", surfaceid); @@ -2548,7 +2591,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)); - win_mgr_restack_ivi_layer(usurf); + ico_window_mgr_restack_layer(usurf, 0); } else { weston_surface_set_position(usurf->surface, (float)(ICO_IVI_MAX_COORDINATE+1), @@ -2812,7 +2855,7 @@ win_mgr_surface_move(struct weston_surface *surface, int *dx, int *dy) * @return none */ /*--------------------------------------------------------------------------*/ -WL_EXPORT void +WL_EXPORT void ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible) { if (visible) { @@ -2820,7 +2863,7 @@ ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible) uifw_trace("ico_window_mgr_set_visible: Chagne to Visible(%08x)", (int)usurf); usurf->visible = 1; /* change unvisible to visible, restack surface list */ - win_mgr_restack_ivi_layer(usurf); + ico_window_mgr_restack_layer(usurf, 0); } } else { @@ -2828,7 +2871,7 @@ ico_window_mgr_set_visible(struct uifw_win_surface *usurf, const int visible) uifw_trace("ico_window_mgr_set_visible: Chagne to Unvisible(%08x)", (int)usurf); usurf->visible = 0; /* change visible to unvisible, restack surface list */ - win_mgr_restack_ivi_layer(usurf); + ico_window_mgr_restack_layer(usurf, 0); } } ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE, @@ -2866,7 +2909,7 @@ win_mgr_set_raise(struct uifw_win_surface *usurf, const int raise) /* rebild compositor surface list */ if (usurf->visible) { - win_mgr_restack_ivi_layer(usurf); + ico_window_mgr_restack_layer(usurf, 0); } ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE, usurf, usurf->visible, usurf->raise, 0, 0,0); @@ -2917,7 +2960,10 @@ win_mgr_destroy_surface(struct weston_surface *surface) /* delete from layer list */ wl_list_remove(&usurf->ivi_layer); - win_mgr_restack_ivi_layer(NULL); + ico_window_mgr_restack_layer(NULL, 0); + + /* delete from cleint list */ + wl_list_remove(&usurf->client_link); /* delete from hash table */ hash = MAKE_IDHASH(usurf->surfaceid); @@ -3061,6 +3107,12 @@ ico_win_mgr_send_to_mgr(const int event, struct uifw_win_surface *usurf, int num_mgr = 0; struct uifw_manager* mgr; + /* if appid not fix, check and fix appid */ + if ((usurf != NULL) && + (usurf->uclient->fixed_appid < ICO_WINDOW_MGR_APPID_FIXCOUNT)) { + win_mgr_get_client_appid(usurf->uclient); + } + /* send created if not send created event */ if ((usurf != NULL) && (usurf->created == 0) && (((usurf->width > 0) && (usurf->height > 0)) || @@ -3215,8 +3267,8 @@ win_mgr_set_scale(struct uifw_win_surface *usurf) usurf->set_transform = 0; wl_list_remove(&usurf->transform.link); } - weston_surface_update_transform(es); weston_surface_geometry_dirty(es); + weston_surface_update_transform(es); weston_surface_damage_below(es); weston_surface_damage(es); ret = 1; @@ -3227,13 +3279,66 @@ win_mgr_set_scale(struct uifw_win_surface *usurf) /*--------------------------------------------------------------------------*/ /** + * @brief ico_window_mgr_get_uclient: get UIFW client table + * + * @param[in] appid application Id + * @return UIFW client table + * @retval !=NULL success(UIFW client table address) + * @retval = NULL error(appid not exist) + */ +/*--------------------------------------------------------------------------*/ +WL_EXPORT struct uifw_client * +ico_window_mgr_get_uclient(const char *appid) +{ + struct uifw_client *uclient; + + wl_list_for_each (uclient, &_ico_win_mgr->client_list, link) { + if (strcmp(uclient->appid, appid) == 0) { + return uclient; + } + } + return NULL; +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief ico_window_mgr_get_client_usurf: get client UIFW surface table + * + * @param[in] appid application Id + * @param[in] winname window name + * @return UIFW surface table + * @retval !=NULL success(UIFW surface table address) + * @retval = NULL error(appid or winname not exist) + */ +/*--------------------------------------------------------------------------*/ +WL_EXPORT struct uifw_win_surface * +ico_window_mgr_get_client_usurf(const char *appid, const char *winname) +{ + struct uifw_client *uclient; + struct uifw_win_surface *usurf; + + wl_list_for_each (uclient, &_ico_win_mgr->client_list, link) { + if (strcmp(uclient->appid, appid) == 0) { + wl_list_for_each (usurf, &uclient->surface_link, client_link) { + if ((winname == NULL) || (*winname == 0) || + (strcmp(winname, usurf->winname) == 0)) { + return usurf; + } + } + } + } + return NULL; +} + +/*--------------------------------------------------------------------------*/ +/** * @brief ico_window_mgr_set_hook_animation: set animation hook routine * * @param[in] hook_animation hook routine * @return none */ /*--------------------------------------------------------------------------*/ -WL_EXPORT void +WL_EXPORT void ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data)) { win_mgr_hook_animation = hook_animation; @@ -3252,16 +3357,16 @@ ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data * @retval -1 error */ /*--------------------------------------------------------------------------*/ -WL_EXPORT int +WL_EXPORT int 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; uifw_info("ico_window_mgr: Enter(module_init)"); @@ -3272,29 +3377,31 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) weston_config_section_get_int(section, "log", &_ico_ivi_debug_level, 3); } - /* get animation default */ - section = weston_config_get_section(ec->config, "ivi-animation", NULL, NULL); + /* get display number list */ + section = weston_config_get_section(ec->config, "ivi-display", 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, "displayno", &displayno, NULL); } - if (_ico_ivi_animation_time < 100) _ico_ivi_animation_time = 600; - if (_ico_ivi_animation_fps < 2) _ico_ivi_animation_fps = 15; - /* get display number list */ - section = weston_config_get_section(ec->config, "ivi-display", NULL, NULL); + /* 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, 101); + 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); } - /* get default layer id */ - section = weston_config_get_section(ec->config, "ivi-layer", NULL, NULL); + /* get animation default */ + section = weston_config_get_section(ec->config, "ivi-animation", NULL, NULL); if (section) { - weston_config_section_get_string(section, "displayno", &displayno, NULL); + 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); } + if (_ico_ivi_animation_time < 100) _ico_ivi_animation_time = 600; + if (_ico_ivi_animation_fps < 2) _ico_ivi_animation_fps = 15; /* create ico_window_mgr management table */ _ico_win_mgr = (struct ico_win_mgr *)malloc(sizeof(struct ico_win_mgr)); @@ -3309,7 +3416,7 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) uifw_error("ico_window_mgr: malloc failed"); return -1; } - uifw_trace("ico_window_mgr: table=%08x", (int)_ico_win_mgr); + 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; @@ -3408,6 +3515,15 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[]) 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_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 c122fcd..551bf28 100644 --- a/src/ico_window_mgr.h +++ b/src/ico_window_mgr.h @@ -44,8 +44,10 @@ struct uifw_client { char appid[ICO_IVI_APPID_LENGTH]; /* ApplicationId(from AppCore AUL) */ struct uifw_manager *mgr; /* Manager table (if manager) */ char manager; /* Manager flag (Need send event) */ + char fixed_appid; /* ApplicationId fix flag(and counter) */ char noconfigure; /* no need configure event */ - char res[2]; + char res; /* (unused) */ + struct wl_list surface_link; /* surface list of same client */ struct wl_list link; }; @@ -63,7 +65,8 @@ struct uifw_node_table { struct uifw_win_layer { uint32_t layer; /* Layer Id */ char visible; /* visibility */ - char res[3]; /* (unused) */ + char layer_type; /* layer type */ + char res[2]; /* (unused) */ struct wl_list surface_list; /* Surfacae list */ struct wl_list link; /* Link pointer for layer list */ }; @@ -146,11 +149,18 @@ struct uifw_win_surface { void *animadata; /* animation data */ } animation; struct wl_list ivi_layer; /* surface list of same layer */ + struct wl_list client_link; /* surface list of same client */ struct wl_list surf_map; /* surface map list */ struct uifw_win_surface *next_idhash; /* UIFW SurfaceId hash list */ struct uifw_win_surface *next_wshash; /* Weston SurfaceId hash list */ }; +/* layer type */ +#define ICO_WINDOW_MGR_LAYER_TYPE_NORMAL 0 /* normal layer */ +#define ICO_WINDOW_MGR_LAYER_TYPE_BACKGROUND 1 /* touch input layer */ +#define ICO_WINDOW_MGR_LAYER_TYPE_INPUT 7 /* touch input layer */ +#define ICO_WINDOW_MGR_LAYER_TYPE_CURSOR 8 /* cursor layer */ + /* animation operation */ /* default animation */ #define ICO_WINDOW_MGR_ANIMATION_NONE 0 /* no animation */ @@ -190,6 +200,15 @@ void ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, int x, in /* surface change */ void ico_window_mgr_change_surface(struct uifw_win_surface *usurf, const int to, const int manager); + /* get UIFW client table */ +struct uifw_client *ico_window_mgr_get_uclient(const char *appid); + /* get UIFW surface table */ +struct uifw_win_surface *ico_window_mgr_get_usurf(const uint32_t surfaceid); + /* get application surface */ +struct uifw_win_surface *ico_window_mgr_get_client_usurf(const char *appid, + const char *winname); + /* rebuild surface layer list */ +void ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touch); /* set window animation hook */ void ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data)); diff --git a/tests/test-client.c b/tests/test-client.c index 2532674..3720301 100644 --- a/tests/test-client.c +++ b/tests/test-client.c @@ -62,6 +62,7 @@ struct input { struct wl_seat *seat; struct wl_pointer *pointer; struct wl_keyboard *keyboard; + struct wl_touch *touch; float x, y; uint32_t button_mask; struct surface *pointer_focus; @@ -99,8 +100,8 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer, input->pointer_focus = wl_surface_get_user_data(surface); input->x = wl_fixed_to_double(x); input->y = wl_fixed_to_double(y); - print_log("CLIENT: got pointer enter (%d,%d), surface %p", - (int)input->x, (int)input->y, surface); + print_log("CLIENT: got pointer enter (%d,%d)=(%d,%d), surface %p", + x, y, (int)input->x, (int)input->y, surface); } static void @@ -123,7 +124,8 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer, input->x = wl_fixed_to_double(x); input->y = wl_fixed_to_double(y); - print_log("CLIENT: got pointer motion (%d,%d)", (int)input->x, (int)input->y); + print_log("CLIENT: got pointer motion (%d,%d)=(%d,%d)", + x, y, (int)input->x, (int)input->y); } static void @@ -197,6 +199,39 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, print_log("CLIENT: got keyboard modifier"); } +static void +touch_handle_down(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, + struct wl_surface *surface, int32_t id, wl_fixed_t x, wl_fixed_t y) +{ + print_log("CLIENT: got touch down %d (%d,%d)", id, x/256, y/256); +} + +static void +touch_handle_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, + int32_t id) +{ + print_log("CLIENT: got touch up %d", id); +} + +static void +touch_handle_motion(void *data, struct wl_touch *wl_touch, uint32_t time, + int32_t id, wl_fixed_t x, wl_fixed_t y) +{ + print_log("CLIENT: got touch motion %d (%d,%d)", id, x/256, y/256); +} + +static void +touch_handle_frame(void *data, struct wl_touch *wl_touch) +{ + print_log("CLIENT: got touch frame"); +} + +static void +touch_handle_cancel(void *data, struct wl_touch *wl_touch) +{ + print_log("CLIENT: got touch cancel"); +} + static const struct wl_pointer_listener pointer_listener = { pointer_handle_enter, pointer_handle_leave, @@ -213,6 +248,14 @@ static const struct wl_keyboard_listener keyboard_listener = { keyboard_handle_modifiers, }; +static const struct wl_touch_listener touch_listener = { + touch_handle_down, + touch_handle_up, + touch_handle_motion, + touch_handle_frame, + touch_handle_cancel +}; + static void seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) @@ -238,6 +281,16 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, wl_keyboard_destroy(input->keyboard); input->keyboard = NULL; } + + if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { + input->touch = wl_seat_get_touch(seat); + wl_touch_set_user_data(input->touch, input); + wl_touch_add_listener(input->touch, &touch_listener, input); + } + else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { + wl_touch_destroy(input->touch); + input->touch = NULL; + } } static const struct wl_seat_listener seat_listener = { @@ -586,9 +639,9 @@ int main(int argc, char *argv[]) while (1) { sleep_with_wayland(display->display, 20); if (display->prompt) { - printf("CLIENT: "); fflush(stdout); + printf("CLIENT> "); fflush(stdout); } - ret = getdata(display->ico_window_mgr, "CLIENT: ", fd, buf, sizeof(buf)); + ret = getdata(display->ico_window_mgr, "CLIENT> ", fd, buf, sizeof(buf)); if (ret < 0) { fprintf(stderr, "CLIENT: read error: fd %d, %m\n", fd); diff --git a/tests/test-homescreen.c b/tests/test-homescreen.c index 265a481..02b4366 100644 --- a/tests/test-homescreen.c +++ b/tests/test-homescreen.c @@ -102,6 +102,7 @@ struct input { struct wl_seat *seat; struct wl_pointer *pointer; struct wl_keyboard *keyboard; + struct wl_touch *touch; float x, y; uint32_t button_mask; struct surface *pointer_focus; @@ -237,6 +238,39 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, print_log("HOMESCREEN: got keyboard modifier"); } +static void +touch_handle_down(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, + struct wl_surface *surface, int32_t id, wl_fixed_t x, wl_fixed_t y) +{ + print_log("CLIENT: got touch down %d (%d,%d)", id, x/256, y/256); +} + +static void +touch_handle_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, + int32_t id) +{ + print_log("CLIENT: got touch up %d", id); +} + +static void +touch_handle_motion(void *data, struct wl_touch *wl_touch, uint32_t time, + int32_t id, wl_fixed_t x, wl_fixed_t y) +{ + print_log("CLIENT: got touch motion %d (%d,%d)", id, x/256, y/256); +} + +static void +touch_handle_frame(void *data, struct wl_touch *wl_touch) +{ + print_log("CLIENT: got touch frame"); +} + +static void +touch_handle_cancel(void *data, struct wl_touch *wl_touch) +{ + print_log("CLIENT: got touch cancel"); +} + static const struct wl_pointer_listener pointer_listener = { pointer_handle_enter, pointer_handle_leave, @@ -253,6 +287,14 @@ static const struct wl_keyboard_listener keyboard_listener = { keyboard_handle_modifiers, }; +static const struct wl_touch_listener touch_listener = { + touch_handle_down, + touch_handle_up, + touch_handle_motion, + touch_handle_frame, + touch_handle_cancel +}; + static void seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) @@ -278,6 +320,16 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, wl_keyboard_destroy(input->keyboard); input->keyboard = NULL; } + + if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { + input->touch = wl_seat_get_touch(seat); + wl_touch_set_user_data(input->touch, input); + wl_touch_add_listener(input->touch, &touch_listener, input); + } + else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { + wl_touch_destroy(input->touch); + input->touch = NULL; + } } static const struct wl_seat_listener seat_listener = { @@ -624,6 +676,10 @@ window_active(void *data, struct ico_window_mgr *ico_window_mgr, { print_log("HOMESCREEN: Event[window_active] surface=%08x acive=%d", (int)surfaceid, (int)active); + if ((surfaceid & 0x0000ffff) == 0x0001) { + ico_window_mgr_set_visible(ico_window_mgr, surfaceid, + ICO_WINDOW_MGR_V_NOCHANGE, 0, 0); + } } static void @@ -733,7 +789,7 @@ handle_global(void *data, struct wl_registry *registry, uint32_t id, output->output = wl_registry_bind(display->registry, id, &wl_output_interface, 1); wl_output_add_listener(output->output, &output_listener, output); display->output[display->num_output] = output; - + print_log("HOMESCREEN: created output[%d] global %p", display->num_output, display->output[display->num_output]); display->num_output ++; @@ -1189,6 +1245,37 @@ raise_surface(struct display *display, char *buf, const int raise) } static void +active_window(struct display *display, char *buf) +{ + char *args[10]; + int narg; + int surfaceid; + int target; + + narg = pars_command(buf, args, 10); + if (narg >= 1) { + surfaceid = search_surface(display, args[0]); + if (narg >= 2) { + target = strtol(args[1], (char **)0, 0); + } + else { + target = ICO_WINDOW_MGR_ACTIVE_POINTER | ICO_WINDOW_MGR_ACTIVE_KEYBOARD; + } + if (surfaceid >= 0) { + print_log("HOMESCREEN: active(%s,%08x,target=%x)", args[0], surfaceid, target); + ico_window_mgr_set_active(display->ico_window_mgr, surfaceid, target); + } + else { + print_log("HOMESCREEN: Unknown surface(%s) at active command", args[0]); + } + } + else { + print_log("HOMESCREEN: active command[active appid[target]] has no argument"); + } +} + + +static void animation_surface(struct display *display, char *buf) { char *args[10]; @@ -1349,6 +1436,98 @@ input_del(struct display *display, char *buf) } static void +input_send(struct display *display, char *buf) +{ + char *args[10]; + int narg; + int surfaceid; + int type; + int no; + int code; + int value; + char appid[64]; + + narg = pars_command(buf, args, 10); + if (narg >= 5) { + memset(appid, 0, sizeof(appid)); + if (args[0][0] == '@') { + strncpy(appid, &args[0][1], sizeof(appid)-1); + surfaceid = 0; + } + else { + surfaceid = search_surface(display, args[0]); + } + if (strcasecmp(args[1], "POINTER") == 0) { + type = ICO_INPUT_MGR_DEVICE_TYPE_POINTER; + } + else if (strcasecmp(args[1], "KEYBOARD") == 0) { + type = ICO_INPUT_MGR_DEVICE_TYPE_KEYBOARD; + } + else if (strcasecmp(args[1], "TOUCH") == 0) { + type = ICO_INPUT_MGR_DEVICE_TYPE_TOUCH; + } + else if (strcasecmp(args[1], "SWITCH") == 0) { + type = ICO_INPUT_MGR_DEVICE_TYPE_SWITCH; + } + else if (strcasecmp(args[1], "HAPTIC") == 0) { + type = ICO_INPUT_MGR_DEVICE_TYPE_HAPTIC; + } + else { + type = strtol(args[1], (char **)0, 0); + } + no = strtol(args[2], (char **)0, 0); + if (strcasecmp(args[3], "ABS_X") == 0) { + code = ABS_X; + } + else if (strcasecmp(args[3], "ABS_Y") == 0) { + code = ABS_Y; + } + else if (strcasecmp(args[3], "ABS_Z") == 0) { + code = ABS_Z; + } + else if (strcasecmp(args[3], "REL_X") == 0) { + code = REL_X | (EV_REL << 16); + } + else if (strcasecmp(args[3], "REL_Y") == 0) { + code = REL_Y | (EV_REL << 16); + } + else if (strcasecmp(args[3], "REL_Z") == 0) { + code = REL_Z | (EV_REL << 16); + } + else if (strcasecmp(args[3], "BTN_TOUCH") == 0) { + code = BTN_TOUCH; + } + else if (strcasecmp(args[3], "BTN_LEFT") == 0) { + code = BTN_LEFT; + } + else if (strcasecmp(args[3], "BTN_RIGHT") == 0) { + code = BTN_RIGHT; + } + else if (strcasecmp(args[3], "BTN_MIDDLE") == 0) { + code = BTN_MIDDLE; + } + else if (strcasecmp(args[3], "BTN_RIGHT") == 0) { + code = BTN_RIGHT; + } + else { + code = strtol(args[3], (char **)0, 0); + } + value = strtol(args[4], (char **)0, 0); + if (narg >= 6) { + value = (value << 16) + strtol(args[5], (char **)0, 0); + } + print_log("HOMESCREEN: input_send(%s.%x,%d,%d,%x,%d)", + appid, surfaceid, type, no, code, value); + ico_input_mgr_control_send_input_event(display->ico_input_mgr, + appid, surfaceid, type, no, code, value); + } + else { + print_log("HOMESCREEN: input_send command[input_send {@app/serface} type no code " + "value [value2]] has no argument"); + } +} + +static void input_conf(struct display *display, char *buf) { char *args[10]; @@ -1623,9 +1802,9 @@ int main(int argc, char *argv[]) while (1) { sleep_with_wayland(display->display, 20); if (display->prompt) { - printf("HOMESCREEN: "); fflush(stdout); + printf("HOMESCREEN> "); fflush(stdout); } - ret = getdata(display->ico_window_mgr, "HOMESCREEN: ", fd, buf, sizeof(buf)); + ret = getdata(display->ico_window_mgr, "HOMESCREEN> ", fd, buf, sizeof(buf)); if (ret < 0) { fprintf(stderr, "HOMESCREEN: read error: fd %d, %m\n", fd); return -1; @@ -1687,6 +1866,10 @@ int main(int argc, char *argv[]) /* Raise/Lower surface window */ raise_surface(display, &buf[5], 0); } + else if (strncasecmp(buf, "active", 6) == 0) { + /* Active surface window */ + active_window(display, &buf[6]); + } else if (strncasecmp(buf, "animation", 9) == 0) { /* Set animation surface window */ animation_surface(display, &buf[9]); @@ -1707,6 +1890,10 @@ int main(int argc, char *argv[]) /* Reset input switch to application*/ input_del(display, &buf[9]); } + else if (strncasecmp(buf, "input_send", 10) == 0) { + /* Input event send to application*/ + input_send(display, &buf[10]); + } else if (strncasecmp(buf, "input_conf", 10) == 0) { /* input switch configuration */ input_conf(display, &buf[10]); diff --git a/tests/testdata/cl_surface2.dat b/tests/testdata/cl_surface2.dat index 68b40f8..c642759 100644 --- a/tests/testdata/cl_surface2.dat +++ b/tests/testdata/cl_surface2.dat @@ -3,7 +3,7 @@ # # 1. Create Surface create-surface -# 2. Sleep 10 sec +# 2. Sleep 8 sec sleep 8 # 3. End of this Application (exit) bye diff --git a/tests/testdata/cl_surface4.dat b/tests/testdata/cl_surface4.dat index 62ff39e..9d27d43 100644 --- a/tests/testdata/cl_surface4.dat +++ b/tests/testdata/cl_surface4.dat @@ -6,6 +6,6 @@ create-surface # 2. Sleep 2 sec with color change sleep 0.1 clear-surface 0x80ff4060 -sleep 35 +sleep 60 # 3. End of this Application (exit) bye diff --git a/tests/testdata/hs_animatest_all.dat b/tests/testdata/hs_animatest_all.dat deleted file mode 100644 index df84c97..0000000 --- a/tests/testdata/hs_animatest_all.dat +++ /dev/null @@ -1,67 +0,0 @@ -# Test for Weston IVI Plugin for HomeScreen(SystemController) -# Animation Test -# -# 1. Surface animation -launch ../tests/test-client < ../tests/testdata/cl_surface4.dat 2> ../tests/testlog/test-client04.log -waitcreate 2 -resize test-client 200 300 -move test-client 300 400 0 -# -# fade and show/hide -animation test-client fade 400 -show test-client 1 -sleep 1 -hide test-client 1 -sleep 2 -# -# slide.toleft and show/hide -animation test-client slide.toleft 400 -show test-client 1 -sleep 1 -hide test-client 1 -sleep 2 -# -# slide.toright and show/hide -animation test-client slide.toright 400 -show test-client 1 -sleep 1 -hide test-client 1 -sleep 2 -# -# slide.totop and show/hide -animation test-client slide.totop 400 -show test-client 1 -sleep 1 -hide test-client 1 -sleep 2 -# -# slide.tobottom and show/hide -animation test-client slide.tobottom 400 -show test-client 1 -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 -# -# fade and move -animation test-client fade 600 -move test-client 600 200 1 -sleep 2 -move test-client 500 300 1 -sleep 3 -# -waitdestroy 60 -sleep 1 -# -kill test-client -sleep 0.5 -# -# 2. End of Test -bye - diff --git a/tests/testdata/hs_mapsurf.dat b/tests/testdata/hs_mapsurf.dat index 149d6e3..d3d8f1b 100644 --- a/tests/testdata/hs_mapsurf.dat +++ b/tests/testdata/hs_mapsurf.dat @@ -31,7 +31,6 @@ sleep 2 kill test-client kill test-eflapp@1 sleep 1 -sleep 1 # # 2. End of Test bye diff --git a/tests/testdata/hs_sendinput.dat b/tests/testdata/hs_sendinput.dat new file mode 100644 index 0000000..eddbe8d --- /dev/null +++ b/tests/testdata/hs_sendinput.dat @@ -0,0 +1,229 @@ +# Test for Weston IVI Plugin for HomeScreen(SystemController) +# send input event Test +# +# 1. trigger clients +# +launch ../tests/test-client < ../tests/testdata/cl_surface4.dat 2> ../tests/testlog/test-client.log 1>&2 +waitcreate 2 +move test-client 100 200 +show test-client +sleep 1 +# +launch ../tests/test-eflapp @1 -color=0xe02040ff 2> ../tests/testlog/test-eflapp.log 1>&2 +waitcreate 2 +move test-eflapp@1 650 80 +show test-eflapp@1 +# +# 11. send pointer event to general pointer motion(general event) +# +sleep 1 +input_send @ pointer 0 ABS_Z 80 160 +sleep 0.1 +input_send @ pointer 0 ABS_X 270 +input_send @ pointer 0 ABS_Y 440 +sleep 0.1 +input_send @ pointer 0 BTN_LEFT 1 +sleep 0.2 +input_send @ pointer 0 BTN_LEFT 0 +sleep 0.5 +input_send @ pointer 0 ABS_X 272 +input_send @ pointer 0 ABS_Y 438 +sleep 0.1 +input_send @ pointer 0 BTN_LEFT 1 +sleep 0.1 +input_send @ pointer 0 ABS_X 271 +input_send @ pointer 0 ABS_Y 439 +sleep 0.1 +input_send @ pointer 0 BTN_LEFT 0 +sleep 1 +# +# 12. send keyboard event(general event) +# +active test-client +input_send @ keyboard 0 1 1 +input_send @ keyboard 0 1 0 +sleep 0.2 +input_send @ keyboard 0 2 1 +sleep 0.1 +input_send @ keyboard 0 2 0 +sleep 1 +# +# 13. send touch event(general event) +# +active test-client +input_send @ touch 0 ABS_Z 250 450 +input_send @ touch 0 BTN_TOUCH 1 +sleep 0.1 +input_send @ touch 0 ABS_Z 255 455 +sleep 0.2 +input_send @ touch 0 BTN_TOUCH 0 +sleep 1 +# +# 14. switch event(general event) +# +active test-client +input_send @ switch 0 11 1 +input_send @ switch 0 11 0 +sleep 0.1 +input_send @ switch 0 12 1 +sleep 0.1 +input_send @ switch 0 12 0 +sleep 1 +# +# 15. haptic event(general event) +# +active test-client +input_send @ haptic 0 ABS_Z 260 460 +sleep 0.1 +input_send @ haptic 0 ABS_Z 262 462 +sleep 0.1 +input_send @ haptic 0 BTN_LEFT 1 +sleep 0.1 +input_send @ haptic 0 BTN_LEFT 0 +sleep 1 +# +# 21. send pointer event to general pointer motion(appid) +# +sleep 1 +input_send @test-client pointer 0 ABS_Z 80 160 +sleep 0.1 +input_send @test-client pointer 0 ABS_X 270 +input_send @test-client pointer 0 ABS_Y 440 +sleep 0.1 +input_send @test-client pointer 0 BTN_LEFT 1 +sleep 0.2 +input_send @test-client pointer 0 BTN_LEFT 0 +sleep 0.5 +input_send @test-client pointer 0 ABS_X 272 +input_send @test-client pointer 0 ABS_Y 438 +sleep 0.1 +input_send @test-client pointer 0 BTN_LEFT 1 +sleep 0.1 +input_send @test-client pointer 0 ABS_X 271 +input_send @test-client pointer 0 ABS_Y 439 +sleep 0.1 +input_send @test-client pointer 0 BTN_LEFT 0 +sleep 1 +# +# 22. send keyboard event(appid) +# +active test-client +input_send @test-client keyboard 0 1 1 +input_send @test-client keyboard 0 1 0 +sleep 0.2 +input_send @test-client keyboard 0 2 1 +sleep 0.1 +input_send @test-client keyboard 0 2 0 +sleep 1 +# +# 23. send touch event(appid) +# +active test-client +input_send @test-client touch 0 ABS_Z 250 450 +input_send @test-client touch 0 BTN_TOUCH 1 +sleep 0.1 +input_send @test-client touch 0 ABS_Z 255 455 +sleep 0.2 +input_send @test-client touch 0 BTN_TOUCH 0 +sleep 1 +# +# 24. switch event(appid) +# +active test-client +input_send @test-client switch 0 11 1 +input_send @test-client switch 0 11 0 +sleep 0.1 +input_send @test-client switch 0 12 1 +sleep 0.1 +input_send @test-client switch 0 12 0 +sleep 1 +# +# 25. haptic event(appid) +# +active test-client +input_send @test-client haptic 0 ABS_Z 260 460 +sleep 0.1 +input_send @test-client haptic 0 ABS_Z 262 462 +sleep 0.1 +input_send @test-client haptic 0 BTN_LEFT 1 +sleep 0.1 +input_send @test-client haptic 0 BTN_LEFT 0 +sleep 1 +# +# 31. send pointer event to general pointer motion(urface id) +# +sleep 1 +input_send test-client pointer 0 ABS_Z 80 160 +sleep 0.1 +input_send test-client pointer 0 ABS_X 270 +input_send test-client pointer 0 ABS_Y 440 +sleep 0.1 +input_send test-client pointer 0 BTN_LEFT 1 +sleep 0.2 +input_send test-client pointer 0 BTN_LEFT 0 +sleep 0.5 +input_send test-client pointer 0 ABS_X 272 +input_send test-client pointer 0 ABS_Y 438 +sleep 0.1 +input_send test-client pointer 0 BTN_LEFT 1 +sleep 0.1 +input_send test-client pointer 0 ABS_X 271 +input_send test-client pointer 0 ABS_Y 439 +sleep 0.1 +input_send test-client pointer 0 BTN_LEFT 0 +sleep 1 +# +# 32. send keyboard event(surface id) +# +active test-client +input_send test-client keyboard 0 1 1 +input_send test-client keyboard 0 1 0 +sleep 0.2 +input_send test-client keyboard 0 2 1 +sleep 0.1 +input_send test-client keyboard 0 2 0 +sleep 1 +# +# 33. send touch event(surface id) +# +active test-client +input_send test-client touch 0 ABS_Z 250 450 +input_send test-client touch 0 BTN_TOUCH 1 +sleep 0.1 +input_send test-client touch 0 ABS_Z 255 455 +sleep 0.2 +input_send test-client touch 0 BTN_TOUCH 0 +sleep 1 +# +# 34. switch event(surface id) +# +active test-client +input_send test-client switch 0 11 1 +input_send test-client switch 0 11 0 +sleep 0.1 +input_send test-client switch 0 12 1 +sleep 0.1 +input_send test-client switch 0 12 0 +sleep 1 +# +# 35. haptic event(surface id) +# +active test-client +input_send test-client haptic 0 ABS_Z 260 460 +sleep 0.1 +input_send test-client haptic 0 ABS_Z 262 462 +sleep 0.1 +input_send test-client haptic 0 BTN_LEFT 1 +sleep 0.1 +input_send test-client haptic 0 BTN_LEFT 0 +sleep 1 +# +sleep 60 +# +kill test-client +kill test-eflapp@1 +sleep 1 +# +# 99. End of Test +bye + diff --git a/tests/weston-plugin-vbox b/tests/weston-plugin-test.send_input similarity index 77% rename from tests/weston-plugin-vbox rename to tests/weston-plugin-test.send_input index 06304ab..f243dd6 100755 --- a/tests/weston-plugin-vbox +++ b/tests/weston-plugin-test.send_input @@ -14,11 +14,8 @@ sleep 1 # 3 Weston/Wayland Envionment export QT_QPA_PLATFORM=wayland -#export ELM_ENGINE=wayland_egl -#export ECORE_EVAS_ENGINE=wayland_egl -export ELM_ENGINE=wayland_shm -export ECORE_EVAS_ENGINE=wayland_shm -export XDG_RUNTIME_DIR=/run/user/5000 +export ELM_ENGINE=wayland_egl +export ECORE_EVAS_ENGINE=wayland_egl # 4 Set Environment for Test export WESTON_IVI_PLUGIN_DIR="../src/.libs" @@ -26,14 +23,14 @@ export WESTON_IVI_PLUGIN_DIR="../src/.libs" # 5 Start Weston export XDG_CONFIG_HOME="../tests" MOD_DIR="$PWD/../src/.libs" -/usr/bin/weston --backend=fbdev-backend.so --modules=$MOD_DIR/ico_plugin_loader.so --idle-time=0 --log=../tests/testlog/weston.log & +/usr/bin/weston --modules=$MOD_DIR/ico_plugin_loader.so --idle-time=0 --log=../tests/testlog/weston.log & sleep 1 # 6 Set library path export LD_LIBRARY_PATH=../src/.libs:$LD_LIBRARY_PATH # 7 Start test-homescreen -../tests/test-homescreen < ../tests/testdata/hs_alltest.dat 2> ../tests/testlog/test-homescreen.log +../tests/test-homescreen < ../tests/testdata/hs_sendinput.dat 2> ../tests/testlog/test-homescreen.log # 8 End of Test sleep 2 diff --git a/tests/weston.ini b/tests/weston.ini index 8e3d53d..00bb382 100644 --- a/tests/weston.ini +++ b/tests/weston.ini @@ -17,6 +17,11 @@ shell-exe= #transform=90 #[output] +#name=HDMI2 +#mode=1280x480 +#mode=100.00 1280 1300 1400 1400 480 500 600 700 -hsync +vsyn + +#[output] #name=LVDS1 #mode=1680x1050 #transform=90 @@ -41,10 +46,13 @@ displayno=1,0 # default layer id default=1 # layer id at the time of the system startup -startup=101 +startup=109 +# background layer id +background=0 # input layer id input=101 # cursor layer id +cursor=102 [ivi-animation] # default animation @@ -52,13 +60,13 @@ default=fade # animation time (ms) time=500 # animation frame rate(frame/sec) -fps=15 +fps=30 [ivi-debug] # debug flags # bit.0 0=hide on surface create(for with HomeScreen)/1=show on surface create flag=0 -# 0=no debug log write(1=err/2=warn/3=info/4=debug) -log=4 +# 0=no debug log write(1=err/2=warn/3=info/4=trace/5=debug) +log=5 diff --git a/tests/weston.ini.fullhd b/tests/weston.ini.fullhd deleted file mode 100644 index 8f5745a..0000000 --- a/tests/weston.ini.fullhd +++ /dev/null @@ -1,64 +0,0 @@ -[core] -modules=error_but_no_problem_for_test.so -# This is Error for Test(No Problem) - -#[input-method] -#path=/no_input_method_err_but_no_problem.so - -[shell] -num-workspaces=1 -shell-exe= - -[output] -name=HDMI3 -#mode=1680x945 -#mode=1920x1080 -mode=173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync -transform=90 - -#[output] -#name=LVDS1 -#mode=1680x1050 -#transform=90 - -#[output] -#name=VGA1 -#mode=173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync -#transform=90 - -#[output] -#name=X1 -#mode=1024x768 -#transform=flipped-270 - -[ivi-plugin] -modules=ico_ivi_shell.so,ico_window_mgr.so,ico_window_animation.so,ico_input_mgr.so - -[ivi-display] -displayno=1,0 - -[ivi-layer] -# default layer id -default=1 -# layer id at the time of the system startup -startup=101 -# input layer id -input=101 -# cursor layer id - -[ivi-animation] -# default animation -default=fade -# animation time (ms) -time=500 -# animation frame rate(frame/sec) -fps=15 - -[ivi-debug] -# debug flags -# bit.0 0=hide on surface create(for with HomeScreen)/1=show on surface create -flag=0 - -# 0=no debug log write(1=err/2=warn/3=info/4=debug) -log=4 - -- 2.7.4