aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/bar.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r--swaybar/bar.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index 5b8028e5..62a7727e 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -46,7 +46,7 @@ static void swaybar_output_free(struct swaybar_output *output) {
46 if (!output) { 46 if (!output) {
47 return; 47 return;
48 } 48 }
49 wlr_log(L_DEBUG, "Removing output %s", output->name); 49 wlr_log(WLR_DEBUG, "Removing output %s", output->name);
50 zwlr_layer_surface_v1_destroy(output->layer_surface); 50 zwlr_layer_surface_v1_destroy(output->layer_surface);
51 wl_surface_destroy(output->surface); 51 wl_surface_destroy(output->surface);
52 wl_output_destroy(output->output); 52 wl_output_destroy(output->output);
@@ -146,8 +146,10 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
146 && y >= hotspot->y 146 && y >= hotspot->y
147 && x < hotspot->x + hotspot->width 147 && x < hotspot->x + hotspot->width
148 && y < hotspot->y + hotspot->height) { 148 && y < hotspot->y + hotspot->height) {
149 hotspot->callback(output, pointer->x, pointer->y, 149 if (HOTSPOT_IGNORE == hotspot->callback(output, pointer->x, pointer->y,
150 button, hotspot->data); 150 wl_button_to_x11_button(button), hotspot->data)) {
151 return;
152 }
151 } 153 }
152 } 154 }
153} 155}
@@ -155,11 +157,28 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
155static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, 157static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
156 uint32_t time, uint32_t axis, wl_fixed_t value) { 158 uint32_t time, uint32_t axis, wl_fixed_t value) {
157 struct swaybar *bar = data; 159 struct swaybar *bar = data;
160 struct swaybar_pointer *pointer = &bar->pointer;
158 struct swaybar_output *output = bar->pointer.current; 161 struct swaybar_output *output = bar->pointer.current;
159 if (!sway_assert(output, "axis with no active output")) { 162 if (!sway_assert(output, "axis with no active output")) {
160 return; 163 return;
161 } 164 }
162 165
166 struct swaybar_hotspot *hotspot;
167 wl_list_for_each(hotspot, &output->hotspots, link) {
168 double x = pointer->x * output->scale;
169 double y = pointer->y * output->scale;
170 if (x >= hotspot->x
171 && y >= hotspot->y
172 && x < hotspot->x + hotspot->width
173 && y < hotspot->y + hotspot->height) {
174 if (HOTSPOT_IGNORE == hotspot->callback(
175 output, pointer->x, pointer->y,
176 wl_axis_to_x11_button(axis, value), hotspot->data)) {
177 return;
178 }
179 }
180 }
181
163 double amt = wl_fixed_to_double(value); 182 double amt = wl_fixed_to_double(value);
164 if (amt == 0.0) { 183 if (amt == 0.0) {
165 return; 184 return;