[gimp] app: make sure we reset tool modifier state before saving options.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make sure we reset tool modifier state before saving options.
- Date: Thu, 22 Nov 2018 15:22:56 +0000 (UTC)
commit dd3d9ab3dd5497812681b02f8c32bbedc7270be1
Author: Jehan <jehan girinstud io>
Date: Thu Nov 22 16:17:19 2018 +0100
app: make sure we reset tool modifier state before saving options.
I had this funny behavior when I was quitting GIMP with the active tool
using modifiers (for instance bucket fill). Each time I'd quit with
ctrl-q (and if the image is not dirty), the options would use the value
from the modifier state and be saved as-is. Hence at next restart, the
default value was always different!
app/gui/gui.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/app/gui/gui.c b/app/gui/gui.c
index 332b20b558..1997eab708 100644
--- a/app/gui/gui.c
+++ b/app/gui/gui.c
@@ -45,6 +45,8 @@
#include "display/gimpstatusbar.h"
#include "tools/gimp-tools.h"
+#include "tools/gimptool.h"
+#include "tools/tool_manager.h"
#include "widgets/gimpaction-history.h"
#include "widgets/gimpclipboard.h"
@@ -694,7 +696,8 @@ static gboolean
gui_exit_callback (Gimp *gimp,
gboolean force)
{
- GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
+ GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
+ GimpTool *active_tool;
if (gimp->be_verbose)
g_print ("EXIT: %s\n", G_STRFUNC);
@@ -723,6 +726,15 @@ gui_exit_callback (Gimp *gimp,
gui_unique_exit ();
+ /* If any modifier is set when quitting (typically when exiting with
+ * Ctrl-q for instance!), when serializing the tool options, it will
+ * save any alternate value instead of the main one. Make sure that
+ * any modifier is reset before saving options.
+ */
+ active_tool = tool_manager_get_active (gimp);
+ if (active_tool && active_tool->focus_display)
+ gimp_tool_set_modifier_state (active_tool, 0, active_tool->focus_display);
+
if (gui_config->save_session_info)
session_save (gimp, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]