From fc063cb2ca912e9e42b751accc662eca5cf38dbd Mon Sep 17 00:00:00 2001 From: Jehan Date: Sun, 13 Mar 2022 13:10:36 +0100 Subject: [PATCH] app: use the unobtrusive cursor only in no-pointer+no-outline case. We take a step back from the original MR which was proposing the "single dot" cursor as a new "Pointer mode" option. I was really unsure this was the best solution, especially reading again the whole original report. It means that now nearly all of the original patch has been rewritten another way, but let's leave the contributor commit as a start point to get to where we are, and as acknowledgement of the contribution. The reporter was annoyed by the crosshair when none were requested and probably mostly for painting tools only (at least examples were about brush or pencil, etc.) while showing outline. It looks to me like the real issue was maybe when we were showing the big crosshair when using the 4-arc fallback outline, for instance when using a dynamics changing size. If so, this main issue is already fixed by my commit 64dc26064b4. No need of a new option for this, especially if the option can be as confusing as a barely visible dot-cursor (I can already imagine the bug reports of people tweaking random preferences and unhappy because the pointer became invisible, while they don't know how they did it). Instead I would say that when people specifically uncheck both "Show brush outline" and "Show pointer" options, showing a huge crosshair feels quite counter-productive. This is where I think that our small unobtrusive cursor (probably a better name than "Single dot" by the way, as it's not a single dot anymore) might be of use, the ultimate case when someone really want a cursor as inconspicuous as possible, while still having a visible feedback of the pointer position (even with display-tablets, parallax issues make such a visual feedback important to target where one paints). So let's try this first and see how it goes. --- app/config/config-enums.c | 2 -- app/config/config-enums.h | 1 - app/config/gimprc-blurbs.h | 6 +++-- app/display/gimpdisplayshell-cursor.c | 8 ++---- app/tools/gimppainttool.c | 39 ++++++++++++++++++--------- 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/app/config/config-enums.c b/app/config/config-enums.c index 988fe3cd76..4c414b9b01 100644 --- a/app/config/config-enums.c +++ b/app/config/config-enums.c @@ -78,7 +78,6 @@ gimp_cursor_mode_get_type (void) { GIMP_CURSOR_MODE_TOOL_ICON, "GIMP_CURSOR_MODE_TOOL_ICON", "tool-icon" }, { GIMP_CURSOR_MODE_TOOL_CROSSHAIR, "GIMP_CURSOR_MODE_TOOL_CROSSHAIR", "tool-crosshair" }, { GIMP_CURSOR_MODE_CROSSHAIR, "GIMP_CURSOR_MODE_CROSSHAIR", "crosshair" }, - { GIMP_CURSOR_MODE_SINGLE_DOT, "GIMP_CURSOR_MODE_SINGLE_DOT", "single-dot" }, { 0, NULL, NULL } }; @@ -87,7 +86,6 @@ gimp_cursor_mode_get_type (void) { GIMP_CURSOR_MODE_TOOL_ICON, NC_("cursor-mode", "Tool icon"), NULL }, { GIMP_CURSOR_MODE_TOOL_CROSSHAIR, NC_("cursor-mode", "Tool icon with crosshair"), NULL }, { GIMP_CURSOR_MODE_CROSSHAIR, NC_("cursor-mode", "Crosshair only"), NULL }, - { GIMP_CURSOR_MODE_SINGLE_DOT, NC_("cursor-mode", "Single dot"), NULL }, { 0, NULL, NULL } }; diff --git a/app/config/config-enums.h b/app/config/config-enums.h index ff8cbeb59c..7894903ee4 100644 --- a/app/config/config-enums.h +++ b/app/config/config-enums.h @@ -53,7 +53,6 @@ typedef enum GIMP_CURSOR_MODE_TOOL_ICON, /*< desc="Tool icon" >*/ GIMP_CURSOR_MODE_TOOL_CROSSHAIR, /*< desc="Tool icon with crosshair" >*/ GIMP_CURSOR_MODE_CROSSHAIR, /*< desc="Crosshair only" >*/ - GIMP_CURSOR_MODE_SINGLE_DOT /*< desc="Single dot" >*/ } GimpCursorMode; diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index ea2017e93b..8a7c4cfb3a 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -417,8 +417,10 @@ _("When enabled, dialogs will show a help button that gives access to " \ "be reached by pressing F1.") #define SHOW_PAINT_TOOL_CURSOR_BLURB \ -_("When enabled, the mouse pointer will be shown over the image while " \ - "using a paint tool.") +_("When enabled, the pointer will be shown over the image while " \ + "using a paint tool. " \ + "If both the brush outline and pointer are disabled, the " \ + "position will be indicated as unobtrusively as possibly.") #define SHOW_MENUBAR_BLURB \ _("When enabled, the menubar is visible by default. This can also be " \ diff --git a/app/display/gimpdisplayshell-cursor.c b/app/display/gimpdisplayshell-cursor.c index f9038a59a3..0e01627f6d 100644 --- a/app/display/gimpdisplayshell-cursor.c +++ b/app/display/gimpdisplayshell-cursor.c @@ -242,7 +242,8 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell, } if (cursor_type != GIMP_CURSOR_NONE && - cursor_type != GIMP_CURSOR_BAD) + cursor_type != GIMP_CURSOR_BAD && + cursor_type != GIMP_CURSOR_SINGLE_DOT) { switch (shell->display->config->cursor_mode) { @@ -270,11 +271,6 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell, modifier = GIMP_CURSOR_MODIFIER_NONE; } break; - - case GIMP_CURSOR_MODE_SINGLE_DOT: - cursor_type = GIMP_CURSOR_SINGLE_DOT; - tool_cursor = GIMP_TOOL_CURSOR_NONE; - break; } } diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c index 32fd6c1a7c..9f7bbba312 100644 --- a/app/tools/gimppainttool.c +++ b/app/tools/gimppainttool.c @@ -569,10 +569,16 @@ gimp_paint_tool_cursor_update (GimpTool *tool, if (! paint_tool->show_cursor && modifier != GIMP_CURSOR_MODIFIER_BAD) { - gimp_tool_set_cursor (tool, display, - GIMP_CURSOR_NONE, - GIMP_TOOL_CURSOR_NONE, - GIMP_CURSOR_MODIFIER_NONE); + if (paint_tool->draw_brush) + gimp_tool_set_cursor (tool, display, + GIMP_CURSOR_NONE, + GIMP_TOOL_CURSOR_NONE, + GIMP_CURSOR_MODIFIER_NONE); + else + gimp_tool_set_cursor (tool, display, + GIMP_CURSOR_SINGLE_DOT, + GIMP_TOOL_CURSOR_NONE, + GIMP_CURSOR_MODIFIER_NONE); return; } @@ -869,15 +875,24 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool) ! paint_tool->show_cursor && ! paint_tool->draw_circle) { - /* don't leave the user without any indication and draw - * a fallback crosshair + /* I am not sure this case can/should ever happen since now we + * always set the GIMP_CURSOR_SINGLE_DOT when neither pointer + * nor outline options are checked. Yet let's imagine any + * weird case where brush outline is wanted, without pointer + * cursor, yet we fail to draw the outline while neither + * circle nor fallbacks are requested (it depends on per-class + * implementation of get_outline()). + * + * In such a case, we don't want to leave the user without any + * indication so we draw a fallback crosshair. */ - gimp_draw_tool_add_handle (draw_tool, - GIMP_HANDLE_CROSSHAIR, - cur_x, cur_y, - GIMP_TOOL_HANDLE_SIZE_CROSSHAIR, - GIMP_TOOL_HANDLE_SIZE_CROSSHAIR, - GIMP_HANDLE_ANCHOR_CENTER); + if (paint_tool->draw_brush) + gimp_draw_tool_add_handle (draw_tool, + GIMP_HANDLE_CIRCLE, + cur_x, cur_y, + GIMP_TOOL_HANDLE_SIZE_CROSSHAIR, + GIMP_TOOL_HANDLE_SIZE_CROSSHAIR, + GIMP_HANDLE_ANCHOR_CENTER); } }