Commit 306db7d0 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

Invalidate the side windows when we invalidate the main window.

2000-11-15  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextview.c (changed_handler): Invalidate the side windows
	when we invalidate the main window.

	* gtk/testtext.c (create_view): Get rid of text_changed_callback,
	GtkTextView will now invalidate the side windows for us when text
	changes.
parent de49f2ce
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Invalidate the side windows
when we invalidate the main window.
* gtk/testtext.c (create_view): Get rid of text_changed_callback,
GtkTextView will now invalidate the side windows for us when text
changes.
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
......
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Invalidate the side windows
when we invalidate the main window.
* gtk/testtext.c (create_view): Get rid of text_changed_callback,
GtkTextView will now invalidate the side windows for us when text
changes.
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
......
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Invalidate the side windows
when we invalidate the main window.
* gtk/testtext.c (create_view): Get rid of text_changed_callback,
GtkTextView will now invalidate the side windows for us when text
changes.
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
......
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Invalidate the side windows
when we invalidate the main window.
* gtk/testtext.c (create_view): Get rid of text_changed_callback,
GtkTextView will now invalidate the side windows for us when text
changes.
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
......
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Invalidate the side windows
when we invalidate the main window.
* gtk/testtext.c (create_view): Get rid of text_changed_callback,
GtkTextView will now invalidate the side windows for us when text
changes.
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
......
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Invalidate the side windows
when we invalidate the main window.
* gtk/testtext.c (create_view): Get rid of text_changed_callback,
GtkTextView will now invalidate the side windows for us when text
changes.
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
......
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Invalidate the side windows
when we invalidate the main window.
* gtk/testtext.c (create_view): Get rid of text_changed_callback,
GtkTextView will now invalidate the side windows for us when text
changes.
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
......
......@@ -2109,7 +2109,7 @@ changed_handler (GtkTextLayout *layout,
widget = GTK_WIDGET (data);
if (GTK_WIDGET_REALIZED (text_view))
{
{
gtk_text_view_get_visible_rect (text_view, &visible_rect);
redraw_rect.x = visible_rect.x;
......@@ -2123,10 +2123,22 @@ changed_handler (GtkTextLayout *layout,
if (gdk_rectangle_intersect (&redraw_rect, &visible_rect, &redraw_rect))
{
redraw_rect.x -= text_view->xoffset;
redraw_rect.y -= text_view->yoffset;
/* text_window_invalidate_rect() takes buffer coordinates */
text_window_invalidate_rect (text_view->text_window,
&redraw_rect);
if (text_view->left_window)
text_window_invalidate_rect (text_view->left_window,
&redraw_rect);
if (text_view->right_window)
text_window_invalidate_rect (text_view->right_window,
&redraw_rect);
if (text_view->top_window)
text_window_invalidate_rect (text_view->top_window,
&redraw_rect);
if (text_view->bottom_window)
text_window_invalidate_rect (text_view->bottom_window,
&redraw_rect);
}
}
......@@ -4480,7 +4492,44 @@ static void
text_window_invalidate_rect (GtkTextWindow *win,
GdkRectangle *rect)
{
gdk_window_invalidate_rect (win->bin_window, rect, FALSE);
GdkRectangle window_rect;
gtk_text_view_buffer_to_window_coords (GTK_TEXT_VIEW (win->widget),
win->type,
rect->x,
rect->y,
&window_rect.x,
&window_rect.y);
window_rect.width = rect->width;
window_rect.height = rect->height;
/* Adjust the rect as appropriate */
switch (win->type)
{
case GTK_TEXT_WINDOW_TEXT:
break;
case GTK_TEXT_WINDOW_LEFT:
case GTK_TEXT_WINDOW_RIGHT:
window_rect.x = 0;
window_rect.width = win->allocation.width;
break;
case GTK_TEXT_WINDOW_TOP:
case GTK_TEXT_WINDOW_BOTTOM:
window_rect.y = 0;
window_rect.height = win->allocation.height;
break;
default:
g_warning ("%s: bug!", G_STRLOC);
return;
break;
}
gdk_window_invalidate_rect (win->bin_window, &window_rect, FALSE);
}
static gint
......
......@@ -1552,35 +1552,6 @@ cursor_set_callback (GtkTextBuffer *buffer,
}
}
static void
text_changed_callback (GtkTextBuffer *buffer,
gpointer user_data)
{
GtkTextView *text_view;
/* Redraw line number windows if the buffer changes
* and the widget is mapped (windows may not exist otherwise)
*/
text_view = GTK_TEXT_VIEW (user_data);
if (GTK_WIDGET_MAPPED (text_view))
{
GdkWindow *line_window;
line_window = gtk_text_view_get_window (text_view,
GTK_TEXT_WINDOW_LEFT);
gdk_window_invalidate_rect (line_window, NULL, FALSE);
line_window = gtk_text_view_get_window (text_view,
GTK_TEXT_WINDOW_RIGHT);
gdk_window_invalidate_rect (line_window, NULL, FALSE);
}
}
static gint
tab_stops_expose (GtkWidget *widget,
GdkEventExpose *event,
......@@ -1930,11 +1901,6 @@ create_view (Buffer *buffer)
"expose_event",
GTK_SIGNAL_FUNC (line_numbers_expose),
NULL);
gtk_signal_connect (GTK_OBJECT (view->buffer->buffer),
"changed",
GTK_SIGNAL_FUNC (text_changed_callback),
view->text_view);
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (sw), view->text_view);
......
......@@ -1552,35 +1552,6 @@ cursor_set_callback (GtkTextBuffer *buffer,
}
}
static void
text_changed_callback (GtkTextBuffer *buffer,
gpointer user_data)
{
GtkTextView *text_view;
/* Redraw line number windows if the buffer changes
* and the widget is mapped (windows may not exist otherwise)
*/
text_view = GTK_TEXT_VIEW (user_data);
if (GTK_WIDGET_MAPPED (text_view))
{
GdkWindow *line_window;
line_window = gtk_text_view_get_window (text_view,
GTK_TEXT_WINDOW_LEFT);
gdk_window_invalidate_rect (line_window, NULL, FALSE);
line_window = gtk_text_view_get_window (text_view,
GTK_TEXT_WINDOW_RIGHT);
gdk_window_invalidate_rect (line_window, NULL, FALSE);
}
}
static gint
tab_stops_expose (GtkWidget *widget,
GdkEventExpose *event,
......@@ -1930,11 +1901,6 @@ create_view (Buffer *buffer)
"expose_event",
GTK_SIGNAL_FUNC (line_numbers_expose),
NULL);
gtk_signal_connect (GTK_OBJECT (view->buffer->buffer),
"changed",
GTK_SIGNAL_FUNC (text_changed_callback),
view->text_view);
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (sw), view->text_view);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment