elect
tailrec fun Window.getParent(): Window { return when { flags has Wf.ChildWindow && flags hasnt (Wf.Popup or Wf.ChildMenu) -> parentWindow?.getParent() ?: this else -> this } }