[gimp/gimp-2-8] Bug 688348 - Layer tab and Images tab: not updated on dropping...



commit 9069bd8d79248b9fa778dcc5149d99aff1b914ad
Author: Michael Natterer <mitch gimp org>
Date:   Tue Apr 23 21:00:17 2013 +0200

    Bug 688348 - Layer tab and Images tab: not updated on dropping...
    
    ...one image onto another
    
    gimp_dock_window_display_changed(): make sure the "auto-follow-active"
    logic works both ways: when the active image or display is changed in
    a dockable, update the global context. Fixes multi-window mode.
    
    gimp_context_real_set_display(): make sure a context's display and
    image are always in a consistent state and never have a display that
    is not display->image: when display is the same as context->display,
    check that the context's image matches display->image, so that after a
    gimp_context_set_display(), the context is consistent in all
    cases. Fixes single-window mode.
    (cherry picked from commit bacc9c9635776c00ac5603d6d56387073e8a933d)

 app/core/gimpcontext.c       |   20 +++++++++++++++++++-
 app/widgets/gimpdockwindow.c |   18 ++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c
index 5ba280a..603492e 100644
--- a/app/core/gimpcontext.c
+++ b/app/core/gimpcontext.c
@@ -1929,7 +1929,25 @@ gimp_context_real_set_display (GimpContext *context,
   GimpObject *old_display;
 
   if (context->display == display)
-    return;
+    {
+      /*  make sure that setting a display *always* sets the image
+       *  to that display's image, even if the display already
+       *  matches
+       */
+      if (display)
+        {
+          GimpImage *image;
+
+          g_object_get (display, "image", &image, NULL);
+
+          gimp_context_real_set_image (context, image);
+
+          if (image)
+            g_object_unref (image);
+        }
+
+      return;
+    }
 
   old_display = context->display;
 
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index b245db4..9b8763a 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -974,6 +974,15 @@ gimp_dock_window_display_changed (GimpDockWindow *dock_window,
                                   GimpObject     *display,
                                   GimpContext    *context)
 {
+  /*  make sure auto-follow-active works both ways  */
+  if (display && dock_window->p->auto_follow_active)
+    {
+      GimpContext *factory_context =
+        gimp_dialog_factory_get_context (dock_window->p->dialog_factory);
+
+      gimp_context_set_display (factory_context, display);
+    }
+
   gimp_ui_manager_update (dock_window->p->ui_manager,
                           display);
 }
@@ -986,6 +995,15 @@ gimp_dock_window_image_changed (GimpDockWindow *dock_window,
   GimpContainer *image_container   = dock_window->p->image_container;
   GimpContainer *display_container = dock_window->p->display_container;
 
+  /*  make sure auto-follow-active works both ways  */
+  if (image && dock_window->p->auto_follow_active)
+    {
+      GimpContext *factory_context =
+        gimp_dialog_factory_get_context (dock_window->p->dialog_factory);
+
+      gimp_context_set_image (factory_context, image);
+    }
+
   if (image == NULL && ! gimp_container_is_empty (image_container))
     {
       image = GIMP_IMAGE (gimp_container_get_first_child (image_container));


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