Windows build fixes. This was SVN commit r7607.
Refactor the video mode setting logic to cope better with dynamic changes. This was SVN commit r7606.