diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2022-08-30 19:22:33 +0300 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2022-08-30 19:26:23 +0300 |
commit | 26e1812ab3eb75ba5c13f1a4060dd74fb4c93263 (patch) | |
tree | af2e4efbc5a94284110ed7227d0d672867f9e295 | |
parent | 2ea80eb115a74ed2047fc19914f0c04f18bb7e5e (diff) | |
download | wlroots-26e1812ab3eb75ba5c13f1a4060dd74fb4c93263.tar.xz |
output-layout: improve wlr_output_layout_output_in_direction()
Now the function checks if the reference output belongs to the layout,
and returns NULL if it doesn't.
-rw-r--r-- | types/wlr_output_layout.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index 275f87d7..37c57fc6 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -459,6 +459,10 @@ static struct wlr_output *wlr_output_layout_output_in_direction( struct wlr_box ref_box; wlr_output_layout_get_box(layout, reference, &ref_box); + if (wlr_box_empty(&ref_box)) { + // The output doesn't belong to the layout + return NULL; + } double min_distance = (distance_method == NEAREST) ? DBL_MAX : DBL_MIN; struct wlr_output *closest_output = NULL; |