Avoid un-necessary video mode changes.

Fixes #11494
(cherry picked from commit 8aca90207ffffc9dd512fa11cd9d88d1f4b5884f)