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)
{
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;