Select Edge as the default backend on MSW

If enabled and available at runtime use the Edge backend.
This is probably more useful for most users.
This commit is contained in:
Tobias Taschner
2021-02-04 22:35:03 +01:00
parent b351e7762d
commit 788bef2cf2
4 changed files with 29 additions and 18 deletions

View File

@@ -34,7 +34,7 @@ extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendEdge[] = "wxWebViewE
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendWebKit[] = "wxWebViewWebKit";
#ifdef __WXMSW__
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendDefault[] = "wxWebViewIE";
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendDefault[] = "";
#else
extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendDefault[] = "wxWebViewWebKit";
#endif
@@ -269,7 +269,22 @@ wxStringWebViewFactoryMap::iterator wxWebView::FindFactory(const wxString &backe
// Initialise the map, it checks internally for existing factories
InitFactoryMap();
return m_factoryMap.find(backend);
#ifdef __WXMSW__
// Use edge as default backend on MSW if available
if (backend.empty())
{
wxStringWebViewFactoryMap::iterator defaultBackend =
m_factoryMap.find(wxWebViewBackendIE);
#if wxUSE_WEBVIEW_EDGE
wxStringWebViewFactoryMap::iterator edgeFactory = m_factoryMap.find(wxWebViewBackendEdge);
if (edgeFactory->second->IsAvailable())
return edgeFactory;
#endif
return defaultBackend;
}
else
#endif
return m_factoryMap.find(backend);
}
// static