How can I avoid the active window losing focus when taking a screenshot?
You are probably trying to take a screenshot of a focused application by right-clicking Greenshot's systray icon, right? Please use Greenshot's global hotkeys instead, e.g. by default the PrntScreen key.
Interacting with other programs or parts of the Windows user interface will take away focus from an application window, in this case right-clicking the Windows systray makes the previous window inactive and also hide opened menus, selection list options, etc. Microsoft Windows is designed to work like that, there is nothing we can do about it, but using the hotkeys is a great workaround.
Hint: you can see the currently assigned hotkeys directly in Greenshot's systray menu. You can also assign other keys/combinations in the settings dialog.