Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Date: Sat, 06 Dec 2008 15:27:00 +0100
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
slouken committed Dec 6, 2008
1 parent acc413d commit 5cf74ed
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/events/SDL_mouse.c
Expand Up @@ -433,9 +433,15 @@ SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure)
}

/* 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) {
Expand Down

0 comments on commit 5cf74ed

Please sign in to comment.