weston_seat_set_keyboard(struct weston_seat *seat, struct weston_keyboard *keyboard);
void
weston_seat_set_touch(struct weston_seat *seat, struct weston_touch *touch);
-void
-weston_seat_update_drag_surface(struct weston_seat *seat, int dx, int dy);
void
weston_pointer_init(struct weston_pointer *pointer);
struct weston_pointer_grab drag_grab;
struct weston_surface *drag_surface;
struct wl_listener drag_surface_destroy_listener;
+ int32_t drag_dx, drag_dy;
uint32_t num_tp;
weston_compositor_offscreen(struct weston_compositor *compositor);
void
weston_compositor_sleep(struct weston_compositor *compositor);
-void
-weston_compositor_update_drag_surfaces(struct weston_compositor *compositor);
struct weston_surface *
weston_compositor_pick_surface(struct weston_compositor *compositor,
wl_fixed_t x, wl_fixed_t y,
{
struct weston_seat *seat = es->configure_private;
struct wl_list *list;
+ float fx, fy;
if (!weston_surface_is_mapped(es) && es->buffer_ref.buffer) {
if (seat->sprite && weston_surface_is_mapped(seat->sprite))
empty_region(&es->pending.input);
}
- weston_surface_configure(es,
- es->geometry.x + sx, es->geometry.y + sy,
- width, height);
+ seat->drag_dx += sx;
+ seat->drag_dy += sy;
+
+ fx = wl_fixed_to_double(seat->pointer->x) + seat->drag_dx;
+ fy = wl_fixed_to_double(seat->pointer->y) + seat->drag_dy;
+ weston_surface_configure(es, fx, fy, width, height);
}
static int
}
seat->drag_surface = surface;
-
- weston_surface_set_position(seat->drag_surface,
- wl_fixed_to_double(seat->pointer->x),
- wl_fixed_to_double(seat->pointer->y));
+ seat->drag_dx = 0;
+ seat->drag_dy = 0;
surface->configure = drag_surface_configure;
surface->configure_private = seat;
seat->drag_surface = NULL;
}
-void
-weston_seat_update_drag_surface(struct weston_seat *seat, int dx, int dy)
-{
- if (!seat->drag_surface)
- return;
-
- if (!dx && !dy)
- return;
-
- weston_surface_set_position(seat->drag_surface,
- seat->drag_surface->geometry.x + wl_fixed_to_double(dx),
- seat->drag_surface->geometry.y + wl_fixed_to_double(dy));
-}
-
-void
-weston_compositor_update_drag_surfaces(struct weston_compositor *compositor)
-{
- struct weston_seat *seat;
-
- wl_list_for_each(seat, &compositor->seat_list, link)
- weston_seat_update_drag_surface(seat, 0, 0);
-}
-
static void
destroy_drag_focus(struct wl_listener *listener, void *data)
{
{
struct weston_seat *seat =
container_of(grab, struct weston_seat, drag_grab);
+ float fx, fy;
+
+ if (seat->drag_surface) {
+ fx = wl_fixed_to_double(seat->pointer->x) + seat->drag_dx;
+ fy = wl_fixed_to_double(seat->pointer->y) + seat->drag_dy;
+ weston_surface_set_position(seat->drag_surface, fx, fy);
+ weston_surface_schedule_repaint(seat->drag_surface);
+ }
if (seat->drag_focus_resource)
wl_data_device_send_motion(seat->drag_focus_resource,
static void
data_device_end_drag_grab(struct weston_seat *seat)
{
- if (seat->drag_surface) {
+ if (seat->drag_surface)
device_release_drag_surface(seat);
- weston_seat_update_drag_surface(seat, 0, 0);
- }
drag_grab_focus(&seat->drag_grab, NULL,
wl_fixed_from_int(0), wl_fixed_from_int(0));
if (icon_resource) {
if (!device_setup_new_drag_surface(seat, icon_resource->data))
return;
- weston_seat_update_drag_surface(seat, 0, 0);
}
weston_pointer_set_focus(seat->pointer, NULL,