diff options
-rw-r--r-- | sway/handlers.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 32e7098c..ee88b247 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -647,30 +647,6 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
647 | case M_SCROLL_DOWN: | 647 | case M_SCROLL_DOWN: |
648 | break; | 648 | break; |
649 | } | 649 | } |
650 | if (!(modifiers->mods ^ config->floating_mod) && | ||
651 | (button == M_SCROLL_UP || button == M_SCROLL_DOWN)) { | ||
652 | switch (config->floating_scroll) { | ||
653 | case FSB_GAPS_INNER: | ||
654 | case FSB_GAPS_OUTER: | ||
655 | { | ||
656 | int amount = button == M_SCROLL_UP ? -1 : 1; | ||
657 | int i,j; | ||
658 | for (i = 0; i < root_container.children->length; ++i) { | ||
659 | swayc_t *op = root_container.children->items[i]; | ||
660 | for (j = 0; j < op->children->length; ++j) { | ||
661 | swayc_t *ws = op->children->items[j]; | ||
662 | if (config->floating_scroll == FSB_GAPS_INNER) { | ||
663 | container_map(ws, add_gaps, &amount); | ||
664 | } else { | ||
665 | ws->gaps += amount; | ||
666 | } | ||
667 | } | ||
668 | } | ||
669 | arrange_windows(&root_container, -1, -1); | ||
670 | break; | ||
671 | } | ||
672 | } | ||
673 | } | ||
674 | 650 | ||
675 | // get focused window and check if to change focus on mouse click | 651 | // get focused window and check if to change focus on mouse click |
676 | swayc_t *focused = get_focused_container(&root_container); | 652 | swayc_t *focused = get_focused_container(&root_container); |
@@ -719,6 +695,34 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
719 | return EVENT_PASSTHROUGH; | 695 | return EVENT_PASSTHROUGH; |
720 | } | 696 | } |
721 | 697 | ||
698 | bool handle_pointer_scroll(wlc_handle view, uint32_t time, const struct wlc_modifiers* modifiers, | ||
699 | uint8_t axis_bits, double _amount[2]) { | ||
700 | if (!(modifiers->mods ^ config->floating_mod)) { | ||
701 | switch (config->floating_scroll) { | ||
702 | case FSB_GAPS_INNER: | ||
703 | case FSB_GAPS_OUTER: | ||
704 | { | ||
705 | int amount = (int)_amount[0]; | ||
706 | int i,j; | ||
707 | for (i = 0; i < root_container.children->length; ++i) { | ||
708 | swayc_t *op = root_container.children->items[i]; | ||
709 | for (j = 0; j < op->children->length; ++j) { | ||
710 | swayc_t *ws = op->children->items[j]; | ||
711 | if (config->floating_scroll == FSB_GAPS_INNER) { | ||
712 | container_map(ws, add_gaps, &amount); | ||
713 | } else { | ||
714 | ws->gaps += amount; | ||
715 | } | ||
716 | } | ||
717 | } | ||
718 | arrange_windows(&root_container, -1, -1); | ||
719 | break; | ||
720 | } | ||
721 | } | ||
722 | } | ||
723 | return EVENT_PASSTHROUGH; | ||
724 | } | ||
725 | |||
722 | static void handle_wlc_ready(void) { | 726 | static void handle_wlc_ready(void) { |
723 | sway_log(L_DEBUG, "Compositor is ready, executing cmds in queue"); | 727 | sway_log(L_DEBUG, "Compositor is ready, executing cmds in queue"); |
724 | // Execute commands until there are none left | 728 | // Execute commands until there are none left |
@@ -751,6 +755,7 @@ void register_wlc_handlers() { | |||
751 | wlc_set_keyboard_key_cb(handle_key); | 755 | wlc_set_keyboard_key_cb(handle_key); |
752 | wlc_set_pointer_motion_cb(handle_pointer_motion); | 756 | wlc_set_pointer_motion_cb(handle_pointer_motion); |
753 | wlc_set_pointer_button_cb(handle_pointer_button); | 757 | wlc_set_pointer_button_cb(handle_pointer_button); |
758 | wlc_set_pointer_scroll_cb(handle_pointer_scroll); | ||
754 | wlc_set_compositor_ready_cb(handle_wlc_ready); | 759 | wlc_set_compositor_ready_cb(handle_wlc_ready); |
755 | wlc_set_input_created_cb(handle_input_created); | 760 | wlc_set_input_created_cb(handle_input_created); |
756 | wlc_set_input_destroyed_cb(handle_input_destroyed); | 761 | wlc_set_input_destroyed_cb(handle_input_destroyed); |