https://bugs.winehq.org/show_bug.cgi?id=48946
--- Comment #11 from RĂ©mi Bernon rbernon@codeweavers.com --- The code iterates the process list on every rawinput message to see which one is interested. Then, every process can register for rawinput message and may specify a target window, or let the system send the message to the foreground window if it belongs to the given process.
The first implements that by getting the target thread for the device (either the owner of the target window, or the foreground thread), then it compares with the process that is currently checked, and if the thread is from another process bails out - this other process will get its own iteration step and receive the message if it is interested.
Then, the second if implements a different check where, if the target thread is not from the foreground process (the process to which belongs the foreground window), then we should only sent the messages if a specific flag is used, which is first unimplemented -not supporting RIDEV_INPUTSINK flag / WM_INPUTSINK messages, and then later implemented in a different patch series.