From 246e0c21bed6cf7cf208c1d66e5e79f1a93e2d48 Mon Sep 17 00:00:00 2001
From: Alam Ed Arias <alam@srb2.org>
Date: Tue, 7 Jun 2016 16:59:32 -0400
Subject: [PATCH] SDL2: do not use silly math in rel mode

---
 src/sdl/i_video.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index 16ccbc6f8f..53761f600d 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -749,7 +749,12 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
 			return;
 		}
 
-		if ((evt.x == realwidth/2) && (evt.y == realheight/2))
+		if (!wrapmouseok)
+		{
+			event.data2 = evt.xrel;
+			event.data3 = evt.yrel;
+		}
+		else if ((evt.x == realwidth/2) && (evt.y == realheight/2))
 		{
 			return;
 		}
-- 
GitLab