Files
spice2x.github.io/src/spice2x/touch/native/inject_internal.h
T
bicarus bd2fbfcb67 touch: restore wintouchemu, fall back to it when native touch hooks fail (#834)
## Link to GitHub Issue or related Pull Request, if one exists
Fixes #833

## Description of change
Last couple PRs - such as #820 #827 #828 - made the native touch hook &
touch injection using `InjectTouchInput` the default path, since it
performs much more reliably with both real touch screens and mouse (or
any other synthetic source).

However, user has reported that WINE lacks `InjectTouchInput` which
means this won't work.

As a fix, revive the old wintouchemu code. Native touch is still the
default, but under following circumstances:

1. if `-touchemuforce` is set, or
2. if any of the required Windows touch APIs are unavailable

then we fail over from native touch to wintouchemu code. 

For Linux, condition #2 would be hit during init, and gracefully switch
over.

Caveat: the poke code for IIDX and Nost will continue to require native
touch, I do not want to maintain two paths for this. This means that
iidx poke will stop working on Linux, unfortunately.

## Testing
Tested on Windows with `-touchemuforce` set. This is mostly reverting
Linux code path back to where we were last release, so this should just
work with wine.
2026-07-26 04:29:45 -07:00

32 lines
931 B
C++

#pragma once
#include <windows.h>
namespace nativetouch::inject {
enum class ContactOwner {
None,
Mouse,
Synthetic,
};
bool initialize_touch_injection();
void initialize_synthetic_touch();
void refresh_contact_lifetime();
bool contact_is_active();
bool contact_is_owned_by(ContactOwner owner, HWND window);
bool begin_contact(
ContactOwner owner,
HWND window,
POINT position,
bool transform_returned_coordinates);
bool update_contact(ContactOwner owner, HWND window, POINT position);
void set_contact_timer(ContactOwner owner, HWND window, UINT_PTR timer_id);
bool release_active_contact();
HWND get_injection_window();
bool handle_mouse_message(HWND window, UINT message, WPARAM w_param);
bool handle_synthetic_message(HWND window, UINT message, WPARAM w_param, LPARAM l_param);
}