Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package zathura-plugin-pdf-mupdf for
openSUSE:Factory checked in at 2022-12-15 19:25:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/zathura-plugin-pdf-mupdf (Old)
and /work/SRC/openSUSE:Factory/.zathura-plugin-pdf-mupdf.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "zathura-plugin-pdf-mupdf"
Thu Dec 15 19:25:37 2022 rev:6 rq:1043061 version:0.4.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/zathura-plugin-pdf-mupdf/zathura-plugin-pdf-mupdf.changes
2022-09-20 19:23:40.758490501 +0200
+++
/work/SRC/openSUSE:Factory/.zathura-plugin-pdf-mupdf.new.1835/zathura-plugin-pdf-mupdf.changes
2022-12-15 19:26:07.888372511 +0100
@@ -1,0 +2,6 @@
+Tue Dec 13 19:19:58 UTC 2022 - llyyr <[email protected]>
+
+- Update to 0.4.0
+ * Implement better text selection
+
+-------------------------------------------------------------------
Old:
----
zathura-pdf-mupdf-0.3.9.tar.xz
New:
----
zathura-pdf-mupdf-0.4.0.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ zathura-plugin-pdf-mupdf.spec ++++++
--- /var/tmp/diff_new_pack.YvxzDc/_old 2022-12-15 19:26:08.360375196 +0100
+++ /var/tmp/diff_new_pack.YvxzDc/_new 2022-12-15 19:26:08.364375219 +0100
@@ -18,7 +18,7 @@
%define realname zathura-pdf-mupdf
Name: zathura-plugin-pdf-mupdf
-Version: 0.3.9
+Version: 0.4.0
Release: 0
Summary: Zathura PDF support through MuPDF
License: Zlib
@@ -35,9 +35,9 @@
BuildRequires: pkgconfig(jbig2dec)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libopenjp2)
-BuildRequires: pkgconfig(zathura) >= 0.3.9
+BuildRequires: pkgconfig(zathura) >= 0.5.2
Requires: mupdf >= 1.20
-Requires: zathura >= 0.2.0
+Requires: zathura >= 0.5.2
Conflicts: zathura-plugin-pdf-poppler
Provides: zathura-pdf-mupdf-plugin
++++++ zathura-pdf-mupdf-0.3.9.tar.xz -> zathura-pdf-mupdf-0.4.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/zathura-pdf-mupdf-0.3.9/meson.build
new/zathura-pdf-mupdf-0.4.0/meson.build
--- old/zathura-pdf-mupdf-0.3.9/meson.build 2022-08-22 23:00:38.000000000
+0200
+++ new/zathura-pdf-mupdf-0.4.0/meson.build 2022-11-27 16:51:05.000000000
+0100
@@ -1,6 +1,6 @@
project('zathura-pdf-mupdf', 'c',
- version: '0.3.9',
- meson_version: '>=0.43',
+ version: '0.4.0',
+ meson_version: '>=0.56',
default_options: ['c_std=c11', 'warning_level=3']
)
@@ -15,7 +15,7 @@
desktopdir = join_paths(datadir, 'applications')
# required dependencies
-zathura = dependency('zathura', version: '>=0.3.9')
+zathura = dependency('zathura', version: '>=0.5.2')
girara = dependency('girara-gtk3')
glib = dependency('glib-2.0')
cairo = dependency('cairo')
@@ -57,7 +57,7 @@
endif
if get_option('plugindir') == ''
- plugindir = zathura.get_pkgconfig_variable('plugindir')
+ plugindir = zathura.get_variable(pkgconfig: 'plugindir')
else
plugindir = get_option('plugindir')
endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/zathura-pdf-mupdf-0.3.9/zathura-pdf-mupdf/plugin.c
new/zathura-pdf-mupdf-0.4.0/zathura-pdf-mupdf/plugin.c
--- old/zathura-pdf-mupdf-0.3.9/zathura-pdf-mupdf/plugin.c 2022-08-22
23:00:38.000000000 +0200
+++ new/zathura-pdf-mupdf-0.4.0/zathura-pdf-mupdf/plugin.c 2022-11-27
16:51:05.000000000 +0100
@@ -17,6 +17,7 @@
.page_links_get = pdf_page_links_get,
.page_images_get = pdf_page_images_get,
.page_get_text = pdf_page_get_text,
+ .page_get_selection = pdf_page_get_selection,
.page_render = pdf_page_render,
.page_render_cairo = pdf_page_render_cairo,
.page_image_get_cairo = pdf_page_image_get_cairo
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/zathura-pdf-mupdf-0.3.9/zathura-pdf-mupdf/plugin.h
new/zathura-pdf-mupdf-0.4.0/zathura-pdf-mupdf/plugin.h
--- old/zathura-pdf-mupdf-0.3.9/zathura-pdf-mupdf/plugin.h 2022-08-22
23:00:38.000000000 +0200
+++ new/zathura-pdf-mupdf-0.4.0/zathura-pdf-mupdf/plugin.h 2022-11-27
16:51:05.000000000 +0100
@@ -134,6 +134,16 @@
char* pdf_page_get_text(zathura_page_t* page, void* mupdf_page,
zathura_rectangle_t rectangle, zathura_error_t* error);
/**
+ * Gets rectangles of highlighted text
+ * @param page Page
+ * @param rectangle Selection
+ * @error Set to an error value (see \ref zathura_error_t) if an error
+ * occurred
+ * @return List of rectangles or NULL if an error occurred.
+ */
+girara_list_t* pdf_page_get_selection(zathura_page_t* page, void* mupdf_page,
zathura_rectangle_t rectangle, zathura_error_t* error);
+
+/**
* Returns a list of document information entries of the document
*
* @param document Zathura document
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/zathura-pdf-mupdf-0.3.9/zathura-pdf-mupdf/select.c
new/zathura-pdf-mupdf-0.4.0/zathura-pdf-mupdf/select.c
--- old/zathura-pdf-mupdf-0.3.9/zathura-pdf-mupdf/select.c 2022-08-22
23:00:38.000000000 +0200
+++ new/zathura-pdf-mupdf-0.4.0/zathura-pdf-mupdf/select.c 2022-11-27
16:51:05.000000000 +0100
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: Zlib */
-#include <mupdf/pdf.h>
+#define MAX_QUADS 1000
#include "plugin.h"
#include "utils.h"
@@ -41,3 +41,69 @@
return NULL;
}
+
+girara_list_t*
+pdf_page_get_selection(zathura_page_t* page, void* data, zathura_rectangle_t
rectangle, zathura_error_t* error) {
+
+ mupdf_page_t* mupdf_page = data;
+
+ if (page == NULL || mupdf_page == NULL || mupdf_page->text == NULL) {
+ if (error != NULL) {
+ *error = ZATHURA_ERROR_INVALID_ARGUMENTS;
+ }
+ goto error_ret;
+ }
+
+ zathura_document_t* document = zathura_page_get_document(page);
+ mupdf_document_t* mupdf_document = zathura_document_get_data(document);
+
+ if (mupdf_page->extracted_text == false) {
+ mupdf_page_extract_text(mupdf_document, mupdf_page);
+ }
+
+ fz_point a = { rectangle.x1, rectangle.y1 };
+ fz_point b = { rectangle.x2, rectangle.y2 };
+
+ girara_list_t* list = girara_list_new2(g_free);
+ if (list == NULL) {
+ if (error != NULL) {
+ *error = ZATHURA_ERROR_OUT_OF_MEMORY;
+ }
+ goto error_free;
+ }
+
+ fz_quad* hits = fz_malloc_array(mupdf_page->ctx, MAX_QUADS, fz_quad);
+ int num_results = fz_highlight_selection(mupdf_page->ctx, mupdf_page->text,
a, b, hits, MAX_QUADS);
+
+ fz_rect r;
+ for (int i = 0; i < num_results; i++) {
+ zathura_rectangle_t* inner_rectangle =
g_malloc0(sizeof(zathura_rectangle_t));
+
+ r = fz_rect_from_quad(hits[i]);
+ inner_rectangle->x1 = r.x0;
+ inner_rectangle->x2 = r.x1;
+ inner_rectangle->y1 = r.y0;
+ inner_rectangle->y2 = r.y1;
+
+ girara_list_append(list, inner_rectangle);
+ }
+
+ fz_free(mupdf_page->ctx, hits);
+
+ return list;
+
+error_free:
+
+ if (list != NULL ) {
+ girara_list_free(list);
+ }
+
+error_ret:
+
+ if (error != NULL && *error == ZATHURA_ERROR_OK) {
+ *error = ZATHURA_ERROR_UNKNOWN;
+ }
+
+ return NULL;
+}
+