xwayland: refactor into xwl_window_post_damage()

Refactor xwl_screen_post_damage() and split the window specific code
into a new function xwl_window_post_damage().

This is a pure refactoring, there are no behavioral changes. An assert
is added to xwl_window_post_damage() to ensure frame callbacks are not
leaked if a future patch changes the call.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
This commit is contained in:
Pekka Paalanen 2016-11-24 11:45:25 +02:00 committed by Adam Jackson
parent 8e3f9ce6c0
commit f7b8560f23

View File

@ -458,20 +458,15 @@ static const struct wl_callback_listener frame_listener = {
};
static void
xwl_screen_post_damage(struct xwl_screen *xwl_screen)
xwl_window_post_damage(struct xwl_window *xwl_window)
{
struct xwl_window *xwl_window, *next_xwl_window;
struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
RegionPtr region;
BoxPtr box;
struct wl_buffer *buffer;
PixmapPtr pixmap;
xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
&xwl_screen->damage_window_list, link_damage) {
/* If we're waiting on a frame callback from the server,
* don't attach a new buffer. */
if (xwl_window->frame_callback)
continue;
assert(!xwl_window->frame_callback);
region = DamageRegion(xwl_window->damage);
pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
@ -496,6 +491,21 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
DamageEmpty(xwl_window->damage);
xorg_list_del(&xwl_window->link_damage);
}
static void
xwl_screen_post_damage(struct xwl_screen *xwl_screen)
{
struct xwl_window *xwl_window, *next_xwl_window;
xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
&xwl_screen->damage_window_list, link_damage) {
/* If we're waiting on a frame callback from the server,
* don't attach a new buffer. */
if (xwl_window->frame_callback)
continue;
xwl_window_post_damage(xwl_window);
}
}