summaryrefslogtreecommitdiffstats
path: root/swaybar/bar.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r--swaybar/bar.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index 5b8028e5..94bc48bc 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);
@@ -147,7 +147,7 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
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 hotspot->callback(output, pointer->x, pointer->y,
150 button, hotspot->data); 150 wl_button_to_x11_button(button), hotspot->data);
151 } 151 }
152 } 152 }
153} 153}
@@ -155,11 +155,26 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
155static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, 155static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
156 uint32_t time, uint32_t axis, wl_fixed_t value) { 156 uint32_t time, uint32_t axis, wl_fixed_t value) {
157 struct swaybar *bar = data; 157 struct swaybar *bar = data;
158 struct swaybar_pointer *pointer = &bar->pointer;
158 struct swaybar_output *output = bar->pointer.current; 159 struct swaybar_output *output = bar->pointer.current;
159 if (!sway_assert(output, "axis with no active output")) { 160 if (!sway_assert(output, "axis with no active output")) {
160 return; 161 return;
161 } 162 }
162 163
164 struct swaybar_hotspot *hotspot;
165 wl_list_for_each(hotspot, &output->hotspots, link) {
166 double x = pointer->x * output->scale;
167 double y = pointer->y * output->scale;
168 if (x >= hotspot->x
169 && y >= hotspot->y
170 && x < hotspot->x + hotspot->width
171 && y < hotspot->y + hotspot->height) {
172 hotspot->callback(output, pointer->x, pointer->y,
173 wl_axis_to_x11_button(axis, value), hotspot->data);
174 return;
175 }
176 }
177
163 double amt = wl_fixed_to_double(value); 178 double amt = wl_fixed_to_double(value);
164 if (amt == 0.0) { 179 if (amt == 0.0) {
165 return; 180 return;