Window handling fixes

This tries to solve 2 different issues:
* Wrong hide/show status of the dockable windows when using multiple tabs
* Ensure that the main window is inside the display viewport (on Windows)

The Windows issue may need some more testing with actual Windows/Multi-Display setups.