Don't ever return BASELINE from gtk_widget_get_halign

This is the same behaviour as gtk_widget_get_valign, except
we have no gtk_wiget_get_halign_with_baseline, as baselines make
no sense for halign.

Without this some widgets (like e.g. GtkOverlay) crash if you accidentally
set a BASELINE halign.
This commit is contained in:
Alexander Larsson
2013-09-16 12:33:56 +02:00
parent 310179176c
commit 247c4cecfc

View File

@@ -13859,13 +13859,24 @@ gtk_widget_real_get_width_for_height (GtkWidget *widget,
*
* Gets the value of the #GtkWidget:halign property.
*
* For backwards compatibility reasons this method will never return
* %GTK_ALIGN_BASELINE, but instead it will convert it to
* %GTK_ALIGN_FILL. Baselines are not supported for horizontal
* alignment.
*
* Returns: the horizontal alignment of @widget
*/
GtkAlign
gtk_widget_get_halign (GtkWidget *widget)
{
GtkAlign align;
g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_ALIGN_FILL);
return _gtk_widget_get_aux_info_or_defaults (widget)->halign;
align = _gtk_widget_get_aux_info_or_defaults (widget)->halign;
if (align == GTK_ALIGN_BASELINE)
return GTK_ALIGN_FILL;
return align;
}
/**