use double for cursor coordinates

master
Tony Crisci 7 years ago
parent 8b74450b39
commit 7a3edf6e62

@ -366,8 +366,8 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) {
if (surface) { if (surface) {
struct example_xdg_surface_v6 *esurface = surface->data; struct example_xdg_surface_v6 *esurface = surface->data;
int32_t sx = sample->cursor->x - esurface->position.lx; double sx = sample->cursor->x - esurface->position.lx;
int32_t sy = sample->cursor->y - esurface->position.ly; double sy = sample->cursor->y - esurface->position.ly;
// TODO z-order // TODO z-order
wlr_seat_pointer_enter(sample->wl_seat, surface->surface, wlr_seat_pointer_enter(sample->wl_seat, surface->surface,

@ -11,7 +11,7 @@ struct wlr_cursor_state;
struct wlr_cursor { struct wlr_cursor {
struct wlr_cursor_state *state; struct wlr_cursor_state *state;
int x, y; double x, y;
struct { struct {
struct wl_signal motion; struct wl_signal motion;

@ -88,7 +88,7 @@ bool wlr_seat_pointer_surface_has_focus(struct wlr_seat *wlr_seat,
* surface that was entered. Coordinates for the enter event are surface-local. * surface that was entered. Coordinates for the enter event are surface-local.
*/ */
void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat, void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
struct wlr_surface *surface, int32_t sx, int32_t sy); struct wlr_surface *surface, double sx, double sy);
/** /**
* Clear the focused surface for the pointer and leave all entered surfaces. * Clear the focused surface for the pointer and leave all entered surfaces.
@ -100,7 +100,7 @@ void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat);
* motion event are surface-local. * motion event are surface-local.
*/ */
void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time, void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
int32_t sx, int32_t sy); double sx, double sy);
/** /**
* Send a button event to the surface with pointer focus. Coordinates for the * Send a button event to the surface with pointer focus. Coordinates for the

@ -261,7 +261,7 @@ static void handle_pointer_focus_resource_destroyed(
} }
void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat, void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
struct wlr_surface *surface, int32_t sx, int32_t sy) { struct wlr_surface *surface, double sx, double sy) {
assert(wlr_seat); assert(wlr_seat);
if (wlr_seat->pointer_state.focused_surface == surface) { if (wlr_seat->pointer_state.focused_surface == surface) {
@ -293,7 +293,7 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
if (handle) { if (handle) {
uint32_t serial = wl_display_next_serial(wlr_seat->display); uint32_t serial = wl_display_next_serial(wlr_seat->display);
wl_pointer_send_enter(handle->pointer, serial, surface->resource, wl_pointer_send_enter(handle->pointer, serial, surface->resource,
wl_fixed_from_int(sx), wl_fixed_from_int(sy)); wl_fixed_from_double(sx), wl_fixed_from_double(sy));
wl_pointer_send_frame(handle->pointer); wl_pointer_send_frame(handle->pointer);
} }
@ -326,14 +326,14 @@ void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat) {
} }
void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time, void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
int32_t sx, int32_t sy) { double sx, double sy) {
if (!wlr_seat->pointer_state.focused_handle) { if (!wlr_seat->pointer_state.focused_handle) {
// nobody to send the event to // nobody to send the event to
return; return;
} }
wl_pointer_send_motion(wlr_seat->pointer_state.focused_handle->pointer, wl_pointer_send_motion(wlr_seat->pointer_state.focused_handle->pointer,
time, wl_fixed_from_int(sx), wl_fixed_from_int(sy)); time, wl_fixed_from_double(sx), wl_fixed_from_double(sy));
wl_pointer_send_frame(wlr_seat->pointer_state.focused_handle->pointer); wl_pointer_send_frame(wlr_seat->pointer_state.focused_handle->pointer);
} }

Loading…
Cancel
Save