[gnome-shell/wip/clutter-deprecation-fixes: 10/21] st-widget: Implement a proper get_preferred_width/height
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/clutter-deprecation-fixes: 10/21] st-widget: Implement a proper get_preferred_width/height
- Date: Tue, 14 Feb 2012 22:02:17 +0000 (UTC)
commit eae0017369f3785be756911bab020c1bb723f877
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Feb 13 18:39:17 2012 -0500
st-widget: Implement a proper get_preferred_width/height
Now that StWidget is concrete and instantiable, we need to do something
other than return an adjusted 0 for width and height. Just chain up
to ClutterActor's default implementation, which uses the layout manager.
https://bugzilla.gnome.org/show_bug.cgi?id=670034
src/st/st-widget.c | 20 ++++----------------
1 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index b8e5e57..96020f5 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -348,17 +348,9 @@ st_widget_get_preferred_width (ClutterActor *self,
{
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self));
- /* Most subclasses will override this and not chain down. However,
- * if they do not, then we need to override ClutterActor's default
- * behavior (request 0x0) to take CSS-specified minimums into
- * account (which st_theme_node_adjust_preferred_width() will do.)
- */
-
- if (min_width_p)
- *min_width_p = 0;
+ st_theme_node_adjust_for_width (theme_node, &for_height);
- if (natural_width_p)
- *natural_width_p = 0;
+ CLUTTER_ACTOR_CLASS (st_widget_parent_class)->get_preferred_width (self, for_height, min_width_p, natural_width_p);
st_theme_node_adjust_preferred_width (theme_node, min_width_p, natural_width_p);
}
@@ -371,13 +363,9 @@ st_widget_get_preferred_height (ClutterActor *self,
{
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self));
- /* See st_widget_get_preferred_width() */
-
- if (min_height_p)
- *min_height_p = 0;
+ st_theme_node_adjust_for_width (theme_node, &for_width);
- if (natural_height_p)
- *natural_height_p = 0;
+ CLUTTER_ACTOR_CLASS (st_widget_parent_class)->get_preferred_height (self, for_width, min_height_p, natural_height_p);
st_theme_node_adjust_preferred_height (theme_node, min_height_p, natural_height_p);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]