diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-18 18:44:50 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-18 18:44:50 -0400 |
commit | cf916bbf6fbdf75abc55d4c1abe26ed6b8153687 (patch) | |
tree | d5b001e393d5fd5aad4608a7d67784baf1c2de92 | |
parent | Merge pull request #73 from KoffeinFlummi/gaps (diff) | |
download | sway-cf916bbf6fbdf75abc55d4c1abe26ed6b8153687.tar.gz sway-cf916bbf6fbdf75abc55d4c1abe26ed6b8153687.tar.zst sway-cf916bbf6fbdf75abc55d4c1abe26ed6b8153687.zip |
Improvements to gaps
-rw-r--r-- | sway/commands.c | 4 | ||||
-rw-r--r-- | sway/container.c | 8 | ||||
-rw-r--r-- | sway/handlers.c | 6 | ||||
-rw-r--r-- | sway/layout.c | 27 |
4 files changed, 24 insertions, 21 deletions
diff --git a/sway/commands.c b/sway/commands.c index 54839322..42d6b173 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -307,9 +307,9 @@ static bool cmd_gaps(struct sway_config *config, int argc, char **argv) { | |||
307 | errno = 0; | 307 | errno = 0; |
308 | return false; | 308 | return false; |
309 | } | 309 | } |
310 | if (strcmp(argv[0], "inner") == 0) { | 310 | if (strcasecmp(argv[0], "inner") == 0) { |
311 | config->gaps_inner = amount; | 311 | config->gaps_inner = amount; |
312 | } else if (strcmp(argv[0], "outer") == 0) { | 312 | } else if (strcasecmp(argv[0], "outer") == 0) { |
313 | config->gaps_outer = amount; | 313 | config->gaps_outer = amount; |
314 | } else { | 314 | } else { |
315 | return false; | 315 | return false; |
diff --git a/sway/container.c b/sway/container.c index 06111674..af9bcd73 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -63,12 +63,11 @@ swayc_t *new_output(wlc_handle handle) { | |||
63 | sway_log(L_DEBUG, "Added output %lu:%s", handle, name); | 63 | sway_log(L_DEBUG, "Added output %lu:%s", handle, name); |
64 | 64 | ||
65 | swayc_t *output = new_swayc(C_OUTPUT); | 65 | swayc_t *output = new_swayc(C_OUTPUT); |
66 | output->x = (config->gaps_outer + config->gaps_inner) / 2; | 66 | output->width = size->w; |
67 | output->y = (config->gaps_outer + config->gaps_inner) / 2; | 67 | output->height = size->h; |
68 | output->width = size->w - (config->gaps_outer + config->gaps_inner); | ||
69 | output->height = size->h - (config->gaps_outer + config->gaps_inner); | ||
70 | output->handle = handle; | 68 | output->handle = handle; |
71 | output->name = name ? strdup(name) : NULL; | 69 | output->name = name ? strdup(name) : NULL; |
70 | output->gaps = config->gaps_outer; | ||
72 | 71 | ||
73 | add_child(&root_container, output); | 72 | add_child(&root_container, output); |
74 | 73 | ||
@@ -176,7 +175,6 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { | |||
176 | view->desired_width = -1; | 175 | view->desired_width = -1; |
177 | view->desired_height = -1; | 176 | view->desired_height = -1; |
178 | 177 | ||
179 | // TODO: properly set this | ||
180 | view->is_floating = false; | 178 | view->is_floating = false; |
181 | 179 | ||
182 | if (sibling->type == C_WORKSPACE) { | 180 | if (sibling->type == C_WORKSPACE) { |
diff --git a/sway/handlers.c b/sway/handlers.c index 1fe2dc27..9b96a5cf 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -168,7 +168,11 @@ static bool handle_view_created(wlc_handle handle) { | |||
168 | } | 168 | } |
169 | if (newview) { | 169 | if (newview) { |
170 | set_focused_container(newview); | 170 | set_focused_container(newview); |
171 | arrange_windows(newview->parent, -1, -1); | 171 | swayc_t *output = newview->parent; |
172 | while (output && output->type != C_OUTPUT) { | ||
173 | output = output->parent; | ||
174 | } | ||
175 | arrange_windows(output, -1, -1); | ||
172 | } | 176 | } |
173 | return true; | 177 | return true; |
174 | } | 178 | } |
diff --git a/sway/layout.c b/sway/layout.c index 02c92026..7cb9186a 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "layout.h" | 4 | #include "layout.h" |
5 | #include "log.h" | 5 | #include "log.h" |
6 | #include "list.h" | 6 | #include "list.h" |
7 | #include "config.h" | ||
7 | #include "container.h" | 8 | #include "container.h" |
8 | #include "workspace.h" | 9 | #include "workspace.h" |
9 | #include "focus.h" | 10 | #include "focus.h" |
@@ -123,11 +124,11 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
123 | // y -= container->y; | 124 | // y -= container->y; |
124 | for (i = 0; i < container->children->length; ++i) { | 125 | for (i = 0; i < container->children->length; ++i) { |
125 | swayc_t *child = container->children->items[i]; | 126 | swayc_t *child = container->children->items[i]; |
126 | sway_log(L_DEBUG, "Arranging workspace #%d", i); | 127 | child->x = x + container->gaps; |
127 | child->x = x; | 128 | child->y = y + container->gaps; |
128 | child->y = y; | 129 | child->width = width - container->gaps * 2; |
129 | child->width = width; | 130 | child->height = height - container->gaps * 2; |
130 | child->height = height; | 131 | sway_log(L_DEBUG, "Arranging workspace #%d at %d, %d", i, child->x, child->y); |
131 | arrange_windows(child, -1, -1); | 132 | arrange_windows(child, -1, -1); |
132 | } | 133 | } |
133 | return; | 134 | return; |
@@ -135,12 +136,12 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
135 | { | 136 | { |
136 | struct wlc_geometry geometry = { | 137 | struct wlc_geometry geometry = { |
137 | .origin = { | 138 | .origin = { |
138 | .x = container->x + container->gaps / 2, | 139 | .x = container->x + container->gaps, |
139 | .y = container->y + container->gaps / 2 | 140 | .y = container->y + container->gaps |
140 | }, | 141 | }, |
141 | .size = { | 142 | .size = { |
142 | .w = width - container->gaps, | 143 | .w = width - container->gaps * 2, |
143 | .h = height - container->gaps | 144 | .h = height - container->gaps * 2 |
144 | } | 145 | } |
145 | }; | 146 | }; |
146 | if (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) { | 147 | if (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) { |
@@ -148,10 +149,10 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
148 | while (parent->type != C_OUTPUT) { | 149 | while (parent->type != C_OUTPUT) { |
149 | parent = parent->parent; | 150 | parent = parent->parent; |
150 | } | 151 | } |
151 | geometry.origin.x = container->gaps / 2; | 152 | geometry.origin.x = 0; |
152 | geometry.origin.y = container->gaps / 2; | 153 | geometry.origin.y = 0; |
153 | geometry.size.w = parent->width - container->gaps; | 154 | geometry.size.w = parent->width; |
154 | geometry.size.h = parent->height - container->gaps; | 155 | geometry.size.h = parent->height; |
155 | wlc_view_set_geometry(container->handle, 0, &geometry); | 156 | wlc_view_set_geometry(container->handle, 0, &geometry); |
156 | wlc_view_bring_to_front(container->handle); | 157 | wlc_view_bring_to_front(container->handle); |
157 | } else { | 158 | } else { |