Reference: this link.
On Linux this is a standard feature, but on Windows you have to open the Registry Editor.
Open the Registry Editor, navigate to HKEY_CURRENT_USER\Control Panel\Desktop,
and edit the UserPreferenceMask value as follows:
9F 3E 07 80 12 00 00 00
Next, in the same location, edit the ActiveWndTrkTimeout value as follows:
150 (set the base to decimal)
Note that 150 here is the delay in milliseconds before focus kicks in, so set it to whatever you like. Once you’re done, log out and log back in.
If you want the window to come to the front when the cursor moves over it, go to
Control Panel\Ease of Access\Ease of Access Center\Make the mouse easier to use
and check “Activate a window by hovering over it with the mouse”.