Make smooth-reload the default

There are some corner cases, but let's reduce some of the complexity.
This commit is contained in:
Sebastian Ramacher 2024-03-03 12:42:27 +01:00
parent ab78c1ddb0
commit ef6e7e295c
6 changed files with 42 additions and 67 deletions

View file

@ -156,14 +156,6 @@ General settings
:type: Boolean
:default: false
.. describe:: smooth-reload
Defines if flickering will be removed when a file is reloaded on change.
This option might increase memory usage.
:type: Boolean
:default: true
.. describe:: show-signature-information
Defines whether additional information on signatures embedded in documents should be displayed.

View file

@ -938,13 +938,6 @@ zathura
* value type: Boolean
* Default value false
*smooth-reload*
Defines if flickering will be removed when a file is reloaded on change. This
option might increase memory usage.
* Value type: Boolean
* Default value: true
*statusbar-basename*
Use basename of the file in the statusbar.

View file

@ -318,8 +318,6 @@ void config_load_default(zathura_t* zathura) {
girara_setting_add(gsession, "search-hadjust", &bool_value, BOOLEAN, false, _("Center result horizontally"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "render-loading", &bool_value, BOOLEAN, false, _("Render 'Loading ...'"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "smooth-reload", &bool_value, BOOLEAN, false, _("Smooth over flicker when reloading file"), NULL, NULL);
girara_setting_add(gsession, "adjust-open", "best-fit", STRING, false, _("Adjust to when opening file"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "show-hidden", &bool_value, BOOLEAN, false, _("Show hidden files and directories"), NULL, NULL);

View file

@ -525,12 +525,9 @@ static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) {
const unsigned int page_height = gtk_widget_get_allocated_height(widget);
const unsigned int page_width = gtk_widget_get_allocated_width(widget);
bool smooth_reload = true;
girara_setting_get(zathura->ui.session, "smooth-reload", &smooth_reload);
bool surface_exists = priv->surface != NULL || priv->thumbnail != NULL;
if (zathura->predecessor_document != NULL && zathura->predecessor_pages != NULL && smooth_reload && !surface_exists) {
if (zathura->predecessor_document != NULL && zathura->predecessor_pages != NULL && !surface_exists) {
unsigned int page_index = zathura_page_get_index(priv->page);
if (page_index < zathura_document_get_number_of_pages(priv->zathura->predecessor_document)) {
@ -727,9 +724,7 @@ static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) {
cairo_fill(cairo);
}
} else {
if (smooth_reload) {
girara_debug("rendering loading screen, flicker might be happening");
}
/* set background color */
if (zathura_renderer_recolor_enabled(priv->zathura->sync.render_thread) == true) {

View file

@ -164,7 +164,12 @@ static void renderer_register_request(ZathuraRenderer* renderer, ZathuraRenderRe
/* init, new and free for ZathuraRenderRequest */
enum { REQUEST_COMPLETED, REQUEST_CACHE_ADDED, REQUEST_CACHE_INVALIDATED, REQUEST_LAST_SIGNAL };
enum {
REQUEST_COMPLETED,
REQUEST_CACHE_ADDED,
REQUEST_CACHE_INVALIDATED,
REQUEST_LAST_SIGNAL,
};
static guint request_signals[REQUEST_LAST_SIGNAL] = {0};

View file

@ -1498,11 +1498,8 @@ save_fileinfo_to_db(zathura_t* zathura)
g_free(file_info.first_page_column_list);
}
bool
document_predecessor_free(zathura_t* zathura) {
if (zathura == NULL
|| (zathura->predecessor_document == NULL
&& zathura->predecessor_pages == NULL)) {
bool document_predecessor_free(zathura_t* zathura) {
if (zathura == NULL || (zathura->predecessor_document == NULL && zathura->predecessor_pages == NULL)) {
return false;
}
@ -1524,9 +1521,7 @@ document_predecessor_free(zathura_t* zathura) {
return true;
}
bool
document_close(zathura_t* zathura, bool keep_monitor)
{
bool document_close(zathura_t* zathura, bool keep_monitor) {
if (zathura == NULL || zathura->document == NULL) {
return false;
}
@ -1539,9 +1534,6 @@ document_close(zathura_t* zathura, bool keep_monitor)
g_free(window_icon);
}
bool smooth_reload = true;
girara_setting_get(zathura->ui.session, "smooth-reload", &smooth_reload);
/* stop rendering */
zathura_renderer_stop(zathura->sync.render_thread);
g_clear_object(&zathura->window_icon_render_request);
@ -1578,7 +1570,7 @@ document_close(zathura_t* zathura, bool keep_monitor)
g_clear_object(&zathura->sync.render_thread);
/* keep the current state to prevent flicker? */
bool override_predecessor = keep_monitor && smooth_reload;
bool override_predecessor = keep_monitor;
if (override_predecessor) {
/* do not override predecessor buffer with empty pages */
@ -1590,7 +1582,7 @@ document_close(zathura_t* zathura, bool keep_monitor)
}
/* free predecessor buffer if we want to overwrite it or if we destroy the document for good */
if (override_predecessor || !keep_monitor || !smooth_reload) {
if (override_predecessor || !keep_monitor) {
document_predecessor_free(zathura);
}