Commit 635b9700 authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.8'

parents a7b3d73f 7d5bdbe6
......@@ -13,9 +13,14 @@ zathura.pc
gcov/
*.swp
version.h
doc/
./doc/_build
*.tmp
zathura.1
zathurarc.5
.version-checks/
dbus-interface-definitions.c
css-definitions.c
.ycm_extra_conf.py
.ropeproject
compile_commands.json
zathura-*.tar.gz
......@@ -23,4 +23,5 @@ Rob Cornish <jrmcornish@gmail.com>
Marwan Tanager <marwan.tngr@gmail.com>
Diego Joss <djego.joss@gmail.com>
Ignas Anikevicius <anikevicius@gmail.com>
Kamil Smardzewski <roderyk197@gmail.com>
oblique
# See LICENSE file for license and copyright information
include config.mk
include colors.mk
include common.mk
PROJECT = zathura
OSOURCE = $(filter-out dbus-interface-definitions.c, $(wildcard *.c))
HEADER = $(wildcard *.h)
OSOURCE = $(filter-out css-definitions.c, $(filter-out dbus-interface-definitions.c, $(wildcard *.c))) $(wildcard synctex/*.c)
HEADER = $(wildcard *.h) $(wildcard synctex/*.h)
HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h
ifneq (${WITH_SQLITE},0)
......@@ -36,8 +36,15 @@ endif
ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
endif
ifeq (,$(findstring -Isynctex,${CPPFLAGS}))
CPPFLAGS += -Isynctex
endif
ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS}))
CPPFLAGS += -DSYNCTEX_VERBOSE=0
endif
OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o
OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o css-definitions.o
DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS))
all: options ${PROJECT} po build-manpages
......@@ -68,19 +75,26 @@ version.h: version.h.in config.mk
$(QUIET)mv version.h.tmp version.h
dbus-interface-definitions.c: data/org.pwmt.zathura.xml
$(QUIET)echo '#include "dbus-interface-definitions.h"' > dbus-interface-definitions.c.tmp
$(QUIET)echo 'const char* DBUS_INTERFACE_XML =' >> dbus-interface-definitions.c.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/org.pwmt.zathura.xml >> dbus-interface-definitions.c.tmp
$(QUIET)echo ';' >> dbus-interface-definitions.c.tmp
$(QUIET)mv dbus-interface-definitions.c.tmp dbus-interface-definitions.c
$(QUIET)echo '#include "dbus-interface-definitions.h"' > $@.tmp
$(QUIET)echo 'const char* DBUS_INTERFACE_XML =' >> $@.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/org.pwmt.zathura.xml >> $@.tmp
$(QUIET)echo ';' >> $@.tmp
$(QUIET)mv $@.tmp $@
css-definitions.c: data/zathura.css_t
$(QUIET)echo '#include "css-definitions.h"' > $@.tmp
$(QUIET)echo 'const char* CSS_TEMPLATE_INDEX =' >> $@.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' $< >> $@.tmp
$(QUIET)echo ';' >> $@.tmp
$(QUIET)mv $@.tmp $@
%.o: %.c
$(ECHO) CC $<
@mkdir -p .depend
$(call colorecho,CC,$<)
$(QUIET) mkdir -p $(shell dirname .depend/$@.dep)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
%.do: %.c
$(ECHO) CC $<
$(call colorecho,CC,$<)
@mkdir -p .depend
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
......@@ -88,32 +102,30 @@ ${OBJECTS} ${DOBJECTS}: config.mk version.h \
.version-checks/GIRARA .version-checks/GLIB .version-checks/GTK
${PROJECT}: ${OBJECTS}
$(ECHO) CC -o $@
$(call colorecho,CC,$@)
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
clean:
$(QUIET)rm -rf ${PROJECT} \
${OBJECTS} \
${PROJECT}-${VERSION}.tar.gz \
${TARFILE} \
${TARDIR} \
${DOBJECTS} \
${PROJECT}-debug \
.depend \
${PROJECT}.pc \
doc \
version.h \
version.h.tmp \
dbus-interface-definitions.c \
dbus-interface-definitions.c.tmp \
*gcda *gcno $(PROJECT).info gcov *.tmp \
.version-checks
ifneq "$(wildcard ${RSTTOMAN})" ""
$(QUIET)rm -f zathura.1 zathurarc.5
endif
$(QUIET)$(MAKE) -C tests clean
$(QUIET)$(MAKE) -C po clean
$(QUIET)$(MAKE) -C doc clean
${PROJECT}-debug: ${DOBJECTS}
$(ECHO) CC -o $@
$(call colorecho,CC,$@)
$(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
debug: ${PROJECT}-debug
......@@ -139,24 +151,13 @@ test: ${OBJECTS}
$(QUIET)make -C tests run
dist: clean build-manpages
$(QUIET)mkdir -p ${PROJECT}-${VERSION}
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/tests
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/po
$(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS Doxyfile \
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \
${PROJECT}.desktop version.h.in \
${PROJECT}.1 ${PROJECT}rc.5 \
${PROJECT}-${VERSION}
$(QUIET)cp -r data ${PROJECT}-${VERSION}
$(QUIET)cp tests/Makefile tests/config.mk tests/*.c \
${PROJECT}-${VERSION}/tests
$(QUIET)cp po/Makefile po/*.po ${PROJECT}-${VERSION}/po
$(QUIET)tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION}
$(QUIET)gzip ${PROJECT}-${VERSION}.tar
$(QUIET)rm -rf ${PROJECT}-${VERSION}
$(QUIET)tar -czf $(TARFILE) --exclude=.gitignore \
--transform 's,^,zathura-$(VERSION)/,' \
`git ls-files` \
doc/_build/$(PROJECT).1 doc/_build/$(PROJECT)rc.5
doc:
$(QUIET)doxygen Doxyfile
$(QUIET)make -C doc
gcov: clean
$(QUIET)CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" LDFLAGS="${LDFLAGS} -fprofile-arcs" ${MAKE} $(PROJECT)
......@@ -170,68 +171,58 @@ po:
update-po:
$(QUIET)${MAKE} -C po update-po
ifneq "$(wildcard ${RSTTOMAN})" ""
%.1 %.5: config.mk
$(QUIET)sed "s/VERSION/${VERSION}/g" < $@.rst > $@.tmp
$(QUIET)${RSTTOMAN} $@.tmp > $@.out.tmp
$(QUIET)mv $@.out.tmp $@
$(QUIET)rm $@.tmp
${PROJECT}.1: ${PROJECT}.1.rst
${PROJECT}rc.5: ${PROJECT}rc.5.rst
build-manpages: ${PROJECT}.1 ${PROJECT}rc.5
else
build-manpages:
endif
$(QUIET)${MAKE} -C doc man
install-manpages: build-manpages
$(ECHO) installing manual pages
$(call colorecho,INSTALL,"man pages")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
ifneq "$(wildcard ${PROJECT}.1)" ""
$(QUIET)install -m 644 ${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
ifneq "$(wildcard doc/_build/${PROJECT}.1)" ""
$(QUIET)install -m 644 doc/_build/${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
endif
ifneq "$(wildcard ${PROJECT}rc.5)" ""
$(QUIET)install -m 644 ${PROJECT}rc.5 ${DESTDIR}${MANPREFIX}/man5
ifneq "$(wildcard doc/_build/${PROJECT}rc.5)" ""
$(QUIET)install -m 644 doc/_build/${PROJECT}rc.5 ${DESTDIR}${MANPREFIX}/man5
endif
install-headers: ${PROJECT}.pc
$(ECHO) installing header files
$(call colorecho,INSTALL,"header files")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(QUIET)install -m 644 ${HEADERINST} ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(ECHO) installing pkgconfig file
$(call colorecho,INSTALL,"pkgconfig file")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
install-dbus:
$(ECHO) installing D-Bus interface definitions
$(call colorecho,INSTALL,"D-Bus interface definitions")
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
$(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR)
install: all install-headers install-manpages install-dbus
$(ECHO) installing executable file
$(call colorecho,INSTALL,"executeable file")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
$(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX}
$(ECHO) installing desktop file
$(call colorecho,INSTALL,"desktop file")
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
$(MAKE) -C po install
uninstall-headers:
$(ECHO) removing header files
$(call colorecho,UNINSTALL,"header files")
$(QUIET)rm -rf ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(ECHO) removing pkgconfig file
$(call colorecho,UNINSTALL,"pkgconfig file")
$(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc
uninstall: uninstall-headers
$(ECHO) removing executable file
$(call colorecho,UNINSTALL,"executeable")
$(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
$(ECHO) removing manual pages
$(call colorecho,UNINSTALL,"man pages")
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
$(ECHO) removing desktop file
$(call colorecho,UNINSTALL,"desktop file")
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
$(ECHO) removing D-Bus interface definitions
$(call colorecho,UNINSTALL,"D-Bus interface definitions")
$(QUIET)rm -f $(DESTDIR)$(DBUSINTERFACEDIR)/org.pwmt.zathura.xml
$(MAKE) -C po uninstall
......
......@@ -7,20 +7,24 @@ Requirements
------------
gtk3
glib (>= 2.28)
girara (>= 0.1.8)
girara (>= 0.2.0)
sqlite3 (optional, >= 3.5.9)
check (for tests)
intltool
python-docutils (optional, for man pages)
libmagic from file(1) (optional, for mime-type detection)
Sphinx (optional, for manpages and HTML documentation)
doxygen (optional, for HTML documentation)
breathe (optional, for HTML documentation)
sphinx_rtd_theme (optional, for HTML documentation)
Please note that you need to have a working pkg-config installation and that the
Makefile is only compatible with GNU make. If you don't have a working
pkg-config installation please set the GTK_INC, GTK_LIB, GIRARA_INC, GIRARA_LIB,
SQLITE_INC and SQLITE_LIB variables accordingly.
And also note that rst2man from python-docutils is needed to build the man pages.
If it is not installed, the man pages won't be built.
Also note that Sphinx is needed to build the manpages. If it is not
installed, the man pages won't be built. For the HTML documentation, doxygen,
breathe and sphinx_rtd_theme are needed in additioan to Sphinx.
If you don't want to build with support for sqlite databases, you can set
WITH_SQLITE=0 and sqlite support won't be available.
......@@ -31,6 +35,9 @@ WITH_MAGIC=0.
If you pass these flags as a command line argument to make, you have to ensure
to pass the same flags when executing the install target.
If you want to build zathuras documentation, please install all python
dependencies from the ./doc/requirements.txt file.
Installation
------------
To build and install zathura:
......
......@@ -63,9 +63,17 @@ position_to_page_number(zathura_document_t* document, double pos_x,
unsigned int c0 = zathura_document_get_first_page_column(document);
unsigned int npag = zathura_document_get_number_of_pages(document);
unsigned int ncol = zathura_document_get_pages_per_row(document);
unsigned int nrow = (npag + c0 - 1 + ncol - 1) / ncol; /* number of rows */
unsigned int nrow = 0;
unsigned int pad = zathura_document_get_page_padding(document);
if (c0 == 1) {
/* There is no offset, so this is easy. */
nrow = (npag + ncol - 1) / ncol;
} else {
/* If there is a offset, we handle the first row extra. */
nrow = 1 + (npag - (ncol - c0 - 1) + (ncol - 1)) / ncol;
}
unsigned int col = floor(pos_x * (double)doc_width / (double)(cell_width + pad));
unsigned int row = floor(pos_y * (double)doc_height / (double)(cell_height + pad));
......@@ -73,7 +81,7 @@ position_to_page_number(zathura_document_t* document, double pos_x,
if (page < c0 - 1) {
return 0;
} else {
return page - (c0 - 1);
return MIN(page - (c0 - 1), npag - 1);
}
}
......
......@@ -137,60 +137,54 @@ cb_view_vadjustment_value_changed(GtkAdjustment* adjustment, gpointer data)
statusbar_page_number_update(zathura);
}
void
cb_view_hadjustment_changed(GtkAdjustment* adjustment, gpointer data)
static void
cb_view_adjustment_changed(GtkAdjustment* adjustment, zathura_t* zathura,
bool width)
{
zathura_t* zathura = data;
g_return_if_fail(zathura != NULL);
zathura_adjust_mode_t adjust_mode =
zathura_document_get_adjust_mode(zathura->document);
/* Do nothing in index mode */
if (girara_mode_get(zathura->ui.session) == zathura->modes.index) {
return;
}
/* Don't scroll we're focusing the inputbar. */
const zathura_adjust_mode_t adjust_mode =
zathura_document_get_adjust_mode(zathura->document);
/* Don't scroll, we're focusing the inputbar. */
if (adjust_mode == ZATHURA_ADJUST_INPUTBAR) {
return;
}
/* save the viewport size */
unsigned int view_width = (unsigned int)floor(gtk_adjustment_get_page_size(adjustment));
zathura_document_set_viewport_width(zathura->document, view_width);
/* Save the viewport size */
unsigned int size = (unsigned int)floor(gtk_adjustment_get_page_size(adjustment));
if (width == true) {
zathura_document_set_viewport_width(zathura->document, size);
} else {
zathura_document_set_viewport_height(zathura->document, size);
}
/* reset the adjustment, in case bounds have changed */
double ratio = zathura_document_get_position_x(zathura->document);
const double ratio = width == true ?
zathura_document_get_position_x(zathura->document) :
zathura_document_get_position_y(zathura->document);
zathura_adjustment_set_value_from_ratio(adjustment, ratio);
}
void
cb_view_vadjustment_changed(GtkAdjustment* adjustment, gpointer data)
cb_view_hadjustment_changed(GtkAdjustment* adjustment, gpointer data)
{
zathura_t* zathura = data;
g_return_if_fail(zathura != NULL);
zathura_adjust_mode_t adjust_mode =
zathura_document_get_adjust_mode(zathura->document);
/* Do nothing in index mode */
if (girara_mode_get(zathura->ui.session) == zathura->modes.index) {
return;
}
/* Don't scroll we're focusing the inputbar. */
if (adjust_mode == ZATHURA_ADJUST_INPUTBAR) {
return;
}
cb_view_adjustment_changed(adjustment, zathura, true);
}
/* save the viewport size */
unsigned int view_height = (unsigned int)floor(gtk_adjustment_get_page_size(adjustment));
zathura_document_set_viewport_height(zathura->document, view_height);
void
cb_view_vadjustment_changed(GtkAdjustment* adjustment, gpointer data)
{
zathura_t* zathura = data;
g_return_if_fail(zathura != NULL);
/* reset the adjustment, in case bounds have changed */
double ratio = zathura_document_get_position_y(zathura->document);
zathura_adjustment_set_value_from_ratio(adjustment, ratio);
cb_view_adjustment_changed(adjustment, zathura, false);
}
void
......@@ -220,13 +214,24 @@ cb_refresh_view(GtkWidget* GIRARA_UNUSED(view), gpointer data)
}
void
cb_page_layout_value_changed(girara_session_t* session, const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
cb_page_layout_value_changed(girara_session_t* session, const char* name, girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
zathura_t* zathura = session->global.data;
/* pages-per-row must not be 0 */
if (g_strcmp0(name, "pages-per-row") == 0) {
unsigned int pages_per_row = *((unsigned int*) value);
if (pages_per_row == 0) {
pages_per_row = 1;
girara_setting_set(session, name, &pages_per_row);
girara_notify(session, GIRARA_WARNING, _("'%s' must not be 0. Set to 1."), name);
return;
}
}
if (zathura->document == NULL) {
/* no document has been openend yet */
return;
......@@ -579,3 +584,16 @@ cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf, void* data)
g_free(selection);
}
void
cb_page_widget_link(ZathuraPage* page, void* data)
{
g_return_if_fail(page != NULL);
bool enter = (bool) data;
GdkWindow* window = gtk_widget_get_parent_window(GTK_WIDGET(page));
GdkCursor* cursor = gdk_cursor_new(enter == true ? GDK_HAND1 : GDK_LEFT_PTR);
gdk_window_set_cursor(window, cursor);
g_object_unref(cursor);
}
......@@ -200,4 +200,8 @@ void cb_page_widget_text_selected(ZathuraPage* page, const char* text,
void cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf,
void* data);
void
cb_page_widget_link(ZathuraPage* page, void* data);
#endif // CALLBACKS_H
# See LICENSE file for license and copyright information
#
TPUT ?= /usr/bin/tput
TPUT_AVAILABLE ?= $(shell ${TPUT} -V 2>/dev/null)
ifdef TPUT_AVAILABLE
ifeq ($(COLOR),1)
COLOR_NORMAL = `$(TPUT) sgr0`
COLOR_ACTION = `$(TPUT) bold``$(TPUT) setaf 3`
COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2`
COLOR_BRACKET = `$(TPUT) setaf 4`
define colorecho
@echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL)
endef
else
define colorecho
@echo " [$1]" $2
endef
endif
else
define colorecho
@echo " [$1]" $2
endef
endif
......@@ -523,8 +523,8 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list)
const char* path = zathura_document_get_path(zathura->document);
GIRARA_LIST_FOREACH(argument_list, char*, iter, value)
char* r = NULL;
if ((r = replace_substring(value, "$FILE", path)) != NULL) {
char* r = girara_replace_substring(value, "$FILE", path);
if (r != NULL) {
girara_list_iterator_set(iter, r);
}
GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value);
......
......@@ -31,17 +31,15 @@ cb_jumplist_change(girara_session_t* session, const char* name,
g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data;
if (g_strcmp0(name, "jumplist-size") != 0) {
return;
}
if (*(int *)value < 0) {
zathura->jumplist.max_size = 0;
} else {
zathura->jumplist.max_size = *(int *)value;
}
zathura_jumplist_trim(zathura);
if (zathura->jumplist.list != NULL && zathura->jumplist.size != 0) {
zathura_jumplist_trim(zathura);
}
}
static void
......@@ -176,6 +174,11 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "render-loading-fg", NULL, STRING, false, _("'Loading ...' foreground color"), cb_color_change, NULL);
girara_setting_set(gsession, "render-loading-fg", "#000000");
girara_setting_add(gsession, "index-fg", "#DDDDDD", STRING, true, _("Index mode foreground color"), NULL, NULL);
girara_setting_add(gsession, "index-bg", "#232323", STRING, true, _("Index mode background color"), NULL, NULL);
girara_setting_add(gsession, "index-active-fg", "#232323", STRING, true, _("Index mode foreground color (active element)"), NULL, NULL);
girara_setting_add(gsession, "index-active-bg", "#9FBC00", STRING, true, _("Index mode background color (active element)"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "recolor", &bool_value, BOOLEAN, false, _("Recolor pages"), cb_setting_recolor_change, NULL);
bool_value = false;
......@@ -184,7 +187,7 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "scroll-wrap", &bool_value, BOOLEAN, false, _("Wrap scrolling"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "scroll-page-aware", &bool_value, BOOLEAN, false, _("Page aware scrolling"), NULL, NULL);
bool_value = false;
bool_value = true;
girara_setting_add(gsession, "advance-pages-per-row", &bool_value, BOOLEAN, false, _("Advance number of pages per row"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "zoom-center", &bool_value, BOOLEAN, false, _("Horizontally centered zoom"), NULL, NULL);
......
# See LICENSE file for license and copyright information
# zathura make config
# project
PROJECT = zathura
ZATHURA_VERSION_MAJOR = 0
ZATHURA_VERSION_MINOR = 2
ZATHURA_VERSION_REV = 7
ZATHURA_VERSION_REV = 8
# If the API changes, the API version and the ABI version have to be bumped.
ZATHURA_API_VERSION = 2
# If the ABI breaks for any reason, this has to be bumped.
......@@ -15,7 +18,7 @@ VERSION = ${ZATHURA_VERSION_MAJOR}.${ZATHURA_VERSION_MINOR}.${ZATHURA_VERSION_RE
# girara
GIRARA_VERSION_CHECK ?= 1
GIRARA_MIN_VERSION = 0.1.8
GIRARA_MIN_VERSION = 0.2.0
GIRARA_PKG_CONFIG_NAME = girara-gtk3
# glib
GLIB_VERSION_CHECK ?= 1
......@@ -48,9 +51,6 @@ PLUGINDIR ?= ${LIBDIR}/zathura
# locale directory
LOCALEDIR ?= ${PREFIX}/share/locale
# rst2man
RSTTOMAN ?= /usr/bin/rst2man
# libs
GTK_INC ?= $(shell pkg-config --cflags gtk+-3.0)
GTK_LIB ?= $(shell pkg-config --libs gtk+-3.0)
......@@ -77,8 +77,11 @@ MAGIC_INC ?=
MAGIC_LIB ?= -lmagic
endif
INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC} ${GLIB_INC}
LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} ${GLIB_LIB} -lpthread -lm
ZLIB_INC ?= $(shell pkg-config --cflags zlib)
ZLIB_LIB ?= $(shell pkg-config --libs zlib)
INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC} ${GLIB_INC} $(ZLIB_INC)
LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} ${GLIB_LIB} $(ZLIB_LIB) -lpthread -lm
# flags
CFLAGS += -std=c99 -pedantic -Wall -Wno-format-zero-length -Wextra $(INCS)
......@@ -107,3 +110,9 @@ VALGRIND_SUPPRESSION_FILE = zathura.suppression
# set to something != 0 if you want verbose build output
VERBOSE ?= 0
# colors
COLOR ?= 1
# dist
TARFILE = ${PROJECT}-${VERSION}.tar.gz
TARDIR = ${PROJECT}-${VERSION}
/* See LICENSE file for license and copyright information */
#ifndef GIRARA_CSS_DEFINITIONS_H
#define GIRARA_CSS_DEFINITIONS_H
extern const char* CSS_TEMPLATE_INDEX;
#endif
/* Index mode colors */
#@session@ .indexmode {
color: @index-fg@;
background-color: @index-bg@;
}
#@session@ .indexmode:selected {
color: @index-active-fg@;
background-color: @index-active-bg@;
}
......@@ -170,7 +170,9 @@ highlight_rects(zathura_t* zathura, unsigned int page,
document_draw_search_results(zathura, true);
if (rectangles[page] == NULL || girara_list_size(rectangles[page]) == 0) {
girara_list_t* rect_list = rectangles[page];
if (rect_list == NULL || girara_list_size(rect_list) == 0) {
girara_debug("No rectangles for the given page. Jumping to page %u.", page);
page_set(zathura, page);
return;
}
......@@ -195,7 +197,13 @@ highlight_rects(zathura_t* zathura, unsigned int page,
/* Need to adjust rectangle to page scale and orientation */
zathura_page_t* doc_page = zathura_document_get_page(zathura->document, page);
zathura_rectangle_t* rect = girara_list_nth(rectangles[page], 0);
zathura_rectangle_t* rect = girara_list_nth(rect_list, 0);
if (rect == NULL) {
girara_debug("List of rectangles is broken. Jumping to page %u.", page);
page_set(zathura, page);
return;
}
zathura_rectangle_t rectangle = recalc_rectangle(doc_page, *rect);
/* compute the center of the rectangle, which will be aligned to the center
......@@ -209,6 +217,7 @@ highlight_rects(zathura_t* zathura, unsigned int page,
}
/* move to position */
girara_debug("Jumping to page %u position (%f, %f).", page, pos_x, pos_y);
zathura_jumplist_add(zathura);
position_set(zathura, pos_x, pos_y);
zathura_jumplist_add(zathura);
......@@ -283,6 +292,7 @@ handle_method_call(GDBusConnection* UNUSED(connection),
&secondary_iter);
if (page >= number_of_pages) {
girara_debug("Got invalid page number.");
GVariant* result = g_variant_new("(b)", false);
g_variant_iter_free(iter);
g_variant_iter_free(secondary_iter);
......@@ -312,7 +322,7 @@ handle_method_call(GDBusConnection* UNUSED(connection),
return;
}
zathura_rectangle_t temp_rect;
zathura_rectangle_t temp_rect = { 0, 0, 0, 0 };
while (g_variant_iter_loop(iter, "(dddd)", &temp_rect.x1, &temp_rect.x2,
&temp_rect.y1, &temp_rect.y2)) {
zathura_rectangle_t* rect = g_try_malloc0(sizeof(zathura_rectangle_t));
......@@ -535,17 +545,17 @@ zathura_dbus_goto_page_and_highlight(const char* filename, unsigned int page,
}
bool
zathura_dbus_synctex_position(const char* filename, const char* position,
pid_t hint)
zathura_dbus_synctex_position(const char* filename, const char* input_file,
int line, int column, pid_t hint)
{
if (filename == NULL || position == NULL) {
if (filename == NULL || input_file == NULL) {
return false;
}
unsigned int page = 0;
girara_list_t* secondary_rects = NULL;
girara_list_t* rectangles = synctex_rectangles_from_position(
filename, position, &page, &secondary_rects);
filename, input_file, line, column, &page, &secondary_rects);
if (rectangles == NULL) {
return false;
}
......
......@@ -57,7 +57,7 @@ bool zathura_dbus_goto_page_and_highlight(const char* filename,
unsigned int page, girara_list_t* rectangles, girara_list_t* secondary_rects,
pid_t pidhint);
bool zathura_dbus_synctex_position(const char* filename, const char* position,
pid_t pidhint);
bool zathura_dbus_synctex_position(const char* filename, const char* input_file,
int line, int column, pid_t hint);
#endif
......@@ -2,7 +2,7 @@
# General information
PROJECT_NAME = zathura
OUTPUT_DIRECTORY = ./doc/
OUTPUT_DIRECTORY = ./_build/doxygen/
OUTPUT_LANGUAGE = English
TAB_SIZE = 2
EXTRACT_ALL = YES
......@@ -16,15 +16,15 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
# Input files
INPUT =
EXCLUDE = ./tests
INPUT = ../
EXCLUDE = ./tests ./doc
FILE_PATTERNS = *.h *.c
RECURSIVE = YES
# Output files
GENERATE_HTML = YES
GENERATE_HTML = NO
GENERATE_LATEX = NO
GENERATE_RTF = NO
GENERATE_XML = NO
GENERATE_XML = YES
SOURCE_BROWSER = YES