diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ico_input_mgr.c | 87 | ||||
-rw-r--r-- | src/ico_window_mgr.c | 46 | ||||
-rw-r--r-- | src/ico_window_mgr.h | 2 |
3 files changed, 119 insertions, 16 deletions
diff --git a/src/ico_input_mgr.c b/src/ico_input_mgr.c index 3aaea7f..178fd9a 100644 --- a/src/ico_input_mgr.c +++ b/src/ico_input_mgr.c @@ -447,11 +447,15 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, int event; /* event flag */ 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 " - "code=%x value=%d)", - target ? target : "(NULL)", surfaceid, type, deviceno, code, value); + "time=%d code=%x value=%d)", + target ? target : "(NULL)", surfaceid, type, deviceno, + time, code, value); /* search pseudo input device */ wl_list_for_each (dev, &pInputMgr->dev_list, link) { @@ -594,36 +598,85 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, if ((surfaceid == 0) && ((target == NULL) || (*target == 0) || (*target == ' '))) { /* send event to surface via weston */ - /* disable the event transmission to a touch layer */ - ico_window_mgr_restack_layer(NULL, TRUE); + /* disable the event transmission to a input layer */ + if (type == ICO_INPUT_MGR_DEVICE_TYPE_TOUCH) { + ico_window_mgr_input_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; + } 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); + 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); + grabsave = pInputMgr->seat->touch->focus; + weston_touch_set_focus(pInputMgr->seat, + weston_compositor_pick_surface( + pInputMgr->compositor, fix_x, fix_y, &dx, &dy)); notify_touch(pInputMgr->seat, ctime, 0, fix_x, fix_y, WL_TOUCH_MOTION); + weston_touch_set_focus(pInputMgr->seat, grabsave); } - else { - uifw_trace("ico_mgr_send_input_event: notify_motion_absolute(%d,%d)", - fix_x, fix_y); + else if (pInputMgr->seat->pointer) { + uifw_trace("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); 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); - notify_button(pInputMgr->seat, ctime, code, - value ? WL_POINTER_BUTTON_STATE_PRESSED : - WL_POINTER_BUTTON_STATE_RELEASED); + 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); + } break; case EVENT_TOUCH: if (value) { - uifw_trace("ico_mgr_send_input_event: notify_touch(%d,%d,DOWN)", - fix_x, fix_y); + uifw_trace("ico_mgr_send_input_event: notify_touch(DOWN=%d/%d)", + fix_x/256, fix_y/256); + grabsave = pInputMgr->seat->touch->focus; + weston_touch_set_focus(pInputMgr->seat, + weston_compositor_pick_surface( + pInputMgr->compositor, fix_x, fix_y, &dx, &dy)); notify_touch(pInputMgr->seat, ctime, 0, fix_x, fix_y, WL_TOUCH_DOWN); + weston_touch_set_focus(pInputMgr->seat, grabsave); } 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)); notify_touch(pInputMgr->seat, ctime, 0, 0, 0, WL_TOUCH_UP); + weston_touch_set_focus(pInputMgr->seat, grabsave); } break; case EVENT_KEY: @@ -636,8 +689,10 @@ ico_mgr_send_input_event(struct wl_client *client, struct wl_resource *resource, 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); + /* enable the event transmission to a input layer */ + if (type == ICO_INPUT_MGR_DEVICE_TYPE_TOUCH) { + ico_window_mgr_input_layer(FALSE); + } } else { if ((target != NULL) && (*target != 0) && (*target != ' ')) { diff --git a/src/ico_window_mgr.c b/src/ico_window_mgr.c index fe97775..6ff4db3 100644 --- a/src/ico_window_mgr.c +++ b/src/ico_window_mgr.c @@ -147,6 +147,8 @@ struct ico_win_mgr { 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 *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]; @@ -1257,6 +1259,42 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc /*--------------------------------------------------------------------------*/ /** + * @brief ico_window_mgr_input_layer: input layer control + * + * @param[in] omit omit input layer flag (TRUE=omit/FALSE=not omit) + * @return none + */ +/*--------------------------------------------------------------------------*/ +WL_EXPORT void +ico_window_mgr_input_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"); + return; + } + + wl_list_for_each (eu, &_ico_win_mgr->input_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; + eu->surface->geometry.x = (float)(ICO_IVI_MAX_COORDINATE+1); + eu->surface->geometry.y = (float)(ICO_IVI_MAX_COORDINATE+1); + } + else { + eu->surface->geometry.x = (float)eu->animation.pos_x; + eu->surface->geometry.y = (float)eu->animation.pos_y; + } + } +} + +/*--------------------------------------------------------------------------*/ +/** * @brief win_mgr_create_layer: create new layer * * @param[in] usurf UIFW surface, (if need) @@ -1285,9 +1323,11 @@ win_mgr_create_layer(struct uifw_win_surface *usurf, const uint32_t layer) } 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_cursor_layer ) { new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_CURSOR; + _ico_win_mgr->cursor_layer = new_el; } else { new_el->layer_type = ICO_WINDOW_MGR_LAYER_TYPE_NORMAL; @@ -1566,6 +1606,9 @@ uifw_set_window_layer(struct wl_client *client, struct wl_resource *resource, else if (layer == ICO_WINDOW_MGR_V_LAYER_CURSOR) { layer = _ico_ivi_cursor_layer; } + else if (layer == ICO_WINDOW_MGR_V_LAYER_STARTUP) { + layer = _ico_ivi_startup_layer; + } uifw_trace("uifw_set_window_layer: Enter res=%08x surfaceid=%08x layer=%d", (int)resource, surfaceid, layer); @@ -2206,6 +2249,9 @@ uifw_set_layer_visible(struct wl_client *client, struct wl_resource *resource, else if (layer == ICO_WINDOW_MGR_V_LAYER_CURSOR) { layer = _ico_ivi_cursor_layer; } + else if (layer == ICO_WINDOW_MGR_V_LAYER_STARTUP) { + layer = _ico_ivi_startup_layer; + } uifw_trace("uifw_set_layer_visible: Enter(layer=%d, visilbe=%d)", layer, visible); diff --git a/src/ico_window_mgr.h b/src/ico_window_mgr.h index 06a11bd..44b6a4e 100644 --- a/src/ico_window_mgr.h +++ b/src/ico_window_mgr.h @@ -217,6 +217,8 @@ struct uifw_win_surface *ico_window_mgr_get_usurf_client(const uint32_t surfacei 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); /* chek surface visibility */ int ico_window_mgr_is_visible(struct uifw_win_surface *usurf); /* set window animation hook */ |