tools-size-set sets tool to size 1
Environment/Versions
- GIMP version: 2.10.18
- Package: Lubuntu APT package
- Operating System: Lubuntu 20.04
I've looked around the code in the repo so I think the problem still exists.
Description of the bug
I was looking to make it simpler to change my brush size via keyboard. Looking at the shortcuts, I found tools-size-set
(Tool's Size: Set). Given the other size tools (increase, decrease, set to default, etc), I assumed tools-size-set
would prompt me inserting a number or something similar, instead it always sets the tool size to 1.
I've looked a bit into the code, but I am not a GIMP expert so please pardon any mistakes.
It seems like the tool is defined here: https://gitlab.gnome.org/GNOME/gimp/-/blob/master/app/actions/tools-actions.c#L342 :
{ "tools-size-set", GIMP_ICON_DIALOG_TOOL_OPTIONS,
NC_("tools-action", "Tool's Size: Set"), NULL, NULL,
GIMP_ACTION_SELECT_SET, TRUE,
NULL },
Now comparing this with the other tool definitions, I went looking for GIMP_ACTION_SELECT_SET
, assuming this is the enum value that is supposed to trigger some kind of value input. Now, I'm not 100% sure this is the right function, but I think that the function that sets the value is here: https://gitlab.gnome.org/GNOME/gimp/-/blob/master/app/actions/actions.c#L516.
Now, note that here the value GIMP_ACTION_SELECT_SET
is not called in the switch. Instead, the default case would get triggered, and considering that GIMP_ACTION_SELECT_SET
is the only value in its original enum (https://gitlab.gnome.org/GNOME/gimp/-/blob/master/app/actions/actions-types.h#L28) that has value zero, this effectively makes GIMP_ACTION_SELECT_SET
set the value to the minimum:
if ((gint) select_type >= 0)
value = (gdouble) select_type * (max - min) / 1000.0 + min;
becomes effectively
value = 0 * (max - min) / 1000.0 + min = min
The only thing which I'm not sure, is that the tool entry I mentioned above has a TRUE
field, whereas the other ones have a FALSE
. Looking into it, that field seems to be called value_variable
in the _GimpEnumActionEntry
struct (https://github.com/GNOME/gimp/blob/76ddf4421cb4f7ff2244f32df533455a472a4a89/app/widgets/gimpactiongroup.h#L109). The only place I could find that seems to use this field is in calls like this: https://github.com/GNOME/gimp/blob/76ddf4421cb4f7ff2244f32df533455a472a4a89/app/actions/tools-commands.c#L966. These however, if I'm getting the code correct, are only about emitting signals (https://github.com/GNOME/gimp/blob/c8020c20a5af439a317b309767687948b930b7e0/app/widgets/gimpaction.c#L103), so I'm not sure they would help when inserting custom values.
If this is the case, I feel that either the set tools (the size one, and ones that are supposed to work similarly) should be removed as they don't really do anything. Or otherwise, when they are triggered, they should open a popup to manually insert values.
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Bind tools-size-set
- Use the binding when using a brush
Expected result: I can somehow set the brush size
Actual result: Brush is set to minimum