summaryrefslogtreecommitdiff
path: root/src/video/sdl_v.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-02-22 23:06:45 +0000
committerfrosch <frosch@openttd.org>2015-02-22 23:06:45 +0000
commit352e528cdab81f1903f13260dedb34d1b113b6e8 (patch)
tree138854a4db9517f6455825ad79acdfbac9151d9d /src/video/sdl_v.cpp
parentfece468d9678fd11ed5435286dd32353c61b1dcc (diff)
downloadopenttd-352e528cdab81f1903f13260dedb34d1b113b6e8.tar.xz
(svn r27167) -Fix: [SDL, Windows] Right-mouse-button scrolling scrolled/jumped way to far, when OpenTTD lagged during mouse event processing.
Diffstat (limited to 'src/video/sdl_v.cpp')
-rw-r--r--src/video/sdl_v.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index d59ab20d4..ea68c2165 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -545,20 +545,8 @@ int VideoDriver_SDL::PollEvent()
switch (ev.type) {
case SDL_MOUSEMOTION:
- if (_cursor.fix_at) {
- int dx = ev.motion.x - _cursor.pos.x;
- int dy = ev.motion.y - _cursor.pos.y;
- if (dx != 0 || dy != 0) {
- _cursor.delta.x = dx;
- _cursor.delta.y = dy;
- SDL_CALL SDL_WarpMouse(_cursor.pos.x, _cursor.pos.y);
- }
- } else {
- _cursor.delta.x = ev.motion.x - _cursor.pos.x;
- _cursor.delta.y = ev.motion.y - _cursor.pos.y;
- _cursor.pos.x = ev.motion.x;
- _cursor.pos.y = ev.motion.y;
- _cursor.dirty = true;
+ if (_cursor.UpdateCursorPosition(ev.motion.x, ev.motion.y, true)) {
+ SDL_CALL SDL_WarpMouse(_cursor.pos.x, _cursor.pos.y);
}
HandleMouseEvents();
break;