summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/gui.cpp13
-rw-r--r--src/gui/gui.h5
-rw-r--r--src/touchactions.cpp4
3 files changed, 18 insertions, 4 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index e243bfc27..13290975a 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -89,6 +89,10 @@ Gui::Gui(Graphics *const graphics) :
mMouseCursorAlpha(1.0f),
mMouseInactivityTimer(0),
mCursorType(Cursor::CURSOR_POINTER),
+#ifdef ANDROID
+ mLastMouseRealX(0),
+ mLastMouseRealY(0),
+#endif
mFocusListeners(),
mCustomCursor(false)
{
@@ -687,6 +691,10 @@ void Gui::handleMouseInput()
if (touchManager.processEvent(mouseInput))
{
+#ifdef ANDROID
+ SDL_WarpMouse(mLastMouseX, mLastMouseY,
+ mLastMouseRealX, mLastMouseRealY);
+#endif
mMouseInactivityTimer = 0;
continue;
}
@@ -695,7 +703,10 @@ void Gui::handleMouseInput()
// changes or modal mouse input focus changes.
mLastMouseX = mouseInput.getX();
mLastMouseY = mouseInput.getY();
-
+#ifdef ANDROID
+ mLastMouseRealX = mouseInput.getRealX();
+ mLastMouseRealY = mouseInput.getRealY();
+#endif
switch (mouseInput.getType())
{
case gcn::MouseInput::PRESSED:
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 477e93d6d..d14198d97 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -173,7 +173,10 @@ class Gui final : public gcn::Gui
float mMouseCursorAlpha;
int mMouseInactivityTimer;
int mCursorType;
-
+#ifdef ANDROID
+ uint16_t mLastMouseRealX;
+ uint16_t mLastMouseRealY;
+#endif
typedef std::list<gcn::FocusListener*> FocusListenerList;
typedef FocusListenerList::iterator FocusListenerIterator;
FocusListenerList mFocusListeners;
diff --git a/src/touchactions.cpp b/src/touchactions.cpp
index d969c8bc2..5115ec6c2 100644
--- a/src/touchactions.cpp
+++ b/src/touchactions.cpp
@@ -104,7 +104,7 @@ static void moveChar(int x, int y)
impHandler(padClick)
{
- moveChar(mouseInput.getTouchX(), mouseInput.getTouchY());
+ moveChar(mouseInput.getX(), mouseInput.getY());
padClicked = true;
}
@@ -113,7 +113,7 @@ impHandler(padEvents)
if (mouseInput.getType() == gcn::MouseInput::MOVED)
{
if (padClicked)
- moveChar(mouseInput.getTouchX(), mouseInput.getTouchY());
+ moveChar(mouseInput.getX(), mouseInput.getY());
}
}