BACKENDS: Fix missing mouse events when system cursor cannot be moved

Normally with SDL, a mouse motion event will be sent after the
system mouse cursor has been moved by a call to
SDL_WarpMouseInWindow, but if the system cursor cannot be moved
(e.g. because the window does not have mouse focus), games still
need to receive these mouse events so they can successfully update
the mouse position internally. Otherwise, games continue to think
the mouse is still in the original position and will continue to
try to perform whatever action is associated with that mouse
position.

Refs Trac#9689.
This commit is contained in:
Colin Snover 2017-09-15 22:59:18 -05:00
parent cd538ffffa
commit d1b77d4b68
10 changed files with 80 additions and 7 deletions

View file

@ -212,6 +212,13 @@ bool SdlGraphicsManager::notifyMousePosition(Common::Point &mouse) {
return valid;
}
void SdlGraphicsManager::setSystemMousePosition(const int x, const int y) {
assert(_window);
if (!_window->warpMouseInWindow(x, y)) {
_eventSource->fakeWarpMouse(x, y);
}
}
void SdlGraphicsManager::handleResizeImpl(const int width, const int height) {
_eventSource->resetKeyboardEmulation(width - 1, height - 1);
_forceRedraw = true;