https://bugs.winehq.org/show_bug.cgi?id=55336
--- Comment #10 from YuriK7 riyu12383@gmail.com --- In x11 case, when focusing out, that HCBT_ACTIVATE hook call leads to handle_foreground_lost from dinput/dinput_main.c which unacquire the device.
In the case of wayland, when focusing out, dinput receives HCBT_SYSCOMMAND but doesn't handle it.