Fix setting focus to wxWebViewEdge
It was impossible to give focus to the actual web view in wxWebViewEdge by keyboard navigation or programmatically with wxWebViewEdge::SetFocus(). Fix it by calling CoreWebView2Controller::MoveFocus() in the wxWebViewEdge's wxEVT_SET_FOCUS handler. Closes https://github.com/wxWidgets/wxWidgets/pull/2444
This commit is contained in:
parent
d50a707b0f
commit
3a0bb1b18c
@ -109,6 +109,8 @@ private:
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
void OnSetFocus(wxFocusEvent& event);
|
||||
|
||||
void OnTopLevelParentIconized(wxIconizeEvent& event);
|
||||
|
||||
bool RunScriptSync(const wxString& javascript, wxString* output = NULL) const;
|
||||
|
@ -535,6 +535,7 @@ bool wxWebViewEdge::Create(wxWindow* parent,
|
||||
if (!m_impl->Create())
|
||||
return false;
|
||||
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
|
||||
Bind(wxEVT_SET_FOCUS, &wxWebViewEdge::OnSetFocus, this);
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent(this);
|
||||
if (topLevelParent)
|
||||
topLevelParent->Bind(wxEVT_ICONIZE, &wxWebViewEdge::OnTopLevelParentIconized, this);
|
||||
@ -549,6 +550,13 @@ void wxWebViewEdge::OnSize(wxSizeEvent& event)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxWebViewEdge::OnSetFocus(wxFocusEvent& event)
|
||||
{
|
||||
if (m_impl && m_impl->m_webViewController)
|
||||
m_impl->m_webViewController->MoveFocus(COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxWebViewEdge::OnTopLevelParentIconized(wxIconizeEvent& event)
|
||||
{
|
||||
if (m_impl && m_impl->m_webViewController)
|
||||
|
Loading…
Reference in New Issue
Block a user