From 88c8408297106c5020084e5f0c9ba3dbca48afc4 Mon Sep 17 00:00:00 2001 From: Masayuki Sasaki Date: Fri, 28 Feb 2014 14:22:49 +0900 Subject: [PATCH] Some interfaces were added for SystemController corresponding to GENIVI layer management. Change-Id: I28da138dd48652a7bcf135222e738acb94549298 Signed-off-by: Masayuki Sasaki --- packaging/ico-uxf-weston-plugin.changes | 5 ++ protocol/ico_input_mgr.xml | 9 +++ protocol/ico_window_mgr.xml | 21 +++++- settings/weston.ini | 3 +- src/ico_input_mgr.c | 111 ++++++++++++++++++++++++----- src/ico_plugin_version.h | 2 +- src/ico_window_mgr.c | 119 ++++++++++++++++++++++++-------- src/ico_window_mgr_private.h | 13 ---- 8 files changed, 219 insertions(+), 64 deletions(-) diff --git a/packaging/ico-uxf-weston-plugin.changes b/packaging/ico-uxf-weston-plugin.changes index 01a44c3..ca63b36 100644 --- a/packaging/ico-uxf-weston-plugin.changes +++ b/packaging/ico-uxf-weston-plugin.changes @@ -1,3 +1,8 @@ +* Fri Feb 28 2014 Shibata Makoto accepted/tizen/ivi/20140214.223342@8dc903b +- 0.9.21 release +-- Some interfaces were added for SystemController corresponding to GENIVI layer management. +-- It changes so that the layer controlling function of GENIVI may be used for surface management and layer management. + * Thu Feb 13 2014 Shibata Makoto accepted/tizen/ivi/20140128.174118@4018b9f - bugfix: TIVI-2396: Virtual Keyboard doesn't catch the mouse event with the ICO UI diff --git a/protocol/ico_input_mgr.xml b/protocol/ico_input_mgr.xml index a2d8219..73db9f2 100644 --- a/protocol/ico_input_mgr.xml +++ b/protocol/ico_input_mgr.xml @@ -25,6 +25,15 @@ + + + + Keyboard event sent to application. + + + + + diff --git a/protocol/ico_window_mgr.xml b/protocol/ico_window_mgr.xml index 1422a1d..cc2a71b 100644 --- a/protocol/ico_window_mgr.xml +++ b/protocol/ico_window_mgr.xml @@ -91,7 +91,26 @@ + + + Event of surface property changed. + + + + + + + + + + + + + + Event of surface destroy. + + + - diff --git a/settings/weston.ini b/settings/weston.ini index 8188e0c..404ded7 100644 --- a/settings/weston.ini +++ b/settings/weston.ini @@ -10,7 +10,8 @@ animation=fade startup-animation=fade [input-method] -path=/bin/weekeyboard +#path=/bin/weekeyboard +path= #[output] #name=LVDS1 diff --git a/src/ico_input_mgr.c b/src/ico_input_mgr.c index 61283f0..2fc0c8e 100644 --- a/src/ico_input_mgr.c +++ b/src/ico_input_mgr.c @@ -61,7 +61,6 @@ 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 wl_list free_region; /* free input region table list */ struct weston_seat *seat; /* input seat */ struct wl_resource *inputmgr; @@ -112,22 +111,6 @@ struct ico_app_mgr { #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 disp_x; /* display X coordinate */ - int disp_y; /* display Y coordinate */ - int x; /* current X coordinate */ - int y; /* current Y coordinate */ - int pend_x; /* pending X coordinate */ - int pend_y; /* pending Y coordinate */ - uint16_t node; /* display number */ - uint16_t pending; /* pending flag */ - struct weston_view *grab; /* current grab surface view */ -}; - /* Input Region Table */ struct uifw_region_mng { struct wl_list link; /* link pointer */ @@ -165,6 +148,9 @@ static void ico_mgr_add_input_app(struct wl_client *client, struct wl_resource * /* delete input event to application */ static void ico_mgr_del_input_app(struct wl_client *client, struct wl_resource *resource, const char *appid, const char *device, int32_t input); + /* send key input event from device */ +static void ico_mgr_send_key_event(struct wl_client *client, struct wl_resource *resource, + const char *target, int32_t code, int32_t value); /* set input region */ static void ico_mgr_set_input_region(struct wl_client *client, struct wl_resource *resource, const char *target, int32_t x, int32_t y, @@ -202,7 +188,8 @@ static void ico_input_send_region_event(struct wl_array *array); /* Input Manager Control interface */ static const struct ico_input_mgr_control_interface ico_input_mgr_implementation = { ico_mgr_add_input_app, - ico_mgr_del_input_app + ico_mgr_del_input_app, + ico_mgr_send_key_event }; /* Extended Input interface */ @@ -420,6 +407,93 @@ ico_mgr_del_input_app(struct wl_client *client, struct wl_resource *resource, /*--------------------------------------------------------------------------*/ /** + * @brief ico_mgr_send_key_event: send key input event from device input controller + * + * @param[in] client client(HomeScreen) + * @param[in] resource resource of request + * @param[in] target target window name and application id + * @param[in] code event code + * @param[in] value event value + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +ico_mgr_send_key_event(struct wl_client *client, struct wl_resource *resource, + const char *target, int32_t code, int32_t value) +{ + struct uifw_win_surface *usurf; /* UIFW surface */ + struct wl_resource *cres; /* event send client resource */ + struct wl_array dummy_array; /* dummy array for wayland API */ + uint32_t ctime; /* current time(ms) */ + uint32_t serial; /* event serial number */ + int keyboard_active; /* keyborad active surface flag */ + + uifw_trace("ico_mgr_send_key_event: Enter(target=%s code=%x value=%d)", + target ? target : "(NULL)", code, value); + + if (! pInputMgr->seat->keyboard) { + uifw_error("ico_mgr_send_key_event: Leave(system has no keyboard)"); + return; + } + + ctime = weston_compositor_get_time(); + + if ((target == NULL) || (*target == 0) || (*target == ' ')) { + /* send event to surface via weston */ + + uifw_trace("ico_mgr_send_key_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); + } + else { + /* send event to fixed application */ + /* get application surface */ + usurf = ico_window_mgr_get_client_usurf(target); + if (! usurf) { + uifw_trace("ico_mgr_send_key_event: Leave(window=%s dose not exist)", + target); + return; + } + + /* send event */ + cres = wl_resource_find_for_client( + &pInputMgr->seat->keyboard->resource_list, + wl_resource_get_client(usurf->surface->resource)); + if (cres) { + if (pInputMgr->seat->keyboard->focus == usurf->surface) { + keyboard_active = 1; + } + else { + keyboard_active = 0; + } + if (! keyboard_active) { + wl_array_init(&dummy_array); + serial = wl_display_next_serial(pInputMgr->compositor->wl_display); + wl_keyboard_send_enter(cres, serial, + usurf->surface->resource, &dummy_array); + } + serial = wl_display_next_serial(pInputMgr->compositor->wl_display); + uifw_trace("ico_mgr_send_key_event: send Key (%d, %d) to %08x", + code, value, usurf->surfaceid); + wl_keyboard_send_key(cres, serial, ctime, code, + value ? WL_KEYBOARD_KEY_STATE_PRESSED : + WL_KEYBOARD_KEY_STATE_RELEASED); + if (! keyboard_active) { + serial = wl_display_next_serial(pInputMgr->compositor->wl_display); + wl_keyboard_send_leave(cres, serial, usurf->surface->resource); + } + } + else { + uifw_trace("ico_mgr_send_key_event: Key client %08x dose not exist", + (int)usurf->surface->resource); + } + } + uifw_debug("ico_mgr_send_key_event: Leave"); +} + +/*--------------------------------------------------------------------------*/ +/** * @brief ico_mgr_set_input_region: set input region for haptic devcie * * @param[in] client client(Device Input Controller) @@ -1420,7 +1494,6 @@ 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); wl_list_init(&pInputMgr->free_region); p = malloc(sizeof(struct uifw_region_mng)*100); if (p) { diff --git a/src/ico_plugin_version.h b/src/ico_plugin_version.h index d33e6f5..381cb64 100644 --- a/src/ico_plugin_version.h +++ b/src/ico_plugin_version.h @@ -1 +1 @@ -#define ICO_PLUIGN_VERSION "0.9.21 (Feb-24-2014)" +#define ICO_PLUIGN_VERSION "0.9.21 (Feb-28-2014)" diff --git a/src/ico_window_mgr.c b/src/ico_window_mgr.c index a5d14da..89e718c 100644 --- a/src/ico_window_mgr.c +++ b/src/ico_window_mgr.c @@ -174,6 +174,8 @@ static void bind_ico_win_mgr(struct wl_client *client, static void unbind_ico_win_mgr(struct wl_resource *resource); /* convert animation name to Id value */ static int ico_get_animation_name(const char *animation); + /* send event to controller */ +static void win_mgr_send_event(int event, uint32_t surfaceid, uint32_t arg1); /* touch/click select surface */ static void win_mgr_select_surface(struct weston_seat *seat, struct weston_surface *focus, int target); @@ -511,11 +513,11 @@ ico_window_mgr_set_weston_surface(struct uifw_win_surface *usurf, height = buf_height; usurf->height = buf_height; } - if ((usurf->width > buf_width) && (usurf->scalex <= 1.0f)) { + if (usurf->width > buf_width) { width = buf_width; x += (usurf->width - buf_width)/2; } - if ((usurf->height > buf_height) && (usurf->scaley <= 1.0f)) { + if (usurf->height > buf_height) { height = buf_height; y += (usurf->height - buf_height)/2; } @@ -1002,6 +1004,40 @@ ico_get_animation_name(const char *animation) /*--------------------------------------------------------------------------*/ /** + * @brief win_mgr_send_event: send event to controller + * + * @param[in] event event code + * @param[in] surfaceid surface id + * @param[in] arg1 argument 1 + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +win_mgr_send_event(int event, uint32_t surfaceid, uint32_t arg1) +{ + struct uifw_manager *mgr; + + /* send event to manager */ + wl_list_for_each (mgr, &_ico_win_mgr->manager_list, link) { + switch (event) { + case ICO_WINDOW_MGR_WINDOW_ACTIVE: /* active event */ + uifw_trace("win_mgr_send_event: Send ACTIVE(surf=%08x, select=%x)", + surfaceid, arg1); + ico_window_mgr_send_window_active(mgr->resource, surfaceid, arg1); + break; + case ICO_WINDOW_MGR_DESTROY_SURFACE: /* surface destroy event */ + uifw_trace("win_mgr_send_event: Send DESTROY_SURFACE(surf=%08x)", surfaceid); + ico_window_mgr_send_destroy_surface(mgr->resource, surfaceid); + break; + default: + uifw_error("win_mgr_send_event: Unknown event(%d)", event); + break; + } + } +} + +/*--------------------------------------------------------------------------*/ +/** * @brief win_mgr_select_surface: select surface by mouse click * * @param[in] seat weston seat @@ -1183,9 +1219,6 @@ ico_ivi_surfaceConfigureNotification(struct weston_layout_surface *ivisurf, void struct weston_view *view; struct weston_surface *surface; uint32_t id_surface; -#if 1 /* for check genivi */ - struct weston_layout_SurfaceProperties prop; -#endif id_surface = weston_layout_getIdOfSurface(ivisurf); view = weston_layout_get_weston_view(ivisurf); @@ -1200,29 +1233,10 @@ ico_ivi_surfaceConfigureNotification(struct weston_layout_surface *ivisurf, void id_surface); } else { -#if 1 /* for check genivi */ - if (weston_layout_getPropertiesOfSurface(ivisurf, &prop) != 0) { - uifw_trace("ico_ivi_surfaceConfigureNotification: Properties get Error"); - uifw_trace("ico_ivi_surfaceConfigureNotification: Configure %08x " - "x/y=%d/%d w/h=%d/%d", - id_surface, (int)view->geometry.x, (int)view->geometry.y, - surface->width, surface->height); - } - else { - uifw_trace("ico_ivi_surfaceConfigureNotification: Configure %08x " - "x/y=%d/%d->%d/%d w/h=%d/%d(%d/%d)->%d/%d", - id_surface, prop.destX, prop.destY, - (int)view->geometry.x, (int)view->geometry.y, - prop.sourceWidth, prop.sourceHeight, - prop.origSourceWidth, prop.origSourceHeight, - surface->width, surface->height); - } -#else uifw_trace("ico_ivi_surfaceConfigureNotification: Configure %08x " "x/y=%d/%d w/h=%d/%d", id_surface, (int)view->geometry.x, (int)view->geometry.y, surface->width, surface->height); -#endif weston_layout_surfaceSetSourceRectangle(ivisurf, 0, 0, surface->width, surface->height); weston_layout_surfaceSetDestinationRectangle(ivisurf, @@ -1248,16 +1262,48 @@ ico_ivi_surfacePropertyNotification(struct weston_layout_surface *ivisurf, enum weston_layout_notification_mask mask, void *userdata) { + struct uifw_manager *mgr; uint32_t id_surface; int retanima; + uint32_t newmask; struct uifw_win_surface *usurf; + newmask = ((uint32_t)mask) & (~(IVI_NOTIFICATION_OPACITY|IVI_NOTIFICATION_ORIENTATION| + IVI_NOTIFICATION_PIXELFORMAT)); id_surface = weston_layout_getIdOfSurface(ivisurf); - if (mask != 0) { - usurf = ico_window_mgr_get_usurf(id_surface); + usurf = ico_window_mgr_get_usurf(id_surface); + + if ((newmask != 0) && (usurf != NULL)) { uifw_trace("ico_ivi_surfacePropertyNotification: Property %x(%08x) usurf=%08x", - id_surface, mask, (int)usurf); - if ((mask & IVI_NOTIFICATION_VISIBILITY) && (usurf != NULL)) { + id_surface, newmask, (int)usurf); + if (newmask & (IVI_NOTIFICATION_SOURCE_RECT|IVI_NOTIFICATION_DEST_RECT| + IVI_NOTIFICATION_POSITION|IVI_NOTIFICATION_DIMENSION)) { + /* change position or size */ + uifw_trace("ico_ivi_surfacePropertyNotification: %08x x/y=%d/%d->%d/%d " + "w/h=%d/%d->%d/%d(%d/%d)", id_surface, usurf->x, usurf->y, + prop->destX, prop->destY, usurf->width, usurf->height, + prop->destWidth, prop->destHeight, + prop->sourceWidth, prop->sourceHeight); + if ((usurf->client_width == prop->sourceWidth) && + (usurf->client_height == prop->sourceHeight)) { + newmask &= (~(IVI_NOTIFICATION_SOURCE_RECT|IVI_NOTIFICATION_DIMENSION)); + } + else { + usurf->client_width = prop->sourceWidth; + usurf->client_height = prop->sourceHeight; + } + if ((usurf->x == prop->destX) && (usurf->y == prop->destY) && + (usurf->width == prop->destWidth) && (usurf->height == prop->destHeight)) { + newmask &= (~(IVI_NOTIFICATION_DEST_RECT|IVI_NOTIFICATION_POSITION)); + } + else { + usurf->x = prop->destX; + usurf->y = prop->destY; + usurf->width = prop->destWidth; + usurf->height = prop->destHeight; + } + } + if (newmask & IVI_NOTIFICATION_VISIBILITY) { if ((usurf->visible == 0) && (prop->visibility)) { uifw_trace("ico_ivi_surfacePropertyNotification: %08x Visible 0=>1", id_surface); @@ -1306,6 +1352,18 @@ ico_ivi_surfacePropertyNotification(struct weston_layout_surface *ivisurf, } else { uifw_trace("ico_ivi_surfacePropertyNotification: visible no change"); + newmask &= (~IVI_NOTIFICATION_VISIBILITY); + } + } + + if (newmask) { + /* surface changed, send event to controller */ + wl_list_for_each (mgr, &_ico_win_mgr->manager_list, link) { + uifw_trace("win_mgr_send_event: Send UPDATE_SURFACE(surf=%08x)", id_surface); + ico_window_mgr_send_update_surface(mgr->resource, id_surface, + usurf->visible, usurf->client_width, + usurf->client_height, usurf->x, usurf->y, + usurf->width, usurf->height); } } } @@ -2080,7 +2138,7 @@ win_mgr_surface_configure(struct uifw_win_surface *usurf, /* not set geometry width/height */ ev = ico_ivi_get_primary_view(usurf); - weston_view_set_position(ev, x + usurf->xadd, y + usurf->yadd); + weston_view_set_position(ev, x, y); } } @@ -2122,6 +2180,9 @@ win_mgr_destroy_surface(struct weston_surface *surface) (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_DESTROY, (void *)usurf); } + /* send destroy event to controller */ + win_mgr_send_event(ICO_WINDOW_MGR_DESTROY_SURFACE, usurf->surfaceid, 0); + /* delete from cleint list */ wl_list_remove(&usurf->client_link); diff --git a/src/ico_window_mgr_private.h b/src/ico_window_mgr_private.h index e5b994e..faeeecf 100644 --- a/src/ico_window_mgr_private.h +++ b/src/ico_window_mgr_private.h @@ -97,28 +97,15 @@ struct uifw_win_surface { struct weston_surface *surface; /* Weston surface */ struct weston_layout_surface *ivisurf; /* Weston layout surface */ struct uifw_client *uclient; /* Client */ - struct weston_transform transform; /* transform matrix */ - float scalex; /* surface transform scale of X */ - float scaley; /* surface transform scale of Y */ int x; /* X-coordinate */ int y; /* Y-coordinate */ - short xadd; /* X-coordinate delta */ - short yadd; /* Y-coordinate delta */ uint16_t width; /* Width */ uint16_t height; /* Height */ uint16_t client_width; /* Widht that a client(App) required */ uint16_t client_height; /* Height that a client(App) required */ - uint16_t conf_width; /* Width that notified to client */ - uint16_t conf_height; /* Height that notified to client */ - uint32_t attributes; /* surface attributes */ char winname[ICO_IVI_WINNAME_LENGTH];/* Window name */ - char disable; /* can not display */ char visible; /* visibility */ - char raise; /* raise(top of the layer) */ - char created; /* sended created event to manager */ - char mapped; /* end of map */ char restrain_configure; /* restrant configure event */ - char set_transform; /* surface transform flag */ char res[1]; /* (unused) */ struct _uifw_win_surface_animation { /* wndow animation */ struct weston_animation animation; /* weston animation control */ -- 2.7.4