Hide popup when STC app is minimized on macos and GTK+

This commit is contained in:
New Pagodi
2019-03-14 02:15:40 -05:00
parent 0c953308de
commit 0f7552cdb0
2 changed files with 20 additions and 3 deletions

View File

@@ -2210,6 +2210,9 @@ wxSTCPopupWindow::wxSTCPopupWindow(wxWindow* parent)
if ( m_tlw ) if ( m_tlw )
{ {
m_tlw->Bind(wxEVT_MOVE, &wxSTCPopupWindow::OnParentMove, this); m_tlw->Bind(wxEVT_MOVE, &wxSTCPopupWindow::OnParentMove, this);
#if defined(__WXOSX_COCOA__) || (defined(__WXGTK__)&&!wxSTC_POPUP_IS_FRAME)
m_tlw->Bind(wxEVT_ICONIZE, &wxSTCPopupWindow::OnIconize, this);
#endif
} }
} }
@@ -2218,6 +2221,9 @@ wxSTCPopupWindow::~wxSTCPopupWindow()
if ( m_tlw ) if ( m_tlw )
{ {
m_tlw->Unbind(wxEVT_MOVE, &wxSTCPopupWindow::OnParentMove, this); m_tlw->Unbind(wxEVT_MOVE, &wxSTCPopupWindow::OnParentMove, this);
#if defined(__WXOSX_COCOA__) || (defined(__WXGTK__)&&!wxSTC_POPUP_IS_FRAME)
m_tlw->Unbind(wxEVT_ICONIZE, &wxSTCPopupWindow::OnIconize, this);
#endif
} }
} }
@@ -2266,7 +2272,15 @@ void wxSTCPopupWindow::OnParentMove(wxMoveEvent& event)
event.Skip(); event.Skip();
} }
#if !wxSTC_POPUP_IS_CUSTOM #if defined(__WXOSX_COCOA__) || (defined(__WXGTK__) && !wxSTC_POPUP_IS_FRAME)
void wxSTCPopupWindow::OnIconize(wxIconizeEvent& event)
{
Show(!event.IsIconized());
}
#elif !wxSTC_POPUP_IS_CUSTOM
void wxSTCPopupWindow::OnFocus(wxFocusEvent& event) void wxSTCPopupWindow::OnFocus(wxFocusEvent& event)
{ {
#if wxSTC_POPUP_IS_FRAME #if wxSTC_POPUP_IS_FRAME
@@ -2276,7 +2290,8 @@ void wxSTCPopupWindow::OnParentMove(wxMoveEvent& event)
GetParent()->SetFocus(); GetParent()->SetFocus();
event.Skip(); event.Skip();
} }
#endif // !wxSTC_POPUP_IS_CUSTOM
#endif // __WXOSX_COCOA__
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@@ -138,7 +138,9 @@ protected:
virtual void DoSetSize(int x, int y, int width, int height, virtual void DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; int sizeFlags = wxSIZE_AUTO) wxOVERRIDE;
void OnParentMove(wxMoveEvent& event); void OnParentMove(wxMoveEvent& event);
#if !wxSTC_POPUP_IS_CUSTOM #if defined(__WXOSX_COCOA__) || (defined(__WXGTK__)&&!wxSTC_POPUP_IS_FRAME)
void OnIconize(wxIconizeEvent& event);
#elif !wxSTC_POPUP_IS_CUSTOM
void OnFocus(wxFocusEvent& event); void OnFocus(wxFocusEvent& event);
#endif #endif