- // But if m_popup was about to get the focus,
- // don't disappear.
- if (event.GetWindow() != m_popup)
+ return;
+ }
+#endif // __WXGTK__
+
+ // when we lose focus we always disappear - unless it goes to the popup (in
+ // which case we don't really lose it)
+ wxWindow *win = event.GetWindow();
+ while ( win )
+ {
+ if ( win == m_popup )
+ return;
+ win = win->GetParent();
+ }
+
+ m_popup->DismissAndNotify();
+}
+
+void wxPopupFocusHandler::OnKeyDown(wxKeyEvent& event)
+{
+ // let the window have it first, it might process the keys
+ if ( !m_popup->ProcessEvent(event) )
+ {
+ // by default, dismiss the popup