[gimp] Bug 688715 - Unconfigured eraser should be set to eraser tool



commit 4e340b613bb7bf0730572bb123d67e9fb6671934
Author: Michael Natterer <mitch gimp org>
Date:   Fri Nov 23 01:17:52 2012 +0100

    Bug 688715 - Unconfigured eraser should be set to eraser tool
    
    I don't know what I tested before, but it didn't work. This patch does
    the magic in two places, one of which I missed.

 app/widgets/gimpdeviceinfo.c    |   21 +++++++++++++++++++++
 app/widgets/gimpdeviceinfo.h    |    2 ++
 app/widgets/gimpdevicemanager.c |   14 +-------------
 app/widgets/gimpdevices.c       |    2 ++
 4 files changed, 26 insertions(+), 13 deletions(-)
---
diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c
index 9ec2148..4b86d01 100644
--- a/app/widgets/gimpdeviceinfo.c
+++ b/app/widgets/gimpdeviceinfo.c
@@ -37,6 +37,7 @@
 #include "core/gimpdatafactory.h"
 #include "core/gimpmarshal.h"
 #include "core/gimpparamspecs.h"
+#include "core/gimptoolinfo.h"
 
 #include "gimpdeviceinfo.h"
 
@@ -634,6 +635,26 @@ gimp_device_info_set_device (GimpDeviceInfo *info,
   gimp_device_info_changed (info);
 }
 
+void
+gimp_device_info_set_default_tool (GimpDeviceInfo *info)
+{
+  g_return_if_fail (GIMP_IS_DEVICE_INFO (info));
+
+  if (info->device &&
+      gdk_device_get_source (info->device) == GDK_SOURCE_ERASER)
+    {
+      GimpContainer *tools = GIMP_CONTEXT (info)->gimp->tool_info_list;
+      GimpToolInfo  *eraser;
+
+      eraser =
+        GIMP_TOOL_INFO (gimp_container_get_child_by_name (tools,
+                                                          "gimp-eraser-tool"));
+
+      if (eraser)
+        gimp_context_set_tool (GIMP_CONTEXT (info), eraser);
+    }
+}
+
 GdkInputMode
 gimp_device_info_get_mode (GimpDeviceInfo *info)
 {
diff --git a/app/widgets/gimpdeviceinfo.h b/app/widgets/gimpdeviceinfo.h
index 76ef200..a514f46 100644
--- a/app/widgets/gimpdeviceinfo.h
+++ b/app/widgets/gimpdeviceinfo.h
@@ -85,6 +85,8 @@ void             gimp_device_info_set_device        (GimpDeviceInfo  *info,
                                                      GdkDevice       *device,
                                                      GdkDisplay      *display);
 
+void             gimp_device_info_set_default_tool  (GimpDeviceInfo  *info);
+
 GdkInputMode     gimp_device_info_get_mode          (GimpDeviceInfo  *info);
 void             gimp_device_info_set_mode          (GimpDeviceInfo  *info,
                                                      GdkInputMode     mode);
diff --git a/app/widgets/gimpdevicemanager.c b/app/widgets/gimpdevicemanager.c
index 5284f3a..4135db1 100644
--- a/app/widgets/gimpdevicemanager.c
+++ b/app/widgets/gimpdevicemanager.c
@@ -29,7 +29,6 @@
 
 #include "core/gimp.h"
 #include "core/gimpmarshal.h"
-#include "core/gimptoolinfo.h"
 
 #include "gimpdeviceinfo.h"
 #include "gimpdevicemanager.h"
@@ -330,18 +329,7 @@ gimp_device_manager_device_added (GdkDisplay        *gdk_display,
     {
       device_info = gimp_device_info_new (private->gimp, device, gdk_display);
 
-      if (gdk_device_get_source (device) == GDK_SOURCE_ERASER)
-        {
-          GimpContainer *tools = private->gimp->tool_info_list;
-          GimpToolInfo  *eraser;
-
-          eraser =
-            GIMP_TOOL_INFO (gimp_container_get_child_by_name (tools,
-                                                              "gimp-eraser-tool"));
-
-          if (eraser)
-            gimp_context_set_tool (GIMP_CONTEXT (device_info), eraser);
-        }
+      gimp_device_info_set_default_tool (device_info);
 
       gimp_container_add (GIMP_CONTAINER (manager), GIMP_OBJECT (device_info));
       g_object_unref (device_info);
diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c
index 2e26826..dc01fb1 100644
--- a/app/widgets/gimpdevices.c
+++ b/app/widgets/gimpdevices.c
@@ -119,6 +119,8 @@ gimp_devices_restore (Gimp *gimp)
 
       gimp_context_copy_properties (user_context, GIMP_CONTEXT (device_info),
                                     GIMP_DEVICE_INFO_CONTEXT_MASK);
+
+      gimp_device_info_set_default_tool (device_info);
     }
 
   filename = gimp_personal_rc_file ("devicerc");



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