aboutsummaryrefslogtreecommitdiff
path: root/swaybar/bar.c
diff options
context:
space:
mode:
authorRyan Dwyer <RyanDwyer@users.noreply.github.com>2018-07-18 09:32:03 +1000
committerGitHub <noreply@github.com>2018-07-18 09:32:03 +1000
commit8ce7e3b44eea0a270ecc35a9da2ae801aaf6bce1 (patch)
tree6badffb0c6ee33b4e23e914c4c9f9b39a625b5f3 /swaybar/bar.c
parent621d2666b1ac214c63628bbe0ac8f5d6485cb501 (diff)
parent48b911a4596f50b585a1073d32413236d9defb60 (diff)
downloadsway-8ce7e3b44eea0a270ecc35a9da2ae801aaf6bce1.tar.xz
Merge branch 'master' into destroy-output-destroy-empty-workspaces
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) {
if (!output) {
return;
}
- wlr_log(L_DEBUG, "Removing output %s", output->name);
+ wlr_log(WLR_DEBUG, "Removing output %s", output->name);
zwlr_layer_surface_v1_destroy(output->layer_surface);
wl_surface_destroy(output->surface);
wl_output_destroy(output->output);
@@ -147,7 +147,7 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
&& x < hotspot->x + hotspot->width
&& y < hotspot->y + hotspot->height) {
hotspot->callback(output, pointer->x, pointer->y,
- button, hotspot->data);
+ wl_button_to_x11_button(button), hotspot->data);
}
}
}
@@ -155,11 +155,26 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
uint32_t time, uint32_t axis, wl_fixed_t value) {
struct swaybar *bar = data;
+ struct swaybar_pointer *pointer = &bar->pointer;
struct swaybar_output *output = bar->pointer.current;
if (!sway_assert(output, "axis with no active output")) {
return;
}
+ struct swaybar_hotspot *hotspot;
+ wl_list_for_each(hotspot, &output->hotspots, link) {
+ double x = pointer->x * output->scale;
+ double y = pointer->y * output->scale;
+ if (x >= hotspot->x
+ && y >= hotspot->y
+ && x < hotspot->x + hotspot->width
+ && y < hotspot->y + hotspot->height) {
+ hotspot->callback(output, pointer->x, pointer->y,
+ wl_axis_to_x11_button(axis, value), hotspot->data);
+ return;
+ }
+ }
+
double amt = wl_fixed_to_double(value);
if (amt == 0.0) {
return;