Quake Champions depends on that to handle loosing focus correctly. It is supposed to minimize itself on WM_ACTIVATEAPP(hwnd=game_hwnd, wparam=0) but refuses to do so if lparam is 0.
With my testing on Windows I could not ever get zero new foreground window tid in WM_ACTIVATEAPP(wparam=0). Depending on the way of loosing focus (alt-tabbing with popping up app swithcer, Win Key + D (show desktop), clicking other windows, programmatically setting foreground window) that may be tid of explorer, terminal services, csrss.exe, destination window thread or application but never 0. In Wine when focus switches to some native non-Wine window the focus is set to desktop, with this patch desktop window exploerer's tid will be reported which I hope is fine.
I added the new tid to the server as a new stored field because there is nowhere else to get it from in the generic case at the moment of clearing active window on the old thread and sending WM_ACTIVATEAPP(wparam=0) to the old foreground window: - (set_active_window) request for the new active window is not called yet, old thread is handled first; - set_foreground_window() win32u function knows the new window and its thread, but passing it around (including through WM_WINE_SETACTIVEWINDOW (which uses NtUserSetActiveWindow) looks more convoluted than getting that in server's reply; - server currently knows the foreground input queue after (set_foreground_window) and before (set_active_window) for the new active window, but not the exact thread for the new active window (as the input may be attached to multiple threads).