diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 90ed1fd0..399269d8 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -230,7 +230,7 @@ fb_handle_buffer_destroy(struct wl_listener *listener, void *data) if (fb == fb->output->next || (fb == fb->output->current && !fb->output->next)) - weston_compositor_schedule_repaint(fb->output->base.compositor); + weston_output_schedule_repaint(&fb->output->base); } static int diff --git a/src/compositor-x11.c b/src/compositor-x11.c index a5c18684..8cff73ed 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -627,6 +627,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data) xcb_key_press_event_t *key_press, *key_release; xcb_keymap_notify_event_t *keymap_notify; xcb_focus_in_event_t *focus_in; + xcb_expose_event_t *expose; xcb_atom_t atom; uint32_t *k; uint32_t i, set; @@ -716,10 +717,9 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data) break; case XCB_EXPOSE: - /* FIXME: schedule output repaint */ - /* output = x11_compositor_find_output(c, expose->window); */ - - weston_compositor_schedule_repaint(&c->base); + expose = (xcb_expose_event_t *) event; + output = x11_compositor_find_output(c, expose->window); + weston_output_schedule_repaint(&output->base); break; case XCB_ENTER_NOTIFY: diff --git a/src/compositor.c b/src/compositor.c index c433c06e..8aefca12 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -929,7 +929,7 @@ weston_output_damage(struct weston_output *output) pixman_region32_union(&compositor->damage, &compositor->damage, &output->region); - weston_compositor_schedule_repaint(compositor); + weston_output_schedule_repaint(output); } static void @@ -1175,23 +1175,21 @@ weston_layer_init(struct weston_layer *layer, struct wl_list *below) } WL_EXPORT void -weston_compositor_schedule_repaint(struct weston_compositor *compositor) +weston_output_schedule_repaint(struct weston_output *output) { - struct weston_output *output; + struct weston_compositor *compositor = output->compositor; struct wl_event_loop *loop; if (compositor->state == WESTON_COMPOSITOR_SLEEPING) return; loop = wl_display_get_event_loop(compositor->wl_display); - wl_list_for_each(output, &compositor->output_list, link) { - output->repaint_needed = 1; - if (output->repaint_scheduled) - continue; + output->repaint_needed = 1; + if (output->repaint_scheduled) + return; - wl_event_loop_add_idle(loop, idle_repaint, output); - output->repaint_scheduled = 1; - } + wl_event_loop_add_idle(loop, idle_repaint, output); + output->repaint_scheduled = 1; if (compositor->input_loop_source) { wl_event_source_remove(compositor->input_loop_source); @@ -1199,6 +1197,15 @@ weston_compositor_schedule_repaint(struct weston_compositor *compositor) } } +WL_EXPORT void +weston_compositor_schedule_repaint(struct weston_compositor *compositor) +{ + struct weston_output *output; + + wl_list_for_each(output, &compositor->output_list, link) + weston_output_schedule_repaint(output); +} + WL_EXPORT void weston_compositor_fade(struct weston_compositor *compositor, float tint) { diff --git a/src/compositor.h b/src/compositor.h index b437d594..ed091572 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -519,6 +519,8 @@ weston_layer_init(struct weston_layer *layer, struct wl_list *below); void weston_output_finish_frame(struct weston_output *output, int msecs); void +weston_output_schedule_repaint(struct weston_output *output); +void weston_output_damage(struct weston_output *output); void weston_compositor_schedule_repaint(struct weston_compositor *compositor); diff --git a/src/screenshooter.c b/src/screenshooter.c index 542425ee..aa8d0c06 100644 --- a/src/screenshooter.c +++ b/src/screenshooter.c @@ -165,7 +165,7 @@ screenshooter_shoot(struct wl_client *client, l->listener.notify = screenshooter_frame_notify; wl_signal_add(&output->frame_signal, &l->listener); - weston_compositor_schedule_repaint(output->compositor); + weston_output_schedule_repaint(output); } struct screenshooter_interface screenshooter_implementation = {