[Scummvm-git-logs] scummvm master -> fb50d5934d982d5670233d0455f76cb73ccdaa27
criezy
criezy at scummvm.org
Wed Feb 15 00:05:38 CET 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fb50d5934d SDL: Fix jerky/laggy analog joystick mouse control
Commit: fb50d5934d982d5670233d0455f76cb73ccdaa27
https://github.com/scummvm/scummvm/commit/fb50d5934d982d5670233d0455f76cb73ccdaa27
Author: rsn8887 (rsn8887 at users.noreply.github.com)
Date: 2017-02-14T23:05:34Z
Commit Message:
SDL: Fix jerky/laggy analog joystick mouse control
This fixes bug 6996: Android: Mouse pointer control with
analog joystick is unusable
Changed paths:
backends/events/sdl/sdl-events.cpp
backends/events/sdl/sdl-events.h
backends/events/wincesdl/wincesdl-events.cpp
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 5fb66a7..832fa36 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -179,11 +179,16 @@ void SdlEventSource::processMouseEvent(Common::Event &event, int x, int y) {
_km.y = y;
}
-void SdlEventSource::handleKbdMouse() {
+void SdlEventSource::handleKbdMouse(Common::Event &event) {
+
// Skip recording of these events
uint32 curTime = g_system->getMillis(true);
if (curTime >= _km.last_time + _km.delay_time) {
+
+ int16 oldKmX = _km.x;
+ int16 oldKmY = _km.y;
+
_km.last_time = curTime;
if (_km.x_down_count == 1) {
_km.x_down_time = curTime;
@@ -248,6 +253,11 @@ void SdlEventSource::handleKbdMouse() {
if (_graphicsManager) {
_graphicsManager->getWindow()->warpMouseInWindow((Uint16)_km.x, (Uint16)_km.y);
}
+
+ if (_km.x != oldKmX || _km.y != oldKmY) {
+ event.type = Common::EVENT_MOUSEMOVE;
+ processMouseEvent(event, _km.x, _km.y);
+ }
}
}
}
@@ -425,7 +435,8 @@ Common::KeyCode SdlEventSource::SDLToOSystemKeycode(const SDLKey key) {
}
bool SdlEventSource::pollEvent(Common::Event &event) {
- handleKbdMouse();
+ handleKbdMouse(event);
+
#if SDL_VERSION_ATLEAST(2, 0, 0)
// In case we still need to send a key up event for a key down from a
diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index c436994..032ad72 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -106,7 +106,7 @@ protected:
virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
- virtual void handleKbdMouse();
+ virtual void handleKbdMouse(Common::Event &event);
//@}
diff --git a/backends/events/wincesdl/wincesdl-events.cpp b/backends/events/wincesdl/wincesdl-events.cpp
index d3141ee..2fcd794 100644
--- a/backends/events/wincesdl/wincesdl-events.cpp
+++ b/backends/events/wincesdl/wincesdl-events.cpp
@@ -69,7 +69,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) {
memset(&event, 0, sizeof(Common::Event));
- handleKbdMouse();
+ handleKbdMouse(event);
// If the screen changed, send an Common::EVENT_SCREEN_CHANGED
int screenID = _graphicsMan->getScreenChangeID();
More information about the Scummvm-git-logs
mailing list