From 0f7552cdb0ca0d506a43e94d187e9f854f31e809 Mon Sep 17 00:00:00 2001 From: New Pagodi Date: Thu, 14 Mar 2019 02:15:40 -0500 Subject: [PATCH] Hide popup when STC app is minimized on macos and GTK+ --- src/stc/PlatWX.cpp | 19 +++++++++++++++++-- src/stc/PlatWX.h | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 628ffbc2ec..42a82cc984 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -2210,6 +2210,9 @@ wxSTCPopupWindow::wxSTCPopupWindow(wxWindow* parent) if ( m_tlw ) { 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 ) { 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(); } -#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) { #if wxSTC_POPUP_IS_FRAME @@ -2276,7 +2290,8 @@ void wxSTCPopupWindow::OnParentMove(wxMoveEvent& event) GetParent()->SetFocus(); event.Skip(); } -#endif // !wxSTC_POPUP_IS_CUSTOM + +#endif // __WXOSX_COCOA__ //---------------------------------------------------------------------- diff --git a/src/stc/PlatWX.h b/src/stc/PlatWX.h index 9c9aaff038..52c7eb92c9 100644 --- a/src/stc/PlatWX.h +++ b/src/stc/PlatWX.h @@ -138,7 +138,9 @@ protected: virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; 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); #endif