mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 03:45:58 +01:00
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.
This commit is contained in:
parent
2ea80eb115
commit
26e1812ab3
1 changed files with 4 additions and 0 deletions
|
@ -459,6 +459,10 @@ static struct wlr_output *wlr_output_layout_output_in_direction(
|
||||||
|
|
||||||
struct wlr_box ref_box;
|
struct wlr_box ref_box;
|
||||||
wlr_output_layout_get_box(layout, reference, &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;
|
double min_distance = (distance_method == NEAREST) ? DBL_MAX : DBL_MIN;
|
||||||
struct wlr_output *closest_output = NULL;
|
struct wlr_output *closest_output = NULL;
|
||||||
|
|
Loading…
Reference in a new issue