Hold down right click then left click, then hold down right click then left click (doesn't seem to matter whether you move the mouse during) and the focus switches away from Texstudio to the most recently opened other window.
Behaviour seen in version 2.12.20, on Windows 10