Notify WebView2 API when minimizing a window with wxWebView
As suggested by the ICoreWebView2Controller documentation call put_isVisible() when the window containing the wxWebViewEdge is minimized/restored.
This commit is contained in:
@@ -105,6 +105,8 @@ private:
|
|||||||
|
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
|
void OnTopLevelParentIconized(wxIconizeEvent& event);
|
||||||
|
|
||||||
bool RunScriptSync(const wxString& javascript, wxString* output = NULL) const;
|
bool RunScriptSync(const wxString& javascript, wxString* output = NULL) const;
|
||||||
|
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxWebViewEdge);
|
wxDECLARE_DYNAMIC_CLASS(wxWebViewEdge);
|
||||||
|
@@ -363,6 +363,9 @@ ICoreWebView2Settings* wxWebViewEdgeImpl::GetSettings()
|
|||||||
|
|
||||||
wxWebViewEdge::~wxWebViewEdge()
|
wxWebViewEdge::~wxWebViewEdge()
|
||||||
{
|
{
|
||||||
|
wxWindow* topLevelParent = wxGetTopLevelParent(this);
|
||||||
|
if (topLevelParent)
|
||||||
|
topLevelParent->Unbind(wxEVT_ICONIZE, &wxWebViewEdge::OnTopLevelParentIconized, this);
|
||||||
delete m_impl;
|
delete m_impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,6 +390,9 @@ bool wxWebViewEdge::Create(wxWindow* parent,
|
|||||||
if (!m_impl->Create())
|
if (!m_impl->Create())
|
||||||
return false;
|
return false;
|
||||||
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
|
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
|
||||||
|
wxWindow* topLevelParent = wxGetTopLevelParent(this);
|
||||||
|
if (topLevelParent)
|
||||||
|
topLevelParent->Bind(wxEVT_ICONIZE, &wxWebViewEdge::OnTopLevelParentIconized, this);
|
||||||
|
|
||||||
LoadURL(url);
|
LoadURL(url);
|
||||||
return true;
|
return true;
|
||||||
@@ -398,6 +404,13 @@ void wxWebViewEdge::OnSize(wxSizeEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWebViewEdge::OnTopLevelParentIconized(wxIconizeEvent& event)
|
||||||
|
{
|
||||||
|
if (m_impl && m_impl->m_webViewController)
|
||||||
|
m_impl->m_webViewController->put_IsVisible(!event.IsIconized());
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
void wxWebViewEdge::LoadURL(const wxString& url)
|
void wxWebViewEdge::LoadURL(const wxString& url)
|
||||||
{
|
{
|
||||||
if (!m_impl->m_webView)
|
if (!m_impl->m_webView)
|
||||||
|
Reference in New Issue
Block a user