aboutsummaryrefslogtreecommitdiff
path: root/swaybar/render.c
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2018-07-19 21:15:01 +0200
committerFurkan Sahin <furkan-dev@proton.me>2018-07-19 21:15:01 +0200
commit81e6d34e3d38122a73542ba9d740f6ea58a8792f (patch)
treee529edd478b8ebfbf19daa7072535d0e181592d2 /swaybar/render.c
parent508512bff20fbbd59b1a412bbed6b651d61a0162 (diff)
swaybar: Fix scroll handling on workspace buttons
As well as ignoring scroll events on status elements when click_events is enabled. Previously, using the scroll wheel on a workspace button would switch to that workspace instead of scrolling through them. Clicks and scrolling on status elements would always be processed by swaybar, too. So in case you were using scrolling as volume control on a status item, swaybar would additionally scroll through your workspaces.
Diffstat (limited to 'swaybar/render.c')
-rw-r--r--swaybar/render.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index d210e25a..6f370077 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -108,11 +108,11 @@ static void render_sharp_line(cairo_t *cairo, uint32_t color,
}
}
-static void block_hotspot_callback(struct swaybar_output *output,
+static enum hotspot_event_handling block_hotspot_callback(struct swaybar_output *output,
int x, int y, enum x11_button button, void *data) {
struct i3bar_block *block = data;
struct status_line *status = output->bar->status;
- i3bar_block_send_click(status, block, x, y, button);
+ return i3bar_block_send_click(status, block, x, y, button);
}
static uint32_t render_status_block(cairo_t *cairo,
@@ -348,9 +348,13 @@ static const char *strip_workspace_number(const char *ws_name) {
return ws_name;
}
-static void workspace_hotspot_callback(struct swaybar_output *output,
+static enum hotspot_event_handling workspace_hotspot_callback(struct swaybar_output *output,
int x, int y, enum x11_button button, void *data) {
+ if (button != LEFT) {
+ return HOTSPOT_PROCESS;
+ }
ipc_send_workspace_command(output->bar, (const char *)data);
+ return HOTSPOT_IGNORE;
}
static uint32_t render_workspace_button(cairo_t *cairo,