Prevent surplus calls of _size_allocate() if no change
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -87,13 +87,15 @@ static void size_allocate(GtkWidget* widget, GtkAllocation* alloc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
widget->allocation = *alloc;
|
widget->allocation = *alloc;
|
||||||
|
|
||||||
// adjust child positions
|
// adjust child positions
|
||||||
for (const GList* list = pizza->m_fixed.children; list; list = list->next)
|
for (const GList* list = pizza->m_fixed.children; list; list = list->next)
|
||||||
{
|
{
|
||||||
const GtkFixedChild* child = static_cast<GtkFixedChild*>(list->data);
|
const GtkFixedChild* child = static_cast<GtkFixedChild*>(list->data);
|
||||||
if (GTK_WIDGET_VISIBLE(child->widget))
|
if (GTK_WIDGET_VISIBLE(child->widget))
|
||||||
{
|
{
|
||||||
|
GtkAllocation child_old_alloc = child->widget->allocation;
|
||||||
|
|
||||||
GtkAllocation child_alloc;
|
GtkAllocation child_alloc;
|
||||||
// note that child positions do not take border into
|
// note that child positions do not take border into
|
||||||
// account, they need to be relative to widget->window,
|
// account, they need to be relative to widget->window,
|
||||||
@@ -105,10 +107,13 @@ static void size_allocate(GtkWidget* widget, GtkAllocation* alloc)
|
|||||||
child_alloc.width = req.width;
|
child_alloc.width = req.width;
|
||||||
child_alloc.height = req.height;
|
child_alloc.height = req.height;
|
||||||
if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
|
||||||
{
|
|
||||||
child_alloc.x = w - child_alloc.x - child_alloc.width;
|
child_alloc.x = w - child_alloc.x - child_alloc.width;
|
||||||
}
|
|
||||||
gtk_widget_size_allocate(child->widget, &child_alloc);
|
if ((child_alloc.x != child_old_alloc.x) ||
|
||||||
|
(child_alloc.y != child_old_alloc.y) ||
|
||||||
|
(child_alloc.width != child_old_alloc.width) ||
|
||||||
|
(child_alloc.height != child_old_alloc.height))
|
||||||
|
gtk_widget_size_allocate(child->widget, &child_alloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user