diff lwlib/lwlib-Xm.c @ 903:4a27df428c73

[xemacs-hg @ 2002-07-06 05:48:14 by andyp] sync with 21.4
author andyp
date Sat, 06 Jul 2002 05:48:22 +0000
parents e5083672c894
children c2569faae8ed
line wrap: on
line diff
--- a/lwlib/lwlib-Xm.c	Fri Jul 05 22:15:04 2002 +0000
+++ b/lwlib/lwlib-Xm.c	Sat Jul 06 05:48:22 2002 +0000
@@ -301,6 +301,14 @@
     XmStringFree (val_string);
 }
 
+static void
+xm_safe_update_label (widget_instance* instance, Widget widget, widget_value* val)
+{
+  /* Don't clobber non-labels. */
+  if (XtIsSubclass (widget, xmLabelWidgetClass))
+    xm_update_label (instance, widget, val);
+}
+
 #endif /* defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) */
 
 /* update of list */
@@ -540,7 +548,7 @@
 	  XtSetArg (al [ac], XmNsubMenuId, menu); ac++;
 	  button = XmCreateCascadeButton (widget, cur->name, al, ac);
 
-	  xm_update_label (instance, button, cur);
+	  xm_safe_update_label (instance, button, cur);
 
 	  XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback,
 			 (XtPointer)instance);
@@ -561,7 +569,7 @@
 	  else
 	    button = XmCreatePushButtonGadget (widget, cur->name, al, ac);
 
-	  xm_update_label (instance, button, cur);
+	  xm_safe_update_label (instance, button, cur);
 
 	  /* don't add a callback to a simple label */
 	  if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE)
@@ -615,7 +623,8 @@
   /* update the menu button as a label. */
   if (val->change >= VISIBLE_CHANGE)
     {
-      xm_update_label (instance, widget, val);
+      xm_safe_update_label (instance, widget, val);
+
       if (XtClass (widget) == xmToggleButtonWidgetClass
 	  || XtClass (widget) == xmToggleButtonGadgetClass)
 	{
@@ -829,8 +838,7 @@
 
 #if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF)
   /* Common to all label like widgets */
-  if (XtIsSubclass (widget, xmLabelWidgetClass))
-    xm_update_label (instance, widget, val);
+  xm_safe_update_label (instance, widget, val);
 #endif
   class = XtClass (widget);
   /* Class specific things */