struct weston_surface *surface,
wl_fixed_t x,
wl_fixed_t y);
- void (*motion)(struct weston_pointer_grab *grab,
- uint32_t time,
- wl_fixed_t x,
- wl_fixed_t y);
+ void (*motion)(struct weston_pointer_grab *grab, uint32_t time);
void (*button)(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state);
};
struct weston_pointer_grab {
const struct weston_pointer_grab_interface *interface;
struct weston_pointer *pointer;
- struct weston_surface *focus;
- wl_fixed_t x, y;
};
struct weston_keyboard_grab;
drag->focus_listener.notify = destroy_drag_focus;
wl_signal_add(&resource->destroy_signal, &drag->focus_listener);
drag->focus_resource = resource;
- grab->focus = surface;
}
static void
-drag_grab_motion(struct weston_pointer_grab *grab,
- uint32_t time, wl_fixed_t x, wl_fixed_t y)
+drag_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
{
struct weston_drag *drag =
container_of(grab, struct weston_drag, grab);
struct weston_pointer *pointer = drag->grab.pointer;
float fx, fy;
+ wl_fixed_t sx, sy;
if (drag->icon) {
fx = wl_fixed_to_double(pointer->x) + drag->dx;
weston_surface_schedule_repaint(drag->icon);
}
- if (drag->focus_resource)
- wl_data_device_send_motion(drag->focus_resource, time, x, y);
+ if (drag->focus_resource) {
+ weston_surface_from_global_fixed(drag->focus,
+ pointer->x, pointer->y,
+ &sx, &sy);
+
+ wl_data_device_send_motion(drag->focus_resource, time, sx, sy);
+ }
}
static void
weston_seat_repick(struct weston_seat *seat)
{
const struct weston_pointer_grab_interface *interface;
- struct weston_surface *surface, *focus;
+ struct weston_surface *surface;
struct weston_pointer *pointer = seat->pointer;
wl_fixed_t sx, sy;
interface = pointer->grab->interface;
interface->focus(pointer->grab, surface, sx, sy);
-
- focus = (struct weston_surface *) pointer->grab->focus;
- if (focus)
- weston_surface_from_global_fixed(focus,
- pointer->x,
- pointer->y,
- &pointer->grab->x,
- &pointer->grab->y);
}
static void
}
static void
-default_grab_motion(struct weston_pointer_grab *grab,
- uint32_t time, wl_fixed_t x, wl_fixed_t y)
+default_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
{
- struct wl_resource *resource;
+ struct weston_pointer *pointer = grab->pointer;
+ wl_fixed_t sx, sy;
- resource = grab->pointer->focus_resource;
- if (resource)
- wl_pointer_send_motion(resource, time, x, y);
+ if (pointer->focus_resource) {
+ weston_surface_from_global_fixed(pointer->focus,
+ pointer->x, pointer->y,
+ &sx, &sy);
+ wl_pointer_send_motion(pointer->focus_resource, time, sx, sy);
+ }
}
static void
pointer->focus_resource = resource;
pointer->focus = surface;
- pointer->default_grab.focus = surface;
wl_signal_emit(&pointer->focus_signal, pointer);
}
move_pointer(seat, pointer->x + dx, pointer->y + dy);
interface = pointer->grab->interface;
- interface->motion(pointer->grab, time,
- pointer->grab->x, pointer->grab->y);
+ interface->motion(pointer->grab, time);
}
WL_EXPORT void
move_pointer(seat, x, y);
interface = pointer->grab->interface;
- interface->motion(pointer->grab, time,
- pointer->grab->x, pointer->grab->y);
+ interface->motion(pointer->grab, time);
}
WL_EXPORT void
&grab->shsurf_destroy_listener);
grab->pointer = pointer;
- grab->grab.focus = shsurf->surface;
weston_pointer_start_grab(pointer, &grab->grab);
desktop_shell_send_grab_cursor(shell->child.desktop_shell, cursor);
noop_grab_focus(struct weston_pointer_grab *grab,
struct weston_surface *surface, wl_fixed_t x, wl_fixed_t y)
{
- grab->focus = NULL;
}
static void
-move_grab_motion(struct weston_pointer_grab *grab,
- uint32_t time, wl_fixed_t x, wl_fixed_t y)
+move_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
{
struct weston_move_grab *move = (struct weston_move_grab *) grab;
struct weston_pointer *pointer = grab->pointer;
};
static void
-resize_grab_motion(struct weston_pointer_grab *grab,
- uint32_t time, wl_fixed_t x, wl_fixed_t y)
+resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
{
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
struct weston_pointer *pointer = grab->pointer;
{
struct shell_grab *grab = (struct shell_grab *) base;
- if (grab->grab.focus != surface) {
+ if (grab->shsurf->surface != surface) {
shell_grab_end(grab);
free(grab);
}
}
static void
-busy_cursor_grab_motion(struct weston_pointer_grab *grab,
- uint32_t time, int32_t x, int32_t y)
+busy_cursor_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
{
}
if (surface && surface->resource.client == client) {
weston_pointer_set_focus(pointer, surface, x, y);
- grab->focus = surface;
} else {
weston_pointer_set_focus(pointer, NULL,
wl_fixed_from_int(0),
wl_fixed_from_int(0));
- grab->focus = NULL;
}
}
static void
-popup_grab_motion(struct weston_pointer_grab *grab,
- uint32_t time, wl_fixed_t sx, wl_fixed_t sy)
+popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
{
- struct wl_resource *resource;
+ struct weston_pointer *pointer = grab->pointer;
+ wl_fixed_t sx, sy;
- resource = grab->pointer->focus_resource;
- if (resource)
- wl_pointer_send_motion(resource, time, sx, sy);
+ if (pointer->focus_resource) {
+ weston_surface_from_global_fixed(pointer->focus,
+ pointer->x, pointer->y,
+ &sx, &sy);
+ wl_pointer_send_motion(pointer->focus_resource, time, sx, sy);
+ }
}
static void
}
static void
-rotate_grab_motion(struct weston_pointer_grab *grab,
- uint32_t time, wl_fixed_t x, wl_fixed_t y)
+rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
{
struct rotate_grab *rotate =
container_of(grab, struct rotate_grab, base.grab);