Commit graph

1407 commits

Author SHA1 Message Date
Rémi Bernon e5c540c59b dinput: Hook window threads instead of the entire prefix.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-16 10:36:47 +01:00
Rémi Bernon 7a2d59fb24 dinput: Forbid acquiring for other process windows.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-16 10:36:47 +01:00
Rémi Bernon aa7a6b8f42 dinput: Use rawinput interface for keyboard device. 2023-02-15 21:48:33 +01:00
Rémi Bernon a75e0d0622 dinput: Merge all acquired device lists together.
This is no longer needed as an optimization.
2023-02-15 21:48:33 +01:00
Rémi Bernon 6e0dd0d8b1 dinput: Merge mouse and rawmouse acquired lists. 2023-02-15 21:48:33 +01:00
Rémi Bernon 5c16cda656 dinput: Avoid entering the hook CS in input_thread_ll_hook_proc. 2023-02-15 21:48:33 +01:00
Rémi Bernon 2d6776e82e dinput: Introduce keyboard_handle_key_event helper. 2023-02-15 21:48:33 +01:00
Rémi Bernon b3aea08c31 dinput: Use a WH_CBT hook instead of WH_CALLWNDPROC.
WH_CALLWNDPROC hooks are called on every message, but we only need it
for the activation messages. WH_CBT hooks are called for a few events
only, which is much lighter, as we need to use a global hook to track
windows which belong to any other thread.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-14 20:57:09 +01:00
Rémi Bernon 20a835a20b dinput: Name input thread message and wparam values.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-14 20:57:09 +01:00
Rémi Bernon 7f9fb63aec dinput: Split dinput_unacquire_window_devices helper.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-14 20:57:09 +01:00
Rémi Bernon e5eeca3843 dinput: Avoid entering hook CS for rawinput messages. 2023-01-30 20:47:34 +01:00
Rémi Bernon 76a138c996 dinput: Use SendMessageW to notify and stop input thread. 2023-01-30 20:47:34 +01:00
Rémi Bernon f3952a3e21 dinput: Move di_em_win_wndproc function around. 2023-01-30 20:47:34 +01:00
Rémi Bernon bf8274edd2 dinput: Move rawinput registration to input_thread_update_device_list. 2023-01-30 20:47:34 +01:00
Rémi Bernon ca2a44bd76 dinput: Move window hook checks to input_thread_update_device_list. 2023-01-30 20:47:33 +01:00
Rémi Bernon 0899dd0bb5 dinput/tests: Dynamically allocate async operation handlers.
Instead of passing them from the stack. The async operation is executed
in a thread pool, which might Release its reference asynchronously and
call a stale function pointer if it is sequenced after the stack
invalidation.
2023-01-30 20:31:18 +01:00
Rémi Bernon 80d1d08787 dinput: Keep track of input thread users using public refcounts.
And start the input thread when first user is created, then stop it when
last user is destroyed.

The thread will not need to enter the hook critical section on stop, as
no public reference are held and devices are already unacquired.
2023-01-27 13:39:07 +01:00
Rémi Bernon 5119753a33 dinput: Unacquire all devices on internal thread error. 2023-01-27 13:39:06 +01:00
Rémi Bernon 7c88cf0f26 dinput: Introduce new dinput_unacquire_window_devices helper. 2023-01-27 13:39:06 +01:00
Rémi Bernon 0a355d8a54 dinput: Cleanup low-level hooks on input thread exit. 2023-01-27 13:39:06 +01:00
Rémi Bernon 721437b436 dinput: Update the device status while holding its CS. 2023-01-27 13:39:06 +01:00
Rémi Bernon 6122dddf4f dinput: Update the input thread device list when notified only. 2023-01-27 13:39:06 +01:00
Rémi Bernon d58055dd7d dinput: Keep a reference on acquired devices while waiting. 2023-01-26 22:05:13 +01:00
Rémi Bernon 5fa11f5fb6 dinput: Keep an internal refcount for dinput devices references. 2023-01-26 22:05:13 +01:00
Rémi Bernon 27e89c5c32 dinput: Introduce new input_thread_update_device_list helper. 2023-01-26 22:05:13 +01:00
Rémi Bernon 35e4a577f0 dinput: Introduce a new struct to keep input thread state. 2023-01-26 22:05:13 +01:00
Rémi Bernon 15c12fd75d dinput: Use an internal refcount on all dinput devices. 2023-01-26 22:05:13 +01:00
Rémi Bernon adbc9ae185 dinput: Rename lpdid local variable to device. 2023-01-25 18:31:03 +01:00
Rémi Bernon 1b7750e448 dinput: Move dinput class implementation to dinput.c. 2023-01-25 18:31:03 +01:00
Rémi Bernon 070e1f5ea8 dinput: Remove unnecessary initialization helpers. 2023-01-25 18:31:03 +01:00
Rémi Bernon 21fa1be53b dinput: Add traces to the ANSI wrappers. 2023-01-25 18:31:03 +01:00
Rémi Bernon 1b3fab9bd4 dinput: Remove outdated and superfluous comments. 2023-01-25 18:31:03 +01:00
Rémi Bernon 36b2f6be52 hidp: Allow match all usages on specific functions only. 2023-01-25 10:16:52 +01:00
Rémi Bernon 4466e2c24c windows.gaming.input: Fix magnitude sign for constant and ramp effects.
The magnitude already carries the sign of X direction. Having a signed
direction will inverse the effective direction. The Y and Z direction
sign and magnitude seem to be ignored.
2023-01-25 10:16:51 +01:00
Rémi Bernon d79075eb07 windows.gaming.input: Fix infinite effect duration scaling. 2023-01-25 10:16:48 +01:00
Rémi Bernon 42082d4d39 dinput: Avoid sending envelope report if it has been removed. 2023-01-25 10:16:48 +01:00
Rémi Bernon 3a0de91ecf dinput/tests: Remove the async cancel tests.
The tests are actually racy, and the async operation is cancellable in
a very short period of time after its creation, but before it started
executing.

This will be hard to test precisely and it's not related to dinput tests
in any way. Let's remove this to fix some spurious Windows failures.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54283
2023-01-13 11:15:02 +01:00
Rémi Bernon 51c73f003f dinput/tests: Test W.G.I condition effect with negative direction. 2023-01-06 13:39:45 +01:00
Rémi Bernon 3a6e527778 dinput/tests: Test W.G.I periodic effect with negative direction. 2023-01-06 13:39:45 +01:00
Rémi Bernon 44799ea3f0 dinput/tests: Test W.G.I constant effect with negative direction. 2023-01-06 13:39:45 +01:00
Rémi Bernon 61c251ac10 dinput/tests: Test W.G.I ramp effect with negative directions. 2023-01-06 13:39:45 +01:00
Rémi Bernon 19fb59eb97 dinput/tests: Reduce tests verbosity. 2023-01-06 13:39:45 +01:00
Tim Clem 055b67ea97 dinput: Add granularity to object_properties.
Return WHEEL_DELTA for the granularity of the mouse z-axis.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53627
2023-01-06 10:42:13 +01:00
Tim Clem 1e6258d26b dinput: Create object_properties for each mouse axis.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53627
2023-01-06 10:42:13 +01:00
Tim Clem b452ebb67c dinput/tests: Test granularity of the mouse z-axis.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53627
2023-01-06 10:42:13 +01:00
Rémi Bernon 11374e7020 dinput/tests: Test dinput force feedback effect envelope removal. 2022-12-21 18:24:39 +01:00
Rémi Bernon d348cf3722 dinput/tests: Test windows.gaming.input infinite effect duration. 2022-12-21 18:24:39 +01:00
Rémi Bernon 735adb9ff4 dinput/tests: Factor async await together with some new helpers. 2022-12-21 18:24:39 +01:00
Rémi Bernon eefc7a86ac dinput/tests: Wait for each device interface to start / stop.
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=53525
2022-12-19 19:27:09 +01:00
Rémi Bernon 2bae0cb5f2 dinput/tests: Add a device count parameter to hid_device_(start|stop). 2022-12-19 19:27:09 +01:00