On Tue Jun 4 14:16:57 2024 +0000, Alexandros Frantzis wrote:
Looks like get_global_hooks only uses the thread to get its desktop.
Maybe pass the desktop to get_first_global_hook and remove then unnecessary use of get_global_hooks? Done in v2.
I don't think RIDEV_NOLEGACY handling is really correct anyway...
In v2 I added some tests to exercise this behavior between processes and a few focus scenarios. Based on these tests I updated the handling to use window thread/process which is going to be the target of the legacy message, instead of the current thread, to check RIDEV_NOLEGACY. This makes more sense to me from what I have understood of raw devices: it's not up to the sender, but rather the raw device registration in the target application to determine whether to emit legacy events for the hardware events.
Yeah, we can probably consider the sender to be irrelevant here. It works very differently in Wine vs in Windows.
In most tests (except `dinput` tests which inject input from a virtual driver), we use `SendInput` in which case the test process is the sender, but that's just because that function happens to behave similarly enough to user input, and thus usable for testing purposes.
But we want to test how Windows behaves on actual user input, not so much what SendInput does (well that's also interesting but only to some extent), and this normally doesn't involve a sender process and input probably comes directly from some in-kernel hardware driver queue.