check toplevelWindow type