aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/resize.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-01-14 20:10:49 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-01-14 20:10:49 +1000
commitb322432effb795860d637c5cd8662a989cded90f (patch)
tree537e5c4f0228d39dc05f3a064978785277bfd8d1 /sway/commands/resize.c
parentReplace resize_axis with wlr_edges (diff)
downloadsway-b322432effb795860d637c5cd8662a989cded90f.tar.gz
sway-b322432effb795860d637c5cd8662a989cded90f.tar.zst
sway-b322432effb795860d637c5cd8662a989cded90f.zip
Use uint32_t where resize axis might contain a bitfield
Diffstat (limited to 'sway/commands/resize.c')
-rw-r--r--sway/commands/resize.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sway/commands/resize.c b/sway/commands/resize.c
index bcec2c9d..0e849afc 100644
--- a/sway/commands/resize.c
+++ b/sway/commands/resize.c
@@ -104,7 +104,7 @@ static void calculate_constraints(int *min_width, int *max_width,
104 } 104 }
105} 105}
106 106
107static enum wlr_edges parse_resize_axis(const char *axis) { 107static uint32_t parse_resize_axis(const char *axis) {
108 if (strcasecmp(axis, "width") == 0 || strcasecmp(axis, "horizontal") == 0) { 108 if (strcasecmp(axis, "width") == 0 || strcasecmp(axis, "horizontal") == 0) {
109 return AXIS_HORIZONTAL; 109 return AXIS_HORIZONTAL;
110 } 110 }
@@ -126,15 +126,15 @@ static enum wlr_edges parse_resize_axis(const char *axis) {
126 return WLR_EDGE_NONE; 126 return WLR_EDGE_NONE;
127} 127}
128 128
129static bool is_horizontal(enum wlr_edges axis) { 129static bool is_horizontal(uint32_t axis) {
130 return axis & (WLR_EDGE_LEFT | WLR_EDGE_RIGHT); 130 return axis & (WLR_EDGE_LEFT | WLR_EDGE_RIGHT);
131} 131}
132 132
133static int parallel_coord(struct sway_container *c, enum wlr_edges axis) { 133static int parallel_coord(struct sway_container *c, uint32_t axis) {
134 return is_horizontal(axis) ? c->x : c->y; 134 return is_horizontal(axis) ? c->x : c->y;
135} 135}
136 136
137static int parallel_size(struct sway_container *c, enum wlr_edges axis) { 137static int parallel_size(struct sway_container *c, uint32_t axis) {
138 return is_horizontal(axis) ? c->width : c->height; 138 return is_horizontal(axis) ? c->width : c->height;
139} 139}
140 140
@@ -160,7 +160,7 @@ static void container_recursive_resize(struct sway_container *container,
160} 160}
161 161
162static void resize_tiled(struct sway_container *parent, int amount, 162static void resize_tiled(struct sway_container *parent, int amount,
163 enum wlr_edges axis) { 163 uint32_t axis) {
164 struct sway_container *focused = parent; 164 struct sway_container *focused = parent;
165 if (!parent) { 165 if (!parent) {
166 return; 166 return;
@@ -304,7 +304,7 @@ void container_resize_tiled(struct sway_container *parent,
304/** 304/**
305 * Implement `resize <grow|shrink>` for a floating container. 305 * Implement `resize <grow|shrink>` for a floating container.
306 */ 306 */
307static struct cmd_results *resize_adjust_floating(enum wlr_edges axis, 307static struct cmd_results *resize_adjust_floating(uint32_t axis,
308 struct resize_amount *amount) { 308 struct resize_amount *amount) {
309 struct sway_container *con = config->handler_context.container; 309 struct sway_container *con = config->handler_context.container;
310 int grow_width = 0, grow_height = 0; 310 int grow_width = 0, grow_height = 0;
@@ -361,7 +361,7 @@ static struct cmd_results *resize_adjust_floating(enum wlr_edges axis,
361/** 361/**
362 * Implement `resize <grow|shrink>` for a tiled container. 362 * Implement `resize <grow|shrink>` for a tiled container.
363 */ 363 */
364static struct cmd_results *resize_adjust_tiled(enum wlr_edges axis, 364static struct cmd_results *resize_adjust_tiled(uint32_t axis,
365 struct resize_amount *amount) { 365 struct resize_amount *amount) {
366 struct sway_container *current = config->handler_context.container; 366 struct sway_container *current = config->handler_context.container;
367 367
@@ -564,7 +564,7 @@ static struct cmd_results *cmd_resize_adjust(int argc, char **argv,
564 int multiplier) { 564 int multiplier) {
565 const char *usage = "Expected 'resize grow|shrink <direction> " 565 const char *usage = "Expected 'resize grow|shrink <direction> "
566 "[<amount> px|ppt [or <amount> px|ppt]]'"; 566 "[<amount> px|ppt [or <amount> px|ppt]]'";
567 enum wlr_edges axis = parse_resize_axis(*argv); 567 uint32_t axis = parse_resize_axis(*argv);
568 if (axis == WLR_EDGE_NONE) { 568 if (axis == WLR_EDGE_NONE) {
569 return cmd_results_new(CMD_INVALID, "resize", usage); 569 return cmd_results_new(CMD_INVALID, "resize", usage);
570 } 570 }