[8610] in Athena Bugs
Patches for bugs in Widget Creation Library (Wcl 1.05)
daemon@ATHENA.MIT.EDU (Ron Newman rnewman@bbn.com)
Sat Nov 16 02:52:56 1991
To: bugs@Athena.MIT.EDU
Date: Sat, 16 Nov 91 02:52:55 EST
From: Ron Newman rnewman@bbn.com <rnewman@Athena.MIT.EDU>
The following patch file fixes a number of bugs in the X11R4
version of the Widget Creation Library (Wcl 1.05):
- WcCallb.c: call "sprintf" with proper number of arguments.
- WcConvert.c: XmuCvtStringToWidget takes the widget as a conversion
argument. This is necessary so that the special characters (~,^,.) work
properly on the right-hand side of a resource specification, e.g.
*button1.topWidget: ^button2
This is important in any multiple-shell-window application.
Also, it now calls XtStringConversionWarning if it can't convert the
string to a widget.
- WcName.c: add code to avoid dereferencing XtParent(w) in cases
where "^" is used in a resource specification, but the widget doesn't
have a parent.
- XmpRegAll.c: CvtStringToMenuWidget takes the widget as a conversion
argument, for the same reason as XmuCvtStringToWidget above. This allows
*this.subMenuId: ^thisMenu
to work correctly.
If you're planning to convert to the X11R5 version (Wcl 1.06), you don't
need these fixes--they've already been incorporated.
But if you're going to stick with Wcl 1.05 for a while, these bug fixes are a good idea.
*** Wc/WcCallb.c Wed Sep 4 19:51:12 1991
--- ./WcCallb.c Wed Jul 31 13:20:21 1991
***************
*** 496,502 ****
Name of parent can be `this' or wildcarded pathname, \n\
Name of child must be single part name from parent. \n\
Problem: Child widget named `%s' not found.",
! callbackName, parent_children, callbackName, cleanName);
XtWarning( msg );
}
}
--- 496,502 ----
Name of parent can be `this' or wildcarded pathname, \n\
Name of child must be single part name from parent. \n\
Problem: Child widget named `%s' not found.",
! callbackName, parent_children, cleanName, callbackName, cleanName);
XtWarning( msg );
}
}
*** Wc/WcConvert.c Wed Sep 4 19:51:17 1991
--- ./WcConvert.c Wed Sep 4 20:34:09 1991
***************
*** 594,599 ****
--- 594,603 ----
therefore, the converter will fail.
*/
+ XtConvertArgRec wcl_name_to_widget_cvtArgs[] = {
+ {XtBaseOffset, (XtPointer)0, sizeof(Widget)}
+ };
+
void XmuCvtStringToWidget (args, num_args, fromVal, toVal)
XrmValue *args;
Cardinal *num_args;
***************
*** 601,608 ****
XrmValue *toVal;
{
toVal->addr =
! (caddr_t) WcFullNameToWidget( WcRootWidget(NULL), fromVal->addr);
toVal->size = sizeof(Widget);
}
/*
--- 605,614 ----
XrmValue *toVal;
{
toVal->addr =
! (caddr_t) WcFullNameToWidget((Widget)(args[0].addr), fromVal->addr);
toVal->size = sizeof(Widget);
+ if (!toVal->addr)
+ XtStringConversionWarning (fromVal->addr, "Widget - no such widget");
}
/*
***************
*** 648,653 ****
XtAddConverter (XtRString,
XtRWidget,
XmuCvtStringToWidget,
! (XtConvertArgList)NULL,
! (Cardinal)0);
}
--- 654,659 ----
XtAddConverter (XtRString,
XtRWidget,
XmuCvtStringToWidget,
! wcl_name_to_widget_cvtArgs,
! 1);
}
*** Wc/WcName.c Wed Sep 4 19:51:04 1991
--- ./WcName.c Wed Sep 4 20:09:35 1991
***************
*** 505,511 ****
{
if (widgetName[i] == '^')
{
! w = XtParent( w );
}
else if (widgetName[i] == '~')
{
--- 505,525 ----
{
if (widgetName[i] == '^')
{
! Widget parent = XtParent(w);
! if (parent)
! w = XtParent( w );
! else {
! #ifdef DEBUG
! sprintf( msg,
! "WcFullNameToWidget cannot convert `%s' to widget \n\
! Problem: Widget name starts with '^', but widget has no parent"
! widgetName );
! XtWarning( msg );
! #endif
! XtFree (widgetName);
! return NULL;
! }
!
}
else if (widgetName[i] == '~')
{
***************
*** 514,521 ****
** argument when it uses it. Therefore, the extra
** parens are necessary here!
*/
! while (! XtIsShell( (w = XtParent(w)) ) )
! ;
}
i++;
}
--- 528,536 ----
** argument when it uses it. Therefore, the extra
** parens are necessary here!
*/
! if (XtParent(w))
! while (! XtIsShell( (w = XtParent(w)) ) )
! ;
}
i++;
}
*** Xmp/XmpRegAll.c Wed Sep 4 19:50:58 1991
--- ./XmpRegAll.c Wed Jul 31 00:37:12 1991
***************
*** 149,181 ****
XrmValue *fromVal;
XrmValue *toVal;
{
! char cleanName[MAX_XRMSTRING];
! Widget root;
! Widget widget;
! Arg existing[1];
- (void)WcCleanName( fromVal->addr, cleanName );
-
- if ( NULL == (root = WcRootWidget(NULL)) )
- {
- XtStringConversionWarning (cleanName,
- "MenuWidget - can't find a root widget for WcFullNameToWidget");
- return;
- }
-
- if (cleanName[0] == '^' || cleanName[0] == '~')
- {
- XtStringConversionWarning (cleanName,
- "MenuWidget - Relative paths cannot be converted. Use path from root widget."
- );
- return;
- }
-
- widget = WcFullNameToWidget( root, cleanName );
-
if ( widget == NULL )
{
! XtStringConversionWarning (cleanName,
"MenuWidget - no such widget. Misspelled? Forgot the path?");
return;
}
--- 149,159 ----
XrmValue *fromVal;
XrmValue *toVal;
{
! Widget widget = WcFullNameToWidget( (Widget)(args[0].addr), fromVal->addr);
if ( widget == NULL )
{
! XtStringConversionWarning (fromVal->addr,
"MenuWidget - no such widget. Misspelled? Forgot the path?");
return;
}
***************
*** 185,191 ****
{
done ( Widget, widget );
}
! XtStringConversionWarning (cleanName,
"MenuWidget - not XmMENU_PULLDOWN or XmMENU_POPUP.");
}
--- 163,169 ----
{
done ( Widget, widget );
}
! XtStringConversionWarning (fromVal->addr,
"MenuWidget - not XmMENU_PULLDOWN or XmMENU_POPUP.");
}
***************
*** 225,230 ****
--- 203,210 ----
void XmpRegisterAll ( app )
XtAppContext app;
{
+ extern XtConvertArgRec wcl_name_to_widget_cvtArgs[];
+
ONCE_PER_XtAppContext( app );
/* -- Register Motif specific action functions */
***************
*** 234,247 ****
XtAddConverter (XtRString,
WcRWidget, /* "Window" is wrong, but it works !?! */
XmuCvtStringToWidget,
! (XtConvertArgList)NULL,
! (Cardinal)0);
XtAddConverter (XtRString,
XmRMenuWidget,
CvtStringToMenuWidget,
! (XtConvertArgList)NULL,
! (Cardinal)0);
#define RCO( name, func ) WcRegisterConstructor ( app, name, func )
#define RCN( name, class ) WcRegisterClassName ( app, name, class )
--- 214,227 ----
XtAddConverter (XtRString,
WcRWidget, /* "Window" is wrong, but it works !?! */
XmuCvtStringToWidget,
! wcl_name_to_widget_cvtArgs,
! 1);
XtAddConverter (XtRString,
XmRMenuWidget,
CvtStringToMenuWidget,
! wcl_name_to_widget_cvtArgs,
! 1);
#define RCO( name, func ) WcRegisterConstructor ( app, name, func )
#define RCN( name, class ) WcRegisterClassName ( app, name, class )