aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-09-23 09:52:33 -0400
committerGitHub <noreply@github.com>2017-09-23 09:52:33 -0400
commita4e3b4fd7ba2b157aee7a583d0560ae297a8c276 (patch)
tree01a7ec7766f205b33cd4226dad13659a7b70383e
parenta865f723a392b29d2ae1b43d6477dda99a0c1009 (diff)
parentfeb8bb96eea887dd215aca52ca90aa4587e4d1dc (diff)
downloadsway-a4e3b4fd7ba2b157aee7a583d0560ae297a8c276.zip
sway-a4e3b4fd7ba2b157aee7a583d0560ae297a8c276.tar.gz
sway-a4e3b4fd7ba2b157aee7a583d0560ae297a8c276.tar.bz2
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 85cb527..f8dc3a1 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,
static void mouse_scroll_notify(struct window *window, enum scroll_direction direction) {
sway_log(L_DEBUG, "Mouse wheel scrolled %s", direction == SCROLL_UP ? "up" : "down");
+ // If there are status blocks and click_events are enabled
+ // check if the position is within the status area and if so
+ // tell the status line to output the event and skip workspace
+ // switching below.
+ int num_blocks = swaybar.status->block_line->length;
+ if (swaybar.status->click_events && num_blocks > 0) {
+ struct status_block *first_block = swaybar.status->block_line->items[0];
+ int x = window->pointer_input.last_x;
+ int y = window->pointer_input.last_y;
+ if (x > first_block->x) {
+ if (direction == SCROLL_UP) {
+ status_line_mouse_event(&swaybar, x, y, 4);
+ } else {
+ status_line_mouse_event(&swaybar, x, y, 5);
+ }
+ return;
+ }
+ }
+
if (!swaybar.config->wrap_scroll) {
// Find output this window lives on
int i;