compositor: Pick output for surface based on amount of overlap
This commit is contained in:
+14
-15
@@ -992,24 +992,23 @@ wlsc_surface_assign_output(struct wlsc_surface *es)
|
|||||||
{
|
{
|
||||||
struct wlsc_compositor *ec = es->compositor;
|
struct wlsc_compositor *ec = es->compositor;
|
||||||
struct wlsc_output *output;
|
struct wlsc_output *output;
|
||||||
|
pixman_region32_t region;
|
||||||
|
uint32_t max, area;
|
||||||
|
pixman_box32_t *e;
|
||||||
|
|
||||||
struct wlsc_output *tmp = es->output;
|
max = 0;
|
||||||
es->output = NULL;
|
|
||||||
|
|
||||||
wl_list_for_each(output, &ec->output_list, link) {
|
wl_list_for_each(output, &ec->output_list, link) {
|
||||||
if (pixman_region32_contains_point(&output->region,
|
pixman_region32_init_rect(®ion,
|
||||||
es->x, es->y, NULL)) {
|
es->x, es->y, es->width, es->height);
|
||||||
if (output != tmp)
|
pixman_region32_intersect(®ion, ®ion, &output->region);
|
||||||
printf("assiging surface %p to output %p\n",
|
|
||||||
es, output);
|
|
||||||
es->output = output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (es->output == NULL) {
|
e = pixman_region32_extents(®ion);
|
||||||
printf("no output found\n");
|
area = (e->x2 - e->x1) * (e->y2 - e->y1);
|
||||||
es->output = container_of(ec->output_list.next,
|
|
||||||
struct wlsc_output, link);
|
if (area >= max) {
|
||||||
|
es->output = output;
|
||||||
|
max = area;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user