boolean () { if (myStack.isEmpty()) return false; final AbstractPopup popup = (AbstractPopup)myStack.peek(); if (popup != null && popup.isVisible() && popup.isCancelOnWindowDeactivation() && popup.canClose()) { popup.cancel(); // setCancelCallback(..) can override cancel() return !popup.isVisible(); } return false; }