e911fa
From 6aff3a819cb69235594124d7b252d1ee8c04f2b0 Mon Sep 17 00:00:00 2001
e911fa
From: Mykola Vshyvkov <mvshyvk@softserveinc.com>
e911fa
Date: Wed, 21 Aug 2013 11:49:00 +0300
e911fa
Subject: [PATCH] Fixed bug #1612 (Label size computed wrong within a Form).
e911fa
e911fa
---
e911fa
 lib/Xm/Form.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
e911fa
 1 file changed, 56 insertions(+), 2 deletions(-)
e911fa
e911fa
diff --git a/lib/Xm/Form.c b/lib/Xm/Form.c
e911fa
index 74140af8..b95a7b1a 100644
e911fa
--- a/lib/Xm/Form.c
e911fa
+++ b/lib/Xm/Form.c
e911fa
@@ -50,6 +50,7 @@ static char rcsid[] = "$TOG: Form.c /main/19 1998/03/25 12:24:56 csn $"
e911fa
 #include "GMUtilsI.h"
e911fa
 
e911fa
 #define FIX_1299
e911fa
+#define FIX_1612
e911fa
 
e911fa
 #define MESSAGE1	_XmMMsgForm_0000
e911fa
 #define MESSAGE5	_XmMMsgForm_0002
e911fa
@@ -285,6 +286,12 @@ static int GetFormOffset(
e911fa
                         XmFormWidget fw,
e911fa
                         int which,
e911fa
                         XmFormAttachment a) ;
e911fa
+#ifdef FIX_1612                        
e911fa
+static Boolean IsWidgetAttachedOneHorizontalSide(
e911fa
+                        Widget w);
e911fa
+static Boolean IsWidgetAttachedOneVerticalSide(
e911fa
+                        Widget w);
e911fa
+#endif
e911fa
 
e911fa
 /********    End Static Function Declarations    ********/
e911fa
 
e911fa
@@ -1083,13 +1090,21 @@ GeometryManager(
e911fa
 	    } else {
e911fa
 		/* the size the Form wants for the kid request is bigger than 
e911fa
 		   its current or proposed size, return No to the kid */
e911fa
-		
e911fa
 		/* backup the original Form size first */
e911fa
 		fw->core.width = orig_form_width  ;
e911fa
 		fw->core.height = orig_form_height;
e911fa
-		
e911fa
 		/* we haden't changed anything else, just return No */
e911fa
 		reply = XtGeometryNo;
e911fa
+		
e911fa
+#ifdef FIX_1612
e911fa
+                if (((IsWidgetAttachedOneHorizontalSide(w)) && 
e911fa
+                     (desired->request_mode & CWWidth)) ||
e911fa
+                    ((IsWidgetAttachedOneVerticalSide(w)) && 
e911fa
+                     (desired->request_mode & CWHeight)))
e911fa
+		  { PlaceChildren (fw, w, desired);
e911fa
+		    reply = XtGeometryYes; 
e911fa
+		  }
e911fa
+#endif
e911fa
 	    }
e911fa
 	} else {
e911fa
 	    /* ok, we got a Yes form the Form's parent, let's relayout
e911fa
@@ -3477,3 +3492,42 @@ XmCreateFormDialog(
e911fa
    return XmeCreateClassDialog (xmFormWidgetClass,
e911fa
 				parent, name, arglist, argcount) ;
e911fa
 }
e911fa
+
e911fa
+
e911fa
+
e911fa
+#ifdef FIX_1612
e911fa
+/************************************************************************
e911fa
+ *
e911fa
+ *  IsWidgetAttachedOneHorizontalSide
e911fa
+ *	Checking the attachments of widget in horizontal direction.
e911fa
+ *  Returns True if only one (left or right) side of widget is attached
e911fa
+ *
e911fa
+ ************************************************************************/
e911fa
+static Boolean IsWidgetAttachedOneHorizontalSide(Widget w)
e911fa
+  { if (w != NULL)
e911fa
+      { XmFormConstraint c = GetFormConstraint(w);
e911fa
+        if (((c->att[LEFT].type == XmATTACH_NONE) && 
e911fa
+             (c->att[RIGHT].type != XmATTACH_NONE)) ||
e911fa
+            ((c->att[LEFT].type != XmATTACH_NONE) && 
e911fa
+             (c->att[RIGHT].type == XmATTACH_NONE)))
e911fa
+          return True;
e911fa
+          
e911fa
+      }
e911fa
+    return False;
e911fa
+  }    
e911fa
+
e911fa
+  
e911fa
+static Boolean IsWidgetAttachedOneVerticalSide(Widget w)
e911fa
+  { if (w != NULL)
e911fa
+      { XmFormConstraint c = GetFormConstraint(w);
e911fa
+        if (((c->att[TOP].type == XmATTACH_NONE) && 
e911fa
+             (c->att[BOTTOM].type != XmATTACH_NONE)) ||
e911fa
+            ((c->att[TOP].type != XmATTACH_NONE) && 
e911fa
+             (c->att[BOTTOM].type == XmATTACH_NONE)))
e911fa
+          return True;
e911fa
+          
e911fa
+      }
e911fa
+    return False;
e911fa
+  }    
e911fa
+  
e911fa
+#endif
e911fa
-- 
e911fa
2.14.3
e911fa