}
}
-//-----------------------------------------------------------------------------
-// "expose_event" from scrolled window and textview
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static gboolean
-gtk_text_exposed_callback( GtkWidget * WXUNUSED(widget),
- GdkEventExpose * WXUNUSED(event),
- wxTextCtrl * WXUNUSED(win) )
-{
- return TRUE;
-}
-}
-
-
//-----------------------------------------------------------------------------
// wxTextCtrl
//-----------------------------------------------------------------------------
{
wxCHECK_RET(m_text != NULL, wxT("invalid text ctrl"));
+ wxWindow::DoFreeze();
+
if ( HasFlag(wxTE_MULTILINE) )
{
- // freeze textview updates and remove buffer
- g_signal_connect (m_text, "expose_event",
- G_CALLBACK (gtk_text_exposed_callback), this);
- g_signal_connect (m_widget, "expose_event",
- G_CALLBACK (gtk_text_exposed_callback), this);
- gtk_widget_set_sensitive(m_widget, false);
+ GTKFreezeWidget(m_text);
+
+ // removing buffer dramatically speeds up insertion:
g_object_ref(m_buffer);
GtkTextBuffer* buf_new = gtk_text_buffer_new(NULL);
GtkTextMark* mark = GTK_TEXT_VIEW(m_text)->first_para_mark;
{
if ( HasFlag(wxTE_MULTILINE) )
{
- // Reattach buffer and thaw textview updates
+ // reattach buffer:
gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), m_buffer);
g_object_unref(m_buffer);
- gtk_widget_set_sensitive(m_widget, true);
- g_signal_handlers_disconnect_by_func (m_widget,
- (gpointer) gtk_text_exposed_callback, this);
- g_signal_handlers_disconnect_by_func (m_text,
- (gpointer) gtk_text_exposed_callback, this);
+
if (m_showPositionOnThaw != NULL)
{
gtk_text_view_scroll_mark_onscreen(
GTK_TEXT_VIEW(m_text), m_showPositionOnThaw);
m_showPositionOnThaw = NULL;
}
+
+ // and thaw the window
+ GTKThawWidget(m_text);
}
+
+ wxWindow::DoThaw();
}
// ----------------------------------------------------------------------------
window = m_wxwindow->window;
return window;
}
+
+// ----------------------------------------------------------------------------
+// freeze/thaw
+// ----------------------------------------------------------------------------
+
+void wxWindowGTK::GTKFreezeWidget(GtkWidget *w)
+{
+ if ( w && !GTK_WIDGET_NO_WINDOW(w) )
+ gdk_window_freeze_updates(w->window);
+}
+
+void wxWindowGTK::GTKThawWidget(GtkWidget *w)
+{
+ if ( w && !GTK_WIDGET_NO_WINDOW(w) )
+ gdk_window_thaw_updates(w->window);
+}
+
+void wxWindowGTK::DoFreeze()
+{
+ GTKFreezeWidget(m_widget);
+ if ( m_wxwindow && m_widget != m_wxwindow )
+ GTKFreezeWidget(m_wxwindow);
+}
+
+void wxWindowGTK::DoThaw()
+{
+ GTKThawWidget(m_widget);
+ if ( m_wxwindow && m_widget != m_wxwindow )
+ GTKThawWidget(m_wxwindow);
+}