|
@@ -20,6 +20,7 @@
|
|
|
#include "../gui/CGuiHandler.h"
|
|
|
#include "../gui/EventDispatcher.h"
|
|
|
#include "../gui/MouseButton.h"
|
|
|
+#include "../gui/WindowHandler.h"
|
|
|
|
|
|
#include <SDL_events.h>
|
|
|
#include <SDL_hints.h>
|
|
@@ -100,8 +101,10 @@ void InputSourceTouch::handleEventFingerDown(const SDL_TouchFingerEvent & tfinge
|
|
|
{
|
|
|
if(tfinger.x > 0.5)
|
|
|
{
|
|
|
- MouseButton button = tfinger.y < 0.5 ? MouseButton::RIGHT : MouseButton::LEFT;
|
|
|
- GH.events().dispatchMouseButtonPressed(button, GH.getCursorPosition());
|
|
|
+ if (tfinger.y < 0.5)
|
|
|
+ GH.events().dispatchShowPopup(GH.getCursorPosition());
|
|
|
+ else
|
|
|
+ GH.events().dispatchMouseLeftButtonPressed(GH.getCursorPosition());
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -138,8 +141,10 @@ void InputSourceTouch::handleEventFingerUp(const SDL_TouchFingerEvent & tfinger)
|
|
|
{
|
|
|
if(tfinger.x > 0.5)
|
|
|
{
|
|
|
- MouseButton button = tfinger.y < 0.5 ? MouseButton::RIGHT : MouseButton::LEFT;
|
|
|
- GH.events().dispatchMouseButtonReleased(button, GH.getCursorPosition());
|
|
|
+ if (tfinger.y < 0.5)
|
|
|
+ GH.events().dispatchClosePopup(GH.getCursorPosition());
|
|
|
+ else
|
|
|
+ GH.events().dispatchMouseLeftButtonReleased(GH.getCursorPosition());
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -151,8 +156,8 @@ void InputSourceTouch::handleEventFingerUp(const SDL_TouchFingerEvent & tfinger)
|
|
|
case TouchState::TAP_DOWN_SHORT:
|
|
|
{
|
|
|
GH.input().setCursorPosition(convertTouchToMouse(tfinger));
|
|
|
- GH.events().dispatchMouseButtonPressed(MouseButton::LEFT, convertTouchToMouse(tfinger));
|
|
|
- GH.events().dispatchMouseButtonReleased(MouseButton::LEFT, convertTouchToMouse(tfinger));
|
|
|
+ GH.events().dispatchMouseLeftButtonPressed(convertTouchToMouse(tfinger));
|
|
|
+ GH.events().dispatchMouseLeftButtonReleased(convertTouchToMouse(tfinger));
|
|
|
state = TouchState::IDLE;
|
|
|
break;
|
|
|
}
|
|
@@ -186,7 +191,7 @@ void InputSourceTouch::handleEventFingerUp(const SDL_TouchFingerEvent & tfinger)
|
|
|
if (SDL_GetNumTouchFingers(tfinger.touchId) == 0)
|
|
|
{
|
|
|
GH.input().setCursorPosition(convertTouchToMouse(tfinger));
|
|
|
- GH.events().dispatchMouseButtonReleased(MouseButton::RIGHT, convertTouchToMouse(tfinger));
|
|
|
+ GH.events().dispatchClosePopup(convertTouchToMouse(tfinger));
|
|
|
state = TouchState::IDLE;
|
|
|
}
|
|
|
break;
|
|
@@ -201,8 +206,10 @@ void InputSourceTouch::handleUpdate()
|
|
|
uint32_t currentTime = SDL_GetTicks();
|
|
|
if (currentTime > lastTapTimeTicks + params.longPressTimeMilliseconds)
|
|
|
{
|
|
|
- state = TouchState::TAP_DOWN_LONG;
|
|
|
- GH.events().dispatchMouseButtonPressed(MouseButton::RIGHT, GH.getCursorPosition());
|
|
|
+ GH.events().dispatchShowPopup(GH.getCursorPosition());
|
|
|
+
|
|
|
+ if (GH.windows().isTopWindowPopup())
|
|
|
+ state = TouchState::TAP_DOWN_LONG;
|
|
|
}
|
|
|
}
|
|
|
}
|