Added support for minimizing window.

Fixed issue where reshape callback would be called multiple times due to conflicting window size messages on keyboard closure.
Fixed issue where changing orientation with the keyboard open would cause multiple reshape events.