Fixed bug 1813 - MouseMotion relative values do not respect renderer LogicalSize
authorSam Lantinga <slouken@libsdl.org>
Sun, 21 Jul 2013 12:54:27 -0700
changeset 749613dfa871f0af
parent 7495 c4ba5e5c2765
child 7497 109f37bca7cc
Fixed bug 1813 - MouseMotion relative values do not respect renderer LogicalSize

driedfruit

A trivial issue, the xrel and yrel values of MouseMotion event struct are not adjusted to renderer logical size.
src/render/SDL_render.c
     1.1 --- a/src/render/SDL_render.c	Sun Jul 21 12:47:47 2013 -0700
     1.2 +++ b/src/render/SDL_render.c	Sun Jul 21 12:54:27 2013 -0700
     1.3 @@ -151,6 +151,16 @@
     1.4              event->motion.y -= renderer->viewport.y;
     1.5              event->motion.x = (int)(event->motion.x / renderer->scale.x);
     1.6              event->motion.y = (int)(event->motion.y / renderer->scale.y);
     1.7 +            if (event->motion.xrel > 0) {
     1.8 +                event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / renderer->scale.x));
     1.9 +            } else if (event->motion.xrel < 0) {
    1.10 +                event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / renderer->scale.x));
    1.11 +            }
    1.12 +            if (event->motion.yrel > 0) {
    1.13 +                event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / renderer->scale.y));
    1.14 +            } else if (event->motion.yrel < 0) {
    1.15 +                event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / renderer->scale.y));
    1.16 +            }
    1.17          }
    1.18      } else if (event->type == SDL_MOUSEBUTTONDOWN ||
    1.19                 event->type == SDL_MOUSEBUTTONUP) {