From c88616e13e3f4a671bf66d0a33d5dcac558d6901 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Wed, 23 Oct 2024 20:55:13 -0700 Subject: [PATCH] Don't Magic switch-out & -in on pointless Ctrl-R/Z h/t Pere for a correction for Ctrl-R (I also applied to Ctlr-Z) and Miyagi for reporting the issue Closes https://sourceforge.net/p/tuxpaint/bugs/294/ --- docs/CHANGES.txt | 8 +++++++- src/tuxpaint.c | 18 +++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index e8aa8c8a5..6c8a7da9f 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -6,7 +6,7 @@ Copyright (c) 2002-2024 Various contributors (see below, and AUTHORS.txt) https://tuxpaint.org/ -2024.October.21 (0.9.34) +2024.October.23 (0.9.34) * New Magic Tools: ---------------- * "Comic Dots", draws repeating dots (using a multiply blend) @@ -221,6 +221,12 @@ https://tuxpaint.org/ transparent areas (e.g., soft edges would be black halos). Mended. Bill Kendrick + * Hitting [Ctrl]-[R] or [Ctrl]-[Z] would invoke switch-out + and switch-back-in of Magic tools, even when no action occured. + h/t Miyagi Andel for reporting + Pere Pujal i Carabantes + Closes https://sourceforge.net/p/tuxpaint/bugs/294/ + * Other Improvements: ------------------- * The macOS build now links against SDL2_gfx. Previously SDL2_gfx was diff --git a/src/tuxpaint.c b/src/tuxpaint.c index aac14452d..009a93b03 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - October 20, 2024 + June 14, 2002 - October 23, 2024 */ #include "platform.h" @@ -2892,10 +2892,10 @@ static void mainloop(void) /* Ctrl-Z - Undo */ /* (As long as we're not in the middle of something!!!) */ - magic_switchout(canvas); - if (tool_avail[TOOL_UNDO]) { + magic_switchout(canvas); + if (cursor_x != -1 && cursor_y != -1) { hide_blinking_cursor(); @@ -2930,18 +2930,18 @@ static void mainloop(void) update_screen_rect(&r_tools); shape_tool_mode = SHAPE_TOOL_MODE_DONE; maybe_redraw_eraser_xor(); - } - magic_switchin(canvas); + magic_switchin(canvas); + } } else if (key == SDLK_r && (mod & KMOD_CTRL) && !noshortcuts) { /* Ctrl-R - Redo */ - magic_switchout(canvas); - if (tool_avail[TOOL_REDO]) { + magic_switchout(canvas); + if (cur_tool == TOOL_STAMP) reset_stamps(&stamp_xored_rt, &stamp_place_x, &stamp_place_y, &stamp_tool_mode); hide_blinking_cursor(); @@ -2949,9 +2949,9 @@ static void mainloop(void) update_screen_rect(&r_tools); shape_tool_mode = SHAPE_TOOL_MODE_DONE; maybe_redraw_eraser_xor(); - } - magic_switchin(canvas); + magic_switchin(canvas); + } } else if (key == SDLK_o && (mod & KMOD_CTRL) && !noshortcuts) {