[PATCH] user32/tests: Add more tests for GetKeyState from background thread.

Rémi Bernon rbernon at codeweavers.com
Fri Feb 5 11:22:43 CST 2021


Please, just ignore this, I'll send an updated version.

I think the two cases where GetKeyState is reportedly failing, are 
actually because the created window steals foreground from the main 
thread even if the main thread calls SetForegroundWindow/SetFocus right 
after.

Adding SetForegroundWindow/SetFocus call in the "background" thread to 
restore focus to the main thread as it's supposed to be, makes 
GetKeyState calls from this background thread catch the key presses even 
if that thread doesn't peek its messages.

My understanding is then that GetKeyState returns some global 
(process-wide?) state, that gets updated by whichever thread is 
foreground as long as this thread peeks its messages, and regardless of 
what the other threads are doing.

I'm also not entirely sure that keybd_event behaves exactly as if a user 
is pressing the keys, but there's some obvious issues with Wine 
implementation nonetheless.
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list