Merge branch 'develop' of pwmt.org:zathura into develop

This commit is contained in:
Sebastian Ramacher 2012-03-01 13:58:54 +01:00
commit d85d6a1996
2 changed files with 17 additions and 12 deletions

View file

@ -100,14 +100,14 @@ static void
zathura_page_widget_init(ZathuraPage* widget) zathura_page_widget_init(ZathuraPage* widget)
{ {
zathura_page_widget_private_t* priv = ZATHURA_PAGE_GET_PRIVATE(widget); zathura_page_widget_private_t* priv = ZATHURA_PAGE_GET_PRIVATE(widget);
priv->page = NULL; priv->page = NULL;
priv->surface = NULL; priv->surface = NULL;
priv->links = NULL; priv->links = NULL;
priv->links_got = false; priv->links_got = false;
priv->link_offset = 0; priv->link_offset = 0;
priv->search_results = NULL; priv->search_results = NULL;
priv->search_current = INT_MAX; priv->search_current = INT_MAX;
priv->selection.x1 = -1; priv->selection.x1 = -1;
g_static_mutex_init(&(priv->lock)); g_static_mutex_init(&(priv->lock));
/* we want mouse events */ /* we want mouse events */
@ -145,15 +145,15 @@ zathura_page_widget_set_property(GObject* object, guint prop_id, const GValue* v
switch (prop_id) { switch (prop_id) {
case PROP_PAGE: case PROP_PAGE:
priv->page = g_value_get_pointer(value); priv->page = g_value_get_pointer(value);
priv->zathura = priv->page->document->zathura; priv->zathura = priv->page->document->zathura;
break; break;
case PROP_DRAW_LINKS: case PROP_DRAW_LINKS:
priv->draw_links = g_value_get_boolean(value); priv->draw_links = g_value_get_boolean(value);
/* get links */ /* get links */
if (priv->draw_links == true && priv->links_got == false) { if (priv->draw_links == true && priv->links_got == false) {
priv->links = zathura_page_links_get(priv->page, NULL); priv->links = zathura_page_links_get(priv->page, NULL);
priv->links_got = true; priv->links_got = true;
priv->number_of_links = (priv->links == NULL) ? 0 : girara_list_size(priv->links); priv->number_of_links = (priv->links == NULL) ? 0 : girara_list_size(priv->links);
} }
@ -254,7 +254,7 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
#if GTK_MAJOR_VERSION == 2 #if GTK_MAJOR_VERSION == 2
const unsigned int page_height = widget->allocation.height; const unsigned int page_height = widget->allocation.height;
const unsigned int page_width = widget->allocation.width; const unsigned int page_width = widget->allocation.width;
#else #else
const unsigned int page_height = gtk_widget_get_allocated_height(widget); const unsigned int page_height = gtk_widget_get_allocated_height(widget);
const unsigned int page_width = gtk_widget_get_allocated_width(widget); const unsigned int page_width = gtk_widget_get_allocated_width(widget);
@ -411,7 +411,7 @@ redraw_rect(ZathuraPage* widget, zathura_rectangle_t* rectangle)
GdkRectangle grect; GdkRectangle grect;
grect.x = rectangle->x1; grect.x = rectangle->x1;
grect.y = rectangle->y1; grect.y = rectangle->y1;
grect.width = rectangle->x2 - rectangle->x1; grect.width = rectangle->x2 - rectangle->x1;
grect.height = rectangle->y2 - rectangle->y1; grect.height = rectangle->y2 - rectangle->y1;
#if (GTK_MAJOR_VERSION == 3) #if (GTK_MAJOR_VERSION == 3)
gtk_widget_queue_draw_area(GTK_WIDGET(widget), grect.x, grect.y, grect.width, grect.height); gtk_widget_queue_draw_area(GTK_WIDGET(widget), grect.x, grect.y, grect.width, grect.height);
@ -512,6 +512,7 @@ cb_zathura_page_widget_button_release_event(GtkWidget* widget, GdkEventButton* b
} else { } else {
redraw_rect(ZATHURA_PAGE(widget), &priv->selection); redraw_rect(ZATHURA_PAGE(widget), &priv->selection);
zathura_rectangle_t tmp = priv->selection; zathura_rectangle_t tmp = priv->selection;
tmp.x1 /= priv->page->document->scale; tmp.x1 /= priv->page->document->scale;
tmp.x2 /= priv->page->document->scale; tmp.x2 /= priv->page->document->scale;
tmp.y1 /= priv->page->document->scale; tmp.y1 /= priv->page->document->scale;
@ -523,6 +524,7 @@ cb_zathura_page_widget_button_release_event(GtkWidget* widget, GdkEventButton* b
g_free(text); g_free(text);
} }
} }
priv->selection.x1 = -1; priv->selection.x1 = -1;
priv->selection.y1 = -1; priv->selection.y1 = -1;
priv->selection.x2 = -1; priv->selection.x2 = -1;

View file

@ -150,7 +150,8 @@ zathura_init(int argc, char* argv[])
config_load_default(zathura); config_load_default(zathura);
/* load global configuration files */ /* load global configuration files */
girara_list_t* config_dirs = girara_split_path_array(girara_get_xdg_path(XDG_CONFIG_DIRS)); char* config_path = girara_get_xdg_path(XDG_CONFIG_DIRS);
girara_list_t* config_dirs = girara_split_path_array(config_path);
ssize_t size = girara_list_size(config_dirs) - 1; ssize_t size = girara_list_size(config_dirs) - 1;
for (; size >= 0; --size) { for (; size >= 0; --size) {
const char* dir = girara_list_nth(config_dirs, size); const char* dir = girara_list_nth(config_dirs, size);
@ -159,6 +160,7 @@ zathura_init(int argc, char* argv[])
g_free(file); g_free(file);
} }
girara_list_free(config_dirs); girara_list_free(config_dirs);
g_free(config_path);
config_load_file(zathura, GLOBAL_RC); config_load_file(zathura, GLOBAL_RC);
@ -302,6 +304,7 @@ zathura_free(zathura_t* zathura)
} }
/* free registered plugins */ /* free registered plugins */
girara_list_free(zathura->plugins.type_plugin_mapping);
girara_list_free(zathura->plugins.plugins); girara_list_free(zathura->plugins.plugins);
girara_list_free(zathura->plugins.path); girara_list_free(zathura->plugins.path);