From 2f1c89006ea19cd68a8d55c1eecbc9fd08933291 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 16 Feb 2015 17:35:45 -0400 Subject: [PATCH] Slightly more robust hack to work around SDL's touch coordinate issues in Linux. --HG-- branch : minor --- src/modules/event/sdl/Event.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/event/sdl/Event.cpp b/src/modules/event/sdl/Event.cpp index 79f2b9667..3d6923d2f 100644 --- a/src/modules/event/sdl/Event.cpp +++ b/src/modules/event/sdl/Event.cpp @@ -145,6 +145,10 @@ Message *Event::convert(const SDL_Event &e) const love::touch::Touch::TouchInfo touchinfo; #endif +#ifdef LOVE_LINUX + static bool touchNormalizationBug = false; +#endif + switch (e.type) { case SDL_KEYDOWN: @@ -251,8 +255,9 @@ Message *Event::convert(const SDL_Event &e) const #ifdef LOVE_LINUX // FIXME: hacky workaround for SDL not normalizing touch coordinates in // its X11 backend: https://bugzilla.libsdl.org/show_bug.cgi?id=2307 - if (fabs(touchinfo.x) >= 1.5 || fabs(touchinfo.y) >= 1.5 || fabs(touchinfo.dx) >= 1.5 || fabs(touchinfo.dy) >= 1.5) + if (touchNormalizationBug || fabs(touchinfo.x) >= 1.5 || fabs(touchinfo.y) >= 1.5 || fabs(touchinfo.dx) >= 1.5 || fabs(touchinfo.dy) >= 1.5) { + touchNormalizationBug = true; windowToPixelCoords(&touchinfo.x, &touchinfo.y); windowToPixelCoords(&touchinfo.dx, &touchinfo.dy); }