Win32 bugfixes.

* Force redraw on LdCategorySymbolView size allocation.
* Fix an infinite loop sometimes caused by update_adjustments().
This commit is contained in:
Přemysl Eric Janouch 2012-10-10 20:35:52 +02:00
parent c535bd2383
commit f0ac99072e
2 changed files with 21 additions and 15 deletions

View File

@ -298,7 +298,10 @@ on_size_allocate (GtkWidget *widget, GdkRectangle *allocation,
self = LD_CATEGORY_SYMBOL_VIEW (widget);
if (self->priv->height_negotiation)
{
gtk_widget_queue_draw (widget);
self->priv->height_negotiation = FALSE;
}
else
{
self->priv->height_negotiation = TRUE;

View File

@ -729,31 +729,34 @@ on_size_allocate (GtkWidget *widget, GtkAllocation *allocation,
update_adjustments (self);
}
static void
update_adjustment_value (LdDiagramView *self, GtkAdjustment *adjustment,
gdouble value, gdouble page_size)
{
gtk_adjustment_set_page_size (adjustment, page_size);
g_signal_handlers_block_by_func (adjustment,
on_adjustment_value_changed, self);
gtk_adjustment_set_value (adjustment, value - page_size / 2);
g_signal_handlers_unblock_by_func (adjustment,
on_adjustment_value_changed, self);
gtk_adjustment_changed (adjustment);
}
static void
update_adjustments (LdDiagramView *self)
{
GtkAllocation allocation;
gdouble scale, page_size;
gdouble scale;
gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
scale = ld_diagram_view_get_scale_in_px (self);
if (self->priv->adjustment_h)
{
page_size = allocation.width / scale;
gtk_adjustment_set_page_size (self->priv->adjustment_h, page_size);
gtk_adjustment_set_value (self->priv->adjustment_h,
self->priv->x - page_size / 2);
gtk_adjustment_changed (self->priv->adjustment_h);
}
update_adjustment_value (self, self->priv->adjustment_h,
self->priv->x, allocation.width / scale);
if (self->priv->adjustment_v)
{
page_size = allocation.height / scale;
gtk_adjustment_set_page_size (self->priv->adjustment_v, page_size);
gtk_adjustment_set_value (self->priv->adjustment_v,
self->priv->y - page_size / 2);
gtk_adjustment_changed (self->priv->adjustment_v);
}
update_adjustment_value (self, self->priv->adjustment_v,
self->priv->y, allocation.height / scale);
}
static void