[gnome-shell/wip/clutter-deprecation-fixes: 11/22] 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: 11/22] st-widget:	Implement a proper get_preferred_width/height
- Date: Wed, 15 Feb 2012 12:28:48 +0000 (UTC)
commit 3dc826099a6d6230398e1566f7c0ab6b2707cc40
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 9cc8848..7abdfd5 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -307,17 +307,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);
 }
@@ -330,13 +322,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]