Misc cleanup.
Fix focus-in/out handling.