diff options
author | 2017-09-23 09:52:33 -0400 | |
---|---|---|
committer | 2017-09-23 09:52:33 -0400 | |
commit | a4e3b4fd7ba2b157aee7a583d0560ae297a8c276 (patch) | |
tree | 01a7ec7766f205b33cd4226dad13659a7b70383e /swaybar | |
parent | Merge pull request #1360 from sporken/japanese-translate (diff) | |
parent | swaybar protocol: handle button 4 and 5 (diff) | |
download | sway-a4e3b4fd7ba2b157aee7a583d0560ae297a8c276.tar.gz sway-a4e3b4fd7ba2b157aee7a583d0560ae297a8c276.tar.zst sway-a4e3b4fd7ba2b157aee7a583d0560ae297a8c276.zip |
Merge pull request #1368 from johnae/swaybar-handle-scroll-events
swaybar protocol: handle button 4 and 5
Diffstat (limited to 'swaybar')
-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; |