Comment 77 for bug 219385

Revision history for this message
In , Karlt (karlt) wrote :

Comment on attachment 540030
mozcontainer.c patch

These are mostly changes involving accessor methods that could be made to the
existing mozcontainer.c (and used in both GTK+ 2 and 3 builds) with the help
of gtk2compat.h.

There are only 2 or 3 statements that need to be different, and these could be
handled through preprocessor conditionals.

>+ gtk_widget_set_allocation(widget, allocation);
>
> tmp_list = container->children;
>@@ -336,10 +339,11 @@ moz_container_size_allocate (GtkWidget
> }
>
>- if (GTK_WIDGET_REALIZED (widget)) {
>- gdk_window_move_resize(widget->window,
>- widget->allocation.x,
>- widget->allocation.y,
>- widget->allocation.width,
>- widget->allocation.height);
>+ gtk_widget_get_allocation(widget, &tmp_allocation);
>+ if (gtk_widget_get_realized(widget)) {
>+ gdk_window_move_resize(gtk_widget_get_window(widget),
>+ tmp_allocation.x,
>+ tmp_allocation.y,
>+ tmp_allocation.width,
>+ tmp_allocation.height);

It should be fine to use the "allocation" variable here instead of using get_allocation to fetch the value just set. (I don't imagine calling size_allocate on children will change the parent's allocation.)