Commit Graph

149 Commits

Author SHA1 Message Date
Rémi Bernon 68b6e876f0 server: Create message queue and thread input in get_key_state.
This removes the fallback to desktop async keystate and uses instead the
keystate synchronization logic in all cases.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-26 13:53:29 +02:00
Rémi Bernon f076e5f854 server: Lock thread input keystate whenever it is modified.
And synchronize it with desktop async keystate, on GetKeyState calls,
if it is not locked yet.

Based on a patch from Sebastian Lackner <sebastian@fds-team.de>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-26 13:53:26 +02:00
Rémi Bernon ff74d5c244 server: Create message queue and thread input in set_key_state.
This marks one test case as todo, but it was an outlier, and the 'X' key
state is now wrong in all cases. Overall this makes the tests results
more coherent.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-26 13:53:18 +02:00
Eric Pouech 92b4fa54b0 user32/tests: Finalize migration to long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-18 17:33:20 +01:00
Eric Pouech 2daf3c76fb user32/tests: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 09:32:41 +01:00
Francois Gouget 623f9569fd user32/tests: Fix the keyboard layout id in an ok() message.
The keyboard layout being tested is not the thread's default keyboard
layout.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-19 12:30:09 +02:00
Rémi Bernon acecfc6336 user32/tests: Recreate the window to make it more likely to have focus.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 20:56:10 +02:00
Rémi Bernon 516c7e0dd8 user32/tests: Initialize the cursor position in test_GetRawInputBuffer.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 20:56:08 +02:00
Rémi Bernon 1cfc34551e user32/tests: Skip inconsistent OemKeyScan tests on non-us keyboard.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 20:56:05 +02:00
Rémi Bernon b943a69c1b user32/tests: Add tests for keyboard layout preload list.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-07 22:22:49 +02:00
Rémi Bernon 82211cd478 user32: Remove unnecessary MOUSE / KEYBOARD special cases.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-04 21:33:15 +02:00
Rémi Bernon 6a0eb7a5f2 user32: Set last error codes on GetRawInputDeviceInfoW failure.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-04 21:33:15 +02:00
Rémi Bernon f2759829f8 user32: Use rawinput device handles to identify devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-03 23:20:41 +02:00
Rémi Bernon 60c7823dcb user32/tests: Add more GetKeyboardLayout(Name) tests.
At least on recent Windows, the HKL values are a combination of user
selected UI language in the low word, and keyboard layout id in the high
word.

The keyboard layout id used in HKL is sometimes different from its name,
as returned by GetKeyboardLayoutName, in which case it's the "Layout Id"
value in the corresponding registry key under the layout name.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-27 16:52:30 +02:00
Rémi Bernon 092c7a09a5 user32: Implement SendInput INPUT_HARDWARE check.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-14 21:23:06 +02:00
Rémi Bernon 2f8da3c12a user32/tests: Add more SendInput tests.
Validating that SendInput with INPUT_HARDWARE type should be no-op.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-14 21:23:02 +02:00
Rémi Bernon 5a8bc554ef winex11.drv: Use X11 root-relative coordinates when possible.
Since whole_rect / client_rect are updated asynchronously, there may be
a small lag between X11 and Wine regarding the expected window position.

Then, as events' x and y fields are reported relative to the X11 window
position, this lag can cause inconsistencies when we compute absolute
mouse positions.

Also, applications that control their own position while being moved
cause additional whole_rect / client_rect updates, before X11 knows
about it.

This can make applications like Winamp go nuts when they are being moved
and move all over the place "randomly".

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46309
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-06 22:46:12 +02:00
Rémi Bernon 6d6b420243 user32/tests: Add a test for SetCursorPos / SetWindowPos interactions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-06 22:46:12 +02:00
Rémi Bernon ee7c17c16d user32/tests: Add GetKeyState tests vs SetKeyboardState calls.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-02 22:50:08 +02:00
Rémi Bernon 53a6b55ff6 user32/tests: Repeat each GetKeyState test a few times.
As it changes the results on the second and later iterations.

This shows for instance that without a thread message queue, the first
key press is always missed but then the thread input will follow desktop
async keystate updates.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-02 22:50:04 +02:00
Rémi Bernon c19cba3f03 user32/tests: Factor GetKeyState test checks together.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-02 22:49:59 +02:00
Rémi Bernon 9942948097 user32/tests: Add tests for SetKeyboardState / GetKeyState interactions.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 22:21:13 +01:00
Rémi Bernon 70e67d1d20 user32/tests: Add tests for GetKeyState / GetKeyboardState interactions.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 22:21:13 +01:00
Rémi Bernon e10cf973d5 user32/tests: Add more tests for GetKeyState from background thread.
It looks like that GetKeyState is supposed to catch key presses when
called from a background thread even after its thread message queue and
thread input structures have been created.

This happens in Bioshock 2 Remaster, and causes the game to stay forever
on a "Press space to continue" screen, as the thread checking for space
key press calls GetKeyState repeatedly (and PeekMessage), although it's
in background.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 22:21:13 +01:00
Francois Gouget 9468e7617c user32/tests: Fix the spelling of a win_skip() message.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-25 22:51:35 +01:00
Arkadiusz Hiler f7edc32818 user32: Implement GetMouseMovePointsEx().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36873
Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-13 22:37:16 +02:00
Rémi Bernon 1e7378d80c user32: Implement GetRegisteredRawInputDevices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-13 21:17:11 +02:00
Rémi Bernon a3aa9ae80a user32/tests: Add basic GetRegisteredRawInputDevices tests.
There's already some in dinput, but this is a more appropriate location.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-13 21:15:38 +02:00
Rémi Bernon e0e3b6bc91 user32: Use WM_INPUT message hw_id as RAWINPUT handle.
This fixes the GetRawInputData regression introduced with
359ee2ecc2 where the message data couldn't
be read twice, while keeping the overwrite logic it introduced.

This also adds some SetLastError to fix some unit tests todos.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49522
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 22:24:39 +02:00
Rémi Bernon b58a899acc user32/tests: Add more GetRawInputData tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 22:24:36 +02:00
Rémi Bernon 359ee2ecc2 user32: Return failure when rawinput has been overwritten.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 21:07:37 +02:00
Rémi Bernon 3a9edf9aad user32: Implement GetRawInputBuffer.
CoD: WWII uses it to read mouse motion instead of listening to WM_INPUT
messages.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 21:07:37 +02:00
Rémi Bernon 083cb5c783 user32/tests: Add GetRawInputBuffer tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 21:06:52 +02:00
Rémi Bernon 27a52d0414 server: Implement RegisterRawInputDevices RIDEV_INPUTSINK flag.
This flag allows applications to receive rawinput messages while in
background. They have to specify a target hwnd, which will receive them,
and the messages will carry a RIM_INPUTSINK wparam if the process wasn't
foreground.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Rémi Bernon 8cf7fe3b7c server: Implement RegisterRawInputDevices RIDEV_NOLEGACY flag.
This makes legacy mouse window messages such as WM_MOUSEMOVE and others,
to stop being sent, including to low-level hooks. The desktop mouse
state should still be udpated.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Rémi Bernon 57124b9905 server: Implement rawinput inter-process message dispatch.
This delivers the rawinput messages to the correct process, regardless
of where the input was received.

As for now RIDEV_INPUTSINK is still not implemented, this only fixes
the case where input is injected in a background process and where it
should not receive rawinput -as in the test- or when cursor moves over
a background window and the foreground process should have received
rawinput messages.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Rémi Bernon 5daf0efbfe user32/tests: Add inter-desktop rawinput message tests.
Another thread is created to execute the tests, for SetThreadDesktop to
succeed consistently. It seems to fail spuriously if it is called from
a thread that already created some windows before.

This shows that rawinput messages may be dispatched across desktops,
but only if the subscribing process has a window in the input desktop,
and it is the foreground process (even if the target window may be in
another desktop).

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Huw Davies afe3e698c5 user32/tests: Use skip() to skip tests when using a non-US keyboard.
Otherwise, under Wine, win_skip() counts as a failure.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-24 18:34:15 +02:00
Rémi Bernon bc282905d9 user32/tests: Add RIM_EXINPUTSINK rawinput message tests.
When RIM_EXINPUTSINK is used, messages are received in background
only if the foreground process didn't register for rawinput messages
itself.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 22:45:20 +02:00
Rémi Bernon df5d632324 user32/tests: Add inter-process rawinput message tests.
Rawinput messages are not received anymore if the foreground window is
from another process. Using RIDEV_INPUTSINK makes it possible to receive
them again, but with RIM_INPUTSINK flag.

When multiple processes register for rawinput messages, the foreground
process will receive the message, as well as any other that registerd
with RIM_INPUTSINK flag, including when the foreground process itself
did.

Currently the messages may be received correctly, but that depends on
where the input events are generated, so add another test case with
messages sent from the test process, and validate that nothing should
be received.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 22:45:17 +02:00
Rémi Bernon 8c7c0c5504 user32/tests: Add inter-thread rawinput message tests.
The rawinput messages are received on the target window if is from the
same process as the foreground window, it doesn't need to be the
foreground window itself, or use RIDEV_INPUTSINK.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 22:45:15 +02:00
Rémi Bernon 36a74a7002 user32/tests: Add basic rawinput message tests.
This tests basic functionality by injecting mouse event and checking
the number of each messages received.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 22:45:11 +02:00
Arkadiusz Hiler 65e550d265 user32: Fix NULL dereference in UnregisterDeviceNotification.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49211
Signed-off-by: Arkadiusz Hiler <arek@hiler.eu>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-27 21:09:21 +02:00
Markus Engel ace37a68b7 user32/tests: Add more tests for GetKeyState().
Signed-off-by: Markus Engel <markus_wine@familie-engel.online>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 22:03:52 +02:00
Zebediah Figura 19c6524e48 user32: Also scan for mouse devices in GetRawInputDeviceList().
Halo: Spartan Strike attempts to discover input devices using rawinput. It
expects to be able to open at least one device file with a zero access mask. It
does not perform any other operations on the file.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-10 12:42:30 +02:00
Serge Gautherie 7770e26f2d include: Remove now useless forced _WIN32_IE defines.
Signed-off-by: Serge Gautherie <winehq-git_serge_180711@gautherie.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-20 19:38:38 +01:00
Derek Lesho 11ef39af39 users/tests: Test scan code prefix for MAPVK_VK_TO_VSC_EX.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-02 22:02:56 +01:00
Rémi Bernon 9099b9843f user32/tests: Wait and flush messages after window creation.
The window created in the separate thread in test_Input_mouse sometimes
fails to catch the mouse input in time. Waiting and flushing the initial
messages seems to make the issue harder to reproduce.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-05 16:46:59 +01:00
Andrew Eikum 6d7828e8df user32: Support RIDI_PREPARSEDDATA in GetRawInputDeviceInfo.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-04 22:43:01 +01:00
Andrew Eikum 4a58d67106 user32/tests: Move rawinput tests into input.c.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-04 22:43:01 +01:00