public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Pacho Ramos (pacho)" <pacho@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in app-text/evince/files: evince-3.12.2-memory-leak.patch evince-3.12.2-scroll-search-2.patch evince-3.12.2-print-center.patch evince-3.12.2-scroll-search-1.patch
Date: Fri, 19 Dec 2014 14:42:20 +0000 (UTC)	[thread overview]
Message-ID: <20141219144220.2E7C7CD90@oystercatcher.gentoo.org> (raw)

pacho       14/12/19 14:42:20

  Added:                evince-3.12.2-memory-leak.patch
                        evince-3.12.2-scroll-search-2.patch
                        evince-3.12.2-print-center.patch
                        evince-3.12.2-scroll-search-1.patch
  Log:
  Fix scrolling when search is used (#532878 by Johan Hovold), apply some more fixes from 3.12 branch. Drop old.
  
  (Portage version: 2.2.15/cvs/Linux x86_64, signed Manifest commit with key A188FBD4)

Revision  Changes    Path
1.1                  app-text/evince/files/evince-3.12.2-memory-leak.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/evince/files/evince-3.12.2-memory-leak.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/evince/files/evince-3.12.2-memory-leak.patch?rev=1.1&content-type=text/plain

Index: evince-3.12.2-memory-leak.patch
===================================================================
From 86cfddae23cacfbb24469f1926cb965522bec6ca Mon Sep 17 00:00:00 2001
From: Giselle Reis <gisellemnr@src.gnome.org>
Date: Sat, 30 Aug 2014 00:23:04 +0200
Subject: libview: fixing memory leak

The memory leak was caused by a g_signal_connect
which was never disconnected. This patch makes
sure the signal is disconnected and the job is
cancelled before creating another rendering job.
It additionally introduces a helper function to
cleanly finalize the job.

diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c
index 897d3de..22170f9 100644
--- a/libview/ev-pixbuf-cache.c
+++ b/libview/ev-pixbuf-cache.c
@@ -161,20 +161,27 @@ ev_pixbuf_cache_finalize (GObject *object)
 }
 
 static void
+end_job (CacheJobInfo *job_info,
+	 gpointer      data)
+{
+	g_signal_handlers_disconnect_by_func (job_info->job,
+					      G_CALLBACK (job_finished_cb),
+					      data);
+	ev_job_cancel (job_info->job);
+	g_object_unref (job_info->job);
+	job_info->job = NULL;
+}
+
+static void
 dispose_cache_job_info (CacheJobInfo *job_info,
 			gpointer      data)
 {
 	if (job_info == NULL)
 		return;
 
-	if (job_info->job) {
-		g_signal_handlers_disconnect_by_func (job_info->job,
-						      G_CALLBACK (job_finished_cb),
-						      data);
-		ev_job_cancel (job_info->job);
-		g_object_unref (job_info->job);
-		job_info->job = NULL;
-	}
+	if (job_info->job)
+		end_job (job_info, data);
+
 	if (job_info->surface) {
 		cairo_surface_destroy (job_info->surface);
 		job_info->surface = NULL;
@@ -281,14 +288,8 @@ copy_job_to_job_info (EvJobRender   *job_render,
 		job_info->points_set = TRUE;
 	}
 
-	if (job_info->job) {
-		g_signal_handlers_disconnect_by_func (job_info->job,
-						      G_CALLBACK (job_finished_cb),
-						      pixbuf_cache);
-		ev_job_cancel (job_info->job);
-		g_object_unref (job_info->job);
-		job_info->job = NULL;
-	}
+	if (job_info->job)
+		end_job (job_info, pixbuf_cache);
 
 	job_info->page_ready = TRUE;
 }
@@ -337,12 +338,7 @@ check_job_size_and_unref (EvPixbufCache *pixbuf_cache,
 	    height == EV_JOB_RENDER (job_info->job)->target_height)
 		return;
 
-	g_signal_handlers_disconnect_by_func (job_info->job,
-					      G_CALLBACK (job_finished_cb),
-					      pixbuf_cache);
-	ev_job_cancel (job_info->job);
-	g_object_unref (job_info->job);
-	job_info->job = NULL;
+	end_job (job_info, pixbuf_cache);
 }
 
 /* Do all function that copies a job from an older cache to it's position in the
@@ -651,6 +647,9 @@ add_job (EvPixbufCache  *pixbuf_cache,
 		cairo_region_destroy (job_info->region);
 	job_info->region = region ? cairo_region_reference (region) : NULL;
 
+	if (job_info->job)
+		end_job (job_info, pixbuf_cache);
+
 	job_info->job = ev_job_render_new (pixbuf_cache->document,
 					   page, rotation, scale,
 					   width, height);
-- 
cgit v0.10.1




1.1                  app-text/evince/files/evince-3.12.2-scroll-search-2.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/evince/files/evince-3.12.2-scroll-search-2.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/evince/files/evince-3.12.2-scroll-search-2.patch?rev=1.1&content-type=text/plain

Index: evince-3.12.2-scroll-search-2.patch
===================================================================
From dd3df79ea999850c737b049081d81afa59af22d3 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Tue, 18 Nov 2014 12:53:40 +0100
Subject: [PATCH] [libview] Show correct page when next search result requested

If there are more than 1 results on a page then requesting
next search result from the same page will not return you
to the page with the search results if you moved from the
page in the meantime (when you are not in continuous mode).
This applies also to previous results.

https://bugzilla.gnome.org/show_bug.cgi?id=730252
---
 libview/ev-view.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libview/ev-view.c b/libview/ev-view.c
index f3aa033..a9159cd 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -8250,6 +8250,8 @@ ev_view_find_next (EvView *view)
 	if (view->find_result >= n_results) {
 		view->find_result = 0;
 		jump_to_find_page (view, EV_VIEW_FIND_NEXT, 1);
+	} else if (view->find_page != view->current_page) {
+		jump_to_find_page (view, EV_VIEW_FIND_NEXT, 0);
 	}
 
 	jump_to_find_result (view);
@@ -8264,6 +8266,8 @@ ev_view_find_previous (EvView *view)
 	if (view->find_result < 0) {
 		jump_to_find_page (view, EV_VIEW_FIND_PREV, -1);
 		view->find_result = MAX (0, ev_view_find_get_n_results (view, view->find_page) - 1);
+	} else if (view->find_page != view->current_page) {
+		jump_to_find_page (view, EV_VIEW_FIND_PREV, 0);
 	}
 
 	jump_to_find_result (view);
-- 
2.1.0




1.1                  app-text/evince/files/evince-3.12.2-print-center.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/evince/files/evince-3.12.2-print-center.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/evince/files/evince-3.12.2-print-center.patch?rev=1.1&content-type=text/plain

Index: evince-3.12.2-print-center.patch
===================================================================
From 1057dc0dd6dee5dc1992fc88b76e4c928d2ff0e7 Mon Sep 17 00:00:00 2001
From: Carlos Garcia Campos <cgarcia@igalia.com>
Date: Thu, 14 Aug 2014 14:07:05 +0200
Subject: print-operation: Fix centering of documents when printing with a
 manual scale

When a manual scale is used for printing, the document is not correctly
centered because the cairo context has a scale already applied. We need
to consider the current scale when centering the page and also convert
the coordinates before the cairo_translate().

https://bugzilla.gnome.org/show_bug.cgi?id=734788

diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c
index b348038..df41c60 100644
--- a/libview/ev-print-operation.c
+++ b/libview/ev-print-operation.c
@@ -1825,6 +1825,27 @@ _print_context_get_hard_margins (GtkPrintContext *context,
 }
 
 static void
+ev_print_operation_print_get_scaled_page_size (EvPrintOperationPrint *print,
+                                               gint                   page,
+                                               gdouble               *width,
+                                               gdouble               *height)
+{
+        GtkPrintSettings *settings;
+        gdouble           manual_scale;
+
+        ev_document_get_page_size (EV_PRINT_OPERATION (print)->document,
+                                   page, width, height);
+
+        settings = gtk_print_operation_get_print_settings (print->op);
+        manual_scale = gtk_print_settings_get_scale (settings) / 100.0;
+        if (manual_scale == 1.0)
+                return;
+
+        *width *= manual_scale;
+        *height *= manual_scale;
+}
+
+static void
 ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
 				    GtkPrintContext       *context,
 				    gint                   page)
@@ -1834,6 +1855,7 @@ ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
 	gdouble           cr_width, cr_height;
 	gdouble           width, height, scale;
 	gdouble           x_scale, y_scale;
+        gdouble           x_offset, y_offset;
 	gdouble           top, bottom, left, right;
 
 	gtk_print_operation_set_defer_drawing (print->op);
@@ -1857,12 +1879,16 @@ ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
 	cr = gtk_print_context_get_cairo_context (context);
 	cr_width = gtk_print_context_get_width (context);
 	cr_height = gtk_print_context_get_height (context);
-	ev_document_get_page_size (op->document, page, &width, &height);
+        ev_print_operation_print_get_scaled_page_size (print, page, &width, &height);
 
 	if (print->page_scale == EV_SCALE_NONE) {
 		/* Center document page on the printed page */
-		if (print->autorotate)
-			cairo_translate (cr, (cr_width - width) / 2, (cr_height - height) / 2);
+		if (print->autorotate) {
+                        x_offset = (cr_width - width) / 2;
+                        y_offset = (cr_height - height) / 2;
+                        cairo_device_to_user (cr, &x_offset, &y_offset);
+                        cairo_translate (cr, x_offset, y_offset);
+                }
 	} else {
 		_print_context_get_hard_margins (context, &top, &bottom, &left, &right);
 
@@ -1875,29 +1901,27 @@ ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
                         scale = 1.0;
 
 		if (print->autorotate) {
-			double left_right_sides, top_bottom_sides;
-
-			cairo_translate (cr, (cr_width - scale * width) / 2,
-					 (cr_height - scale * height) / 2);
+                        x_offset = (cr_width - scale * width) / 2;
+                        y_offset = (cr_height - scale * height) / 2;
+                        cairo_device_to_user (cr, &x_offset, &y_offset);
+                        cairo_translate (cr, x_offset, y_offset);
 
 			/* Ensure document page is within the margins. The
 			 * scale guarantees the document will fit in the
 			 * margins so we just need to check each side and
 			 * if it overhangs the margin, translate it to the
-			 * margin. */
-			left_right_sides = (cr_width - width*scale)/2;
-			top_bottom_sides = (cr_height - height*scale)/2;
-			if (left_right_sides < left)
-				cairo_translate (cr, left - left_right_sides, 0);
+                         * margin. */
+			if (x_offset < left)
+				cairo_translate (cr, left - x_offset, 0);
 
-			if (left_right_sides < right)
-				cairo_translate (cr, -(right - left_right_sides), 0);
+			if (x_offset < right)
+				cairo_translate (cr, -(right - x_offset), 0);
 
-			if (top_bottom_sides < top)
-				cairo_translate (cr, 0, top - top_bottom_sides);
+			if (y_offset < top)
+				cairo_translate (cr, 0, top - y_offset);
 
-			if (top_bottom_sides < bottom)
-				cairo_translate (cr, 0, -(bottom - top_bottom_sides));
+			if (y_offset < bottom)
+				cairo_translate (cr, 0, -(bottom - y_offset));
 		} else {
 			cairo_translate (cr, left, top);
 		}
-- 
cgit v0.10.1




1.1                  app-text/evince/files/evince-3.12.2-scroll-search-1.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/evince/files/evince-3.12.2-scroll-search-1.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-text/evince/files/evince-3.12.2-scroll-search-1.patch?rev=1.1&content-type=text/plain

Index: evince-3.12.2-scroll-search-1.patch
===================================================================
From 2cb9d88d7b396b6ac4bb01c035a40b48da419b65 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Mon, 19 May 2014 14:32:19 +0200
Subject: [PATCH 1/2] [libview] Scroll to the search result selected by user

Scroll to page on which is the search result selected by user
when not in continuous mode.

https://bugzilla.gnome.org/show_bug.cgi?id=730252
---
 libview/ev-view.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libview/ev-view.c b/libview/ev-view.c
index 7618bbd..393bf77 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -7684,6 +7684,9 @@ jump_to_find_page (EvView *view, EvViewFindDirection direction, gint shift)
 			break;
 		}
 	}
+
+	if (!view->continuous)
+		ev_document_model_set_page (view->model, view->find_page);
 }
 
 static void
@@ -7808,6 +7811,7 @@ ev_view_find_set_result (EvView *view, gint page, gint result)
 {
 	view->find_page = page;
 	view->find_result = result;
+	jump_to_find_page (view, EV_VIEW_FIND_NEXT, 0);
 	jump_to_find_result (view);
 	gtk_widget_queue_draw (GTK_WIDGET (view));
 }
-- 
1.9.0






                 reply	other threads:[~2014-12-19 14:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141219144220.2E7C7CD90@oystercatcher.gentoo.org \
    --to=pacho@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox