X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c02ee97f963f584179a54b50338c550a1057dd2e..acc0ebd7a871124d4d6b36069340227e6c584f38:/src/common/popupcmn.cpp diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 8f7215b235..ae9ab6392e 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -18,7 +18,7 @@ // ---------------------------------------------------------------------------- #ifdef __GNUG__ - #pragma implementation "popupwin.h" + #pragma implementation "popupwinbase.h" #endif // For compilers that support precompilation, includes "wx.h". @@ -28,7 +28,7 @@ #pragma hdrstop #endif -#if wxUSE_POPUPWIN +#if wxUSE_POPUPWIN && !defined(__WXMOTIF__) #include "wx/popupwin.h" @@ -187,10 +187,17 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus) m_child = this; } + // we can't capture mouse before the window is shown in wxGTL +#ifdef __WXGTK__ + Show(); +#endif + m_child->CaptureMouse(); m_child->PushEventHandler(new wxPopupWindowHandler(this)); +#ifndef __WXGTK__ Show(); +#endif m_focus = winFocus ? winFocus : this; m_focus->PushEventHandler(new wxPopupFocusHandler(this)); @@ -222,7 +229,7 @@ bool wxPopupTransientWindow::ProcessLeftDown(wxMouseEvent& WXUNUSED(event)) return FALSE; } -#if wxUSE_COMBOBOX +#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) // ---------------------------------------------------------------------------- // wxPopupComboWindow @@ -246,7 +253,7 @@ void wxPopupComboWindow::PositionNearCombo() // the origin point must be in screen coords wxPoint ptOrigin = m_combo->ClientToScreen(wxPoint(0, 0)); -#ifdef __WXUNIVERSAL__ +#if 0 //def __WXUNIVERSAL__ // account for the fact that (0, 0) is not the top left corner of the // window: there is also the border wxRect rectBorders = m_combo->GetRenderer()-> @@ -265,7 +272,7 @@ void wxPopupComboWindow::OnDismiss() m_combo->OnDismiss(); } -#endif // wxUSE_COMBOBOX +#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) // ---------------------------------------------------------------------------- // wxPopupWindowHandler @@ -293,6 +300,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) m_popup->DismissAndNotify(); break; +#ifdef __WXUNIVERSAL__ case wxHT_WINDOW_HORZ_SCROLLBAR: sbar = win->GetScrollbar(wxHORIZONTAL); break; @@ -300,6 +308,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) case wxHT_WINDOW_VERT_SCROLLBAR: sbar = win->GetScrollbar(wxVERTICAL); break; +#endif default: // forgot to update the switch after adding a new hit test code? @@ -337,7 +346,11 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event) { // when we lose focus we always disappear - m_popup->DismissAndNotify(); + + // But if m_popup was about to get the focus, + // don't disappear. + if (event.GetWindow() != m_popup) + m_popup->DismissAndNotify(); } #endif // wxUSE_POPUPWIN