struct weston_pointer_grab;
struct weston_pointer_grab_interface {
void (*focus)(struct weston_pointer_grab *grab);
- void (*motion)(struct weston_pointer_grab *grab, uint32_t time);
+ void (*motion)(struct weston_pointer_grab *grab, uint32_t time,
+ wl_fixed_t x, wl_fixed_t y);
void (*button)(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state);
void (*cancel)(struct weston_pointer_grab *grab);
void
weston_pointer_clamp(struct weston_pointer *pointer,
wl_fixed_t *fx, wl_fixed_t *fy);
+void
+weston_pointer_move(struct weston_pointer *pointer,
+ wl_fixed_t x, wl_fixed_t y);
struct weston_keyboard *
weston_keyboard_create(void);
}
static void
-drag_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
+drag_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+ wl_fixed_t x, wl_fixed_t y)
{
struct weston_drag *drag =
container_of(grab, struct weston_drag, grab);
float fx, fy;
wl_fixed_t sx, sy;
+ weston_pointer_move(pointer, x, y);
+
if (drag->icon) {
fx = wl_fixed_to_double(pointer->x) + drag->dx;
fy = wl_fixed_to_double(pointer->y) + drag->dy;
}
static void
-default_grab_pointer_motion(struct weston_pointer_grab *grab, uint32_t time)
+default_grab_pointer_motion(struct weston_pointer_grab *grab, uint32_t time,
+ wl_fixed_t x, wl_fixed_t y)
{
struct weston_pointer *pointer = grab->pointer;
wl_fixed_t sx, sy;
struct wl_list *resource_list;
struct wl_resource *resource;
+ weston_pointer_move(pointer, x, y);
+
resource_list = &pointer->focus_resource_list;
wl_resource_for_each(resource, resource_list) {
weston_view_from_global_fixed(pointer->focus,
}
/* Takes absolute values */
-static void
-move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y)
+WL_EXPORT void
+weston_pointer_move(struct weston_pointer *pointer, wl_fixed_t x, wl_fixed_t y)
{
- struct weston_pointer *pointer = seat->pointer;
int32_t ix, iy;
weston_pointer_clamp (pointer, &x, &y);
weston_view_schedule_repaint(pointer->sprite);
}
+ pointer->grab->interface->focus(pointer->grab);
wl_signal_emit(&pointer->motion_signal, pointer);
}
struct weston_pointer *pointer = seat->pointer;
weston_compositor_wake(ec);
-
- move_pointer(seat, pointer->x + dx, pointer->y + dy);
-
- pointer->grab->interface->focus(pointer->grab);
- pointer->grab->interface->motion(pointer->grab, time);
+ pointer->grab->interface->motion(pointer->grab, time, pointer->x + dx, pointer->y + dy);
}
WL_EXPORT void
struct weston_pointer *pointer = seat->pointer;
weston_compositor_wake(ec);
-
- move_pointer(seat, x, y);
-
- pointer->grab->interface->focus(pointer->grab);
- pointer->grab->interface->motion(pointer->grab, time);
+ pointer->grab->interface->motion(pointer->grab, time, x, y);
}
WL_EXPORT void
wl_fixed_t x, wl_fixed_t y)
{
if (output) {
- move_pointer(seat, x, y);
+ weston_pointer_move(seat->pointer, x, y);
} else {
/* FIXME: We should call weston_pointer_set_focus(seat,
* NULL) here, but somehow that breaks re-entry... */
}
static void
-move_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
+move_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+ wl_fixed_t x, wl_fixed_t y)
{
struct weston_move_grab *move = (struct weston_move_grab *) grab;
struct weston_pointer *pointer = grab->pointer;
struct shell_surface *shsurf = move->base.shsurf;
- int dx = wl_fixed_to_int(pointer->x + move->dx);
- int dy = wl_fixed_to_int(pointer->y + move->dy);
+ int dx, dy;
+
+ weston_pointer_move(pointer, x, y);
+ dx = wl_fixed_to_int(pointer->x + move->dx);
+ dy = wl_fixed_to_int(pointer->y + move->dy);
if (!shsurf)
return;
};
static void
-resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
+resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+ wl_fixed_t x, wl_fixed_t y)
{
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
struct weston_pointer *pointer = grab->pointer;
wl_fixed_t from_x, from_y;
wl_fixed_t to_x, to_y;
+ weston_pointer_move(pointer, x, y);
+
if (!shsurf)
return;
}
static void
-busy_cursor_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
+busy_cursor_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+ wl_fixed_t x, wl_fixed_t y)
{
+ weston_pointer_move(grab->pointer, x, y);
}
static void
}
static void
-popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
+popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+ wl_fixed_t x, wl_fixed_t y)
{
struct weston_pointer *pointer = grab->pointer;
struct wl_resource *resource;
wl_fixed_t sx, sy;
+ weston_pointer_move(pointer, x, y);
+
wl_resource_for_each(resource, &pointer->focus_resource_list) {
weston_view_from_global_fixed(pointer->focus,
pointer->x, pointer->y,
}
static void
-rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
+rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
+ wl_fixed_t x, wl_fixed_t y)
{
struct rotate_grab *rotate =
container_of(grab, struct rotate_grab, base.grab);
struct shell_surface *shsurf = rotate->base.shsurf;
float cx, cy, dx, dy, cposx, cposy, dposx, dposy, r;
+ weston_pointer_move(pointer, x, y);
+
if (!shsurf)
return;