Ignore sub-pixel mouse motion

To avoid slowdowns due to unnecessary repeated events at the same
pixel location, when using high sample rate, high DPI gaming mouse.

Patch by Pere.  h/t Sadie for reporting the issue & sending a video.
This commit is contained in:
Bill Kendrick 2025-11-09 10:27:01 +00:00
parent cc304b8b5e
commit 8c6f8a9dc3
2 changed files with 22 additions and 10 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2025
Various contributors (see below, and AUTHORS.txt) Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/ https://tuxpaint.org/
2025.September.28 (0.9.36) 2025.November.9 (0.9.36)
* Documentation updates: * Documentation updates:
---------------------- ----------------------
+ Describe where Tux Paint searches for system fonts, + Describe where Tux Paint searches for system fonts,
@ -22,6 +22,17 @@ https://tuxpaint.org/
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
h/t Will Thompson for pointing this out h/t Will Thompson for pointing this out
* Other Improvements:
-------------------
+ Expose SDL2_gfx to Magic Tool plugins
Will Thompson <https://sourceforge.net/u/wjjjjt/profile/>
+ Tux Paint discards sub-pixel mouse motion (which can cause
slow-down when using an input device with very high DPI and
polling rate, e.g. a gaming mouse).
Pere Pujal i Carabantes <perepujal@gmail.com>
h/t Sadie for reporting
* Bug Fixes: * Bug Fixes:
---------- ----------
+ When Magic tools are not grouped ("ungroupmagictools"), + When Magic tools are not grouped ("ungroupmagictools"),
@ -40,12 +51,6 @@ https://tuxpaint.org/
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
h/t Wisdom Lupus h/t Wisdom Lupus
* Other Improvements:
-------------------
+ macOS build updated to remove dependency on libSDLmain.a no longer
required, a holderover from SDL 1.2.
Mark Kim <markuskimius@gmail.com>
* Localization Updates: * Localization Updates:
--------------------- ---------------------
+ French translation + French translation
@ -62,8 +67,9 @@ https://tuxpaint.org/
* Ports & Building: * Ports & Building:
----------------- -----------------
+ Expose SDL2_gfx to Magic Tool plugins + macOS build updated to remove dependency on libSDLmain.a no longer
Will Thompson <https://sourceforge.net/u/wjjjjt/profile/> required, a holderover from SDL 1.2.
Mark Kim <markuskimius@gmail.com>
2025.May.26 (0.9.35) 2025.May.26 (0.9.35)
* New Magic Tools: * New Magic Tools:

View file

@ -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 - June 6, 2025 June 14, 2002 - November 9, 2025
*/ */
#include "platform.h" #include "platform.h"
@ -2691,6 +2691,12 @@ static void mainloop(void)
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
if (event.type == SDL_MOUSEMOTION && oldpos_x == (int)event.motion.x && oldpos_y == (int)event.motion.y)
{
DEBUG_PRINTF("Discarding mouse motion event\n");
break;
}
current_event_time = SDL_GetTicks(); current_event_time = SDL_GetTicks();
/* To avoid getting stuck in a 'catching up with mouse motion' interface lock-up */ /* To avoid getting stuck in a 'catching up with mouse motion' interface lock-up */