[gnome-shell] checkBox: Work around a height-for-width problem



commit bf992989c7197a48c539cef7b29cb200d42c07e2
Author: Florian MÃllner <fmuellner gnome org>
Date:   Mon Mar 26 11:17:09 2012 +0200

    checkBox: Work around a height-for-width problem
    
    StBoxLayout currently does not handle height-for-width children
    correctly under some circumstances. As a work-around, hard-code
    a label height of two lines of text, which should work for most
    locales in the one place the widget is currently used.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672543

 js/ui/checkBox.js |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/checkBox.js b/js/ui/checkBox.js
index 097fe96..06b4367 100644
--- a/js/ui/checkBox.js
+++ b/js/ui/checkBox.js
@@ -42,6 +42,12 @@ const CheckBoxContainer = new Lang.Class({
     },
 
     _getPreferredHeight: function(actor, forWidth, alloc) {
+        /* FIXME: StBoxlayout currently does not handle
+           height-for-width children correctly, so hard-code
+           two lines for the label until that problem is fixed.
+
+           https://bugzilla.gnome.org/show_bug.cgi?id=672543 */
+/*
         let [minBoxHeight, natBoxHeight] =
             this._box.get_preferred_height(forWidth);
         let [minLabelHeight, natLabelHeight] =
@@ -49,6 +55,14 @@ const CheckBoxContainer = new Lang.Class({
 
         alloc.min_size = Math.max(minBoxHeight, minLabelHeight);
         alloc.natural_size = Math.max(natBoxHeight, natLabelHeight);
+*/
+        let [minBoxHeight, natBoxHeight] =
+            this._box.get_preferred_height(-1);
+        let [minLabelHeight, natLabelHeight] =
+            this.label.get_preferred_height(-1);
+
+        alloc.min_size = Math.max(minBoxHeight, 2 * minLabelHeight);
+        alloc.natural_size = Math.max(natBoxHeight, 2 * natLabelHeight);
     },
 
     _allocate: function(actor, box, flags) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]