From f25c6b312b2f4176a1936436e23140c791919ceb Mon Sep 17 00:00:00 2001 From: taiyu Date: Sat, 5 Sep 2015 20:48:52 -0700 Subject: gap resize --- sway/container.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index c922a6e6..ef0e6c55 100644 --- a/sway/container.c +++ b/sway/container.c @@ -653,15 +653,24 @@ void update_visibility(swayc_t *container) { } } -void reset_gaps(swayc_t *view, void *data) { - (void) data; +void set_gaps(swayc_t *view, void *_data) { + int *data = _data; if (!ASSERT_NONNULL(view)) { return; } - if (view->type == C_WORKSPACE) { - view->gaps = -1; + if (view->type == C_WORKSPACE || view->type == C_VIEW) { + view->gaps = *data; } - if (view->type == C_VIEW) { - view->gaps = -1; +} + +void add_gaps(swayc_t *view, void *_data) { + int *data = _data; + if (!ASSERT_NONNULL(view)) { + return; + } + if (view->type == C_WORKSPACE || view->type == C_VIEW) { + if ((view->gaps += *data) < 0) { + view->gaps = 0; + } } } -- cgit v1.2.3