Commit c659361a authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge branch 'develop'

parents de0890c2 07cb63c8
......@@ -11,3 +11,4 @@ zathura.pc
*.gcno
*.gcda
gcov/
*.swp
zathura is written by:
Moritz Lipp <mlq@pwmt.org>
Sebastian Ramacher <s.ramacher@gmx.at>
Other contributors are (in alphabetical order):
Pavel Borzenkov <pavel.borzenkov@gmail.com>
Ivan Sichmann Freitas <ivansichfreitas@gmail.com>
int3 <jezreel@gmail.com>
karottenreibe <k@rottenrei.be>
Johannes Meng <j@jmeng.de>
Copyright (c) 2009-2011 pwmt.org
Copyright (c) 2009-2012 pwmt.org
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
......
......@@ -63,6 +63,8 @@ ${PROJECT}.pc: ${PROJECT}.pc.in config.mk
$(QUIET)echo project=${PROJECT} > ${PROJECT}.pc
$(QUIET)echo version=${VERSION} >> ${PROJECT}.pc
$(QUIET)echo includedir=${PREFIX}/include >> ${PROJECT}.pc
$(QUIET)echo plugindir=${PLUGINDIR} >> ${PROJECT}.pc
$(QUIET)echo GTK_VERSION=${ZATHURA_GTK_VERSION} >> ${PROJECT}.pc
$(QUIET)cat ${PROJECT}.pc.in >> ${PROJECT}.pc
valgrind: debug
......@@ -72,19 +74,22 @@ valgrind: debug
gdb: debug
cgdb ${PROJECT}-debug
tests: ${OBJECTS}
$(QUIET)make -C tests
test: ${OBJECTS}
$(QUIET)make -C tests run
dist: clean
$(QUIET)mkdir -p ${PROJECT}-${VERSION}
$(QUIET)cp -R LICENSE Makefile config.mk common.mk README Doxyfile \
${PROJECT}.1 ${SOURCE} ${HEADER} ${PROJECT}.pc.in tests \
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/tests
$(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS Doxyfile \
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${SOURCE} ${HEADER} ${PROJECT}.pc.in \
${PROJECT}-${VERSION}
$(QUIET)cp Makefile config.mk tests/*.c \
${PROJECT}-${VERSION}/tests
$(QUIET)tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION}
$(QUIET)gzip ${PROJECT}-${VERSION}.tar
$(QUIET)rm -rf ${PROJECT}-${VERSION}
doc: clean
doc:
$(QUIET)doxygen Doxyfile
gcov: clean
......@@ -103,10 +108,15 @@ install: all ${PROJECT}.pc
$(QUIET)cp -f zathura.h ${DESTDIR}${PREFIX}/include/${PROJECT}
$(ECHO) installing manual pages
$(QUIET)mkdir -p ${DESTDIR}${MANPREFIX}/man1
$(QUIET)sed "s/VERSION/${VERSION}/g" < ${PROJECT}.1 > ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(QUIET)if which rst2man > /dev/null ; then \
mkdir -p ${DESTDIR}${MANPREFIX}/man1 ; \
sed "s/VERSION/${VERSION}/g" < ${PROJECT}.1.rst > ${PROJECT}-v.1.rst ; \
rst2man ${PROJECT}-v.1.rst > ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1 ; \
rm -f ${PROJECT}-v.1.rst ; \
mkdir -p ${DESTDIR}${MANPREFIX}/man5 ; \
rst2man ${PROJECT}rc.5.rst > ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5 ; \
sed "s/VERSION/${VERSION}/g" < ${PROJECT}rc.5.rst > ${PROJECT}rc-v.5.rst ; \
rst2man ${PROJECT}rc-v.5.rst > ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5 ; \
rm -f ${PROJECT}rc-v.5.rst ; \
fi
$(QUIET)mkdir -p ${DESTDIR}${DESKTOPPREFIX}
$(ECHO) installing desktop file
......@@ -131,4 +141,4 @@ uninstall:
-include $(wildcard .depend/*.dep)
.PHONY: all options clean doc debug valgrind gdb dist doc install uninstall tests
.PHONY: all options clean doc debug valgrind gdb dist doc install uninstall test
......@@ -32,8 +32,9 @@ zathura_bookmark_add(zathura_t* zathura, const gchar* id, unsigned int page)
bookmark->id = g_strdup(id);
bookmark->page = page;
girara_list_append(zathura->bookmarks.bookmarks, bookmark);
if (zathura->database) {
if (!zathura_db_add_bookmark(zathura->database, zathura->document->file_path, bookmark)) {
if (zathura->database != NULL) {
if (zathura_db_add_bookmark(zathura->database, zathura->document->file_path, bookmark) == false) {
girara_warning("Failed to add bookmark to database.");
}
}
......@@ -48,15 +49,16 @@ zathura_bookmark_remove(zathura_t* zathura, const gchar* id)
g_return_val_if_fail(id, false);
zathura_bookmark_t* bookmark = zathura_bookmark_get(zathura, id);
if (!bookmark) {
if (bookmark == NULL) {
return false;
}
if (zathura->database) {
if (!zathura_db_remove_bookmark(zathura->database, zathura->document->file_path, bookmark->id)) {
if (zathura->database != NULL) {
if (zathura_db_remove_bookmark(zathura->database, zathura->document->file_path, bookmark->id) == false) {
girara_warning("Failed to remove bookmark from database.");
}
}
girara_list_remove(zathura->bookmarks.bookmarks, bookmark);
return true;
......@@ -74,7 +76,7 @@ zathura_bookmark_get(zathura_t* zathura, const gchar* id)
void
zathura_bookmark_free(zathura_bookmark_t* bookmark)
{
if (!bookmark) {
if (bookmark == NULL) {
return;
}
......@@ -86,17 +88,19 @@ bool
zathura_bookmarks_load(zathura_t* zathura, const gchar* file) {
g_return_val_if_fail(zathura, false);
g_return_val_if_fail(file, false);
if (zathura->database == NULL) {
return false;
}
girara_list_t* bookmarks = zathura_db_load_bookmarks(zathura->database, file);
if (!bookmarks) {
if (bookmarks == NULL) {
return false;
}
girara_list_free(zathura->bookmarks.bookmarks);
zathura->bookmarks.bookmarks = bookmarks;
return true;
}
......@@ -106,9 +110,11 @@ zathura_bookmarks_compare(zathura_bookmark_t* lhs, zathura_bookmark_t* rhs)
if (lhs == NULL && rhs == NULL) {
return 0;
}
if (lhs == NULL) {
return -1;
}
if (rhs == NULL) {
return 1;
}
......
......@@ -97,18 +97,25 @@ cb_view_vadjustment_value_changed(GtkAdjustment* GIRARA_UNUSED(adjustment), gpoi
}
void
cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* data)
cb_pages_per_row_value_changed(girara_session_t* session, const char* UNUSED(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;
int pages_per_row = *(int*) value;
zathura_t* zathura = data;
if (pages_per_row < 1) {
pages_per_row = 1;
}
page_widget_set_mode(zathura, pages_per_row);
if (zathura->document != NULL) {
unsigned int current_page = zathura->document->current_page_number;
page_set_delayed(zathura, current_page);
}
}
void
......@@ -214,11 +221,16 @@ cb_file_monitor(GFileMonitor* monitor, GFile* file, GFile* UNUSED(other_file), G
g_return_if_fail(file != NULL);
g_return_if_fail(session != NULL);
if (event != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) {
return;
switch (event) {
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
case G_FILE_MONITOR_EVENT_CREATED:
gdk_threads_enter();
sc_reload(session, NULL, NULL, 0);
gdk_threads_leave();
break;
default:
return;
}
sc_reload(session, NULL, NULL, 0);
}
static gboolean
......@@ -256,13 +268,13 @@ cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog)
g_free(input);
}
g_idle_add(password_dialog, dialog);
gdk_threads_add_idle(password_dialog, dialog);
return false;
}
/* try to open document again */
if (document_open(dialog->zathura, dialog->path, input) == false) {
g_idle_add(password_dialog, dialog);
gdk_threads_add_idle(password_dialog, dialog);
} else {
g_free(dialog->path);
free(dialog);
......@@ -283,14 +295,22 @@ error_ret:
}
bool
cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* UNUSED(allocation), zathura_t* zathura)
cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* allocation, zathura_t* zathura)
{
if (zathura == NULL || zathura->document == NULL) {
return false;
}
girara_argument_t argument = { zathura->document->adjust_mode, NULL };
sc_adjust_window(zathura->ui.session, &argument, NULL, 0);
static int height = -1;
static int width = -1;
return true;
/* adjust only if the allocation changed */
if (width != allocation->width || height != allocation->height) {
girara_argument_t argument = { zathura->document->adjust_mode, NULL };
sc_adjust_window(zathura->ui.session, &argument, NULL, 0);
width = allocation->width;
height = allocation->height;
}
return false;
}
......@@ -116,7 +116,7 @@ cmd_close(girara_session_t* session, girara_list_t* UNUSED(argument_list))
return true;
}
document_close(zathura);
document_close(zathura, false);
return true;
}
......@@ -157,11 +157,6 @@ cmd_info(girara_session_t* session, girara_list_t* UNUSED(argument_list))
char* tmp = zathura_document_meta_get(zathura->document, meta_fields[i].field, NULL);
if (tmp != NULL) {
char* text = g_strdup_printf("<b>%s:</b> %s\n", meta_fields[i].name, tmp);
if (text == NULL) {
g_free(tmp);
return true;
}
g_string_append(string, text);
g_free(text);
......@@ -198,8 +193,8 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list)
girara_notify(session, GIRARA_ERROR, "Too many arguments.");
return false;
} else if (argc >= 1) {
if (zathura->document) {
document_close(zathura);
if (zathura->document != NULL) {
document_close(zathura, false);
}
document_open(zathura, girara_list_nth(argument_list, 0), (argc == 2) ? girara_list_nth(argument_list, 1) : NULL);
......@@ -286,6 +281,8 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
}
bool firsthit = true;
zathura_plugin_error_t error = ZATHURA_PLUGIN_ERROR_OK;
for (unsigned int page_id = 0; page_id < zathura->document->number_of_pages; ++page_id) {
zathura_page_t* page = zathura->document->pages[(page_id + zathura->document->current_page_number) % zathura->document->number_of_pages];
if (page == NULL) {
......@@ -294,11 +291,16 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
g_object_set(page->drawing_area, "draw-links", FALSE, NULL);
girara_list_t* result = zathura_page_search_text(page, input, NULL);
girara_list_t* result = zathura_page_search_text(page, input, &error);
if (result == NULL || girara_list_size(result) == 0) {
girara_list_free(result);
g_object_set(page->drawing_area, "search-results", NULL, NULL);
continue;
if (error == ZATHURA_PLUGIN_ERROR_NOT_IMPLEMENTED) {
break;
} else {
continue;
}
}
g_object_set(page->drawing_area, "search-results", result, NULL);
......@@ -332,14 +334,20 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list)
}
const char* attachment_name = girara_list_nth(argument_list, 0);
const char* file_name = girara_list_nth(argument_list, 1);
const char* file_name = girara_list_nth(argument_list, 1);
if (file_name == NULL || attachment_name == NULL) {
return false;
}
char* file_name2 = girara_fix_path(file_name);
if (!zathura_document_attachment_save(zathura->document, attachment_name, file_name)) {
if (zathura_document_attachment_save(zathura->document, attachment_name, file_name) == false) {
girara_notify(session, GIRARA_ERROR, "Couldn't write attachment '%s' to '%s'.", attachment_name, file_name);
} else {
girara_notify(session, GIRARA_INFO, "Wrote attachment '%s' to '%s'.", attachment_name, file_name2);
}
g_free(file_name2);
return true;
}
......@@ -11,6 +11,7 @@
#include "utils.h"
#include <girara/session.h>
#include <girara/settings.h>
#include <girara/completion.h>
#include <girara/utils.h>
#include <girara/datastructures.h>
......@@ -29,6 +30,10 @@ compare_case_insensitive(const char* str1, const char* str2)
static girara_list_t*
list_files(zathura_t* zathura, const char* current_path, const char* current_file, int current_file_length, bool is_dir)
{
if (zathura == NULL || zathura->ui.session == NULL || current_path == NULL) {
return NULL;
}
/* read directory */
GDir* dir = g_dir_open(current_path, 0, NULL);
if (dir == NULL) {
......@@ -38,6 +43,9 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
girara_list_t* res = girara_sorted_list_new2((girara_compare_function_t)compare_case_insensitive,
(girara_free_function_t)g_free);
bool show_hidden = false;
girara_setting_get(zathura->ui.session, "show-hidden", &show_hidden);
/* read files */
char* name = NULL;
while ((name = (char*) g_dir_read_name(dir)) != NULL) {
......@@ -45,20 +53,26 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
if (e_name == NULL) {
goto error_free;
}
int e_length = strlen(e_name);
if ((current_file_length > e_length) || strncmp(current_file, e_name,
current_file_length)) {
int e_length = strlen(e_name);
if (show_hidden == false && e_name[0] == '.') {
g_free(e_name);
continue;
}
char* full_path = g_strdup_printf("%s%s%s", current_path, is_dir ? "" : "/", e_name);
if (full_path == NULL) {
if ((current_file_length > e_length) || strncmp(current_file, e_name, current_file_length)) {
g_free(e_name);
goto error_free;
continue;
}
char* tmp = "/";
if (is_dir == true || g_strcmp0(current_path, "/") == 0) {
tmp = "";
};
char* full_path = g_strdup_printf("%s%s%s", current_path, tmp, e_name);
if (g_file_test(full_path, G_FILE_TEST_IS_DIR) == true) {
char* tmp_path = full_path;
full_path = g_strdup_printf("%s/", full_path);
......@@ -120,9 +134,6 @@ cc_open(girara_session_t* session, const char* input)
}
char* tmp_path = g_strdup_printf("%s/%s", cwd, path);
if (tmp_path == NULL) {
goto error_free;
}
g_free(path);
path = tmp_path;
......@@ -132,10 +143,6 @@ cc_open(girara_session_t* session, const char* input)
bool is_dir = (path[strlen(path) - 1] == '/') ? true : false;
if ((g_file_test(path, G_FILE_TEST_IS_DIR) == TRUE) && !is_dir) {
char* tmp_path = g_strdup_printf("%s/", path);
if (tmp_path == NULL) {
goto error_free;
}
g_free(path);
path = tmp_path;
is_dir = true;
......
This diff is collapsed.
......@@ -3,6 +3,9 @@
VERSION = 0.0.8.1
# the GTK version to use
ZATHURA_GTK_VERSION ?= 2
# paths
PREFIX ?= /usr
MANPREFIX ?= ${PREFIX}/share/man
......@@ -13,11 +16,11 @@ PLUGINDIR ?= ${PREFIX}/lib/zathura
# libs
# set this to 0 if you don't need to link against dl
GTK_INC ?= $(shell pkg-config --cflags gtk+-2.0)
GTK_LIB ?= $(shell pkg-config --libs gtk+-2.0 gthread-2.0)
GTK_INC ?= $(shell pkg-config --cflags gtk+-${ZATHURA_GTK_VERSION}.0)
GTK_LIB ?= $(shell pkg-config --libs gtk+-${ZATHURA_GTK_VERSION}.0 gthread-2.0)
GIRARA_INC ?= $(shell pkg-config --cflags girara-gtk2)
GIRARA_LIB ?= $(shell pkg-config --libs girara-gtk2)
GIRARA_INC ?= $(shell pkg-config --cflags girara-gtk${ZATHURA_GTK_VERSION})
GIRARA_LIB ?= $(shell pkg-config --libs girara-gtk${ZATHURA_GTK_VERSION})
SQLITE_INC ?= $(shell pkg-config --cflags sqlite3)
SQLITE_LIB ?= $(shell pkg-config --libs sqlite3)
......
......@@ -234,9 +234,6 @@ zathura_db_set_fileinfo(zathura_database_t* db, const char* file, unsigned int
}
char* tmp = g_strdup_printf("%f", scale);
if (tmp == NULL) {
return false;
}
g_key_file_set_integer(db->history, file, KEY_PAGE, page);
g_key_file_set_integer(db->history, file, KEY_OFFSET, offset);
......
This diff is collapsed.
......@@ -271,9 +271,9 @@ struct zathura_document_s
girara_list_t* (*page_images_get)(zathura_page_t* page, zathura_plugin_error_t* error);
/**
* Save image to a file
* Get the image
*/
zathura_plugin_error_t (*page_image_save)(zathura_page_t* page, zathura_image_t* image, const char* file);
cairo_surface_t* (*page_image_get_cairo)(zathura_page_t* page, zathura_image_t* image, zathura_plugin_error_t* error);
/**
* Get text for selection
......@@ -300,14 +300,6 @@ struct zathura_document_s
* Document pages
*/
zathura_page_t** pages;
/**
* File monitor
*/
struct {
GFileMonitor* monitor; /**< File monitor */
GFile* file; /**< File for file monitor */
} file_monitor;
};
/**
......@@ -477,21 +469,21 @@ zathura_plugin_error_t zathura_page_form_fields_free(girara_list_t* list);
girara_list_t* zathura_page_images_get(zathura_page_t* page, zathura_plugin_error_t* error);
/**
* Save image
* Get image
*
* @param page Page
* @param image The image
* @param file Path to the file
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
* zathura_plugin_error_t
* @param image Image identifier
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
* error occured
* @return The cairo image surface or NULL if an error occured
*/
zathura_plugin_error_t zathura_page_image_save(zathura_page_t* page, zathura_image_t* image, const char* file);
cairo_surface_t* zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathura_plugin_error_t* error);
/**
* Get text for selection
* @param page Page
* @param rectangle Selection
* @error Set to an error value (see \ref zathura_plugin_error_t) if an error
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an error
* occured
* @return The selected text (needs to be deallocated with g_free)
*/
......
......@@ -29,7 +29,10 @@ typedef struct zathura_page_widget_private_s {
#define ZATHURA_PAGE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PAGE, zathura_page_widget_private_t))
static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo);
#if GTK_MAJOR_VERSION == 2
static gboolean zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event);
#endif
static void zathura_page_widget_finalize(GObject* object);
static void zathura_page_widget_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);
static void zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec);
......@@ -61,7 +64,11 @@ zathura_page_widget_class_init(ZathuraPageClass* class)
/* overwrite methods */
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(class);
#if GTK_MAJOR_VERSION == 3
widget_class->draw = zathura_page_widget_draw;
#else
widget_class->expose_event = zathura_page_widget_expose;
#endif
widget_class->size_allocate = zathura_page_widget_size_allocate;
widget_class->button_press_event = cb_zathura_page_widget_button_press_event;
widget_class->button_release_event = cb_zathura_page_widget_button_release_event;
......@@ -219,6 +226,7 @@ zathura_page_widget_get_property(GObject* object, guint prop_id, GValue* value,
}
}
#if GTK_MAJOR_VERSION == 2
static gboolean
zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event)
{
......@@ -232,14 +240,29 @@ zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event)
cairo_rectangle(cairo, event->area.x, event->area.y, event->area.width, event->area.height);
cairo_clip(cairo);
const gboolean ret = zathura_page_widget_draw(widget, cairo);
cairo_destroy(cairo);
return ret;
}
#endif
static gboolean
zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
{
zathura_page_widget_private_t* priv = ZATHURA_PAGE_GET_PRIVATE(widget);
g_static_mutex_lock(&(priv->lock));
#if GTK_MAJOR_VERSION == 2
const unsigned int page_height = widget->allocation.height;
const unsigned int page_width = widget->allocation.width;
#else
const unsigned int page_height = gtk_widget_get_allocated_height(widget);
const unsigned int page_width = gtk_widget_get_allocated_width(widget);
#endif
if (priv->surface != NULL) {
cairo_save(cairo);
unsigned int page_height = widget->allocation.height;
unsigned int page_width = widget->allocation.width;
switch (priv->page->document->rotate) {
case 90:
cairo_translate(cairo, page_width, 0);
......@@ -302,10 +325,11 @@ zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event)
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, *rect);
/* draw position */
GdkColor color = priv->zathura->ui.colors.highlight_color;
if (idx == priv->search_current) {
cairo_set_source_rgba(cairo, 0, color.green, color.blue, transparency);
GdkColor color = priv->zathura->ui.colors.highlight_color_active;
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
} else {
GdkColor color = priv->zathura->ui.colors.highlight_color;
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
}
cairo_rectangle(cairo, rectangle.x1, rectangle.y1,
......@@ -325,7 +349,7 @@ zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event)
} else {
/* set background color */
cairo_set_source_rgb(cairo, 255, 255, 255);
cairo_rectangle(cairo, 0, 0, widget->allocation.width, widget->allocation.height);
cairo_rectangle(cairo, 0, 0, page_width, page_height);
cairo_fill(cairo);
bool render_loading = true;
......@@ -339,8 +363,8 @@ zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event)
cairo_set_font_size(cairo, 16.0);
cairo_text_extents_t extents;
cairo_text_extents(cairo, text, &extents);
double x = widget->allocation.width * 0.5 - (extents.width * 0.5 + extents.x_bearing);
double y = widget->allocation.height * 0.5 - (extents.height * 0.5 + extents.y_bearing);
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);
}
......@@ -348,8 +372,6 @@ zathura_page_widget_expose(GtkWidget* widget, GdkEventExpose* event)
/* render real page */
render_page(priv->zathura->sync.render_thread, priv->page);
}
cairo_destroy(cairo);
g_static_mutex_unlock(&(priv->lock));
return FALSE;
}
......@@ -391,7 +413,11 @@ redraw_rect(ZathuraPage* widget, zathura_rectangle_t* rectangle)
grect.y = rectangle->y1;
grect.width = rectangle->x2 - rectangle->x1;
grect.height = rectangle->y2 - rectangle->y1;
#if (GTK_MAJOR_VERSION == 3)
gtk_widget_queue_draw_area(GTK_WIDGET(widget), grect.x, grect.y, grect.width, grect.height);
#else
gdk_window_invalidate_rect(GTK_WIDGET(widget)->window, &grect, TRUE);
#endif
}
static void
......
......@@ -112,7 +112,7 @@ render_free(render_thread_t* render_thread)
}
if (render_thread->list) {
girara_list_free(render_thread->list);
girara_list_clear(render_thread->list);
}
if (render_thread->cond) {
......@@ -121,6 +121,10 @@ render_free(render_thread_t* render_thread)
g_cond_free(render_thread->cond);
}
if (render_thread->list) {
girara_list_free(render_thread->list);
}
if (render_thread->lock) {
g_mutex_free(render_thread->lock);
}
......
This diff is collapsed.
......@@ -38,6 +38,18 @@ bool sc_adjust_window(girara_session_t* session, girara_argument_t* argument, gi
*/
bool sc_change_mode(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
/**
* Shortcut function to focus the inputbar
*
* @param session The used girara session
* @param argument The argument
* @param event Girara event
* @param t Number of executions
* @return true No error occured
* @return false An error occured (abort execution)
*/
bool sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
/**
* Follow a link
*
......
......@@ -21,7 +21,7 @@ ZSOURCE += ../database-plain.c
endif
endif
all: ${PROJECT} run
all: ${PROJECT}
run: ${PROJECT}
$(QUIET)./${PROJECT}
......@@ -46,8 +46,8 @@ ${PROJECT}: options ${OBJECTS}
${OBJECTS}: ../config.mk
clean:
$(QUIET)rm -rf ${OBJECTS} ${PROJECT}
$(QUIET)rm -rf ${OBJECTS} ${PROJECT} *.gcno *.gcda
.PHONY: all options clean debug
.PHONY: all options clean debug run
-include $(wildcard .depend/*.dep)
......@@ -7,7 +7,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "math.h"
#include <math.h>
#include "utils.h"
#include "zathura.h"
......@@ -263,7 +263,8 @@ recalc_rectangle(zathura_page_t* page, zathura_rectangle_t rectangle)
void
set_adjustment(GtkAdjustment* adjustment, gdouble value)
{
gtk_adjustment_set_value(adjustment, MAX(adjustment->lower, MIN(adjustment->upper - adjustment->page_size, value)));
gtk_adjustment_set_value(adjustment, MAX(gtk_adjustment_get_lower(adjustment),
MIN(gtk_adjustment_get_upper(adjustment) - gtk_adjustment_get_page_size(adjustment), value)));
}
void
......
......@@ -74,7 +74,8 @@ void page_calculate_offset(zathura_page_t* page, page_offset_t* offset);
/**
* Rotate a rectangle by 0, 90, 180 or 270 degree
* @param rect the rectangle to rotate
*
* @param rectangle the rectangle to rotate
* @param degree rotation degree
* @param height the height of the enclosing rectangle
* @param width the width of the enclosing rectangle
......
.TH ZATHURA 1 zathura\-VERSION
.SH NAME
zathura \- a document viewer
.SH SYNOPSIS
.B zathura
.RB [options]
.RB [file]
.RB [password]
.SH DESCRIPTION
zathura is a highly customizable and functional document viewer.
.SH OPTIONS
.TP
.B "-e xid"
Reparents to window specified by xid.
.TP
.B "-c path"
Path to the config directory.
.TP
.B "-d path"
Path to the data directory.
.TP
.B "-p path"
Path to the plugin directory.
=======
zathura
=======