summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-09-23 09:52:33 -0400
committerLibravatar GitHub <noreply@github.com>2017-09-23 09:52:33 -0400
commita4e3b4fd7ba2b157aee7a583d0560ae297a8c276 (patch)
tree01a7ec7766f205b33cd4226dad13659a7b70383e
parentMerge pull request #1360 from sporken/japanese-translate (diff)
parentswaybar protocol: handle button 4 and 5 (diff)
downloadsway-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
-rw-r--r--swaybar/bar.c19
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,
143static void mouse_scroll_notify(struct window *window, enum scroll_direction direction) { 143static 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;