Fixed problem with kill focus event getting sent to control
that is getting the focus. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -227,25 +227,33 @@ void wxWindowMac::SetFocus()
|
|||||||
{
|
{
|
||||||
if (gFocusWindow )
|
if (gFocusWindow )
|
||||||
{
|
{
|
||||||
#if wxUSE_CARET
|
#if wxUSE_CARET
|
||||||
// Deal with caret
|
// Deal with caret
|
||||||
if ( gFocusWindow->m_caret )
|
if ( gFocusWindow->m_caret )
|
||||||
{
|
{
|
||||||
gFocusWindow->m_caret->OnKillFocus();
|
gFocusWindow->m_caret->OnKillFocus();
|
||||||
}
|
}
|
||||||
#endif // wxUSE_CARET
|
#endif // wxUSE_CARET
|
||||||
#ifndef __WXUNIVERSAL__
|
#ifndef __WXUNIVERSAL__
|
||||||
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
|
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
|
||||||
if ( control && control->GetMacControl() )
|
if ( control && control->GetMacControl() )
|
||||||
{
|
{
|
||||||
UMASetKeyboardFocus( (WindowRef) gFocusWindow->MacGetRootWindow() , (ControlHandle) control->GetMacControl() , kControlFocusNoPart ) ;
|
UMASetKeyboardFocus( (WindowRef) gFocusWindow->MacGetRootWindow() , (ControlHandle) control->GetMacControl() , kControlFocusNoPart ) ;
|
||||||
control->MacRedrawControl() ;
|
control->MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
// Without testing the window id, for some reason
|
||||||
|
// a kill focus event can still be sent to
|
||||||
|
// the control just being focussed.
|
||||||
|
int thisId = this->m_windowId;
|
||||||
|
int gFocusWindowId = gFocusWindow->m_windowId;
|
||||||
|
if (gFocusWindowId != thisId)
|
||||||
|
{
|
||||||
wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
|
wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
|
||||||
event.SetEventObject(gFocusWindow);
|
event.SetEventObject(gFocusWindow);
|
||||||
gFocusWindow->GetEventHandler()->ProcessEvent(event) ;
|
gFocusWindow->GetEventHandler()->ProcessEvent(event) ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gFocusWindow = this ;
|
gFocusWindow = this ;
|
||||||
{
|
{
|
||||||
#if wxUSE_CARET
|
#if wxUSE_CARET
|
||||||
@@ -1765,6 +1773,7 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
|
|||||||
if ( erase && !EmptyRgn(ownUpdateRgn) )
|
if ( erase && !EmptyRgn(ownUpdateRgn) )
|
||||||
{
|
{
|
||||||
wxWindowDC dc(this);
|
wxWindowDC dc(this);
|
||||||
|
if (!EmptyRgn(ownUpdateRgn))
|
||||||
dc.SetClippingRegion(wxRegion(ownUpdateRgn));
|
dc.SetClippingRegion(wxRegion(ownUpdateRgn));
|
||||||
wxEraseEvent eevent( GetId(), &dc );
|
wxEraseEvent eevent( GetId(), &dc );
|
||||||
eevent.SetEventObject( this );
|
eevent.SetEventObject( this );
|
||||||
|
@@ -227,25 +227,33 @@ void wxWindowMac::SetFocus()
|
|||||||
{
|
{
|
||||||
if (gFocusWindow )
|
if (gFocusWindow )
|
||||||
{
|
{
|
||||||
#if wxUSE_CARET
|
#if wxUSE_CARET
|
||||||
// Deal with caret
|
// Deal with caret
|
||||||
if ( gFocusWindow->m_caret )
|
if ( gFocusWindow->m_caret )
|
||||||
{
|
{
|
||||||
gFocusWindow->m_caret->OnKillFocus();
|
gFocusWindow->m_caret->OnKillFocus();
|
||||||
}
|
}
|
||||||
#endif // wxUSE_CARET
|
#endif // wxUSE_CARET
|
||||||
#ifndef __WXUNIVERSAL__
|
#ifndef __WXUNIVERSAL__
|
||||||
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
|
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
|
||||||
if ( control && control->GetMacControl() )
|
if ( control && control->GetMacControl() )
|
||||||
{
|
{
|
||||||
UMASetKeyboardFocus( (WindowRef) gFocusWindow->MacGetRootWindow() , (ControlHandle) control->GetMacControl() , kControlFocusNoPart ) ;
|
UMASetKeyboardFocus( (WindowRef) gFocusWindow->MacGetRootWindow() , (ControlHandle) control->GetMacControl() , kControlFocusNoPart ) ;
|
||||||
control->MacRedrawControl() ;
|
control->MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
// Without testing the window id, for some reason
|
||||||
|
// a kill focus event can still be sent to
|
||||||
|
// the control just being focussed.
|
||||||
|
int thisId = this->m_windowId;
|
||||||
|
int gFocusWindowId = gFocusWindow->m_windowId;
|
||||||
|
if (gFocusWindowId != thisId)
|
||||||
|
{
|
||||||
wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
|
wxFocusEvent event(wxEVT_KILL_FOCUS, gFocusWindow->m_windowId);
|
||||||
event.SetEventObject(gFocusWindow);
|
event.SetEventObject(gFocusWindow);
|
||||||
gFocusWindow->GetEventHandler()->ProcessEvent(event) ;
|
gFocusWindow->GetEventHandler()->ProcessEvent(event) ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gFocusWindow = this ;
|
gFocusWindow = this ;
|
||||||
{
|
{
|
||||||
#if wxUSE_CARET
|
#if wxUSE_CARET
|
||||||
@@ -1765,6 +1773,7 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
|
|||||||
if ( erase && !EmptyRgn(ownUpdateRgn) )
|
if ( erase && !EmptyRgn(ownUpdateRgn) )
|
||||||
{
|
{
|
||||||
wxWindowDC dc(this);
|
wxWindowDC dc(this);
|
||||||
|
if (!EmptyRgn(ownUpdateRgn))
|
||||||
dc.SetClippingRegion(wxRegion(ownUpdateRgn));
|
dc.SetClippingRegion(wxRegion(ownUpdateRgn));
|
||||||
wxEraseEvent eevent( GetId(), &dc );
|
wxEraseEvent eevent( GetId(), &dc );
|
||||||
eevent.SetEventObject( this );
|
eevent.SetEventObject( this );
|
||||||
|
Reference in New Issue
Block a user