X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e691f46b2ec1b5dbbff2e51131e3c532e688a89..c15521c67eb8aba1994240262ba973aa11ef0086:/src/gtk1/textctrl.cpp diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index b7dd3a877d..487926fefc 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -44,6 +44,7 @@ extern bool g_isIdle; extern bool g_blockEventsOnDrag; extern wxCursor g_globalCursor; +extern wxWindowGTK *g_delayedFocus; // ---------------------------------------------------------------------------- // helpers @@ -451,18 +452,10 @@ void wxTextCtrl::WriteText( const wxString &text ) // After cursor movements, gtk_text_get_point() is wrong by one. gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) ); - // if we have any special style, use it - if ( !m_defaultStyle.IsDefault() ) - { - GetInsertionPoint(); - - wxGtkTextInsert(m_text, m_defaultStyle, txt, txtlen); - } - else // no style - { - gint len = GET_EDITABLE_POS(m_text); - gtk_editable_insert_text( GTK_EDITABLE(m_text), txt, txtlen, &len ); - } + // always use m_defaultStyle, even if it is empty as otherwise + // resetting the style and appending some more text wouldn't work: if + // we don't specify the style explicitly, the old style would be used + wxGtkTextInsert(m_text, m_defaultStyle, txt, txtlen); // Bring editable's cursor back uptodate. SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) )); @@ -1245,6 +1238,15 @@ void wxTextCtrl::OnInternalIdle() gdk_window_set_cursor( window, cursor.GetCursor() ); } + if (g_delayedFocus == this) + { + if (GTK_WIDGET_REALIZED(m_widget)) + { + gtk_widget_grab_focus( m_widget ); + g_delayedFocus = NULL; + } + } + UpdateWindowUI(); }