debdiff *.dsc | filterdiff -p1 -x'help/*/*.po' -x'po/*.po' -x'debian/patches/*.patch'

diff -Nru evince-48.0/data/org.gnome.Evince.metainfo.xml.in evince-48.1/data/org.gnome.Evince.metainfo.xml.in
--- evince-48.0/data/org.gnome.Evince.metainfo.xml.in	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/data/org.gnome.Evince.metainfo.xml.in	2025-06-29 19:43:42.000000000 +0100
@@ -46,8 +46,6 @@
   <url type="donation">https://www.gnome.org/donate/</url>
   <url type="vcs-browser">https://gitlab.gnome.org/GNOME/evince/</url>
   <project_group>GNOME</project_group>
-  <!-- developer_name tag deprecated with Appstream 1.0 -->
-  <developer_name>The GNOME Project</developer_name>
   <developer id="org.gnome">
     <name>The GNOME Project</name>
   </developer>
@@ -60,6 +58,17 @@
   <translation type="gettext">evince</translation>
   <content_rating type="oars-1.1" />
   <releases>
+    <release version="48.1" type="stable" date="2025-06-16">
+      <description>
+        <p>Bug fixes and improvements.</p>
+      </description>
+      <issues>
+        <issue url="https://gitlab.gnome.org/GNOME/evince/issues/1399">#1399</issue>
+        <issue url="https://gitlab.gnome.org/GNOME/evince/issues/1600">#1600</issue>
+        <issue url="https://gitlab.gnome.org/GNOME/evince/issues/2093">#2093</issue>
+        <issue url="https://gitlab.gnome.org/GNOME/evince/issues/2094">#2094</issue>
+      </issues>
+    </release>
     <release version="48.0" type="stable" date="2025-03-15">
       <description>
         <p>Improves support for Adobe PDF open parameters, and fixes the modification time when saving a document.</p>
diff -Nru evince-48.0/debian/changelog evince-48.1/debian/changelog
--- evince-48.0/debian/changelog	2025-03-17 12:45:49.000000000 +0000
+++ evince-48.1/debian/changelog	2025-07-17 15:20:39.000000000 +0100
@@ -1,3 +1,56 @@
+evince (48.1-2) unstable; urgency=medium
+
+  * Team upload
+  * Mention #1109382 in previous changelog entry
+  * d/p/EvWindow-fix-launching-fullscreen-actions-from-popover.patch:
+    Add proposed patch from upstream MR evince!728 to fix entry to
+    fullscreen or presentation mode via the menu.
+    This fixes an intermittent but frequent bug seen when testing
+    presentation mode, where the popover menu remains visible (but
+    unresponsive) after presentation mode is entered. (Closes: #1109381)
+
+ -- Simon McVittie <smcv@debian.org>  Thu, 17 Jul 2025 15:20:39 +0100
+
+evince (48.1-1) unstable; urgency=medium
+
+  * Team upload
+  * New upstream bugfix release
+    - Stop working around a GTK scaling bug when using a sufficiently recent
+      GTK where the bug is fixed, to avoid double-scaling causing
+      presentation mode to display the PDF too small
+      (evince#1600 upstream, Closes: #1093497)
+    - Ensure that the application ID matches the .desktop filename, so that
+      Wayland compositors can always match the window to its icon; previously
+      this was correct for the main app but not for the previewer
+      (evince!725 upstream, Closes: #1023928)
+    - Make sure the caret colour is visible against the document background
+      colour, even if viewing a light-background document under a
+      dark system theme
+      (evince#2093 upstream)
+    - Always make annotation popup windows opaque, even if the annotation
+      highlight colour is semi-transparent
+      (evince#1399 upstream)
+    - Guard against integer overflow when allocating memory on a per-page
+      basis
+      (evince#2094 upstream; probably redundant because GLib already has a
+      similar check, but harmless)
+    - Avoid deprecated syntax in Appstream metadata
+    - Translation updates
+  * d/patches: Update to upstream git commit 48.1-4-g440ab79d8 from
+    gnome-48 branch
+    - Fix a crash in accessibility code by guarding against
+      ev_page_cache_get_text() returning NULL
+      (evince!681 upstream)
+    - Avoid an XML metacharacter in the Hindi translation causing the
+      Appstream metadata to become corrupted with recent gettext
+      (Infrastructure/damned-lies#655 upstream, Closes: #1109382)
+    - Translation updates
+  * d/control: Remove Suggests: unrar.
+    evince has used libarchive instead since Debian 10 or earlier.
+    Thanks to Adrian Bunk (Closes: #1065399)
+
+ -- Simon McVittie <smcv@debian.org>  Mon, 14 Jul 2025 10:30:38 +0100
+
 evince (48.0-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru evince-48.0/debian/control evince-48.1/debian/control
--- evince-48.0/debian/control	2025-03-17 12:45:49.000000000 +0000
+++ evince-48.1/debian/control	2025-07-17 15:20:39.000000000 +0100
@@ -64,7 +64,6 @@
 Suggests: gvfs,
           nautilus-sendto,
           poppler-data,
-          unrar
 Breaks: libevdocument3-4t64 (<< 3.29.91-2~)
 Replaces: libevdocument3-4t64 (<< 3.29.91-2~)
 Enhances: nautilus
diff -Nru evince-48.0/debian/patches/series evince-48.1/debian/patches/series
--- evince-48.0/debian/patches/series	2025-03-17 12:45:49.000000000 +0000
+++ evince-48.1/debian/patches/series	2025-07-17 15:20:39.000000000 +0100
@@ -0,0 +1,5 @@
+Update-Czech-translation.patch
+Update-Czech-translation-1.patch
+po-Fix-xml-element-in-Hindi-translation.patch
+libview-Fix-crash-in-the-accessible-code-when-page-cache-.patch
+EvWindow-fix-launching-fullscreen-actions-from-popover.patch
diff -Nru evince-48.0/libdocument/ev-document.c evince-48.1/libdocument/ev-document.c
--- evince-48.0/libdocument/ev-document.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/libdocument/ev-document.c	2025-06-29 19:43:42.000000000 +0100
@@ -299,6 +299,10 @@
                         /* It's a different page size.  Backfill the array. */
                         int j;
 
+                        /* Check for potential integer overflow in allocation - Issue #2094 */
+                        if ((gsize)priv->n_pages > G_MAXSIZE / sizeof(EvPageSize))
+                                g_error ("Exiting program due to abnormal page count detected: %d", priv->n_pages);
+
                         priv->page_sizes = g_new0 (EvPageSize, priv->n_pages);
 
                         for (j = 0; j < i; j++) {
diff -Nru evince-48.0/libview/ev-annotation-window.c evince-48.1/libview/ev-annotation-window.c
--- evince-48.0/libview/ev-annotation-window.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/libview/ev-annotation-window.c	2025-06-29 19:43:42.000000000 +0100
@@ -445,7 +445,6 @@
 	GdkRGBA             color;
 	EvRectangle        *rect;
 	gdouble             scale;
-	gdouble             opacity;
 
 	object = G_OBJECT_CLASS (ev_annotation_window_parent_class)->constructor (type,
 										  n_construct_properties,
@@ -472,8 +471,8 @@
 	ev_annotation_get_rgba (annot, &color);
 	ev_annotation_window_set_color (window, &color);
 
-	opacity = ev_annotation_markup_get_opacity (markup);
-	ev_annotation_window_set_opacity (window, opacity);
+	/* The popup window should always be opaque - Issue #1399 */
+	ev_annotation_window_set_opacity (window, 1.);
 
 	gtk_widget_set_name (GTK_WIDGET (window), ev_annotation_get_name (annot));
 	gtk_window_set_title (GTK_WINDOW (window), label);
diff -Nru evince-48.0/libview/ev-page-accessible.c evince-48.1/libview/ev-page-accessible.c
--- evince-48.0/libview/ev-page-accessible.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/libview/ev-page-accessible.c	2025-07-17 15:45:21.000000000 +0100
@@ -486,6 +486,9 @@
 		return NULL;
 
 	page_text = ev_page_cache_get_text (view->page_cache, self->priv->page);
+	if (!page_text)
+		return NULL;
+
 	if (end_offset < 0 || end_offset > g_utf8_strlen (page_text, -1))
 		end_offset = strlen (page_text);
 	start_offset = CLAMP (start_offset, 0, end_offset);
@@ -633,11 +636,13 @@
 {
 	EvPageAccessible *self = EV_PAGE_ACCESSIBLE (text);
 	EvView *view = ev_page_accessible_get_view (self);
-	gint retval;
+	const gchar *page_text;
 
-	retval = g_utf8_strlen (ev_page_cache_get_text (view->page_cache, self->priv->page), -1);
+	page_text = ev_page_cache_get_text (view->page_cache, self->priv->page);
+	if (!page_text)
+		return 0;
 
-	return retval;
+	return g_utf8_strlen (page_text, -1);
 }
 
 static gboolean
diff -Nru evince-48.0/libview/ev-view-accessible.c evince-48.1/libview/ev-view-accessible.c
--- evince-48.0/libview/ev-view-accessible.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/libview/ev-view-accessible.c	2025-06-29 19:43:42.000000000 +0100
@@ -392,6 +392,10 @@
 	ev_document = ev_document_model_get_document (self->priv->model);
 	n_pages = ev_document_get_n_pages (ev_document);
 
+	/* Check for potential integer overflow in allocation - Issue #2094 */
+	if ((gsize)n_pages > G_MAXSIZE / sizeof(EvPageAccessible))
+		g_error ("Exiting program due to abnormal page count detected: %d", n_pages);
+
 	self->priv->children = g_ptr_array_new_full (n_pages, (GDestroyNotify) g_object_unref);
 	for (i = 0; i < n_pages; i++) {
 		child = ev_page_accessible_new (self, i);
diff -Nru evince-48.0/libview/ev-view.c evince-48.1/libview/ev-view.c
--- evince-48.0/libview/ev-view.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/libview/ev-view.c	2025-06-29 19:43:42.000000000 +0100
@@ -4826,11 +4826,19 @@
 {
 	GdkRectangle view_rect;
 	GdkRGBA      cursor_color;
+	GtkStyleContext *context;
 
 	if (!get_caret_cursor_area (view, view->cursor_page, view->cursor_offset, &view_rect))
 		return;
 
-	get_cursor_color (gtk_widget_get_style_context (GTK_WIDGET (view)), &cursor_color);
+	context = gtk_widget_get_style_context (GTK_WIDGET (view));
+	gtk_style_context_save (context);
+	gtk_style_context_add_class (context, EV_STYLE_CLASS_DOCUMENT_PAGE);
+	if (ev_document_model_get_inverted_colors (view->model))
+		gtk_style_context_add_class (context, EV_STYLE_CLASS_INVERTED);
+
+	get_cursor_color (context, &cursor_color);
+	gtk_style_context_restore (context);
 
 	cairo_save (cr);
 	gdk_cairo_set_source_rgba (cr, &cursor_color);
diff -Nru evince-48.0/libview/ev-view-presentation.c evince-48.1/libview/ev-view-presentation.c
--- evince-48.0/libview/ev-view-presentation.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/libview/ev-view-presentation.c	2025-06-29 19:43:42.000000000 +0100
@@ -1267,7 +1267,7 @@
 	pview->monitor_width = geometry.width;
 	pview->monitor_height = geometry.height;
 
-#if GTK_CHECK_VERSION(3, 24, 9) && defined (GDK_WINDOWING_WAYLAND)
+#if GTK_CHECK_VERSION(3, 24, 9) && !GTK_CHECK_VERSION(3, 24, 42) && defined (GDK_WINDOWING_WAYLAND)
 	if (GDK_IS_WAYLAND_DISPLAY (display)) {
 		/* See Evince issue #1365 and GTK regression gtk#2599 */
 		int scale_factor = gdk_monitor_get_scale_factor (monitor);
diff -Nru evince-48.0/meson.build evince-48.1/meson.build
--- evince-48.0/meson.build	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/meson.build	2025-06-29 19:43:42.000000000 +0100
@@ -1,6 +1,6 @@
 project(
   'evince', ['c'],
-  version: '48.0',
+  version: '48.1',
   license: 'GPL-2.0-or-later',
   meson_version: '>= 0.59.0',
   default_options: [
@@ -80,6 +80,7 @@
 
 # package
 config_h.set_quoted('PACKAGE_ICON_NAME', app_id)
+config_h.set_quoted('APPLICATION_ID', ev_namespace)
 config_h.set_quoted('PACKAGE_VERSION', ev_version)
 config_h.set_quoted('VERSION', ev_version)
 
diff -Nru evince-48.0/NEWS evince-48.1/NEWS
--- evince-48.0/NEWS	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/NEWS	2025-06-29 19:43:42.000000000 +0100
@@ -1,4 +1,24 @@
 =============
+Evince   48.1
+=============
+
+general:
+  * Avoid potential heap overflow when allocating from n_pages (#2094, Nelson Benítez León)
+
+libview:
+  * Confine monitor fix to affected gtk versions (#1600, Nelson Benítez León)
+  * Fix caret-color when using system dark mode (#2093, Nelson Benítez León)
+  * Make annotation popup window always opaque (#1399, Casey Jao)
+
+shell/previwer:
+  * Set application ID to match with .desktop (Balló György)
+
+Developers:
+  * Balló GyöNinpwnrgy, Casey Jao, Nelson Benítez León
+
+Special thanks to Ninpwn for reporting potential heap overflow.
+
+=============
 Evince   48.0
 =============
 
diff -Nru evince-48.0/previewer/ev-previewer.c evince-48.1/previewer/ev-previewer.c
--- evince-48.0/previewer/ev-previewer.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/previewer/ev-previewer.c	2025-06-29 19:43:42.000000000 +0100
@@ -290,8 +290,6 @@
 	textdomain (GETTEXT_PACKAGE);
 #endif
 
-        g_set_prgname ("evince-previewer");
-
 	context = g_option_context_new (_("GNOME Document Previewer"));
 	g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
 	g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE);
@@ -313,9 +311,10 @@
 	ev_stock_icons_init ();
 
 	g_set_application_name (_("GNOME Document Previewer"));
+	g_set_prgname (APPLICATION_ID "-previewer");
 	gtk_window_set_default_icon_name (PACKAGE_ICON_NAME);
 
-        application = gtk_application_new (NULL, G_APPLICATION_NON_UNIQUE);
+        application = gtk_application_new (APPLICATION_ID "-previewer", G_APPLICATION_NON_UNIQUE);
         g_signal_connect (application, "startup", G_CALLBACK (startup_cb), NULL);
         g_signal_connect (application, "activate", G_CALLBACK (activate_cb), NULL);
 
diff -Nru evince-48.0/shell/ev-application.c evince-48.1/shell/ev-application.c
--- evince-48.0/shell/ev-application.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/shell/ev-application.c	2025-06-29 19:43:42.000000000 +0100
@@ -65,7 +65,6 @@
 
 G_DEFINE_TYPE (EvApplication, ev_application, GTK_TYPE_APPLICATION)
 
-#define APPLICATION_NAME             "org.gnome.Evince"
 #ifdef ENABLE_DBUS
 #define APPLICATION_DBUS_OBJECT_PATH "/org/gnome/evince/Evince"
 #define APPLICATION_DBUS_INTERFACE   "org.gnome.evince.Application"
@@ -104,7 +103,7 @@
   const GApplicationFlags flags = G_APPLICATION_NON_UNIQUE;
 
   return g_object_new (EV_TYPE_APPLICATION,
-                       "application-id", APPLICATION_NAME,
+                       "application-id", APPLICATION_ID,
                        "flags", flags,
                        NULL);
 }
diff -Nru evince-48.0/shell/evince.css evince-48.1/shell/evince.css
--- evince-48.0/shell/evince.css	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/shell/evince.css	2025-06-29 19:43:42.000000000 +0100
@@ -34,11 +34,13 @@
 
 evview.document-page {
     background-color: white;
+    caret-color: black;
     padding: 0;
 }
 
 evview.document-page.inverted {
     background-color: black;
+    caret-color: white;
 }
 
 evsidebarthumbnails.page-thumbnail {
diff -Nru evince-48.0/shell/ev-sidebar-thumbnails.c evince-48.1/shell/ev-sidebar-thumbnails.c
--- evince-48.0/shell/ev-sidebar-thumbnails.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/shell/ev-sidebar-thumbnails.c	2025-06-29 19:43:42.000000000 +0100
@@ -150,6 +150,11 @@
 	}
 
 	n_pages = ev_document_get_n_pages (document);
+
+	/* Check for potential integer overflow in allocation - Issue #2094 */
+	if ((gsize)n_pages > G_MAXSIZE / sizeof(EvThumbsSize))
+		g_error ("Exiting program due to abnormal page count detected: %d", n_pages);
+
 	cache->sizes = g_new0 (EvThumbsSize, n_pages);
 
 	for (i = 0; i < n_pages; i++) {
diff -Nru evince-48.0/shell/ev-toolbar.c evince-48.1/shell/ev-toolbar.c
--- evince-48.0/shell/ev-toolbar.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/shell/ev-toolbar.c	2025-07-17 15:45:21.000000000 +0100
@@ -195,6 +195,24 @@
                                       !is_active);
 }
 
+gboolean
+ev_toolbar_action_menu_popover_is_visible (EvToolbar *ev_toolbar)
+{
+	EvToolbarPrivate *priv;
+	GtkPopover *popover;
+
+	g_return_val_if_fail (EV_IS_TOOLBAR (ev_toolbar), FALSE);
+
+	priv = GET_PRIVATE (ev_toolbar);
+
+	popover = gtk_menu_button_get_popover (GTK_MENU_BUTTON (priv->action_menu_button));
+
+	if (popover)
+		return gtk_widget_get_visible (GTK_WIDGET (popover));
+
+	return FALSE;
+}
+
 GtkWidget *
 ev_toolbar_get_page_selector (EvToolbar *ev_toolbar)
 {
diff -Nru evince-48.0/shell/ev-toolbar.h evince-48.1/shell/ev-toolbar.h
--- evince-48.0/shell/ev-toolbar.h	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/shell/ev-toolbar.h	2025-07-17 15:45:21.000000000 +0100
@@ -52,6 +52,7 @@
 GType         ev_toolbar_get_type           (void);
 GtkWidget    *ev_toolbar_new                (EvWindow *window);
 void          ev_toolbar_action_menu_toggle (EvToolbar *ev_toolbar);
+gboolean      ev_toolbar_action_menu_popover_is_visible (EvToolbar *ev_toolbar);
 GtkWidget    *ev_toolbar_get_page_selector  (EvToolbar *ev_toolbar);
 HdyHeaderBar *ev_toolbar_get_header_bar     (EvToolbar *ev_toolbar);
 void          ev_toolbar_set_mode           (EvToolbar     *ev_toolbar,
diff -Nru evince-48.0/shell/ev-window.c evince-48.1/shell/ev-window.c
--- evince-48.0/shell/ev-window.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/shell/ev-window.c	2025-07-17 15:45:21.000000000 +0100
@@ -4724,14 +4724,19 @@
 			       gpointer       user_data)
 {
 	EvWindow *window = user_data;
+	EvWindowPrivate *priv = GET_PRIVATE (window);
 
 	if (g_variant_get_boolean (state)) {
-		ev_window_run_fullscreen (window);
+		if (ev_toolbar_action_menu_popover_is_visible (EV_TOOLBAR (priv->toolbar))) {
+			/* Popover menu is opened, so launch after a small delay
+			 * to avoid interfering with the popover closing - Issue #2088 */
+			g_timeout_add_once (200, (GSourceOnceFunc) ev_window_run_fullscreen, window);
+		} else {
+			ev_window_run_fullscreen (window);
+		}
 	} else {
 		ev_window_stop_fullscreen (window, TRUE);
 	}
-
-	g_simple_action_set_state (action, state);
 }
 
 static void
@@ -4897,8 +4902,15 @@
 	EvWindow *window = user_data;
 	EvWindowPrivate *priv = GET_PRIVATE (window);
 
-	if (!EV_WINDOW_IS_PRESENTATION (priv))
-		ev_window_run_presentation (window);
+	if (!EV_WINDOW_IS_PRESENTATION (priv)) {
+		if (ev_toolbar_action_menu_popover_is_visible (EV_TOOLBAR (priv->toolbar))) {
+			/* Popover menu is opened, so launch after a small delay
+			 * to avoid interfering with the popover closing - Issue #2088 */
+			g_timeout_add_once (200, (GSourceOnceFunc) ev_window_run_presentation, window);
+		} else {
+			ev_window_run_presentation (window);
+		}
+	}
 	/* We don't exit presentation when action is toggled because it conflicts with some
 	 * remote controls. The behaviour is also consistent with libreoffice and other
 	 * presentation tools. See https://bugzilla.gnome.org/show_bug.cgi?id=556162
diff -Nru evince-48.0/shell/main.c evince-48.1/shell/main.c
--- evince-48.0/shell/main.c	2025-03-15 10:55:07.000000000 +0000
+++ evince-48.1/shell/main.c	2025-06-29 19:43:42.000000000 +0100
@@ -377,6 +377,7 @@
 
 	/* Manually set name and icon */
 	g_set_application_name (_("Document Viewer"));
+	g_set_prgname (APPLICATION_ID);
 	gtk_window_set_default_icon_name (PACKAGE_ICON_NAME);
 
         application = ev_application_new ();
