mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 09:46:01 +01:00
Changed the strucure a bit
This commit is contained in:
parent
c5491675aa
commit
801fe03009
4 changed files with 15 additions and 17 deletions
10
document.c
10
document.c
|
@ -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;
|
||||
|
||||
|
|
5
render.c
5
render.c
|
@ -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);
|
||||
|
|
14
zathura.c
14
zathura.c
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue