From 4f39960daadb0a89f752d314b81612dcec5a30c0 Mon Sep 17 00:00:00 2001 From: Nelson Benitez Leon Date: Sun, 4 Jun 2017 18:08:29 +0500 Subject: sidebar-thumbnails: fix unwanted move to start after fullscreen After activating or deactivating fullscreen mode, the sidebar window is automatically moved to its start, while scroll bar stays in its original position. The sidebar window move is unwanted and unsolicited, and it's most probably caused by GtkIconView or GtkScrolledWindow bug. Workaround this by having the sidebar sync its window with the current scroll position after a fullscreen operation, do that by just emitting a "value-changed" on the current scroll adjustment. https://bugzilla.gnome.org/show_bug.cgi?id=783404 origin commit: https://git.gnome.org/browse/evince/commit/?id=2bfb8fa --- shell/ev-sidebar-thumbnails.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'shell') diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 20243e5b..3d17d692 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -300,6 +300,23 @@ ev_sidebar_thumbnails_map (GtkWidget *widget) adjustment_changed_cb (sidebar); } +static void +ev_sidebar_fullscreen_cb (EvSidebarThumbnails *sidebar) +{ + /* After activating or deactivating fullscreen mode, the sidebar + * window is automatically moved to its start, while scroll bar + * stays in its original position. + * + * The sidebar window move is unwanted and unsolicited, and it's + * most probably caused by GtkIconView or GtkScrolledWindow bug. + * + * Workaround this by having the sidebar sync its window with the + * current scroll position after a fullscreen operation, do that by + * just emitting a "value-changed" on the current scroll adjustment. + * Fixes https://bugzilla.gnome.org/show_bug.cgi?id=783404 */ + g_signal_emit_by_name (sidebar->priv->vadjustment, "value-changed"); +} + static void ev_sidebar_thumbnails_class_init (EvSidebarThumbnailsClass *ev_sidebar_thumbnails_class) { @@ -955,6 +972,9 @@ ev_sidebar_thumbnails_document_changed_cb (EvDocumentModel *model, g_signal_connect (priv->model, "notify::inverted-colors", G_CALLBACK (ev_sidebar_thumbnails_inverted_colors_changed_cb), sidebar_thumbnails); + g_signal_connect_swapped (priv->model, "notify::fullscreen", + G_CALLBACK (ev_sidebar_fullscreen_cb), + sidebar_thumbnails); sidebar_thumbnails->priv->start_page = -1; sidebar_thumbnails->priv->end_page = -1; ev_sidebar_thumbnails_set_current_page (sidebar_thumbnails, -- cgit v1.2.1