fixed focus related regression in wxListCtrl's wxTextCtrl handling after r52476

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52839 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-03-26 23:45:20 +00:00
parent be3a59f269
commit 0ed3d9f17a

View File

@@ -203,6 +203,7 @@ static wxWindowGTK *g_captureWindow = (wxWindowGTK*) NULL;
static bool g_captureWindowHasMouse = false;
wxWindowGTK *g_focusWindow = (wxWindowGTK*) NULL;
wxWindowGTK *g_focusWindowPending = (wxWindowGTK*) NULL;
// the last window which had the focus - this is normally never NULL (except
// if we never had focus at all) as even when g_focusWindow is NULL it still
@@ -269,7 +270,7 @@ gdk_window_warp_pointer (GdkWindow *window,
// Note: can't be static, needed by textctrl.cpp.
wxWindow *wxFindFocusedChild(wxWindowGTK *win)
{
wxWindow *winFocus = wxWindowGTK::FindFocus();
wxWindow *winFocus = g_focusWindow;
if ( !winFocus )
return (wxWindow *)NULL;
@@ -1025,7 +1026,7 @@ gtk_window_key_press_callback( GtkWidget *widget,
// widgets has both IM context and input focus, the event should be filtered
// by gtk_im_context_filter_keypress().
// Then, we should, according to GTK+ 2.0 API doc, return whatever it returns.
if ((!ret) && (win->m_imData != NULL) && ( wxWindow::FindFocus() == win ))
if ((!ret) && (win->m_imData != NULL) && ( g_focusWindow == win ))
{
// We should let GTK+ IM filter key event first. According to GTK+ 2.0 API
// docs, if IM filter returns true, no further processing should be done.
@@ -1842,6 +1843,7 @@ gtk_window_focus_in_callback( GtkWidget *widget,
g_focusWindowLast =
g_focusWindow = win;
g_focusWindowPending = NULL;
wxLogTrace(TRACE_FOCUS,
_T("%s: focus in"), win->GetName().c_str());
@@ -2228,7 +2230,7 @@ public:
wxWindow *wxWindowBase::DoFindFocus()
{
// the cast is necessary when we compile in wxUniversal mode
return (wxWindow *)g_focusWindow;
return (wxWindow *)(g_focusWindowPending ? g_focusWindowPending : g_focusWindow);
}
//-----------------------------------------------------------------------------
@@ -2470,6 +2472,8 @@ wxWindowGTK::~wxWindowGTK()
if (g_focusWindow == this)
g_focusWindow = NULL;
if (g_focusWindowPending == this)
g_focusWindowPending = NULL;
if ( g_delayedFocus == this )
g_delayedFocus = NULL;
@@ -3276,7 +3280,7 @@ void wxWindowGTK::SetFocus()
// Because we want to FindFocus() call immediately following
// foo->SetFocus() to return foo, we have to keep track of "pending" focus
// ourselves.
g_focusWindow = this;
g_focusWindowPending = this;
if (m_wxwindow)
{