Optimize window positions for MS Windows and OS X.

Signed-off-by: Nicola Ferralis <feranick@hotmail.com>
Code cleanup.

Signed-off-by: Nicola Ferralis <feranick@hotmail.com>