From c126eb92b5f97234c177e96041f520e821bdfa9a Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Sun, 13 Feb 2022 17:09:17 -0500 Subject: [PATCH] macOS fix for backspace in text/label tools in some languages Fixed the issue with the backspace not working in text and label tools when in certain language modes in macOS. Mac keyboards have the DELETE key where PC keyboards have the BACKSPACE key, and the two keys have different keycodes, so the backspace requires special handling on the macOS in programs writtens for the PC. --- docs/CHANGES.txt | 6 ++++++ src/tuxpaint.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index a7d121714..49f239d20 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -199,6 +199,12 @@ http://www.tuxpaint.org/ * Fonts are now also looked for in the system preferences path, /Library/Application Support/TuxPaint/fonts + * Fixed the issue with the backspace not working in text and label tools + when in certain language modes in macOS. Mac keyboards have the DELETE + key where PC keyboards have the BACKSPACE key, and the two keys have + different keycodes, so the backspace requires special handling on the + macOS in programs writtens for the PC. + * Documentation updates: --------------------- * macOS Apple Silicon and Universal Binary build instructions diff --git a/src/tuxpaint.c b/src/tuxpaint.c index c1b72235a..92997c237 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -2825,6 +2825,11 @@ static void mainloop(void) /* Queue each character to be displayed */ while (*im_cp) { +#ifdef __APPLE__ + /* Apple uses DEL for BACKSPACE */ + if (*im_cp == SDLK_DELETE) *im_cp = L'\b'; +#endif + if (*im_cp == L'\b') { /* [Backspace] */