Expand From Center fails with some modifiers (Fixes #9453)

Open programmer_ceds requested to merge programmer_ceds/gimp:ExpandFromCenterIssue into master

Fixes issue #9453 (which applies to V2.10.34 flatpak and V2.99.14 flatpak, both on Linux Mint 21.1 Cinnamon)

The above issue applies not only to the crop tool but also to the rectangle select tool and the ellipse select tool.

The problem occurs when the two modifiers (Shift and Ctrl for Windows) are both held to override the Expand From Center and Fixed Rule settings of the tool and either just the Expand From Center option selected or both the Expand From Center and Fixed Rule options are selected. (There are just two failures from the sixteen possible combinations of options and modifiers).

The problem lies in function gimptoolrectangle.c/gimp_tool_rectangle_motion_modifier(). It was processing the Expand From Center modifier key after the mouse button had been released. The change is to prevent the function doing this (as it already did with the Fixed Rule modifier).

This change is in one of the areas modified by MR !779 (merged). This MR introduced the flag modifier_toggle_allowed so that the modifier keys are only actioned when the mouse button is being held. That MR fixed the problem that it was intended to fix, this new MR extends the change to prevent the problem reported in issue #9453. It also simplifies the code slightly by removing the definition and setting of the flag button1_down - the flag modifier_toggle_allowed serves the same purpose.

Edited by programmer_ceds

Merge request reports