Disallow Ctrl-Z in certain situations

Closes https://sourceforge.net/p/tuxpaint/bugs/239/
This commit is contained in:
Bill Kendrick 2023-01-03 22:30:45 -08:00
parent 7ecd0ab075
commit 35dbd40bf6
2 changed files with 11 additions and 5 deletions

View file

@ -2,12 +2,12 @@ CHANGES.txt for Tux Paint
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2022 Copyright (c) 2002-2023
Various contributors (see below, and AUTHORS.txt) Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/ https://tuxpaint.org/
2022.December.28 (0.9.29) 2022.January.3 (0.9.29)
* Improvements to "Stamp" tool: * Improvements to "Stamp" tool:
----------------------------- -----------------------------
* Stamps may now be rotated. * Stamps may now be rotated.
@ -116,6 +116,11 @@ https://tuxpaint.org/
(h/t Miyagi Andel for reporting & Shin-ichi TOYAMA for pinpointing (h/t Miyagi Andel for reporting & Shin-ichi TOYAMA for pinpointing
the issue) the issue)
* Disallow using Ctrl-Z shortcut while drawing or rotating shapes
or shapes, to avoid unexpected results.
Closes https://sourceforge.net/p/tuxpaint/bugs/239/
Pere Pujal i Carabantes <perepujal@gmail.com>
* Ports & Building: * Ports & Building:
----------------- -----------------
* Processed PNG images through `pngout` to increase some compression * Processed PNG images through `pngout` to increase some compression

View file

@ -3,7 +3,7 @@
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2022 Copyright (c) 2002-2023
by various contributors; see AUTHORS.txt by various contributors; see AUTHORS.txt
https://tuxpaint.org/ https://tuxpaint.org/
@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - December 28, 2022 June 14, 2002 - January 3, 2023
*/ */
#include "platform.h" #include "platform.h"
@ -2861,9 +2861,10 @@ static void mainloop(void)
magic_switchin(canvas); magic_switchin(canvas);
} }
#endif #endif
else if (key == SDLK_z && (mod & KMOD_CTRL) && !noshortcuts) else if (key == SDLK_z && (mod & KMOD_CTRL) && !noshortcuts && !button_down && !emulate_button_pressed && stamp_tool_mode != STAMP_TOOL_MODE_ROTATE && shape_tool_mode != SHAPE_TOOL_MODE_ROTATE)
{ {
/* Ctrl-Z - Undo */ /* Ctrl-Z - Undo */
/* (As long as we're not in the middle of something!!!) */
magic_switchout(canvas); magic_switchout(canvas);