(svn r27167) -Fix: [SDL, Windows] Right-mouse-button scrolling scrolled/jumped way to far, when OpenTTD lagged during mouse event processing.
This commit is contained in:
@@ -388,22 +388,10 @@ static void PollEvent()
|
||||
}
|
||||
|
||||
/* Mouse movement */
|
||||
int dx = mouse_x - _cursor.pos.x;
|
||||
int dy = mouse_y - _cursor.pos.y;
|
||||
if (dx != 0 || dy != 0) {
|
||||
if (_cursor.fix_at) {
|
||||
_cursor.delta.x = dx;
|
||||
_cursor.delta.y = dy;
|
||||
position_mouse(_cursor.pos.x, _cursor.pos.y);
|
||||
} else {
|
||||
_cursor.delta.x = dx;
|
||||
_cursor.delta.y = dy;
|
||||
_cursor.pos.x = mouse_x;
|
||||
_cursor.pos.y = mouse_y;
|
||||
_cursor.dirty = true;
|
||||
}
|
||||
mouse_action = true;
|
||||
if (_cursor.UpdateCursorPosition(mouse_x, mouse_y, false)) {
|
||||
position_mouse(_cursor.pos.x, _cursor.pos.y);
|
||||
}
|
||||
if (_cursor.delta.x != 0 || _cursor.delta.y) mouse_action = true;
|
||||
|
||||
static int prev_mouse_z = 0;
|
||||
if (prev_mouse_z != mouse_z) {
|
||||
|
@@ -362,22 +362,8 @@ static void QZ_DoUnsidedModifiers(unsigned int newMods)
|
||||
|
||||
static void QZ_MouseMovedEvent(int x, int y)
|
||||
{
|
||||
if (_cursor.fix_at) {
|
||||
int dx = x - _cursor.pos.x;
|
||||
int dy = y - _cursor.pos.y;
|
||||
|
||||
if (dx != 0 || dy != 0) {
|
||||
_cursor.delta.x += dx;
|
||||
_cursor.delta.y += dy;
|
||||
|
||||
QZ_WarpCursor(_cursor.pos.x, _cursor.pos.y);
|
||||
}
|
||||
} else {
|
||||
_cursor.delta.x = x - _cursor.pos.x;
|
||||
_cursor.delta.y = y - _cursor.pos.y;
|
||||
_cursor.pos.x = x;
|
||||
_cursor.pos.y = y;
|
||||
_cursor.dirty = true;
|
||||
if (_cursor.UpdateCursorPosition(x, y, false)) {
|
||||
QZ_WarpCursor(_cursor.pos.x, _cursor.pos.y);
|
||||
}
|
||||
HandleMouseEvents();
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -747,25 +747,11 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, (TIMERPROC)TrackMouseTimerProc);
|
||||
}
|
||||
|
||||
if (_cursor.fix_at) {
|
||||
int dx = x - _cursor.pos.x;
|
||||
int dy = y - _cursor.pos.y;
|
||||
if (dx != 0 || dy != 0) {
|
||||
_cursor.delta.x = dx;
|
||||
_cursor.delta.y = dy;
|
||||
|
||||
pt.x = _cursor.pos.x;
|
||||
pt.y = _cursor.pos.y;
|
||||
|
||||
ClientToScreen(hwnd, &pt);
|
||||
SetCursorPos(pt.x, pt.y);
|
||||
}
|
||||
} else {
|
||||
_cursor.delta.x = x - _cursor.pos.x;
|
||||
_cursor.delta.y = y - _cursor.pos.y;
|
||||
_cursor.pos.x = x;
|
||||
_cursor.pos.y = y;
|
||||
_cursor.dirty = true;
|
||||
if (_cursor.UpdateCursorPosition(x, y, true)) {
|
||||
pt.x = _cursor.pos.x;
|
||||
pt.y = _cursor.pos.y;
|
||||
ClientToScreen(hwnd, &pt);
|
||||
SetCursorPos(pt.x, pt.y);
|
||||
}
|
||||
MyShowCursor(false);
|
||||
HandleMouseEvents();
|
||||
|
Reference in New Issue
Block a user