X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5f9e369af0c834bbde0f7f5d2047abd736967f58..591805e0b85d26b6256617710277b26065a2b767:/src/common/popupcmn.cpp diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 09d012c6c1..49ef9c8857 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -265,8 +265,16 @@ void wxPopupTransientWindow::PopHandlers() void wxPopupTransientWindow::Popup(wxWindow *winFocus) { + // If we have a single child, we suppose that it must cover the entire + // popup window and hence we give the mouse capture to it instead of + // keeping it for ourselves. + // + // Notice that this works best for combobox-like popups which have a single + // control inside them and not so well for popups containing a single + // wxPanel with multiple children inside it but OTOH it does no harm in + // this case neither and we can't reliably distinguish between them. const wxWindowList& children = GetChildren(); - if ( children.GetCount() ) + if ( children.GetCount() == 1 ) { m_child = children.GetFirst()->GetData(); }