compositor: Pick output for surface based on amount of overlap

dev
Kristian Høgsberg 14 years ago
parent 7fb56b3ebc
commit 4f0df049bb
  1. 27
      compositor/compositor.c

@ -992,25 +992,24 @@ 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(&region,
es->x, es->y, NULL)) { es->x, es->y, es->width, es->height);
if (output != tmp) pixman_region32_intersect(&region, &region, &output->region);
printf("assiging surface %p to output %p\n",
es, output); e = pixman_region32_extents(&region);
area = (e->x2 - e->x1) * (e->y2 - e->y1);
if (area >= max) {
es->output = output; es->output = output;
max = area;
} }
} }
if (es->output == NULL) {
printf("no output found\n");
es->output = container_of(ec->output_list.next,
struct wlsc_output, link);
}
} }
static void static void

Loading…
Cancel
Save