+extern wxWindowGTK *g_delayedFocus;
+
+// ----------------------------------------------------------------------------
+// helpers
+// ----------------------------------------------------------------------------
+
+extern "C" {
+static void wxGtkTextInsert(GtkWidget *text,
+                            const wxTextAttr& attr,
+                            const char *txt,
+                            size_t len)
+{
+    wxFont tmpFont;
+    GdkFont *font;
+    if (attr.HasFont())
+    {
+        tmpFont = attr.GetFont();
+
+        // FIXME: if this crashes because tmpFont goes out of scope and the GdkFont is
+        // deleted, then we need to call gdk_font_ref on font.
+        // This is because attr.GetFont() now returns a temporary font since wxTextAttr
+        // no longer stores a wxFont object, for efficiency.
+
+        font = tmpFont.GetInternalFont();
+    }
+    else
+        font  = NULL;
+
+    GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor()
+                                           : NULL;
+
+    GdkColor *colBg = attr.HasBackgroundColour()
+                        ? attr.GetBackgroundColour().GetColor()
+                        : NULL;
+
+    gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len );
+}
+}