diff options
author | Caduser2020 <51916507+Caduser2020@users.noreply.github.com> | 2021-09-09 18:06:17 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-09-12 09:05:12 +0200 |
commit | 57ae751655e106748644d1b356edd4aadd0510f4 (patch) | |
tree | 7e5db1f12e920c7f56b7108e2aa9059a8f7cddf4 /swaybar/input.c | |
parent | introduce wlr_drm_lease_v1 (diff) | |
download | sway-57ae751655e106748644d1b356edd4aadd0510f4.tar.gz sway-57ae751655e106748644d1b356edd4aadd0510f4.tar.zst sway-57ae751655e106748644d1b356edd4aadd0510f4.zip |
Simplify swaybar/swaynag scaling code
Use `cairo_scale` to set the scale factor, removing redundant
multiplications by `output->scale`.
Diffstat (limited to 'swaybar/input.c')
-rw-r--r-- | swaybar/input.c | 8 |
1 files changed, 3 insertions, 5 deletions
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, | |||
142 | 142 | ||
143 | static bool process_hotspots(struct swaybar_output *output, | 143 | static bool process_hotspots(struct swaybar_output *output, |
144 | double x, double y, uint32_t button) { | 144 | double x, double y, uint32_t button) { |
145 | double px = x * output->scale; | ||
146 | double py = y * output->scale; | ||
147 | struct swaybar_hotspot *hotspot; | 145 | struct swaybar_hotspot *hotspot; |
148 | wl_list_for_each(hotspot, &output->hotspots, link) { | 146 | wl_list_for_each(hotspot, &output->hotspots, link) { |
149 | if (px >= hotspot->x && py >= hotspot->y | 147 | if (x >= hotspot->x && y >= hotspot->y |
150 | && px < hotspot->x + hotspot->width | 148 | && x < hotspot->x + hotspot->width |
151 | && py < hotspot->y + hotspot->height) { | 149 | && y < hotspot->y + hotspot->height) { |
152 | if (HOTSPOT_IGNORE == hotspot->callback(output, hotspot, x, y, | 150 | if (HOTSPOT_IGNORE == hotspot->callback(output, hotspot, x, y, |
153 | button, hotspot->data)) { | 151 | button, hotspot->data)) { |
154 | return true; | 152 | return true; |