Removing manual focus handling

see https://github.com/wxWidgets/wxWidgets/pull/672 , commit 61b1a9a3533d4e16b2b7a9441e42766d8d9655c7 , revert this change if problems arise to see whether this is a recursion
This commit is contained in:
Stefan Csomor
2018-01-18 19:42:08 +01:00
parent 0a966eb145
commit a1cf0e1cd4
3 changed files with 1 additions and 69 deletions

View File

@@ -36,11 +36,6 @@ wxEND_EVENT_TABLE()
// creation/destruction
// ----------------------------------------------------------------------------
void wxFrame::Init()
{
m_winLastFocused = NULL;
}
bool wxFrame::Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
@@ -156,38 +151,10 @@ void wxFrame::OnActivate(wxActivateEvent& event)
{
if ( !event.GetActive() )
{
// remember the last focused child if it is our child
m_winLastFocused = FindFocus();
// so we NULL it out if it's a child from some other frame
wxWindow *win = m_winLastFocused;
while ( win )
{
if ( win->IsTopLevel() )
{
if ( win != this )
m_winLastFocused = NULL;
break;
}
win = win->GetParent();
}
event.Skip();
}
else
{
// restore focus to the child which was last focused
wxWindow *parent = m_winLastFocused
? m_winLastFocused->GetParent()
: NULL;
if (parent == NULL)
parent = this;
wxSetFocusToChild(parent, &m_winLastFocused);
#if wxUSE_MENUS
if (m_frameMenuBar != NULL)
{

View File

@@ -239,20 +239,6 @@ wxWindowMac::~wxWindowMac()
MacInvalidateBorders() ;
#ifndef __WXUNIVERSAL__
// VS: make sure there's no wxFrame with last focus set to us:
for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
{
wxFrame *frame = wxDynamicCast(win, wxFrame);
if ( frame )
{
if ( frame->GetLastFocus() == this )
frame->SetLastFocus(NULL);
break;
}
}
#endif
// destroy children before destroying this window itself
DestroyChildren();
@@ -266,15 +252,6 @@ wxWindowMac::~wxWindowMac()
tlw->SetDefaultItem(NULL);
}
#ifndef __WXUNIVERSAL__
wxFrame* frame = wxDynamicCast( wxGetTopLevelParent( (wxWindow*)this ) , wxFrame ) ;
if ( frame )
{
if ( frame->GetLastFocus() == this )
frame->SetLastFocus( NULL ) ;
}
#endif
// delete our drop target if we've got one
#if wxUSE_DRAG_AND_DROP
wxDELETE(m_dropTarget);