Fixes to drawing the background of the bin window so that clearing and

Thu Jan  7 19:10:21 1999  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes
	to drawing the background of the bin window
	so that clearing and redrawing of child
	widgets work properly.

	* gtk/gtkwidget.c (gtk_widget_idle_draw): Juggle around
	data so that if somebody triggers more redraw queuing
	from a expose_event handler, it doesn't confuse the
	heck out of GTK+. (But is highly liable to cause
	an infinite loop...)
This commit is contained in:
Owen Taylor 1999-01-08 00:12:43 +00:00 committed by Owen Taylor
parent bedab705f2
commit 41604dd844
9 changed files with 148 additions and 31 deletions

View File

@ -1,3 +1,16 @@
Thu Jan 7 19:10:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes
to drawing the background of the bin window
so that clearing and redrawing of child
widgets work properly.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Juggle around
data so that if somebody triggers more redraw queuing
from a expose_event handler, it doesn't confuse the
heck out of GTK+. (But is highly liable to cause
an infinite loop...)
Thu Jan 7 12:31:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_unref): Fix some

View File

@ -1,3 +1,16 @@
Thu Jan 7 19:10:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes
to drawing the background of the bin window
so that clearing and redrawing of child
widgets work properly.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Juggle around
data so that if somebody triggers more redraw queuing
from a expose_event handler, it doesn't confuse the
heck out of GTK+. (But is highly liable to cause
an infinite loop...)
Thu Jan 7 12:31:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_unref): Fix some

View File

@ -1,3 +1,16 @@
Thu Jan 7 19:10:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes
to drawing the background of the bin window
so that clearing and redrawing of child
widgets work properly.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Juggle around
data so that if somebody triggers more redraw queuing
from a expose_event handler, it doesn't confuse the
heck out of GTK+. (But is highly liable to cause
an infinite loop...)
Thu Jan 7 12:31:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_unref): Fix some

View File

@ -1,3 +1,16 @@
Thu Jan 7 19:10:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes
to drawing the background of the bin window
so that clearing and redrawing of child
widgets work properly.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Juggle around
data so that if somebody triggers more redraw queuing
from a expose_event handler, it doesn't confuse the
heck out of GTK+. (But is highly liable to cause
an infinite loop...)
Thu Jan 7 12:31:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_unref): Fix some

View File

@ -1,3 +1,16 @@
Thu Jan 7 19:10:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes
to drawing the background of the bin window
so that clearing and redrawing of child
widgets work properly.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Juggle around
data so that if somebody triggers more redraw queuing
from a expose_event handler, it doesn't confuse the
heck out of GTK+. (But is highly liable to cause
an infinite loop...)
Thu Jan 7 12:31:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_unref): Fix some

View File

@ -1,3 +1,16 @@
Thu Jan 7 19:10:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes
to drawing the background of the bin window
so that clearing and redrawing of child
widgets work properly.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Juggle around
data so that if somebody triggers more redraw queuing
from a expose_event handler, it doesn't confuse the
heck out of GTK+. (But is highly liable to cause
an infinite loop...)
Thu Jan 7 12:31:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_unref): Fix some

View File

@ -1,3 +1,16 @@
Thu Jan 7 19:10:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkviewport.c (gtk_viewport_style_set): Fixes
to drawing the background of the bin window
so that clearing and redrawing of child
widgets work properly.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Juggle around
data so that if somebody triggers more redraw queuing
from a expose_event handler, it doesn't confuse the
heck out of GTK+. (But is highly liable to cause
an infinite loop...)
Thu Jan 7 12:31:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_unref): Fix some

View File

@ -555,11 +555,16 @@ gtk_viewport_draw (GtkWidget *widget,
gtk_viewport_paint (widget, &tmp_area);
tmp_area.x += viewport->hadjustment->value - widget->style->klass->xthickness;
tmp_area.y += viewport->vadjustment->value - widget->style->klass->ythickness;
gtk_paint_flat_box(widget->style, viewport->bin_window,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
&tmp_area, widget, "viewportbin",
0, 0, -1, -1);
if (bin->child)
{
tmp_area.x += viewport->hadjustment->value - widget->style->klass->xthickness;
tmp_area.y += viewport->vadjustment->value - widget->style->klass->ythickness;
if (gtk_widget_intersect (bin->child, &tmp_area, &child_area))
gtk_widget_draw (bin->child, &child_area);
}
@ -585,13 +590,22 @@ gtk_viewport_expose (GtkWidget *widget,
if (event->window == widget->window)
gtk_viewport_paint (widget, &event->area);
else if (event->window == viewport->bin_window)
{
child_event = *event;
gtk_paint_flat_box(widget->style, viewport->bin_window,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
&event->area, widget, "viewportbin",
0, 0, -1, -1);
if ((bin->child != NULL) &&
GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
}
child_event = *event;
if ((event->window == viewport->bin_window) &&
(bin->child != NULL) &&
GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
}
return FALSE;
@ -688,10 +702,6 @@ gtk_viewport_size_allocate (GtkWidget *widget,
child_allocation.y,
child_allocation.width,
child_allocation.height);
gtk_paint_flat_box(widget->style, viewport->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
NULL, widget, "viewportbin",
0, 0, -1, -1);
}
viewport->hadjustment->page_size = child_allocation.width;
@ -822,10 +832,6 @@ gtk_viewport_style_set (GtkWidget *widget,
gtk_style_set_background (widget->style, viewport->bin_window, GTK_STATE_NORMAL);
gtk_style_set_background (widget->style, widget->window, widget->state);
gtk_paint_flat_box(widget->style, viewport->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
NULL, widget, "viewportbin",
0, 0, -1, -1);
if (GTK_WIDGET_DRAWABLE (widget))
{
gdk_window_clear (widget->window);

View File

@ -1661,6 +1661,8 @@ static GMemChunk *draw_data_mem_chunk = NULL;
static GSList *draw_data_free_list = NULL;
static const gchar *draw_data_key = "gtk-draw-data";
static GQuark draw_data_key_id = 0;
static const gchar *draw_data_tmp_key = "gtk-draw-data-tmp";
static GQuark draw_data_tmp_key_id = 0;
static gint gtk_widget_idle_draw (gpointer data);
@ -1955,18 +1957,39 @@ static gint
gtk_widget_idle_draw (gpointer data)
{
GSList *widget_list;
GSList *old_queue;
GSList *draw_data_list;
GtkWidget *widget;
if (!draw_data_tmp_key_id)
draw_data_tmp_key_id = g_quark_from_static_string (draw_data_tmp_key);
GDK_THREADS_ENTER ();
old_queue = gtk_widget_redraw_queue;
gtk_widget_redraw_queue = NULL;
/* Translate all draw requests to be allocation-relative.
* At the same time, move all the data out of the way,
* so when we get down to the draw step, we can queue
* more information for "next time", if the application
* is that foolhardy.
*/
widget_list = old_queue;
/* Translate all draw requests to be allocation-relative */
widget_list = gtk_widget_redraw_queue;
while (widget_list)
{
widget = widget_list->data;
draw_data_list = gtk_object_get_data_by_id (GTK_OBJECT (widget),
draw_data_key_id);
gtk_object_set_data_by_id (GTK_OBJECT (widget),
draw_data_key_id,
NULL);
gtk_object_set_data_by_id (GTK_OBJECT (widget),
draw_data_tmp_key_id,
draw_data_list);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_REDRAW_PENDING);
while (draw_data_list)
{
@ -2009,15 +2032,15 @@ gtk_widget_idle_draw (gpointer data)
widget_list = widget_list->next;
}
/* Coalesce redraws
/* Coalesce redraws.
*/
widget_list = gtk_widget_redraw_queue;
widget_list = old_queue;
while (widget_list)
{
GSList *prev_node = NULL;
widget = widget_list->data;
draw_data_list = gtk_object_get_data_by_id (GTK_OBJECT (widget),
draw_data_key_id);
draw_data_tmp_key_id);
while (draw_data_list)
{
@ -2042,7 +2065,7 @@ gtk_widget_idle_draw (gpointer data)
prev_node->next = draw_data_list->next;
else
gtk_object_set_data_by_id (GTK_OBJECT (widget),
draw_data_key_id,
draw_data_tmp_key_id,
draw_data_list->next);
tmp = draw_data_list->next;
@ -2082,7 +2105,7 @@ gtk_widget_idle_draw (gpointer data)
if (parent && GTK_WIDGET_REDRAW_PENDING (parent))
parent_list = gtk_object_get_data_by_id (GTK_OBJECT (parent),
draw_data_key_id);
draw_data_tmp_key_id);
else
parent_list = NULL;
}
@ -2107,19 +2130,17 @@ gtk_widget_idle_draw (gpointer data)
/* Process the draws */
widget_list = gtk_widget_redraw_queue;
widget_list = old_queue;
while (widget_list)
{
widget = widget_list->data;
draw_data_list = gtk_object_get_data_by_id (GTK_OBJECT (widget),
draw_data_key_id);
draw_data_tmp_key_id);
gtk_object_set_data_by_id (GTK_OBJECT (widget),
draw_data_key_id,
draw_data_tmp_key_id,
NULL);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_REDRAW_PENDING);
while (draw_data_list)
{
GtkDrawData *data = draw_data_list->data;
@ -2138,8 +2159,7 @@ gtk_widget_idle_draw (gpointer data)
widget_list = widget_list->next;
}
g_slist_free (gtk_widget_redraw_queue);
gtk_widget_redraw_queue = NULL;
g_slist_free (old_queue);
GDK_THREADS_LEAVE ();