mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 02:55: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;
|
int int_value = 0;
|
||||||
float float_value = 0;
|
float float_value = 0;
|
||||||
char* string_value = NULL;
|
char* string_value = NULL;
|
||||||
|
bool bool_value = false;
|
||||||
girara_session_t* gsession = zathura->ui.session;
|
girara_session_t* gsession = zathura->ui.session;
|
||||||
|
|
||||||
/* mode settings */
|
/* 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);
|
girara_setting_add(gsession, "highlight-color", string_value, STRING, false, "Color for highlighting", NULL, NULL);
|
||||||
float_value = 0.5;
|
float_value = 0.5;
|
||||||
girara_setting_add(gsession, "highlight-transparency", &float_value, FLOAT, false, "Transparency for highlighting", NULL, NULL);
|
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 */
|
/* define default shortcuts */
|
||||||
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_c, NULL, sc_abort, 0, 0, NULL);
|
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_c, NULL, sc_abort, 0, 0, NULL);
|
||||||
|
|
12
render.c
12
render.c
|
@ -4,6 +4,7 @@
|
||||||
#include <girara/datastructures.h>
|
#include <girara/datastructures.h>
|
||||||
#include <girara/utils.h>
|
#include <girara/utils.h>
|
||||||
#include <girara/session.h>
|
#include <girara/session.h>
|
||||||
|
#include <girara/settings.h>
|
||||||
|
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "zathura.h"
|
#include "zathura.h"
|
||||||
|
@ -324,7 +325,17 @@ page_expose_event(GtkWidget* UNUSED(widget), GdkEventExpose* UNUSED(event),
|
||||||
cairo_rectangle(cairo, 0, 0, page_width, page->height * page->height);
|
cairo_rectangle(cairo, 0, 0, page_width, page->height * page->height);
|
||||||
cairo_fill(cairo);
|
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 */
|
/* write text */
|
||||||
|
if (render_loading == true) {
|
||||||
cairo_set_source_rgb(cairo, 0, 0, 0);
|
cairo_set_source_rgb(cairo, 0, 0, 0);
|
||||||
const char* text = "Loading...";
|
const char* text = "Loading...";
|
||||||
cairo_select_font_face(cairo, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
cairo_select_font_face(cairo, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||||
|
@ -335,6 +346,7 @@ page_expose_event(GtkWidget* UNUSED(widget), GdkEventExpose* UNUSED(event),
|
||||||
double y = page_height * 0.5 - (extents.height * 0.5 + extents.y_bearing);
|
double y = page_height * 0.5 - (extents.height * 0.5 + extents.y_bearing);
|
||||||
cairo_move_to(cairo, x, y);
|
cairo_move_to(cairo, x, y);
|
||||||
cairo_show_text(cairo, text);
|
cairo_show_text(cairo, text);
|
||||||
|
}
|
||||||
|
|
||||||
/* render real page */
|
/* render real page */
|
||||||
render_page(page->document->zathura->sync.render_thread, page);
|
render_page(page->document->zathura->sync.render_thread, page);
|
||||||
|
|
Loading…
Reference in a new issue