aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sway/commands.c4
-rw-r--r--sway/container.c8
-rw-r--r--sway/handlers.c6
-rw-r--r--sway/layout.c27
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) {
errno = 0;
return false;
}
- if (strcmp(argv[0], "inner") == 0) {
+ if (strcasecmp(argv[0], "inner") == 0) {
config->gaps_inner = amount;
- } else if (strcmp(argv[0], "outer") == 0) {
+ } else if (strcasecmp(argv[0], "outer") == 0) {
config->gaps_outer = amount;
} else {
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) {
sway_log(L_DEBUG, "Added output %lu:%s", handle, name);
swayc_t *output = new_swayc(C_OUTPUT);
- output->x = (config->gaps_outer + config->gaps_inner) / 2;
- output->y = (config->gaps_outer + config->gaps_inner) / 2;
- output->width = size->w - (config->gaps_outer + config->gaps_inner);
- output->height = size->h - (config->gaps_outer + config->gaps_inner);
+ output->width = size->w;
+ output->height = size->h;
output->handle = handle;
output->name = name ? strdup(name) : NULL;
+ output->gaps = config->gaps_outer;
add_child(&root_container, output);
@@ -176,7 +175,6 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) {
view->desired_width = -1;
view->desired_height = -1;
- // TODO: properly set this
view->is_floating = false;
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) {
}
if (newview) {
set_focused_container(newview);
- arrange_windows(newview->parent, -1, -1);
+ swayc_t *output = newview->parent;
+ while (output && output->type != C_OUTPUT) {
+ output = output->parent;
+ }
+ arrange_windows(output, -1, -1);
}
return true;
}
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 @@
#include "layout.h"
#include "log.h"
#include "list.h"
+#include "config.h"
#include "container.h"
#include "workspace.h"
#include "focus.h"
@@ -123,11 +124,11 @@ void arrange_windows(swayc_t *container, int width, int height) {
// y -= container->y;
for (i = 0; i < container->children->length; ++i) {
swayc_t *child = container->children->items[i];
- sway_log(L_DEBUG, "Arranging workspace #%d", i);
- child->x = x;
- child->y = y;
- child->width = width;
- child->height = height;
+ child->x = x + container->gaps;
+ child->y = y + container->gaps;
+ child->width = width - container->gaps * 2;
+ child->height = height - container->gaps * 2;
+ sway_log(L_DEBUG, "Arranging workspace #%d at %d, %d", i, child->x, child->y);
arrange_windows(child, -1, -1);
}
return;
@@ -135,12 +136,12 @@ void arrange_windows(swayc_t *container, int width, int height) {
{
struct wlc_geometry geometry = {
.origin = {
- .x = container->x + container->gaps / 2,
- .y = container->y + container->gaps / 2
+ .x = container->x + container->gaps,
+ .y = container->y + container->gaps
},
.size = {
- .w = width - container->gaps,
- .h = height - container->gaps
+ .w = width - container->gaps * 2,
+ .h = height - container->gaps * 2
}
};
if (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) {
@@ -148,10 +149,10 @@ void arrange_windows(swayc_t *container, int width, int height) {
while (parent->type != C_OUTPUT) {
parent = parent->parent;
}
- geometry.origin.x = container->gaps / 2;
- geometry.origin.y = container->gaps / 2;
- geometry.size.w = parent->width - container->gaps;
- geometry.size.h = parent->height - container->gaps;
+ geometry.origin.x = 0;
+ geometry.origin.y = 0;
+ geometry.size.w = parent->width;
+ geometry.size.h = parent->height;
wlc_view_set_geometry(container->handle, 0, &geometry);
wlc_view_bring_to_front(container->handle);
} else {