mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 13:16:00 +01:00
Highlight search results again
This commit is a incomplete patch to highlight the search results again.
This commit is contained in:
parent
bdc6f33325
commit
5a0e067dce
1 changed files with 23 additions and 3 deletions
26
zathura.c
26
zathura.c
|
@ -244,6 +244,12 @@ struct
|
||||||
GStaticMutex search_lock;
|
GStaticMutex search_lock;
|
||||||
} Lock;
|
} Lock;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
GList* results;
|
||||||
|
int page;
|
||||||
|
} Search;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
GThread* search_thread;
|
GThread* search_thread;
|
||||||
|
@ -427,6 +433,9 @@ init_zathura()
|
||||||
Zathura.Marker.number_of_markers = 0;
|
Zathura.Marker.number_of_markers = 0;
|
||||||
Zathura.Marker.last = -1;
|
Zathura.Marker.last = -1;
|
||||||
|
|
||||||
|
Zathura.Search.results = NULL;
|
||||||
|
Zathura.Search.page = 0;
|
||||||
|
|
||||||
Zathura.Inotify.fd = inotify_init();
|
Zathura.Inotify.fd = inotify_init();
|
||||||
|
|
||||||
/* UI */
|
/* UI */
|
||||||
|
@ -1135,7 +1144,6 @@ search(void* parameter)
|
||||||
static int next_page = 0;
|
static int next_page = 0;
|
||||||
int page_counter;
|
int page_counter;
|
||||||
GList* results = NULL;
|
GList* results = NULL;
|
||||||
GList* list = NULL;
|
|
||||||
|
|
||||||
if(argument->data)
|
if(argument->data)
|
||||||
search_item = g_strdup((char*) argument->data);
|
search_item = g_strdup((char*) argument->data);
|
||||||
|
@ -1151,10 +1159,19 @@ search(void* parameter)
|
||||||
}
|
}
|
||||||
g_static_mutex_unlock(&(Zathura.Lock.document_lock));
|
g_static_mutex_unlock(&(Zathura.Lock.document_lock));
|
||||||
|
|
||||||
|
/* delete old results */
|
||||||
|
if(Zathura.Search.results)
|
||||||
|
{
|
||||||
|
g_list_free(Zathura.Search.results);
|
||||||
|
Zathura.Search.results = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* search document */
|
/* search document */
|
||||||
if(argument->n)
|
if(argument->n)
|
||||||
direction = (argument->n == BACKWARD) ? -1 : 1;
|
direction = (argument->n == BACKWARD) ? -1 : 1;
|
||||||
|
|
||||||
|
printf("%s\n", search_item);
|
||||||
|
|
||||||
int number_of_pages = Zathura.PDF.number_of_pages;
|
int number_of_pages = Zathura.PDF.number_of_pages;
|
||||||
int page_number = Zathura.PDF.page_number;
|
int page_number = Zathura.PDF.page_number;
|
||||||
|
|
||||||
|
@ -1193,8 +1210,8 @@ search(void* parameter)
|
||||||
|
|
||||||
set_page(next_page);
|
set_page(next_page);
|
||||||
|
|
||||||
for(list = results; list && list->data; list = g_list_next(list))
|
Zathura.Search.results = results;
|
||||||
highlight_result(next_page, (PopplerRectangle*) list->data);
|
Zathura.Search.page = next_page;
|
||||||
|
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
}
|
}
|
||||||
|
@ -3004,6 +3021,9 @@ gboolean cb_draw(GtkWidget* widget, GdkEventExpose* expose, gpointer data)
|
||||||
else
|
else
|
||||||
offset_y = 0;
|
offset_y = 0;
|
||||||
|
|
||||||
|
GList* list;
|
||||||
|
for(list = Zathura.Search.results; list && list->data; list = g_list_next(list))
|
||||||
|
highlight_result(Zathura.Search.page, (PopplerRectangle*) list->data);
|
||||||
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue