Thread: [Tuxpaint-devel] Shortcut ([Del] key) for quick access to a small eraser
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
From: Bill K. <nb...@so...> - 2022-09-28 09:13:07
|
Tonight I thought that, since Tux Paint is now focused on SDL2, I could finally look into adding drawing tablet (e.g., Wacom) support to Tux Paint. Right now, it works, but acts as a mouse: no pressure, no recognition of which stylus tip (pen vs. eraser) is being usded, etc. Unfortunately, even after so many years, SDL isn't quite ready! :-D (See https://github.com/libsdl-org/SDL/issues/2217) However, I realized the process would end up being very similar to what I did for the color picker "pipette" shortcut ([Ctrl] key) in 0.9.28, and decided I could add a similar feature that would give users quick access to an eraser via a shortcut key. Once SDL could actually tell us when a stylus' eraser tip is being used, we could simply do the same thing as when the shortcut key is being held! So, I've added code in what will become Tux Paint 0.9.29 that lets you hold the [Del] ("delete"; not to be confused with "backspace") key, at _almost_ any time, to get quick access to a small, round eraser. Without checking for the state of things, I discovered that this feature would interfer with the rotation steps of both the Shapes and Stamps tools. So I specifically avoid invoking this new code in those two situations. Other parts of Tux Paint -- like the Fill tool's linear gradient and brush modes, interactive Magic tools, etc. -- appear to inherently avoid interference from this feature, since you're in the process of click+dragging. It's impossible to get another click in there; pressing [Del] on its own doesn't invoke this code, it's the combination of an otherwise-uncaught click, plus the [Del] key already being held. However, as usual, it's late at night, I should have gone to bed 2 hours ago, and mistakes happen. So, if you notice any glitches, please let me know ASAP so I can try to address them. So far, I think I need to tackle: * interferrence with onscreen keyboard (Text & Label tools) * "--mouse-accessibility" mode (other features, like the [Ctrl] quick access color picker, probably need to better support this option!) * "--keyboard" mode (ditto) -- -bill! Sent from my computer |
From: Mark K. K. <mar...@gm...> - 2022-09-29 01:24:21
|
Hi Bill, On Wed, Sep 28, 2022 at 5:13 AM Bill Kendrick <nb...@so...> wrote: > So, if you notice any glitches, > please let me know ASAP so I can try to address them. > 1. The erase operation doesn't start until the delete key and the primary mouse button are both pressed. My instinct is to expect the mouse cursor to change the moment the delete key is pressed to signal that the function of the primary button on the mouse has changed from "draw" to "erase". 2. The erase operation doesn't stop if the mouse is moving quickly even after both the delete key and the primary mouse button are both released. This can go on indefinitely as far as I can tell as long as the mouse continues to move quickly. 3. Using the "delete" key to erase on the Mac will be confusing and difficult. Confusing because the key labeled "delete" on the Mac keyboard is actually where the backspace key is on the PC keyboard and works like the backspace key. And difficult because triggering the scancode equivalent to PC's delete on the Mac keyboard, which lacks the extended keys on the default out-of-the-box keyboard, involves pressing and holding down simultaneously the Fn key on the bottom-left of the keyboard and pressing the delete key on the top-right of the keyboard, which is a two handed operation for most people. Therefore holding down the "delete key" and using the mouse simultaneously is a three-handed operation on the Mac! :D Mark |
From: Bill K. <nb...@so...> - 2022-09-29 05:00:05
|
On Wed, Sep 28, 2022 at 09:24:02PM -0400, Mark K. Kim wrote: > Hi Bill, > > On Wed, Sep 28, 2022 at 5:13 AM Bill Kendrick <nb...@so...> wrote: > > > So, if you notice any glitches, > > please let me know ASAP so I can try to address them. > > > > 1. The erase operation doesn't start until the delete key and the primary > mouse button are both pressed. My instinct is to expect the mouse cursor > to change the moment the delete key is pressed to signal that the function > of the primary button on the mouse has changed from "draw" to "erase". I don't disagree. I'm just a little fearful of tacking too much more on in here. :-) It would also need to be done for the [Ctrl]+click for the pipette tool, for consistency, IMO. > 2. The erase operation doesn't stop if the mouse is moving quickly even > after both the delete key and the primary mouse button are both released. > This can go on indefinitely as far as I can tell as long as the mouse > continues to move quickly. Hrm, it should exit on SDL_MOUSEBUTTONUP, but perhaps if you move very quickly some of the events get lost. I'm unable to replicate this, though. (And I was REALLY going nuts with my mouse :) ) Also, the function will also exit when you press [Esc] (SDL_KEYDOWN with SDLK_ESCAPE). > 3. Using the "delete" key to erase on the Mac will be confusing and > difficult. Confusing because the key labeled "delete" on the Mac keyboard > is actually where the backspace key is on the PC keyboard and works like > the backspace key. And difficult because triggering the scancode > equivalent to PC's delete on the Mac keyboard, which lacks the extended > keys on the default out-of-the-box keyboard, involves pressing and holding > down simultaneously the Fn key on the bottom-left of the keyboard and > pressing the delete key on the top-right of the keyboard, which is a two > handed operation for most people. Therefore holding down the "delete key" > and using the mouse simultaneously is a three-handed operation on the Mac! > :D Hah! Whoops, rookie mistake! Sorry! Okay, so I'm going to restrict this feature such that it does not work _at all_ while using the Text or Label tool, and am using the [X] key, instead of [Del]. QWERTY, QWERTZ, and AZERTY all have "X". However, ÄWERTY, and sometimes ĄŽERTY, do not have "X". It's a bit of a rabbit hole. Any problems with this plan, does anyone think? -- -bill! Sent from my computer |
From: Pere P. i C. <per...@gm...> - 2022-09-29 06:17:46
|
El dc. 28 de 09 de 2022 a les 21:59 -0700, en/na Bill Kendrick va escriure: > On Wed, Sep 28, 2022 at 09:24:02PM -0400, Mark K. Kim wrote: > > Hi Bill, > > > > On Wed, Sep 28, 2022 at 5:13 AM Bill Kendrick <nb...@so...> wrote: > > > > > > > > > 2. The erase operation doesn't stop if the mouse is moving quickly even > > after both the delete key and the primary mouse button are both released. > > This can go on indefinitely as far as I can tell as long as the mouse > > continues to move quickly. > > Hrm, it should exit on SDL_MOUSEBUTTONUP, but perhaps if you move very > quickly some of the events get lost. I'm unable to replicate this, > though. (And I was REALLY going nuts with my mouse :) ) I've reproduced by slowing tuxpaint with valgrind valgrind ./tuxpaint --1800x1000 I found this that seems a different issue, click, hold X, slowly drag and start erasing, then release X but continue slowly dragging, it still erases. |
From: Shin-ichi T. <dol...@wm...> - 2022-09-29 14:04:40
|
Hi! On Thu, 29 Sep 2022 08:17:32 +0200, Pere Pujal i Carabantes wrote: >> > 2. The erase operation doesn't stop if the mouse is moving quickly even >> > after both the delete key and the primary mouse button are both released. >> > This can go on indefinitely as far as I can tell as long as the mouse >> > continues to move quickly. >> >> Hrm, it should exit on SDL_MOUSEBUTTONUP, but perhaps if you move very >> quickly some of the events get lost. I'm unable to replicate this, >> though. (And I was REALLY going nuts with my mouse :) ) > >I've reproduced by slowing tuxpaint with valgrind >valgrind ./tuxpaint --1800x1000 > >I found this that seems a different issue, click, hold X, slowly drag and start erasing, >then release X but continue slowly dragging, it still erases. It reproduce also on windows build regardless of the mouse speed. FYI |
From: Mark K. K. <mar...@gm...> - 2022-09-29 22:55:14
|
"x" works great on the Mac. Fixed the quick eraser continuing to quick erase while the mouse is moving -- https://sourceforge.net/p/tuxpaint/tuxpaint/ci/371d9cdbd855939e340e9758efa3d6d586244760/ Thanks, Mark |
From: Bill K. <nb...@so...> - 2022-09-30 06:22:55
|
On Thu, Sep 29, 2022 at 06:54:55PM -0400, Mark K. Kim wrote: > "x" works great on the Mac. > > Fixed the quick eraser continuing to quick erase while the mouse is moving Thanks Mark (and Pere & Shin-ichi)! -bill! |
From: Shin-ichi T. <dol...@wm...> - 2022-09-30 06:41:13
|
Hi! On Thu, 29 Sep 2022 23:22:46 -0700, Bill Kendrick wrote: >On Thu, Sep 29, 2022 at 06:54:55PM -0400, Mark K. Kim wrote: >> "x" works great on the Mac. >> >> Fixed the quick eraser continuing to quick erase while the mouse is moving > >Thanks Mark (and Pere & Shin-ichi)! Afterwhile, I realized that the issue Pere and I reported was different from Mark's one. However, now I think it is all right to let current behavior (continue erasing after releasing "X" key) as it is. -- Shin-ichi TOYAMA <dol...@wm...> |