[gimp] Bug 794356 - Rulers always shown for subsequent image views



commit 7230d5d777c98fb4896f1de76c147deb4f3ae692
Author: Michael Natterer <mitch gimp org>
Date:   Tue Apr 3 22:36:17 2018 +0200

    Bug 794356 - Rulers always shown for subsequent image views
    
    Remove the connect_after() hack from GimpImageWindow again and instead
    add gimp_display_shell_canvas_realize_after() and restore the configured
    ruler visibility there. Should work for all cases now.

 app/display/gimpdisplayshell-callbacks.c |   14 ++++++++++++++
 app/display/gimpdisplayshell-callbacks.h |    2 ++
 app/display/gimpdisplayshell.c           |    3 +++
 app/display/gimpimagewindow.c            |   14 +++-----------
 4 files changed, 22 insertions(+), 11 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index 590c491..b6bdd96 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -130,6 +130,20 @@ gimp_display_shell_canvas_realize (GtkWidget        *canvas,
 }
 
 void
+gimp_display_shell_canvas_realize_after (GtkWidget        *canvas,
+                                         GimpDisplayShell *shell)
+{
+  GimpImageWindow *window = gimp_display_shell_get_window (shell);
+
+  /*  HACK: see above: must go with GTK+ 3.x too. Restore the rulers'
+   *  intended visibility again.
+   */
+  gimp_image_window_suspend_keep_pos (window);
+  gimp_display_shell_appearance_update (shell);
+  gimp_image_window_resume_keep_pos (window);
+}
+
+void
 gimp_display_shell_canvas_size_allocate (GtkWidget        *widget,
                                          GtkAllocation    *allocation,
                                          GimpDisplayShell *shell)
diff --git a/app/display/gimpdisplayshell-callbacks.h b/app/display/gimpdisplayshell-callbacks.h
index 2fca4e5..9764f56 100644
--- a/app/display/gimpdisplayshell-callbacks.h
+++ b/app/display/gimpdisplayshell-callbacks.h
@@ -21,6 +21,8 @@
 
 void       gimp_display_shell_canvas_realize          (GtkWidget        *widget,
                                                        GimpDisplayShell *shell);
+void       gimp_display_shell_canvas_realize_after    (GtkWidget        *widget,
+                                                       GimpDisplayShell *shell);
 void       gimp_display_shell_canvas_size_allocate    (GtkWidget        *widget,
                                                        GtkAllocation    *alloc,
                                                        GimpDisplayShell *shell);
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index e7f8965..c38d6d2 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -604,6 +604,9 @@ gimp_display_shell_constructed (GObject *object)
   g_signal_connect (shell->canvas, "realize",
                     G_CALLBACK (gimp_display_shell_canvas_realize),
                     shell);
+  g_signal_connect (shell->canvas, "realize",
+                    G_CALLBACK (gimp_display_shell_canvas_realize_after),
+                    shell);
   g_signal_connect (shell->canvas, "size-allocate",
                     G_CALLBACK (gimp_display_shell_canvas_size_allocate),
                     shell);
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index d1f3373..c346f71 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -479,17 +479,9 @@ gimp_image_window_constructed (GObject *object)
   gtk_paned_pack1 (GTK_PANED (private->right_hpane), private->notebook,
                    TRUE, TRUE);
 
-  /*  HACK: remove with GTK+ 3.x: there is no reason to
-   *  connect_after() here except the HACK at the end of
-   *  gimp_display_shell_canvas_realize().
-   *
-   *  We need to make sure gimp_display_shell_appearance_update() is
-   *  called after realize() so the ill-shown rulers are properly
-   *  hidden again
-   */
-  g_signal_connect_after (private->notebook, "switch-page",
-                          G_CALLBACK (gimp_image_window_switch_page),
-                          window);
+  g_signal_connect (private->notebook, "switch-page",
+                    G_CALLBACK (gimp_image_window_switch_page),
+                    window);
   g_signal_connect (private->notebook, "page-removed",
                     G_CALLBACK (gimp_image_window_page_removed),
                     window);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]