diff lwlib/lwlib-Xm.c @ 639:4b7d425dd3c2

[xemacs-hg @ 2001-07-28 05:08:58 by andyp] Stop flickering on OpenMotif.
author andyp
date Sat, 28 Jul 2001 05:09:03 +0000
parents c33ae14dd6d0
children e5083672c894
line wrap: on
line diff
--- a/lwlib/lwlib-Xm.c	Thu Jul 26 21:10:48 2001 +0000
+++ b/lwlib/lwlib-Xm.c	Sat Jul 28 05:09:03 2001 +0000
@@ -336,6 +336,36 @@
   XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
 }
 
+static void
+xm_update_progress (widget_instance* instance, Widget scale,
+		      widget_value* val)
+{
+  Arg al[20];
+  int ac = 0;
+  Dimension height = 0;
+  Dimension width = 0;
+  if (!val->call_data)
+    {
+      XtSetArg (al [ac], XmNeditable, False);		ac++;
+    }
+  else
+    {
+      XtSetArg (al [ac], XmNeditable, val->enabled);		ac++;
+    }
+  height = (Dimension)lw_get_value_arg (val, XtNheight);
+  width = (Dimension)lw_get_value_arg (val, XtNwidth);
+  if (height > 0)
+    {
+      XtSetArg (al [ac], XmNscaleHeight, height); ac++;
+    }
+  if (width > 0)
+    {
+      XtSetArg (al [ac], XmNscaleWidth, width); ac++;
+    }
+
+  XtSetValues (scale, al, 1);
+}
+
 #ifdef LWLIB_MENUBARS_MOTIF
 
 static void
@@ -858,6 +888,10 @@
       xm_update_scrollbar (instance, widget, val);
     }
 #endif
+  else if (class == xmScaleWidgetClass)
+    {
+      xm_update_progress (instance, widget, val);
+    }
   /* Lastly update our global arg values. */
   if (val->args && val->args->nargs)
     XtSetValues (widget, val->args->args, val->args->nargs);
@@ -912,7 +946,7 @@
       if (radiobox)
 	{
 	  CompositeWidget radio = (CompositeWidget)widget;
-	  int i;
+	  unsigned int i;
 	  for (i = 0; i < radio->composite.num_children; i++)
 	    {
 	      int set = False;
@@ -1649,20 +1683,18 @@
 {
   Arg al[20];
   int ac = 0;
+  Dimension height = 0;
+  Dimension width = 0;
   Widget scale = 0;
   widget_value* val = instance->info->val;
-#if 0		/* This looks too awful, although more correct. */
   if (!val->call_data)
     {
-      XtSetArg (al [ac], XmNsensitive, False);		ac++;
+      XtSetArg (al [ac], XmNeditable, False);		ac++;
     }
   else
     {
-      XtSetArg (al [ac], XmNsensitive, val->enabled);		ac++;
+      XtSetArg (al [ac], XmNeditable, val->enabled);		ac++;
     }
-#else
-  XtSetArg (al [ac], XmNsensitive, True);		ac++;
-#endif
   XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING);	ac++;
   XtSetArg (al [ac], XmNuserData, val->call_data);		ac++;
   XtSetArg (al [ac], XmNmappedWhenManaged, FALSE);	ac++;
@@ -1671,6 +1703,18 @@
      look ugly.  I think this may be a LessTif bug but for now we just
      get rid of it. */
   XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+  
+  height = (Dimension)lw_get_value_arg (val, XtNheight);
+  width = (Dimension)lw_get_value_arg (val, XtNwidth);
+  if (height > 0)
+    {
+      XtSetArg (al [ac], XmNscaleHeight, height); ac++;
+    }
+  if (width > 0)
+    {
+      XtSetArg (al [ac], XmNscaleWidth, width); ac++;
+    }
+
   /* add any args the user supplied for creation time */
   lw_add_value_args_to_args (val, al, &ac);