tri->egl = egl;
tri->widget = window_add_subsurface(window, tri,
int_to_mode(option_triangle_mode));
+ widget_set_use_cairo(tri->widget, 0);
widget_set_resize_handler(tri->widget, triangle_resize_handler);
widget_set_redraw_handler(tri->widget, triangle_redraw_handler);
int opaque;
int tooltip_count;
int default_cursor;
+ /* If this is set to false then no cairo surface will be
+ * created before redrawing the surface. This is useful if the
+ * redraw handler is going to do completely custom rendering
+ * such as using EGL directly */
+ int use_cairo;
};
struct touch_point {
widget->tooltip = NULL;
widget->tooltip_count = 0;
widget->default_cursor = CURSOR_LEFT_PTR;
+ widget->use_cairo = 1;
return widget;
}
struct surface *surface = widget->surface;
struct window *window = widget->window;
+ assert(widget->use_cairo);
+
if (!surface->cairo_surface) {
if (surface == window->main_surface)
window_create_main_surface(window);
window_schedule_redraw_task(widget->window);
}
+void
+widget_set_use_cairo(struct widget *widget,
+ int use_cairo)
+{
+ widget->use_cairo = use_cairo;
+}
+
cairo_surface_t *
window_get_surface(struct window *window)
{
wl_callback_destroy(surface->frame_cb);
}
- if (!widget_get_cairo_surface(surface->widget)) {
+ if (surface->widget->use_cairo &&
+ !widget_get_cairo_surface(surface->widget)) {
DBG_OBJ(surface->surface, "cancelled due buffer failure\n");
return -1;
}
widget_axis_handler_t handler);
void
widget_schedule_redraw(struct widget *widget);
+void
+widget_set_use_cairo(struct widget *widget, int use_cairo);
struct widget *
window_frame_create(struct window *window, void *data);