mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 21:55:59 +01:00
Fix deprecated gdk thread function calls
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
16fbefa5cf
commit
7127a46033
2 changed files with 16 additions and 5 deletions
13
callbacks.c
13
callbacks.c
|
@ -107,7 +107,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
zathura_page_set_visibility(page, false);
|
zathura_page_set_visibility(page, false);
|
||||||
/* If a page becomes invisible, abort all render requests. */
|
/* If a page becomes invisible, abort the render request. */
|
||||||
zathura_page_widget_abort_render_request(zathura_page_widget);
|
zathura_page_widget_abort_render_request(zathura_page_widget);
|
||||||
/* if the page is not visible and not cached, but still has a surface, we
|
/* if the page is not visible and not cached, but still has a surface, we
|
||||||
* need to get rid of the surface */
|
* need to get rid of the surface */
|
||||||
|
@ -370,6 +370,13 @@ cb_sc_display_link(GtkEntry* entry, girara_session_t* session)
|
||||||
return handle_link(entry, session, ZATHURA_LINK_ACTION_DISPLAY);
|
return handle_link(entry, session, ZATHURA_LINK_ACTION_DISPLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
file_monitor_reload(void* data)
|
||||||
|
{
|
||||||
|
sc_reload((girara_session_t*) data, NULL, NULL, 0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cb_file_monitor(GFileMonitor* monitor, GFile* file, GFile* UNUSED(other_file), GFileMonitorEvent event, girara_session_t* session)
|
cb_file_monitor(GFileMonitor* monitor, GFile* file, GFile* UNUSED(other_file), GFileMonitorEvent event, girara_session_t* session)
|
||||||
{
|
{
|
||||||
|
@ -380,9 +387,7 @@ cb_file_monitor(GFileMonitor* monitor, GFile* file, GFile* UNUSED(other_file), G
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
||||||
case G_FILE_MONITOR_EVENT_CREATED:
|
case G_FILE_MONITOR_EVENT_CREATED:
|
||||||
gdk_threads_enter();
|
g_main_context_invoke(NULL, file_monitor_reload, session);
|
||||||
sc_reload(session, NULL, NULL, 0);
|
|
||||||
gdk_threads_leave();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|
8
main.c
8
main.c
|
@ -25,7 +25,9 @@ main(int argc, char* argv[])
|
||||||
#if !GLIB_CHECK_VERSION(2, 31, 0)
|
#if !GLIB_CHECK_VERSION(2, 31, 0)
|
||||||
g_thread_init(NULL);
|
g_thread_init(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
#if !GTK_CHECK_VERSION(3, 6, 0)
|
||||||
gdk_threads_init();
|
gdk_threads_init();
|
||||||
|
#endif
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
/* create zathura session */
|
/* create zathura session */
|
||||||
|
@ -46,7 +48,7 @@ main(int argc, char* argv[])
|
||||||
bool synctex = false;
|
bool synctex = false;
|
||||||
int page_number = ZATHURA_PAGE_NUMBER_UNSPECIFIED;
|
int page_number = ZATHURA_PAGE_NUMBER_UNSPECIFIED;
|
||||||
|
|
||||||
#if (GTK_MAJOR_VERSION == 3)
|
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||||
Window embed = 0;
|
Window embed = 0;
|
||||||
#else
|
#else
|
||||||
GdkNativeWindow embed = 0;
|
GdkNativeWindow embed = 0;
|
||||||
|
@ -148,9 +150,13 @@ main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run zathura */
|
/* run zathura */
|
||||||
|
#if !GTK_CHECK_VERSION(3, 6, 0)
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
|
#endif
|
||||||
gtk_main();
|
gtk_main();
|
||||||
|
#if !GTK_CHECK_VERSION(3, 6, 0)
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* free zathura */
|
/* free zathura */
|
||||||
zathura_free(zathura);
|
zathura_free(zathura);
|
||||||
|
|
Loading…
Reference in a new issue