jb: touch debounce (#798)

## Link to GitHub Issue or related Pull Request, if one exists
n/a

## Description of change
Debouce option for touch input. Applies to all touch handlers (rawinput,
win8, win7) since it sits at the touch layer, and then consumed by jb
touch logic.

## Testing
This commit is contained in:
bicarus
2026-07-13 02:06:54 -07:00
committed by GitHub
parent c255e3a1db
commit 5d25fdb035
9 changed files with 71 additions and 11 deletions
+5
View File
@@ -20,6 +20,7 @@
#include "util/detour.h"
#include "util/libutils.h"
#include "util/logging.h"
#include "util/time.h"
#include "util/utils.h"
#include "handler.h"
@@ -538,6 +539,7 @@ static LRESULT CALLBACK SpiceTouchWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
.x = GET_X_LPARAM(lParam),
.y = GET_Y_LPARAM(lParam),
.mouse = true,
.down_ms = get_performance_milliseconds(),
};
TOUCH_POINTS.push_back(tp);
@@ -851,6 +853,9 @@ void touch_write_points(std::vector<TouchPoint> *touch_points) {
// create new touch point when not found
if (!found) {
// stamp the landing time so debounce can measure the contact's age
tp.down_ms = get_performance_milliseconds();
// add touch point
TOUCH_POINTS.push_back(tp);
+1
View File
@@ -7,6 +7,7 @@ struct TouchPoint {
DWORD id;
LONG x, y;
bool mouse;
double down_ms = 0.0; // performance-counter milliseconds when the contact first landed
};
enum TouchEventType {
TOUCH_DOWN,
+2
View File
@@ -11,6 +11,7 @@
#include "util/libutils.h"
#include "util/logging.h"
#include "util/time.h"
#include "rawinput/touch.h"
// mingw issue #2205 workaround
@@ -177,6 +178,7 @@ void Win7Handler::handle_message(msg_handler_result &result, HWND hWnd, UINT msg
.x = point.x,
.y = point.y,
.mouse = false,
.down_ms = get_performance_milliseconds(),
};
TOUCH_POINTS.push_back(tp);
+2
View File
@@ -12,6 +12,7 @@
#include "util/libutils.h"
#include "util/logging.h"
#include "util/time.h"
#include "rawinput/touch.h"
// mingw does not seem to have this either
@@ -220,6 +221,7 @@ void Win8Handler::handle_message(msg_handler_result &result, HWND hWnd, UINT msg
.x = point.x,
.y = point.y,
.mouse = false,
.down_ms = get_performance_milliseconds(),
};
TOUCH_POINTS.push_back(tp);