GSFrame: Pass focus to GSPanel once Frame receives focus

Passing focus on the focus message instead of the activate message
resolves an issue where external processes (e.g. NVIDIA overlay)
forced a focus change to the GS Frame, requiring the window to be
refocused in order for keyboard inputs to work again.

Currently, GSFrame rejects focus messages and instead passes it to
the child GSPanel.
This commit is contained in:
Silent 2021-04-28 00:19:36 +02:00 committed by lightningterror
parent f7966bd213
commit a4057d569f
2 changed files with 4 additions and 4 deletions

View File

@ -565,7 +565,7 @@ GSFrame::GSFrame( const wxString& title)
Bind(wxEVT_CLOSE_WINDOW, &GSFrame::OnCloseWindow, this);
Bind(wxEVT_MOVE, &GSFrame::OnMove, this);
Bind(wxEVT_SIZE, &GSFrame::OnResize, this);
Bind(wxEVT_ACTIVATE, &GSFrame::OnActivate, this);
Bind(wxEVT_SET_FOCUS, &GSFrame::OnFocus, this);
Bind(wxEVT_TIMER, &GSFrame::OnUpdateTitle, this, m_timer_UpdateTitle.GetId());
}
@ -799,11 +799,11 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
SetTitle(title);
}
void GSFrame::OnActivate( wxActivateEvent& evt )
void GSFrame::OnFocus( wxFocusEvent& evt )
{
if( IsBeingDeleted() ) return;
evt.Skip();
evt.Skip(false); // Reject the focus message, as we pass focus to the child
if( wxWindow* gsPanel = GetViewport() ) gsPanel->SetFocus();
}

View File

@ -112,7 +112,7 @@ protected:
void OnCloseWindow( wxCloseEvent& evt );
void OnMove( wxMoveEvent& evt );
void OnResize( wxSizeEvent& evt );
void OnActivate( wxActivateEvent& evt );
void OnFocus( wxFocusEvent& evt );
void OnUpdateTitle( wxTimerEvent& evt );
void AppStatusEvent_OnSettingsApplied();