Commit 309bc0d4 authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.7'

parents eab4eaff e35c78aa
......@@ -6,3 +6,4 @@ Sebastian Ramacher <s.ramacher@gmx.at>
Other contributors are (in alphabetical order):
Pavel Borzenkov <pavel.borzenkov@gmail.com>
William Skeith <wes@cs.ccny.cuny.edu>
......@@ -2,7 +2,7 @@
VERSION_MAJOR = 0
VERSION_MINOR = 2
VERSION_REV = 6
VERSION_REV = 7
VERSION = ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}
# minimum required zathura version
......@@ -32,7 +32,7 @@ endif
OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
MUPDF_LIB ?= -lmupdf -lmupdf-js-none
MUPDF_LIB ?= -lmupdf -lmujs
INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC}
LIBS = ${GTK_LIB} ${GIRARA_LIB} ${MUPDF_LIB} ${OPENSSL_LIB} -ljbig2dec -lopenjp2 -ljpeg
......
......@@ -33,10 +33,16 @@ pdf_document_open(zathura_document_t* document)
const char* path = zathura_document_get_path(document);
const char* password = zathura_document_get_password(document);
if (strstr(path, ".xps") != 0 || strstr(path, ".XPS") != 0 || strstr(path, ".rels") != 0) {
mupdf_document->document = (fz_document*) xps_open_document(mupdf_document->ctx, (char*) path);
} else {
mupdf_document->document = (fz_document*) pdf_open_document(mupdf_document->ctx, (char*) path);
fz_try(mupdf_document->ctx){
if (strstr(path, ".xps") != 0 || strstr(path, ".XPS") != 0 || strstr(path, ".rels") != 0) {
mupdf_document->document = (fz_document*) xps_open_document(mupdf_document->ctx, (char*) path);
} else {
mupdf_document->document = (fz_document*) pdf_open_document(mupdf_document->ctx, (char*) path);
}
}
fz_catch(mupdf_document->ctx){
error = ZATHURA_ERROR_UNKNOWN;
return error;
}
if (mupdf_document->document == NULL) {
......@@ -46,7 +52,7 @@ pdf_document_open(zathura_document_t* document)
/* authenticate if password is required and given */
if (fz_needs_password(mupdf_document->document) != 0) {
if (password == NULL || fz_authenticate_password(mupdf_document->document, (char*) password) != 0) {
if (password == NULL || fz_authenticate_password(mupdf_document->document, (char*) password) == 0) {
error = ZATHURA_ERROR_INVALID_PASSWORD;
goto error_free;
}
......
......@@ -46,9 +46,9 @@ build_index(fz_outline* outline, girara_tree_node_t* root)
while (outline != NULL) {
zathura_index_element_t* index_element = zathura_index_element_new(outline->title);
zathura_link_target_t target;
zathura_link_type_t type;
zathura_rectangle_t rect;
zathura_link_target_t target = { ZATHURA_LINK_DESTINATION_UNKNOWN, NULL, 0, -1, -1, -1, -1, 0 };
zathura_link_type_t type = ZATHURA_LINK_INVALID;
zathura_rectangle_t rect = { .x1 = 0, .y1 = 0, .x2 = 0, .y2 = 0 };
switch (outline->dest.kind) {
case FZ_LINK_NONE:
......@@ -65,6 +65,18 @@ build_index(fz_outline* outline, girara_tree_node_t* root)
target.left = 0;
target.top = 0;
target.scale = 0.0;
{
int gflags = outline->dest.ld.gotor.flags;
if (gflags & fz_link_flag_l_valid) {
target.left = outline->dest.ld.gotor.lt.x;
}
if (gflags & fz_link_flag_t_valid) {
target.top = outline->dest.ld.gotor.lt.y;
}
if (gflags & fz_link_flag_r_is_zoom) {
target.scale = outline->dest.ld.gotor.rb.x;
}
}
break;
default:
continue;
......
......@@ -59,6 +59,30 @@ pdf_page_links_get(zathura_page_t* page, mupdf_page_t* mupdf_page, zathura_error
target.left = 0;
target.top = 0;
target.scale = 0.0;
{
int gflags = link->dest.ld.gotor.flags;
if (gflags & fz_link_flag_l_valid) {
target.left = link->dest.ld.gotor.lt.x;
}
if (gflags & fz_link_flag_t_valid) {
target.top = link->dest.ld.gotor.lt.y;
}
/* if (gflags & fz_link_flag_r_is_zoom) { */
/* target.scale = link->dest.ld.gotor.rb.x; */
/* } */
}
break;
case FZ_LINK_LAUNCH:
type = ZATHURA_LINK_LAUNCH;
target.value = link->dest.ld.launch.file_spec;
break;
case FZ_LINK_NAMED:
type = ZATHURA_LINK_NAMED;
target.value = link->dest.ld.named.named;
break;
case FZ_LINK_GOTOR:
type = ZATHURA_LINK_GOTO_REMOTE;
target.value = link->dest.ld.gotor.file_spec;
break;
default:
continue;
......
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