aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHristo Venev <hristo@venev.name>2020-02-01 18:58:13 +0100
committerSimon Ser <contact@emersion.fr>2020-02-10 18:58:09 +0100
commitfca32b6334afe69ea10c88de7670c79ae98ce0fd (patch)
tree66ca6253e253da6029df2981659557439af709ed
parent0f5157668da3cbf614a2f71ff24778ed62bad1ea (diff)
Do not truncate pointer coordinates to int.
This increases the precision of the clicks when using i3bar.
-rw-r--r--include/swaybar/input.h2
-rw-r--r--swaybar/input.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/include/swaybar/input.h b/include/swaybar/input.h
index 2d38f7a7..6557a29e 100644
--- a/include/swaybar/input.h
+++ b/include/swaybar/input.h
@@ -18,7 +18,7 @@ struct swaybar_pointer {
struct wl_cursor_image *cursor_image;
struct wl_surface *cursor_surface;
struct swaybar_output *current;
- int x, y;
+ double x, y;
uint32_t serial;
};
diff --git a/swaybar/input.c b/swaybar/input.c
index 7f68caec..aa6290fa 100644
--- a/swaybar/input.c
+++ b/swaybar/input.c
@@ -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,
uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) {
struct swaybar_seat *seat = data;
- seat->pointer.x = wl_fixed_to_int(surface_x);
- seat->pointer.y = wl_fixed_to_int(surface_y);
+ seat->pointer.x = wl_fixed_to_double(surface_x);
+ seat->pointer.y = wl_fixed_to_double(surface_y);
}
static bool check_bindings(struct swaybar *bar, uint32_t button,