From 57ae751655e106748644d1b356edd4aadd0510f4 Mon Sep 17 00:00:00 2001 From: Caduser2020 <51916507+Caduser2020@users.noreply.github.com> Date: Thu, 9 Sep 2021 18:06:17 -0500 Subject: Simplify swaybar/swaynag scaling code Use `cairo_scale` to set the scale factor, removing redundant multiplications by `output->scale`. --- swaybar/input.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'swaybar/input.c') diff --git a/swaybar/input.c b/swaybar/input.c index 6e13f177..c8c8f0d4 100644 --- a/swaybar/input.c +++ b/swaybar/input.c @@ -142,13 +142,11 @@ static bool check_bindings(struct swaybar *bar, uint32_t button, static bool process_hotspots(struct swaybar_output *output, double x, double y, uint32_t button) { - double px = x * output->scale; - double py = y * output->scale; struct swaybar_hotspot *hotspot; wl_list_for_each(hotspot, &output->hotspots, link) { - if (px >= hotspot->x && py >= hotspot->y - && px < hotspot->x + hotspot->width - && py < hotspot->y + hotspot->height) { + if (x >= hotspot->x && y >= hotspot->y + && x < hotspot->x + hotspot->width + && y < hotspot->y + hotspot->height) { if (HOTSPOT_IGNORE == hotspot->callback(output, hotspot, x, y, button, hotspot->data)) { return true; -- cgit v1.2.3-54-g00ecf