[gimp/gimp-2-10] Issue #4992 - Modifiers change Free Select tool mode while active



commit 25112a53556aaaebb774f760e6be110c682ab6da
Author: Ell <ell_se yahoo com>
Date:   Tue May 5 18:12:31 2020 +0300

    Issue #4992 - Modifiers change Free Select tool mode while active
    
    Properly initialize GimpSelectionTool::saved_operation upon
    modifer-key press, even when some modifiers are masked out by
    GimpPolygonSelectTool while the tool is active.  This avoids
    erroneously "restoring" the operation to a previously-saved state
    once the modifier keys are released.
    
    (cherry picked from commit e0a5aaeb224d85dd00bb2e7835a24729b866981b)

 app/tools/gimpselectiontool.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c
index 3029a38ac1..c1cec9c4ce 100644
--- a/app/tools/gimpselectiontool.c
+++ b/app/tools/gimpselectiontool.c
@@ -161,11 +161,20 @@ gimp_selection_tool_modifier_key (GimpTool        *tool,
     {
       GimpChannelOps button_op = options->operation;
 
+      state &= extend_mask |
+               modify_mask |
+               GDK_MOD1_MASK;
+
       if (press)
         {
-          if (key == (state & (extend_mask |
-                               modify_mask |
-                               GDK_MOD1_MASK)))
+          if (key == state ||
+              /* GimpPolygonSelectTool may mask-out part of the state, which
+               * can cause the wrong mode to be restored on release if we don't
+               * init saved_operation here.
+               *
+               * see issue #4992.
+               */
+              ! state)
             {
               /*  first modifier pressed  */
 
@@ -174,9 +183,7 @@ gimp_selection_tool_modifier_key (GimpTool        *tool,
         }
       else
         {
-          if (! (state & (extend_mask |
-                          modify_mask |
-                          GDK_MOD1_MASK)))
+          if (! state)
             {
               /*  last modifier released  */
 


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