mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 18:15:59 +01:00
Add option to disable rendering of 'Loading ...'
This commit is contained in:
parent
7c2d6718f0
commit
3b5d29d52b
2 changed files with 25 additions and 10 deletions
3
config.c
3
config.c
|
@ -23,6 +23,7 @@ config_load_default(zathura_t* zathura)
|
|||
int int_value = 0;
|
||||
float float_value = 0;
|
||||
char* string_value = NULL;
|
||||
bool bool_value = false;
|
||||
girara_session_t* gsession = zathura->ui.session;
|
||||
|
||||
/* mode settings */
|
||||
|
@ -57,6 +58,8 @@ config_load_default(zathura_t* zathura)
|
|||
girara_setting_add(gsession, "highlight-color", string_value, STRING, false, "Color for highlighting", NULL, NULL);
|
||||
float_value = 0.5;
|
||||
girara_setting_add(gsession, "highlight-transparency", &float_value, FLOAT, false, "Transparency for highlighting", NULL, NULL);
|
||||
bool_value = true;
|
||||
girara_setting_add(gsession, "render-loading", &bool_value, BOOLEAN, false, "Render 'Loading ...'", NULL, NULL);
|
||||
|
||||
/* define default shortcuts */
|
||||
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_c, NULL, sc_abort, 0, 0, NULL);
|
||||
|
|
32
render.c
32
render.c
|
@ -4,6 +4,7 @@
|
|||
#include <girara/datastructures.h>
|
||||
#include <girara/utils.h>
|
||||
#include <girara/session.h>
|
||||
#include <girara/settings.h>
|
||||
|
||||
#include "render.h"
|
||||
#include "zathura.h"
|
||||
|
@ -324,17 +325,28 @@ page_expose_event(GtkWidget* UNUSED(widget), GdkEventExpose* UNUSED(event),
|
|||
cairo_rectangle(cairo, 0, 0, page_width, page->height * page->height);
|
||||
cairo_fill(cairo);
|
||||
|
||||
bool render_loading = false;
|
||||
bool* tmp = (page->document != NULL && page->document->zathura != NULL &&
|
||||
page->document->zathura->ui.session != NULL) ?
|
||||
girara_setting_get(page->document->zathura->ui.session, "render-loading") : NULL;
|
||||
if (tmp != NULL) {
|
||||
render_loading = *tmp;
|
||||
g_free(tmp);
|
||||
}
|
||||
|
||||
/* write text */
|
||||
cairo_set_source_rgb(cairo, 0, 0, 0);
|
||||
const char* text = "Loading...";
|
||||
cairo_select_font_face(cairo, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size(cairo, 16.0);
|
||||
cairo_text_extents_t extents;
|
||||
cairo_text_extents(cairo, text, &extents);
|
||||
double x = page_width * 0.5 - (extents.width * 0.5 + extents.x_bearing);
|
||||
double y = page_height * 0.5 - (extents.height * 0.5 + extents.y_bearing);
|
||||
cairo_move_to(cairo, x, y);
|
||||
cairo_show_text(cairo, text);
|
||||
if (render_loading == true) {
|
||||
cairo_set_source_rgb(cairo, 0, 0, 0);
|
||||
const char* text = "Loading...";
|
||||
cairo_select_font_face(cairo, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size(cairo, 16.0);
|
||||
cairo_text_extents_t extents;
|
||||
cairo_text_extents(cairo, text, &extents);
|
||||
double x = page_width * 0.5 - (extents.width * 0.5 + extents.x_bearing);
|
||||
double y = page_height * 0.5 - (extents.height * 0.5 + extents.y_bearing);
|
||||
cairo_move_to(cairo, x, y);
|
||||
cairo_show_text(cairo, text);
|
||||
}
|
||||
|
||||
/* render real page */
|
||||
render_page(page->document->zathura->sync.render_thread, page);
|
||||
|
|
Loading…
Reference in a new issue