Blame SOURCES/evince-3.28.4-move-annotations.patch

79d870
From 9d6ebdb168f8438449c43e63f38f687e09c8fe4f Mon Sep 17 00:00:00 2001
79d870
From: Marek Kasik <mkasik@redhat.com>
79d870
Date: Thu, 5 Mar 2020 13:21:59 +0100
79d870
Subject: [PATCH] ev-view: Move annotation popup window to new position
79d870
79d870
Open annotation popup window at new position if its
79d870
annotation was moved when the popup window was hidden.
79d870
This places existing popup window the same way as when
79d870
it was created.
79d870
---
79d870
 libview/ev-view.c | 35 +++++++++++++++++++++++++++++++++++
79d870
 1 file changed, 35 insertions(+)
79d870
79d870
diff --git a/libview/ev-view.c b/libview/ev-view.c
79d870
index ffbe1704..43a0410d 100644
79d870
--- a/libview/ev-view.c
79d870
+++ b/libview/ev-view.c
79d870
@@ -3390,6 +3390,41 @@ ev_view_handle_annotation (EvView       *view,
79d870
 
79d870
 			parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
79d870
 			window = ev_view_create_annotation_window (view, annot, parent);
79d870
+		} else if (window && ev_annotation_markup_has_popup (EV_ANNOTATION_MARKUP (annot))) {
79d870
+			EvViewWindowChild *child;
79d870
+			EvMappingList     *annots;
79d870
+			EvRectangle        popup_rect;
79d870
+			EvMapping         *mapping;
79d870
+			GdkPoint           view_point;
79d870
+			EvPoint            annotation_corner;
79d870
+
79d870
+			child = ev_view_get_window_child (view, window);
79d870
+			annots = ev_page_cache_get_annot_mapping (view->page_cache,
79d870
+								  ev_annotation_get_page_index (annot));
79d870
+			mapping = ev_mapping_list_find (annots, annot);
79d870
+			ev_annotation_markup_get_rectangle (EV_ANNOTATION_MARKUP (annot),
79d870
+							    &popup_rect);
79d870
+
79d870
+			popup_rect.x2 = mapping->area.x2 + popup_rect.x2 - popup_rect.x1;
79d870
+			popup_rect.y2 = mapping->area.y2 + popup_rect.y2 - popup_rect.y1;
79d870
+			popup_rect.x1 = mapping->area.x2;
79d870
+			popup_rect.y1 = mapping->area.y2;
79d870
+			g_object_set (annot,
79d870
+				      "rectangle", &popup_rect,
79d870
+				      "popup_is_open", TRUE,
79d870
+				      NULL);
79d870
+
79d870
+			annotation_corner.x = mapping->area.x2;
79d870
+			annotation_corner.y = mapping->area.y2;
79d870
+
79d870
+			_ev_view_transform_doc_point_to_view_point (view,
79d870
+								    ev_annotation_get_page_index (annot),
79d870
+								    &annotation_corner,
79d870
+								    &view_point);
79d870
+
79d870
+			ev_view_window_child_move (view, child,
79d870
+						   child->parent_x + view_point.x - view->scroll_x,
79d870
+						   child->parent_y + view_point.y - view->scroll_y);
79d870
 		}
79d870
 		ev_view_annotation_show_popup_window (view, window);
79d870
 	}
79d870
-- 
79d870
2.24.1
79d870