[gimp] app: tool_manager: correctly preserve tool state across a push/pop



commit cb6b821c70251ebfa298aff3e6d570c31504fe27
Author: Michael Natterer <mitch gimp org>
Date:   Wed Apr 6 20:40:26 2011 +0200

    app: tool_manager: correctly preserve tool state across a push/pop
    
    tool_manager_select_tool(): don't reset the previously active tool if
    it is only temporarily pushed to the tool stack.
    
    tool_manager_pop_tool(): don't try to restore the previously active
    tool's state because it was not reset on push().

 app/tools/tool_manager.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c
index 5bbc23f..37412c3 100644
--- a/app/tools/tool_manager.c
+++ b/app/tools/tool_manager.c
@@ -168,7 +168,12 @@ tool_manager_select_tool (Gimp     *gimp,
 
   tool_manager = tool_manager_get (gimp);
 
-  if (tool_manager->active_tool)
+  /*  reset the previously selected tool, but only if it is not only
+   *  temporarily pushed to the tool stack
+   */
+  if (tool_manager->active_tool &&
+      ! (tool_manager->tool_stack &&
+         tool_manager->active_tool == tool_manager->tool_stack->data))
     {
       GimpTool    *active_tool = tool_manager->active_tool;
       GimpDisplay *display;
@@ -224,20 +229,14 @@ tool_manager_pop_tool (Gimp *gimp)
 
   if (tool_manager->tool_stack)
     {
-      GimpTool    *tool          = tool_manager->tool_stack->data;
-      GimpDisplay *focus_display = NULL;
-
-      if (tool_manager->active_tool)
-        focus_display = tool_manager->active_tool->focus_display;
+      GimpTool *tool = tool_manager->tool_stack->data;
 
       tool_manager->tool_stack = g_slist_remove (tool_manager->tool_stack,
                                                  tool);
 
       tool_manager_select_tool (gimp, tool);
-      g_object_unref (tool);
 
-      if (focus_display)
-        tool_manager_focus_display_active (gimp, focus_display);
+      g_object_unref (tool);
     }
 }
 



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