aboutsummaryrefslogtreecommitdiff
path: root/sway/container.c
diff options
context:
space:
mode:
authortaiyu <taiyu.len@gmail.com>2015-09-05 20:48:52 -0700
committertaiyu <taiyu.len@gmail.com>2015-09-05 20:48:52 -0700
commitf25c6b312b2f4176a1936436e23140c791919ceb (patch)
tree63537a7cb41b5e4c97cc25a243fdaf9b939fdefd /sway/container.c
parent7169ebc24cb61ba7443d6c69e52b378907a3d4b7 (diff)
gap resize
Diffstat (limited to 'sway/container.c')
-rw-r--r--sway/container.c21
1 files changed, 15 insertions, 6 deletions
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;
+ }
}
}