};
static struct egl_surface *
-pick_surface(struct wlsc_input_device *device)
+pick_surface(struct wlsc_input_device *device, int32_t *sx, int32_t *sy)
{
struct egl_compositor *ec = device->ec;
struct egl_surface *es;
es = container_of(es->link.prev,
struct egl_surface, link);
+
+ /* Transform to surface coordinates. */
+ *sx = (x - es->map.x) * es->width / es->map.width;
+ *sy = (y - es->map.y) * es->height / es->map.height;
}
return NULL;
if (y >= ec->height)
y = ec->height - 1;
- es = pick_surface(device);
-
- if (es) {
- sx = (x - es->map.x) * es->width / es->map.width;
- sy = (y - es->map.y) * es->height / es->map.height;
+ es = pick_surface(device, &sx, &sy);
+ if (es)
wl_surface_post_event(&es->base, &device->base,
WL_INPUT_MOTION, x, y, sx, sy);
- }
device->x = x;
device->y = y;
if (!ec->vt_active)
return;
- es = pick_surface(device);
+ es = pick_surface(device, &sx, &sy);
if (es) {
wl_list_remove(&es->link);
wl_list_insert(device->ec->surface_list.prev, &es->link);
device->grab--;
}
- sx = (device->x - es->map.x) * es->width / es->map.width;
- sy = (device->y - es->map.y) * es->height / es->map.height;
-
/* FIXME: Swallow click on raise? */
wl_surface_post_event(&es->base, &device->base,
WL_INPUT_BUTTON, button, state,