aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-12-30 14:31:56 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-12-30 14:31:56 -0600
commitdbe44e48c8b0434565fa9322fda4d493b0ae25ba (patch)
tree2fb11e24f86324ca8ed839e4d6ed4d3212eb534a
parent0b2c33248c57d8d6366f292d421f86f664ca3c67 (diff)
return early if selmon is not part of the output layout in dirtomon()
instead of checking twice
-rw-r--r--dwl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dwl.c b/dwl.c
index 1f0db88..19bb6ce 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1168,12 +1168,12 @@ Monitor *
dirtomon(enum wlr_direction dir)
{
struct wlr_output *next;
- if (wlr_output_layout_get(output_layout, selmon->wlr_output)
- && (next = wlr_output_layout_adjacent_output(output_layout,
+ if (!wlr_output_layout_get(output_layout, selmon->wlr_output))
+ return selmon;
+ if ((next = wlr_output_layout_adjacent_output(output_layout,
dir, selmon->wlr_output, selmon->m.x, selmon->m.y)))
return next->data;
- if (wlr_output_layout_get(output_layout, selmon->wlr_output)
- && (next = wlr_output_layout_farthest_output(output_layout,
+ if ((next = wlr_output_layout_farthest_output(output_layout,
dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT),
selmon->wlr_output, selmon->m.x, selmon->m.y)))
return next->data;