mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
SDL: Fix jerky/laggy analog joystick mouse control
This fixes bug 6996: Android: Mouse pointer control with analog joystick is unusable
This commit is contained in:
parent
8c13a263ae
commit
fb50d5934d
@ -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
|
||||
|
@ -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);
|
||||
|
||||
//@}
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user