queue the idle_sizer with GTK_PRIORITY_INTERNAL - 1, so widgets get first

Tue May 12 00:21:33 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
        GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
        redrawn if that is still neccessary. don't allow queueing of already
        destructed objects.
        (gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
        widgets which are in the queue can be destroyed savely, handle
        requeueing properly.
        (gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
        widgets which are in the queue can be destroyed/unrealized savely.
This commit is contained in:
Tim Janik 1998-05-11 22:32:52 +00:00 committed by Tim Janik
parent 387379e6c4
commit f15bd558ab
8 changed files with 125 additions and 49 deletions

View File

@ -1,3 +1,15 @@
Mon May 11 23:53:38 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
redrawn if that is still neccessary. don't allow queueing of already
destructed objects.
(gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
widgets which are in the queue can be destroyed savely, handle
requeueing properly.
(gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
widgets which are in the queue can be destroyed/unrealized savely.
Mon May 11 17:54:44 BST 1998 Tony Gale <gale@gtk.org>
* gtkfaq.sgml: add question on multi-threading,

View File

@ -1,3 +1,15 @@
Mon May 11 23:53:38 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
redrawn if that is still neccessary. don't allow queueing of already
destructed objects.
(gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
widgets which are in the queue can be destroyed savely, handle
requeueing properly.
(gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
widgets which are in the queue can be destroyed/unrealized savely.
Mon May 11 17:54:44 BST 1998 Tony Gale <gale@gtk.org>
* gtkfaq.sgml: add question on multi-threading,

View File

@ -1,3 +1,15 @@
Mon May 11 23:53:38 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
redrawn if that is still neccessary. don't allow queueing of already
destructed objects.
(gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
widgets which are in the queue can be destroyed savely, handle
requeueing properly.
(gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
widgets which are in the queue can be destroyed/unrealized savely.
Mon May 11 17:54:44 BST 1998 Tony Gale <gale@gtk.org>
* gtkfaq.sgml: add question on multi-threading,

View File

@ -1,3 +1,15 @@
Mon May 11 23:53:38 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
redrawn if that is still neccessary. don't allow queueing of already
destructed objects.
(gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
widgets which are in the queue can be destroyed savely, handle
requeueing properly.
(gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
widgets which are in the queue can be destroyed/unrealized savely.
Mon May 11 17:54:44 BST 1998 Tony Gale <gale@gtk.org>
* gtkfaq.sgml: add question on multi-threading,

View File

@ -1,3 +1,15 @@
Mon May 11 23:53:38 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
redrawn if that is still neccessary. don't allow queueing of already
destructed objects.
(gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
widgets which are in the queue can be destroyed savely, handle
requeueing properly.
(gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
widgets which are in the queue can be destroyed/unrealized savely.
Mon May 11 17:54:44 BST 1998 Tony Gale <gale@gtk.org>
* gtkfaq.sgml: add question on multi-threading,

View File

@ -1,3 +1,15 @@
Mon May 11 23:53:38 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
redrawn if that is still neccessary. don't allow queueing of already
destructed objects.
(gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
widgets which are in the queue can be destroyed savely, handle
requeueing properly.
(gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
widgets which are in the queue can be destroyed/unrealized savely.
Mon May 11 17:54:44 BST 1998 Tony Gale <gale@gtk.org>
* gtkfaq.sgml: add question on multi-threading,

View File

@ -1,3 +1,15 @@
Mon May 11 23:53:38 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
redrawn if that is still neccessary. don't allow queueing of already
destructed objects.
(gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
widgets which are in the queue can be destroyed savely, handle
requeueing properly.
(gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
widgets which are in the queue can be destroyed/unrealized savely.
Mon May 11 17:54:44 BST 1998 Tony Gale <gale@gtk.org>
* gtkfaq.sgml: add question on multi-threading,

View File

@ -187,7 +187,6 @@ static void gtk_widget_real_realize (GtkWidget *widget);
static void gtk_widget_real_unrealize (GtkWidget *widget);
static void gtk_widget_real_draw (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_widget_real_queue_draw (GtkWidget *widget);
static void gtk_widget_real_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_widget_style_set (GtkWidget *widget,
@ -1555,23 +1554,10 @@ gtk_widget_unrealize (GtkWidget *widget)
*****************************************/
static gint
gtk_widget_idle_draw (void *data)
gtk_widget_idle_draw (gpointer data)
{
GSList *node;
GSList *draw_queue;
draw_queue = node = gtk_widget_redraw_queue;
/* We set this gtk_widget_redraw_queue to NULL first, in case anybody
* calls queue_draw recursively
*/
gtk_widget_redraw_queue = NULL;
while (node)
{
gtk_widget_real_queue_draw ((GtkWidget*) node->data);
node = node->next;
}
g_slist_free (draw_queue);
while (gtk_widget_redraw_queue)
gtk_widget_draw (gtk_widget_redraw_queue->data, NULL);
return FALSE;
}
@ -1600,7 +1586,8 @@ gtk_widget_queue_draw (GtkWidget *widget)
GTK_PRIVATE_SET_FLAG (widget, GTK_REDRAW_PENDING);
if (gtk_widget_redraw_queue == NULL)
gtk_idle_add_priority (GTK_PRIORITY_INTERNAL,
(GtkFunction) gtk_widget_idle_draw, NULL);
gtk_widget_idle_draw,
NULL);
gtk_widget_redraw_queue = g_slist_prepend (gtk_widget_redraw_queue, widget);
}
@ -1617,22 +1604,44 @@ gtk_widget_queue_draw (GtkWidget *widget)
static gint
gtk_widget_idle_sizer (void *data)
{
GSList *slist, *free_slist;
GSList *slist;
GSList *re_queue;
free_slist = gtk_widget_resize_queue;
gtk_widget_resize_queue = NULL;
for (slist = free_slist; slist; slist = slist->next)
re_queue = NULL;
while (gtk_widget_resize_queue)
{
GtkWidget *widget;
slist = gtk_widget_resize_queue;
gtk_widget_resize_queue = slist->next;
widget = slist->data;
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
gtk_widget_ref (widget);
if (gtk_container_need_resize (GTK_CONTAINER (widget)))
gtk_widget_queue_resize (widget);
{
slist->next = re_queue;
re_queue = slist;
}
else
{
g_slist_free_1 (slist);
gtk_widget_unref (widget);
}
}
g_slist_free (free_slist);
for (slist = re_queue; slist; slist = slist->next)
{
GtkWidget *widget;
widget = slist->data;
if (GTK_OBJECT (widget)->ref_count > 1 &&
!GTK_OBJECT_DESTROYED (widget))
gtk_widget_queue_resize (widget);
gtk_widget_unref (widget);
}
g_slist_free (re_queue);
return FALSE;
}
@ -1643,6 +1652,8 @@ gtk_widget_queue_resize (GtkWidget *widget)
GtkWidget *toplevel;
g_return_if_fail (widget != NULL);
if (GTK_OBJECT_DESTROYED (widget))
return;
toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel))
@ -1653,8 +1664,9 @@ gtk_widget_queue_resize (GtkWidget *widget)
{
GTK_PRIVATE_SET_FLAG (toplevel, GTK_RESIZE_PENDING);
if (gtk_widget_resize_queue == NULL)
gtk_idle_add_priority (GTK_PRIORITY_INTERNAL,
(GtkFunction) gtk_widget_idle_sizer, NULL);
gtk_idle_add_priority (GTK_PRIORITY_INTERNAL - 1,
gtk_widget_idle_sizer,
NULL);
gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, toplevel);
}
@ -3745,26 +3757,6 @@ gtk_widget_real_draw (GtkWidget *widget,
}
}
/*****************************************
* gtk_widget_real_queue_draw:
*
* arguments:
*
* results:
*****************************************/
static gint
gtk_widget_real_queue_draw (GtkWidget *widget)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_REDRAW_PENDING);
gtk_widget_draw (widget, NULL);
return FALSE;
}
/*****************************************
* gtk_widget_real_size_allocate:
*