From 64142eeef222d3f525cabee89f1c0a30b264c589 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Thu, 6 Sep 2018 05:58:51 +0300 Subject: [PATCH] resize set for tiling: default to px when not specified --- src/commands.c | 10 ++++++---- testcases/t/541-resize-set-tiling.t | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/commands.c b/src/commands.c index 0343f9dc..28798017 100644 --- a/src/commands.c +++ b/src/commands.c @@ -694,13 +694,15 @@ void cmd_resize_set(I3_CMD, long cwidth, const char *mode_width, long cheight, c continue; } - if (cwidth > 0 && mode_width) { + if (cwidth > 0) { + bool is_ppt = mode_width && strcmp(mode_width, "ppt") == 0; success &= resize_set_tiling(current_match, cmd_output, current->con, - HORIZ, strcmp(mode_width, "ppt") == 0, cwidth); + HORIZ, is_ppt, cwidth); } - if (cheight > 0 && mode_height) { + if (cheight > 0) { + bool is_ppt = mode_height && strcmp(mode_height, "ppt") == 0; success &= resize_set_tiling(current_match, cmd_output, current->con, - VERT, strcmp(mode_height, "ppt") == 0, cheight); + VERT, is_ppt, cheight); } } } diff --git a/testcases/t/541-resize-set-tiling.t b/testcases/t/541-resize-set-tiling.t index d695edee..0298fecd 100644 --- a/testcases/t/541-resize-set-tiling.t +++ b/testcases/t/541-resize-set-tiling.t @@ -124,6 +124,14 @@ cmd 'resize set 155 px 135 px'; cmp_float($nodes->[1]->{nodes}->[1]->{rect}->{width}, 155, 'bottom-right window got 155 px width'); cmp_float($nodes->[1]->{nodes}->[1]->{rect}->{height}, 135, 'bottom-right window got 135 px height'); +# Without specifying mode +cmd 'resize set 201 131'; + +($nodes, $focus) = get_ws_content($tmp); + +cmp_float($nodes->[1]->{nodes}->[1]->{rect}->{width}, 201, 'bottom-right window got 201 px width'); +cmp_float($nodes->[1]->{nodes}->[1]->{rect}->{height}, 131, 'bottom-right window got 131 px height'); + # Mix ppt and px cmd 'resize set 75 ppt 200 px';