From 9be4fa529f2dc149962b2ffbe1cff9adc4d13fe7 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Wed, 28 Sep 2022 22:00:29 -0700 Subject: [PATCH] [X] instead of [Del] for eraser quick access Apple keyboards have only a "Delete" key (which acts as Backspace), so contortions with Fn key required to access the keysym I was using for eraser quick access. h/t Mark Kim for pointing it out. Because of this use of a printable glyph key, and to solve the issue of on screen keyboard and in-progress text input getting clobbered while accessing eraser, preventing access to the quick eraser when either Text or Label tool are selected. --- docs/CHANGES.txt | 7 ++++--- src/tuxpaint.c | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index bc9397eb1..7e02f26b1 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -60,10 +60,11 @@ http://www.tuxpaint.org/ * Other Improvements: ------------------- * A keyboard shortcut is now available for quickly accessing - a small eraser. Hold the [Del] key while clicking, and drag + a small eraser. Hold the [X] key while clicking, and drag around the picture to erase. (Not available if in the process - of rotating a stamp or shape.) Release the mouse to return to - normal operation. + of rotating a stamp or shape, or when Text or Label tool are + active.) Release the mouse to return to normal operation. + (Eventually, this could be utilized when we can support the recognition of a drawing tablet stylus' "eraser" tip; see https://sourceforge.net/p/tuxpaint/feature-requests/8/) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 84ef7bf0f..53c418224 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -5363,14 +5363,16 @@ static void mainloop(void) SDL_Flip(screen); } - else if (kbd_state[SDL_SCANCODE_DELETE] /* FIXME */) + else if (kbd_state[SDL_SCANCODE_X]) { - /* Holding [Del] while clicking; switch to temp-mode eraser! + /* Holding [X] while clicking; switch to temp-mode eraser! (as long as we're not involved in anything else within this main loop!) */ if ((cur_tool != TOOL_SHAPES || shape_mode == SHAPE_TOOL_MODE_DONE) && - (cur_tool != TOOL_STAMP || stamp_tool_mode == STAMP_TOOL_MODE_PLACE)) + (cur_tool != TOOL_STAMP || stamp_tool_mode == STAMP_TOOL_MODE_PLACE) && + cur_tool != TOOL_TEXT && + cur_tool != TOOL_LABEL) { do_quick_eraser(); }