Date: Sat, 06 Dec 2008 15:27:00 +0100
authorSam Lantinga
Sat, 06 Dec 2008 17:50:50 +0000
changeset 284297ba0be8b565
parent 2841 483f85e35a1a
child 2843 e919f2e3700d
Date: Sat, 06 Dec 2008 15:27:00 +0100
From: Couriersud
Subject: SDL: Relative mouse movements

The patch below will reenable processing of relative mouse movements.
The DirectFB drivers generates those in "grabbed" mode. These ensure,
that even in fullscreen mode relative movements are reported. SDLMAME
depends on this for games with trackballs.

Looking at the code I ask myself whether relative movements should be
handled in the drivers (x11, directfb). Both x11 and directfb are able
to report relative movements. This would leave it to the driver to use
the most appropriate method for relative movements when at the border of
a fullscreen window or being "grabbed".
src/events/SDL_mouse.c
     1.1 --- a/src/events/SDL_mouse.c	Sat Dec 06 17:46:55 2008 +0000
     1.2 +++ b/src/events/SDL_mouse.c	Sat Dec 06 17:50:50 2008 +0000
     1.3 @@ -433,9 +433,15 @@
     1.4      }
     1.5  
     1.6      /* the relative motion is calculated regarding the system cursor last position */
     1.7 -
     1.8 -    xrel = x - last_x;
     1.9 -    yrel = y - last_y;
    1.10 +    if (relative) {
    1.11 +        xrel = x;
    1.12 +        yrel = y;
    1.13 +        x = (last_x + x);
    1.14 +        y = (last_y + y);
    1.15 +    } else {
    1.16 +        xrel = x - last_x;
    1.17 +        yrel = y - last_y;
    1.18 +    }
    1.19  
    1.20      /* Drop events that don't change state */
    1.21      if (!xrel && !yrel) {