Touch support reworked
This commit is contained in:
+7
-5
@@ -261,8 +261,8 @@ long OpenTxSim::onMouseDown(FXObject *, FXSelector, void * v)
|
|||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
touchState.event = TE_DOWN;
|
touchState.event = TE_DOWN;
|
||||||
touchState.startX = touchState.lastX = touchState.x = evt->win_x;
|
touchState.startX = touchState.x = evt->win_x;
|
||||||
touchState.startY = touchState.lastY = touchState.y = evt->win_y;
|
touchState.startY = touchState.y = evt->win_y;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -278,8 +278,8 @@ long OpenTxSim::onMouseUp(FXObject*,FXSelector,void*v)
|
|||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
if (touchState.event == TE_DOWN) {
|
if (touchState.event == TE_DOWN) {
|
||||||
touchState.event = TE_UP;
|
touchState.event = TE_UP;
|
||||||
touchState.x = evt->win_x;
|
touchState.x = touchState.startX;
|
||||||
touchState.y = evt->win_y;
|
touchState.y = touchState.startY;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
touchState.event = TE_NONE;
|
touchState.event = TE_NONE;
|
||||||
@@ -298,7 +298,9 @@ long OpenTxSim::onMouseMove(FXObject*,FXSelector,void*v)
|
|||||||
TRACE_WINDOWS("[Mouse Move] %d %d", evt->win_x, evt->win_y);
|
TRACE_WINDOWS("[Mouse Move] %d %d", evt->win_x, evt->win_y);
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
if (touchState.event == TE_SLIDE || abs(evt->win_x - touchState.x) > 5 || abs(evt->win_y - touchState.y) > 5) {
|
touchState.deltaX += evt->win_x - touchState.x;
|
||||||
|
touchState.deltaY += evt->win_y - touchState.y;
|
||||||
|
if (touchState.event == TE_SLIDE || abs(touchState.deltaX) >= SLIDE_RANGE || abs(touchState.deltaY) >= SLIDE_RANGE) {
|
||||||
touchState.event = TE_SLIDE;
|
touchState.event = TE_SLIDE;
|
||||||
touchState.x = evt->win_x;
|
touchState.x = evt->win_x;
|
||||||
touchState.y = evt->win_y;
|
touchState.y = evt->win_y;
|
||||||
|
|||||||
@@ -812,3 +812,12 @@ void check_intmodule_heartbeat()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool touchPanelEventOccured()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void touchPanelRead()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 50e9396fc0...92929584ee
+7
-8
@@ -32,14 +32,13 @@ enum TouchEvent
|
|||||||
|
|
||||||
struct TouchState
|
struct TouchState
|
||||||
{
|
{
|
||||||
unsigned char event;
|
unsigned char event;
|
||||||
short x;
|
short x;
|
||||||
short y;
|
short y;
|
||||||
short startX;
|
short startX;
|
||||||
short startY;
|
short startY;
|
||||||
short lastX;
|
short deltaX;
|
||||||
short lastY;
|
short deltaY;
|
||||||
uint32_t time;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr uint8_t SLIDE_RANGE = 6;
|
constexpr uint8_t SLIDE_RANGE = 6;
|
||||||
|
|||||||
Reference in New Issue
Block a user