Fix wlr_output_layout_intersects

master
emersion 7 years ago
parent 2af261fe40
commit 669a452aef
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -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…
Cancel
Save