Skip to content

Commit

Permalink
fix #6046 #5326 #5222 #4663
Browse files Browse the repository at this point in the history
one small step for Spring
  • Loading branch information
rt committed Sep 29, 2018
1 parent 5b91dd8 commit 9e82927
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rts/Game/UI/MouseHandler.cpp
Expand Up @@ -216,6 +216,14 @@ void CMouseHandler::MouseMove(int x, int y, int dx, int dy)
lastx = std::abs(x);
lasty = std::abs(y);

// switching to MMB-mode while user is moving mouse can generate
// a spurious event in the opposite direction (if cursor happens
// to pass the center pixel) which would cause a camera position
// jump, so always ignore one SDL_MOUSEMOTION after entering it
dx *= (1 - ignoreMove);
dy *= (1 - ignoreMove);

ignoreMove = false;
// MouseInput passes negative coordinates when cursor leaves the window
offscreen = (x < 0 && y < 0);

Expand Down Expand Up @@ -691,6 +699,7 @@ void CMouseHandler::ToggleMiddleClickScroll()

locked = !locked;
mmbScroll = !mmbScroll;
ignoreMove = mmbScroll;
}


Expand Down
1 change: 1 addition & 0 deletions rts/Game/UI/MouseHandler.h
Expand Up @@ -109,6 +109,7 @@ class CMouseHandler
bool hwHideCursor = true;
bool hardwareCursor = false;
bool invertMouse = false;
bool ignoreMove = false;

float cursorScale = 1.0f;
float dragScrollThreshold = 0.0f;
Expand Down

0 comments on commit 9e82927

Please sign in to comment.