Commit 7127a460 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Fix deprecated gdk thread function calls

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 16fbefa5
......@@ -107,7 +107,7 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
}
} else {
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);
/* if the page is not visible and not cached, but still has a surface, we
* 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);
}
static gboolean
file_monitor_reload(void* data)
{
sc_reload((girara_session_t*) data, NULL, NULL, 0);
return FALSE;
}
void
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) {
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
case G_FILE_MONITOR_EVENT_CREATED:
gdk_threads_enter();
sc_reload(session, NULL, NULL, 0);
gdk_threads_leave();
g_main_context_invoke(NULL, file_monitor_reload, session);
break;
default:
return;
......
......@@ -25,7 +25,9 @@ main(int argc, char* argv[])
#if !GLIB_CHECK_VERSION(2, 31, 0)
g_thread_init(NULL);
#endif
#if !GTK_CHECK_VERSION(3, 6, 0)
gdk_threads_init();
#endif
gtk_init(&argc, &argv);
/* create zathura session */
......@@ -46,7 +48,7 @@ main(int argc, char* argv[])
bool synctex = false;
int page_number = ZATHURA_PAGE_NUMBER_UNSPECIFIED;
#if (GTK_MAJOR_VERSION == 3)
#if GTK_CHECK_VERSION(3, 0, 0)
Window embed = 0;
#else
GdkNativeWindow embed = 0;
......@@ -148,9 +150,13 @@ main(int argc, char* argv[])
}
/* run zathura */
#if !GTK_CHECK_VERSION(3, 6, 0)
gdk_threads_enter();
#endif
gtk_main();
#if !GTK_CHECK_VERSION(3, 6, 0)
gdk_threads_leave();
#endif
/* free zathura */
zathura_free(zathura);
......
Markdown is supported
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