[RFC] Listening to keyboard in background, RawInput and DInput

Rémi Bernon rbernon at codeweavers.com
Mon Aug 26 10:01:32 CDT 2019


On 8/23/19 2:23 PM, Gabriel Ivăncescu wrote:
> Hi Rémi,
> 
> I don't know much about the input thing, but do you know what Windows 
> does when you Alt-Tab? Does it send Alt release immediately to the 
> window, or when you actually release it? (even without focus)

It sends the release event for the Alt key when you release it. If you 
don't have focus, then you can only see that with the low-level hooks or 
the raw input messages if you ask for background events.

> If it's the former, I guess one easy way would be to simply release all 
> keys that are pressed when they keyboard is grabbed. Not sure if X11 has 
> such a notification facility.
> 
> But I'm pretty sure you already looked into this and turned out it's 
> more complicated than that. :-)
I think that faking the keyboard state so that this particular issue 
doesn't happen isn't a very good solution. You can easily create a 
windows application with low-level hooks, raw input messages or even 
dinput that monitors the keyboard while the window is in background, and 
wine should send the correct messages in all cases.

Until now, no application was actually doing that so I guess it was OK 
not to send the expected messages. But there's now one application that 
expects the dinput keyboard state to be kept up-to-date on focus 
lost/gain (Warhammer: Chaosbane, to put a name on it), and I think we 
can and should implement it the right way.

Also, here it's about a key not being seen as released when it is, but 
it could very well be the other way around.
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list