mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 18:39:48 +01:00
Fix wlr_output_layout_intersects
This commit is contained in:
parent
2af261fe40
commit
669a452aef
1 changed files with 8 additions and 9 deletions
|
@ -190,19 +190,18 @@ bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
|
||||||
|
|
||||||
bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
|
bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
|
||||||
struct wlr_output *reference, int x1, int y1, int x2, int y2) {
|
struct wlr_output *reference, int x1, int y1, int x2, int y2) {
|
||||||
struct wlr_output_layout_output *l_output =
|
struct wlr_output_layout_output *layout_output =
|
||||||
wlr_output_layout_get(layout, reference);
|
wlr_output_layout_get(layout, reference);
|
||||||
|
if (!layout_output) {
|
||||||
if (!l_output) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the output box must contain one of the points
|
struct wlr_box *output_box = wlr_output_layout_output_get_box(layout_output);
|
||||||
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box target_box = {x1, y1, x2 - x1, y2 - y1};
|
||||||
return wlr_box_contains_point(box, x1, y1) ||
|
|
||||||
wlr_box_contains_point(box, x2, y2) ||
|
struct wlr_box out;
|
||||||
wlr_box_contains_point(box, x2, y1) ||
|
struct wlr_box *out_ptr = &out;
|
||||||
wlr_box_contains_point(box, y2, x1);
|
return wlr_box_intersection(output_box, &target_box, &out_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
|
struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
|
||||||
|
|
Loading…
Reference in a new issue