From abc1cd62774b1e9c5191cc1e532afb07f7638520 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sun, 25 Mar 2012 04:16:06 +0200 Subject: [PATCH 1/2] Update style. --- page-widget.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/page-widget.c b/page-widget.c index 32cc86d..4d7e776 100644 --- a/page-widget.c +++ b/page-widget.c @@ -372,11 +372,11 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) } /* draw selection */ if (priv->selection.y2 != -1 && priv->selection.x2 != -1) { - GdkColor color = priv->zathura->ui.colors.highlight_color; - cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency); - cairo_rectangle(cairo, priv->selection.x1, priv->selection.y1, - (priv->selection.x2 - priv->selection.x1), (priv->selection.y2 - priv->selection.y1)); - cairo_fill(cairo); + GdkColor color = priv->zathura->ui.colors.highlight_color; + cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency); + cairo_rectangle(cairo, priv->selection.x1, priv->selection.y1, + (priv->selection.x2 - priv->selection.x1), (priv->selection.y2 - priv->selection.y1)); + cairo_fill(cairo); } } else { /* set background color */ @@ -641,9 +641,9 @@ zathura_page_widget_popup_menu(GtkWidget* widget, GdkEventButton* event) zathura_image_t* image = NULL; GIRARA_LIST_FOREACH(priv->images, zathura_image_t*, iter, image_it) zathura_rectangle_t rect = recalc_rectangle(priv->page, image_it->position); - if (rect.x1 <= event->x && rect.x2 >= event->x && rect.y1 <= event->y && rect.y2 >= event->y) { - image = image_it; - } + if (rect.x1 <= event->x && rect.x2 >= event->x && rect.y1 <= event->y && rect.y2 >= event->y) { + image = image_it; + } GIRARA_LIST_FOREACH_END(priv->images, zathura_image_t*, iter, image_it); if (image == NULL) { From 87ef40e399bf478fa682841d6fb20bcbf968b801 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 27 Mar 2012 00:24:58 +0200 Subject: [PATCH 2/2] On GNU Hurd use flock instead of fcntl. Furthermore we need to open the file for writing if we want to lock it for writing. --- database-plain.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/database-plain.c b/database-plain.c index e10093f..3f30c14 100644 --- a/database-plain.c +++ b/database-plain.c @@ -21,11 +21,16 @@ #define KEY_SCALE "scale" #define KEY_ROTATE "rotate" +#ifdef __GNU__ +#include +#define file_lock_set(fd, cmd) flock(fd, cmd) +#else #define file_lock_set(fd, cmd) \ { \ struct flock lock = { .l_type = cmd, .l_start = 0, .l_whence = SEEK_SET, .l_len = 0}; \ - fcntl(fd, F_SETLK, lock); \ + fcntl(fd, F_SETLK, lock, NULL); \ } +#endif static void zathura_database_interface_init(ZathuraDatabaseInterface* iface); @@ -441,7 +446,7 @@ zathura_db_read_key_file_from_file(const char* path) } /* open file */ - FILE* file = fopen(path, "r"); + FILE* file = fopen(path, "rw"); if (file == NULL) { return NULL; }