unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 4e0ee6de37a7b5b0f96e59f733d35bb8a71c6dc1 3461 bytes (raw)
name: gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
diff --git a/pdf_viewer/document_view.cpp b/pdf_viewer/document_view.cpp
index f48d05e..0bc3855 100644
--- a/pdf_viewer/document_view.cpp
+++ b/pdf_viewer/document_view.cpp
@@ -1121,7 +1121,7 @@ std::vector<DocumentPos> DocumentView::find_line_definitions() {
 
 			std::optional<PdfLink> pdf_link = current_document->get_link_in_page_rect(get_center_page_number(), line_rects[line_index]);
 			if (pdf_link.has_value()) {
-				auto parsed_uri = parse_uri(mupdf_context, pdf_link.value().uri);
+				auto parsed_uri = parse_uri(mupdf_context, current_document->doc, pdf_link.value().uri);
 				result.push_back({ parsed_uri.page - 1, parsed_uri.x, parsed_uri.y });
 				return result;
 			}
diff --git a/pdf_viewer/main_widget.cpp b/pdf_viewer/main_widget.cpp
index 19b568b..335a93f 100644
--- a/pdf_viewer/main_widget.cpp
+++ b/pdf_viewer/main_widget.cpp
@@ -170,7 +170,7 @@ void MainWidget::set_overview_position(int page, float offset) {
 
 void MainWidget::set_overview_link(PdfLink link) {
 
-    auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri);
+    auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, link.uri);
     if (page >= 1) {
         set_overview_position(page - 1, offset_y);
     }
@@ -3178,7 +3178,7 @@ void MainWidget::handle_pending_text_command(std::wstring text) {
 					open_web_url(utf8_decode(selected_link->uri));
                 }
                 else{
-					auto [page, offset_x, offset_y] = parse_uri(mupdf_context, selected_link->uri);
+					auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, selected_link->uri);
 					long_jump_to_destination(page-1, offset_y);
                 }
             }
@@ -3863,7 +3863,7 @@ void MainWidget::handle_link_click(const PdfLink& link) {
 		return;
 	}
 
-	auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri);
+	auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, link.uri);
 
 	// convert one indexed page to zero indexed page
 	page--;
diff --git a/pdf_viewer/utils.cpp b/pdf_viewer/utils.cpp
index 22d4265..3150e66 100644
--- a/pdf_viewer/utils.cpp
+++ b/pdf_viewer/utils.cpp
@@ -116,8 +116,9 @@ bool rects_intersect(fz_rect rect1, fz_rect rect2) {
 	return range_intersects(rect1.x0, rect1.x1, rect2.x0, rect2.x1) && range_intersects(rect1.y0, rect1.y1, rect2.y0, rect2.y1);
 }
 
-ParsedUri parse_uri(fz_context* mupdf_context, std::string uri) {
-	fz_link_dest dest = pdf_parse_link_uri(mupdf_context, uri.c_str());
+ParsedUri parse_uri(fz_context* mupdf_context, fz_document* fz_doc, std::string uri) {
+	pdf_document* doc = pdf_document_from_fz_document(mupdf_context, fz_doc);
+	fz_link_dest dest = pdf_resolve_link_dest(mupdf_context, doc, uri.c_str());
 	return { dest.loc.page + 1, dest.x, dest.y };
 }
 
diff --git a/pdf_viewer/utils.h b/pdf_viewer/utils.h
index 2a12211..643b030 100644
--- a/pdf_viewer/utils.h
+++ b/pdf_viewer/utils.h
@@ -55,7 +55,7 @@ void get_flat_toc(const std::vector<TocNode*>& roots, std::vector<std::wstring>&
 int mod(int a, int b);
 bool range_intersects(float range1_start, float range1_end, float range2_start, float range2_end);
 bool rects_intersect(fz_rect rect1, fz_rect rect2);
-ParsedUri parse_uri(fz_context* mupdf_context, std::string uri);
+ParsedUri parse_uri(fz_context* mupdf_context, fz_document* fz_doc, std::string uri);
 char get_symbol(int key, bool is_shift_pressed, const std::vector<char>&special_symbols);
 
 template<typename T>

debug log:

solving 4e0ee6de37 ...
found 4e0ee6de37 in https://yhetil.org/guix-patches/f57e90f08d99bfe3bf424c85a54fdc19f126061d.1708885668.git.i@dan.games/ ||
	https://yhetil.org/guix-patches/6f33128cb1f1125430f77b86d21b31cebec44d4d.1708885904.git.i@dan.games/

applying [1/1] https://yhetil.org/guix-patches/f57e90f08d99bfe3bf424c85a54fdc19f126061d.1708885668.git.i@dan.games/
diff --git a/gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch b/gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch
new file mode 100644
index 0000000000..4e0ee6de37

1:12: trailing whitespace.
 
1:13: space before tab in indent.
 			std::optional<PdfLink> pdf_link = current_document->get_link_in_page_rect(get_center_page_number(), line_rects[line_index]);
1:14: space before tab in indent.
 			if (pdf_link.has_value()) {
1:17: space before tab in indent.
 				result.push_back({ parsed_uri.page - 1, parsed_uri.x, parsed_uri.y });
1:18: space before tab in indent.
 				return result;
Checking patch gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch...
Applied patch gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch cleanly.
warning: squelched 16 whitespace errors
warning: 21 lines add whitespace errors.

skipping https://yhetil.org/guix-patches/6f33128cb1f1125430f77b86d21b31cebec44d4d.1708885904.git.i@dan.games/ for 4e0ee6de37
index at:
100644 4e0ee6de37a7b5b0f96e59f733d35bb8a71c6dc1	gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).