Alter focus handling to disable GTK+ standard
behaviour for custom controls (non native controls) so that window is not invalidated after focus in and out. Leave native control alone. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37592 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -173,7 +173,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
|
|||||||
event.SetEventObject(g_activeFrame);
|
event.SetEventObject(g_activeFrame);
|
||||||
g_activeFrame->GetEventHandler()->ProcessEvent(event);
|
g_activeFrame->GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget,
|
|||||||
g_activeFrame = NULL;
|
g_activeFrame = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1867,20 +1867,25 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_CARET
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
|
bool ret = FALSE;
|
||||||
|
|
||||||
// does the window itself think that it has the focus?
|
// does the window itself think that it has the focus?
|
||||||
if ( !win->m_hasFocus )
|
if ( !win->m_hasFocus )
|
||||||
{
|
{
|
||||||
// not yet, notify it
|
// not yet, notify it
|
||||||
win->m_hasFocus = true;
|
win->m_hasFocus = true;
|
||||||
|
|
||||||
if ( DoSendFocusEvents(win) )
|
(void)DoSendFocusEvents(win);
|
||||||
{
|
|
||||||
g_signal_stop_emission_by_name (widget, "focus_in_event");
|
ret = TRUE;
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
// Disable default focus handling for custom windows
|
||||||
|
// since the default GTK+ handler issues a repaint
|
||||||
|
if (win->m_wxwindow)
|
||||||
|
g_signal_stop_emission_by_name (widget, "focus_in_event");
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1923,6 +1928,8 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_CARET
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
|
bool ret = FALSE;
|
||||||
|
|
||||||
// don't send the window a kill focus event if it thinks that it doesn't
|
// don't send the window a kill focus event if it thinks that it doesn't
|
||||||
// have focus already
|
// have focus already
|
||||||
if ( win->m_hasFocus )
|
if ( win->m_hasFocus )
|
||||||
@@ -1932,14 +1939,17 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk
|
|||||||
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
|
|
||||||
// even if we did process the event in wx code, still let GTK itself
|
|
||||||
// process it too as otherwise bad things happen, especially in GTK2
|
|
||||||
// where the text control simply aborts the program if it doesn't get
|
|
||||||
// the matching focus out event
|
|
||||||
(void)win->GetEventHandler()->ProcessEvent( event );
|
(void)win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
// Disable default focus handling for custom windows
|
||||||
|
// since the default GTK+ handler issues a repaint
|
||||||
|
if (win->m_wxwindow)
|
||||||
|
g_signal_stop_emission_by_name (widget, "focus_out_event");
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user