aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-10-10 20:05:10 +0200
committeremersion <contact@emersion.fr>2017-10-10 20:05:10 +0200
commit669a452aefa65bb11799a3def2628e54479ea6d8 (patch)
treeb997b8df1062af7e27f1f46e7bd4aa73abc03d1f
parent2af261fe404839ebd4b81879f36448068a026a15 (diff)
Fix wlr_output_layout_intersects
-rw-r--r--types/wlr_output_layout.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c
index 922c332b..1890074b 100644
--- a/types/wlr_output_layout.c
+++ b/types/wlr_output_layout.c
@@ -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,
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);
-
- if (!l_output) {
+ if (!layout_output) {
return false;
}
- // the output box must contain one of the points
- struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
- return wlr_box_contains_point(box, x1, y1) ||
- wlr_box_contains_point(box, x2, y2) ||
- wlr_box_contains_point(box, x2, y1) ||
- wlr_box_contains_point(box, y2, x1);
+ struct wlr_box *output_box = wlr_output_layout_output_get_box(layout_output);
+ struct wlr_box target_box = {x1, y1, x2 - x1, y2 - y1};
+
+ struct wlr_box out;
+ struct wlr_box *out_ptr = &out;
+ return wlr_box_intersection(output_box, &target_box, &out_ptr);
}
struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,