diff options
-rw-r--r-- | swaybar/bar.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index 85cb5270..f8dc3a1f 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -143,6 +143,25 @@ static void mouse_button_notify(struct window *window, int x, int y, | |||
143 | static void mouse_scroll_notify(struct window *window, enum scroll_direction direction) { | 143 | static void mouse_scroll_notify(struct window *window, enum scroll_direction direction) { |
144 | sway_log(L_DEBUG, "Mouse wheel scrolled %s", direction == SCROLL_UP ? "up" : "down"); | 144 | sway_log(L_DEBUG, "Mouse wheel scrolled %s", direction == SCROLL_UP ? "up" : "down"); |
145 | 145 | ||
146 | // If there are status blocks and click_events are enabled | ||
147 | // check if the position is within the status area and if so | ||
148 | // tell the status line to output the event and skip workspace | ||
149 | // switching below. | ||
150 | int num_blocks = swaybar.status->block_line->length; | ||
151 | if (swaybar.status->click_events && num_blocks > 0) { | ||
152 | struct status_block *first_block = swaybar.status->block_line->items[0]; | ||
153 | int x = window->pointer_input.last_x; | ||
154 | int y = window->pointer_input.last_y; | ||
155 | if (x > first_block->x) { | ||
156 | if (direction == SCROLL_UP) { | ||
157 | status_line_mouse_event(&swaybar, x, y, 4); | ||
158 | } else { | ||
159 | status_line_mouse_event(&swaybar, x, y, 5); | ||
160 | } | ||
161 | return; | ||
162 | } | ||
163 | } | ||
164 | |||
146 | if (!swaybar.config->wrap_scroll) { | 165 | if (!swaybar.config->wrap_scroll) { |
147 | // Find output this window lives on | 166 | // Find output this window lives on |
148 | int i; | 167 | int i; |