diff --git a/callbacks.c b/callbacks.c index 7a3f5dc..d625798 100644 --- a/callbacks.c +++ b/callbacks.c @@ -19,9 +19,21 @@ cb_destroy(GtkWidget* widget, gpointer data) gboolean cb_draw(GtkWidget* widget, GdkEventExpose* expose, gpointer data) { + if(!widget) { + return false; + } + + gdk_window_clear(widget->window); + cairo_t *cairo = gdk_cairo_create(widget->window); + + if(!cairo) { + return false; + } + // FIXME: Split up zathura_page_t* page = zathura_page_get(Zathura.document, Zathura.document->current_page_number); if(!page) { + cairo_destroy(cairo); goto error_out; } @@ -32,6 +44,10 @@ cb_draw(GtkWidget* widget, GdkEventExpose* expose, gpointer data) goto error_out; } + cairo_set_source_surface(cairo, surface, 0, 0); + cairo_paint(cairo); + cairo_destroy(cairo); + cairo_surface_destroy(surface); zathura_page_free(page);