1
0
mirror of https://gitlab.gnome.org/GNOME/evince synced 2024-07-02 15:48:59 +00:00

EvView: preview popups only triggered by motion events

to avoid unwanted previews showing up in any of these
situations:

- when scrolling the view
- when pressing PageUp/PageDown or NextPage/PrevPage keys
- when changing to a page by clicking a bookmark or outline entry

we make sure to only show them when moving the mouse over them
(motion events).

Fixes issue #1666
This commit is contained in:
Nelson Benítez León 2022-01-16 19:08:20 -04:00 committed by Germán Poo-Caamaño
parent e247450852
commit 6f06d2d688

View File

@ -2221,11 +2221,13 @@ ev_view_handle_cursor_over_xy (EvView *view, gint x, gint y)
EvLinkDest *dest;
EvLinkDestType type;
GtkWidget *popover, *spinner;
GdkEvent *event;
cairo_surface_t *page_surface = NULL;
guint link_dest_page;
EvPoint link_dest_doc;
GdkPoint link_dest_view;
gint device_scale = 1;
gboolean from_motion = FALSE;
ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK);
@ -2241,6 +2243,18 @@ ev_view_handle_cursor_over_xy (EvView *view, gint x, gint y)
if (!dest)
return;
event = gtk_get_current_event ();
if (event) {
if (event->type == GDK_MOTION_NOTIFY &&
gdk_event_get_window (event) == gtk_widget_get_window (GTK_WIDGET (view))) {
from_motion = TRUE;
}
gdk_event_free (event);
}
/* Show preview popups only for motion events - Issue #1666 */
if (!from_motion)
return;
type = ev_link_dest_get_dest_type (dest);
if (type == EV_LINK_DEST_TYPE_NAMED) {
dest = ev_document_links_find_link_dest (EV_DOCUMENT_LINKS (view->document),