Do not redraw search results

This commit is contained in:
Moritz Lipp 2010-05-13 11:39:20 +02:00
parent 5d7f332909
commit 1192099f65

View file

@ -248,6 +248,7 @@ struct
{ {
GList* results; GList* results;
int page; int page;
gboolean draw;
} Search; } Search;
struct struct
@ -435,6 +436,7 @@ init_zathura()
Zathura.Search.results = NULL; Zathura.Search.results = NULL;
Zathura.Search.page = 0; Zathura.Search.page = 0;
Zathura.Search.draw = TRUE;
Zathura.Inotify.fd = inotify_init(); Zathura.Inotify.fd = inotify_init();
@ -707,6 +709,8 @@ draw(int page_id)
} }
} }
Zathura.Search.draw = TRUE;
gtk_widget_set_size_request(Zathura.UI.drawing_area, width, height); gtk_widget_set_size_request(Zathura.UI.drawing_area, width, height);
gtk_widget_queue_draw(Zathura.UI.drawing_area); gtk_widget_queue_draw(Zathura.UI.drawing_area);
} }
@ -3027,9 +3031,13 @@ gboolean cb_draw(GtkWidget* widget, GdkEventExpose* expose, gpointer data)
else else
offset_y = 0; offset_y = 0;
GList* list; if(Zathura.Search.draw)
for(list = Zathura.Search.results; list && list->data; list = g_list_next(list)) {
highlight_result(Zathura.Search.page, (PopplerRectangle*) list->data); GList* list;
for(list = Zathura.Search.results; list && list->data; list = g_list_next(list))
highlight_result(Zathura.Search.page, (PopplerRectangle*) list->data);
Zathura.Search.draw = FALSE;
}
cairo_set_source_surface(cairo, Zathura.PDF.surface, offset_x, offset_y); cairo_set_source_surface(cairo, Zathura.PDF.surface, offset_x, offset_y);
cairo_paint(cairo); cairo_paint(cairo);