From: jeon Date: Mon, 16 Mar 2020 05:38:07 +0000 (+0900) Subject: e_devicemgr: clipping warp coords to inside of the window X-Git-Tag: submit/tizen/20200320.100516~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F29%2F227729%2F4;p=platform%2Fupstream%2Fenlightenment.git e_devicemgr: clipping warp coords to inside of the window Change-Id: I4ad3f284eef937caf5e70da6e6d41983ed9a94b5 --- diff --git a/src/bin/e_devicemgr_input.c b/src/bin/e_devicemgr_input.c index b101546155..85abab3439 100644 --- a/src/bin/e_devicemgr_input.c +++ b/src/bin/e_devicemgr_input.c @@ -30,8 +30,9 @@ int e_devicemgr_input_pointer_warp(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface, wl_fixed_t x, wl_fixed_t y) { E_Client *ec; - int new_x, new_y; - int ret; + Evas_Map *map; + int new_x, new_y, ret; + int i, min_x, min_y, max_x, max_y, tmp_x, tmp_y; if (!(ec = wl_resource_get_user_data(surface)) || !ec->visible) { @@ -54,9 +55,42 @@ e_devicemgr_input_pointer_warp(struct wl_client *client, struct wl_resource *res new_x = wl_fixed_to_int(x); new_y = wl_fixed_to_int(y); + if (new_x < ec->x) new_x = ec->x; + if ((ec->w != 0) && (new_x > ec->x + ec->w - 1)) new_x = ec->x + ec->w - 1; + + if (new_y < ec->y) new_y = ec->y; + if ((ec->h != 0) && (new_y > ec->y + ec->h - 1)) new_y = ec->y + ec->h - 1; + if (evas_object_map_enable_get(ec->frame)) { e_comp_wl_map_inv_coord_get(ec, new_x, new_y, &new_x, &new_y); + + map = (Evas_Map *)evas_object_map_get(ec->frame); + evas_map_point_coord_get(map, 0, &min_x, &min_y, NULL); + max_x = min_x; + max_y = min_y; + + for (i = 1; i < evas_map_count_get(map); i++) + { + evas_map_point_coord_get(map, i, &tmp_x, &tmp_y, NULL); + + if (tmp_x < min_x) min_x = tmp_x; + else if (tmp_x > max_x) max_x = tmp_x; + + if (tmp_y < min_y) min_y = tmp_y; + else if (tmp_y > max_y) max_y = tmp_y; + } + + if (min_x != max_x) + { + if (new_x < min_x) new_x = min_x; + if (new_x > max_x - 1) new_x = max_x - 1; + } + if (min_y != max_y) + { + if (new_y < min_y) new_y = min_y; + if (new_y > max_y - 1) new_y = max_y - 1; + } } ret = _e_devicemgr_input_pointer_warp(ec->client.x + new_x, ec->client.y + new_y); return ret;