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

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