Break everything^W^WUse wlr_box for sway_container

This commit is contained in:
Drew DeVault 2018-04-06 15:03:05 -04:00
parent d447460c01
commit 764489e737
13 changed files with 144 additions and 145 deletions

View file

@ -49,7 +49,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
}
}
arrange_windows(parent, parent->width, parent->height);
arrange_windows(parent, parent->box.width, parent->box.height);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}

View file

@ -95,7 +95,8 @@ static struct cmd_results *cmd_move_container(struct sway_container *current,
}
struct sway_container *source = container_parent(current, C_OUTPUT);
struct sway_container *destination = output_in_direction(argv[3],
source->sway_output->wlr_output, current->x, current->y);
source->sway_output->wlr_output,
current->box.x, current->box.y);
if (!destination) {
return cmd_results_new(CMD_FAILURE, "move workspace",
"Can't find output with name/direction '%s'", argv[3]);
@ -124,8 +125,8 @@ static struct cmd_results *cmd_move_workspace(struct sway_container *current,
return cmd_results_new(CMD_INVALID, "move", expected_syntax);
}
struct sway_container *source = container_parent(current, C_OUTPUT);
int center_x = current->width / 2 + current->x,
center_y = current->height / 2 + current->y;
int center_x = current->box.width / 2 + current->box.x,
center_y = current->box.height / 2 + current->box.y;
struct sway_container *destination = output_in_direction(argv[3],
source->sway_output->wlr_output, center_x, center_y);
if (!destination) {

View file

@ -48,11 +48,11 @@ static enum resize_axis parse_resize_axis(const char *axis) {
}
static int parallel_coord(struct sway_container *c, enum resize_axis a) {
return a == RESIZE_AXIS_HORIZONTAL ? c->x : c->y;
return a == RESIZE_AXIS_HORIZONTAL ? c->box.x : c->box.y;
}
static int parallel_size(struct sway_container *c, enum resize_axis a) {
return a == RESIZE_AXIS_HORIZONTAL ? c->width : c->height;
return a == RESIZE_AXIS_HORIZONTAL ? c->box.width : c->box.height;
}
static void resize_tiled(int amount, enum resize_axis axis) {
@ -196,10 +196,10 @@ static void resize(int amount, enum resize_axis axis, enum resize_unit unit) {
float pct = amount / 100.0f;
switch (axis) {
case RESIZE_AXIS_HORIZONTAL:
amount = (float)current->width * pct;
amount = (float)current->box.width * pct;
break;
case RESIZE_AXIS_VERTICAL:
amount = (float)current->height * pct;
amount = (float)current->box.height * pct;
break;
default:
sway_assert(0, "invalid resize axis");