summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2012-03-28 13:09:42 -0400
committerMatt Turner <mattst88@gmail.com>2012-03-29 18:36:45 -0400
commitddf8ae9731e546558b94151c6ecd3ca29ae55ea9 (patch)
treee0dd48081909ee05b3944bb0dec83817b0e5c1aa
parent4a51ddbba053ae5b864475de77f9a4511d70d73a (diff)
Make Box.c:PreferredSize match libXaw
Fix up from 5d367cd9d0c. No functional changes. Signed-off-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--src/Box.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Box.c b/src/Box.c
index 9cf3b5f..50be698 100644
--- a/src/Box.c
+++ b/src/Box.c
@@ -351,15 +351,13 @@ PreferredSize(Widget widget, XtWidgetGeometry *constraint, XtWidgetGeometry *pre
else {
width = preferred_width;
do { /* find some width big enough to stay within this height */
- if (width > constraint->width/2) { /* avoid short int overflow */
+ if (width > (constraint->width >> 1)) /* avoid short int overflow */
width = constraint->width;
- }
- else {
- width *= 2;
- }
+ else
+ width <<= 1;
DoLayout(w, width, 0, &preferred_width, &preferred_height, FALSE);
- } while (preferred_height > constraint->height &&
- width < constraint->width);
+ } while (preferred_height > constraint->height
+ && width < constraint->width);
if (width != constraint->width) {
do { /* find minimum width */
width = preferred_width;