# HG changeset patch # User Sam Lantinga # Date 1228585850 0 # Node ID 97ba0be8b565b99e1108eedae265a73fdf615f6e # Parent 483f85e35a1adb7aceb5ff9be78badba70bd2ea9 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". diff -r 483f85e35a1a -r 97ba0be8b565 src/events/SDL_mouse.c --- a/src/events/SDL_mouse.c Sat Dec 06 17:46:55 2008 +0000 +++ b/src/events/SDL_mouse.c Sat Dec 06 17:50:50 2008 +0000 @@ -433,9 +433,15 @@ } /* the relative motion is calculated regarding the system cursor last position */ - - xrel = x - last_x; - yrel = y - last_y; + if (relative) { + xrel = x; + yrel = y; + x = (last_x + x); + y = (last_y + y); + } else { + xrel = x - last_x; + yrel = y - last_y; + } /* Drop events that don't change state */ if (!xrel && !yrel) {