Do not truncate pointer coordinates to int.

This increases the precision of the clicks when using i3bar.
This commit is contained in:
Hristo Venev 2020-02-01 18:58:13 +01:00 committed by Simon Ser
parent 0f5157668d
commit fca32b6334
2 changed files with 3 additions and 3 deletions

View file

@ -18,7 +18,7 @@ struct swaybar_pointer {
struct wl_cursor_image *cursor_image; struct wl_cursor_image *cursor_image;
struct wl_surface *cursor_surface; struct wl_surface *cursor_surface;
struct swaybar_output *current; struct swaybar_output *current;
int x, y; double x, y;
uint32_t serial; uint32_t serial;
}; };

View file

@ -121,8 +121,8 @@ static void wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
static void wl_pointer_motion(void *data, struct wl_pointer *wl_pointer, static void wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) {
struct swaybar_seat *seat = data; struct swaybar_seat *seat = data;
seat->pointer.x = wl_fixed_to_int(surface_x); seat->pointer.x = wl_fixed_to_double(surface_x);
seat->pointer.y = wl_fixed_to_int(surface_y); seat->pointer.y = wl_fixed_to_double(surface_y);
} }
static bool check_bindings(struct swaybar *bar, uint32_t button, static bool check_bindings(struct swaybar *bar, uint32_t button,