[gtk+] Don't ever return BASELINE from gtk_widget_get_halign
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Don't ever return BASELINE from gtk_widget_get_halign
- Date: Mon, 16 Sep 2013 10:35:42 +0000 (UTC)
commit 247c4cecfc22c9ee73ad98c3eb796efc91c217b5
Author: Alexander Larsson <alexl redhat com>
Date: Mon Sep 16 12:33:56 2013 +0200
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.
gtk/gtkwidget.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 213a3fe..a2e5e3c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]