Commit 801fe030 authored by Moritz Lipp's avatar Moritz Lipp
Browse files

Changed the strucure a bit

parent c5491675
......@@ -385,9 +385,13 @@ zathura_page_get(zathura_document_t* document, unsigned int page_id)
zathura_page_t* page = document->functions.page_get(document, page_id);
if (page) {
page->number = page_id;
page->rendered = false;
page->event_box = gtk_event_box_new();
page->number = page_id;
page->rendered = false;
page->event_box = gtk_event_box_new();
page->drawing_area = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(page->event_box), page->drawing_area);
g_static_mutex_init(&(page->lock));
}
......
......@@ -147,7 +147,8 @@ typedef struct zathura_page_s
zathura_document_t* document; /**> Document */
void* data; /**> Custom data */
bool rendered; /**> Page has been rendered */
GtkWidget* event_box; /**> Widget wrapper */
GtkWidget* event_box; /**> Widget wrapper for mouse events */
GtkWidget* drawing_area; /**> Drawing area */
GStaticMutex lock; /**> Lock */
} zathura_page_t;
......
......@@ -170,10 +170,7 @@ render(zathura_page_t* page)
}
/* draw to gtk widget */
GtkWidget* drawing_area = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(page->event_box), drawing_area);
cairo_t* cairo = gdk_cairo_create(drawing_area->window);
cairo_t* cairo = gdk_cairo_create(page->drawing_area->window);
cairo_set_source_surface(cairo, surface, 0, 0);
cairo_paint(cairo);
cairo_destroy(cairo);
......
......@@ -224,16 +224,12 @@ create_blank_pages()
zathura_page_t* page = Zathura.document->pages[i];
g_static_mutex_lock(&(page->lock));
/* create blank page */
GtkWidget* image = page_blank(page->width, page->height);
cairo_t* cairo = gdk_cairo_create(page->drawing_area->window);
cairo_set_source_rgb(cairo, 1, 1, 1);
cairo_rectangle(cairo, 0, 0, page->width, page->height);
cairo_fill(cairo);
cairo_destroy(cairo);
if (!image) {
g_static_mutex_unlock(&(page->lock));
continue;
}
/* pack to page view */
gtk_container_add(GTK_CONTAINER(page->event_box), image);
g_static_mutex_unlock(&(page->lock));
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment