diff options
author | Drew DeVault <[email protected]> | 2016-03-30 08:34:32 -0400 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2016-03-30 08:34:32 -0400 |
commit | a12850444d38cc1b00e30adb6dea82b6e2045914 (patch) | |
tree | 60b01009710f0379a5ff08f777405ebba93736a3 /sway/handlers.c | |
parent | 68f4f9b52050e74e6fa53695b3d968e7a902d092 (diff) |
New feature: adjust gaps with floating_mod+scroll
I made this configurable but I didn't make the command for it. That's
left as an exercise to an eager contributor.
mod_scroll_behavior [gaps inner|gaps outer]
Would merge implementions of more behaviors for mod+scroll, if anyone
has some neato ideas.
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 54326dd0..9648e729 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -647,6 +647,31 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w case M_SCROLL_DOWN: break; } + if (!(modifiers->mods ^ config->floating_mod) && + (button == M_SCROLL_UP || button == M_SCROLL_DOWN)) { + switch (config->floating_scroll) { + case FSB_GAPS_INNER: + case FSB_GAPS_OUTER: + { + int amount = button == M_SCROLL_UP ? -1 : 1; + int i,j; + for (i = 0; i < root_container.children->length; ++i) { + swayc_t *op = root_container.children->items[i]; + for (j = 0; j < op->children->length; ++j) { + swayc_t *ws = op->children->items[j]; + // TODO: adjust outer gaps ws->gaps = 0; + if (config->floating_scroll == FSB_GAPS_INNER) { + container_map(ws, add_gaps, &amount); + } else { + ws->gaps += amount; + } + } + } + arrange_windows(&root_container, -1, -1); + break; + } + } + } // get focused window and check if to change focus on mouse click swayc_t *focused = get_focused_container(&root_container); |