window: do proper Cairo device flushing

The Cairo documentation tells us to always call cairo_device_flush()
before using other rendering APIs on the cairo surface, especially where
the Cairo device shares state with us (that is, EGL and GL state in this
case).

Add a call to cairo_device_flush() into display_acquire_window_surface(),
which the toytoolkit offers for switching to native (GL) rendering.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
dev
Pekka Paalanen 13 years ago committed by Kristian Høgsberg
parent ce03ec3fbe
commit 9015ead7d6
  1. 6
      clients/window.c

@ -995,11 +995,6 @@ window_draw_decorations(struct window *window)
cairo_show_text(cr, window->title); cairo_show_text(cr, window->title);
cairo_destroy(cr); cairo_destroy(cr);
/* FIXME: this breakes gears, fix cairo? */
#if 0
cairo_device_flush (window->display->device);
#endif
} }
void void
@ -2529,6 +2524,7 @@ display_acquire_window_surface(struct display *display,
data = cairo_surface_get_user_data(window->cairo_surface, data = cairo_surface_get_user_data(window->cairo_surface,
&surface_data_key); &surface_data_key);
cairo_device_flush(device);
cairo_device_acquire(device); cairo_device_acquire(device);
if (!eglMakeCurrent(display->dpy, data->surf, data->surf, ctx)) if (!eglMakeCurrent(display->dpy, data->surf, data->surf, ctx))
fprintf(stderr, "failed to make surface current\n"); fprintf(stderr, "failed to make surface current\n");

Loading…
Cancel
Save