Fixed focus issue when window is deactivated and then activated.