xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XForms] Bug in fdesign with spinner bounds


From: SBP
Subject: Re: [XForms] Bug in fdesign with spinner bounds
Date: Tue, 10 Nov 2015 19:38:39 -0600

Hi there

Following up on my previous (and somewhat erroneous) bug report, I've
found how to fix it. It turns out there IS code for reading out the
spinner properties (in fd_spec.c) but there was a problem with how this
information was used by fdesign when assigning spinner properties.

The following two patches fix this problem and another with fdesign
segfaulting when changing the precision of a float spinner. Hope these
help and get upstream.

--- fd_super.c~ 2014-06-28 15:34:29.000000000 -0500
+++ fd_super.c  2015-11-04 22:07:52.490200451 -0600
@@ -410,9 +410,9 @@ superspec_to_spec( FL_OBJECT * obj )
     {
         FLI_SPINNER_SPEC *sp = obj->spec;
 
-        fl_set_spinner_value( obj, ssp->val );
-        fl_set_spinner_bounds( obj, ssp->min, ssp->max );
-        fl_set_spinner_step( obj, ssp->step );
+        fl_set_spinner_value( obj, ssp->dval );
+        fl_set_spinner_bounds( obj, ssp->dmin, ssp->dmax );
+        fl_set_spinner_step( obj, ssp->dstep );
         fl_set_spinner_precision( obj, ssp->prec );
         sp->orient = ssp->orient;
     }


--- sp_spinner.c~       2013-12-14 07:26:25.000000000 -0600
+++ sp_spinner.c        2015-11-04 22:29:30.184820771 -0600
@@ -187,7 +187,7 @@ spinner_emit_spec_fd_code( FILE      * f
     else
     {
         if ( sp->f_min != defsp->f_min || sp->f_max != defsp->f_max )
-            fprintf( fp, "    bounds: %.*fd %.*f\n",
+            fprintf( fp, "    bounds: %.*f %.*f\n",
                      sp->prec, sp->f_min, sp->prec, sp->f_max );
 
         if ( sp->f_val != defsp->f_val )
@@ -300,14 +300,15 @@ spn_minmax_change( FL_OBJECT * obj   FL_
  ***************************************/
 
 void
-spn_stepchange_cb( FL_OBJECT * obj,
+spn_stepchange_cb( FL_OBJECT * obj   FL_UNUSED_ARG,
                    long        data  FL_UNUSED_ARG )
 {
     FLI_SPINNER_SPEC *sp = curobj->spec;
 
-    set_finput_value( obj, get_finput_value( obj ),
+    set_finput_value( spn_attrib->step,
+                      get_finput_value( spn_attrib->step ),
                       curobj->type == FL_INT_SPINNER ? 0 : sp->prec );
-    fl_set_spinner_step( curobj, get_finput_value( obj ) );
+    fl_set_spinner_step( curobj, get_finput_value( spn_attrib->step )
); redraw_the_form( 0 );
 }
 
@@ -316,14 +317,15 @@ spn_stepchange_cb( FL_OBJECT * obj,
  ***************************************/
 
 void
-spn_initialvalue_change( FL_OBJECT * obj,
+spn_initialvalue_change( FL_OBJECT * obj   FL_UNUSED_ARG,
                          long        data  FL_UNUSED_ARG )
 {
     FLI_SPINNER_SPEC *sp = curobj->spec;
 
-    set_finput_value( obj, get_finput_value( obj ),
+    set_finput_value( spn_attrib->initialval,
+                      get_finput_value( spn_attrib->initialval ),
                       curobj->type == FL_INT_SPINNER ? 0 : sp->prec );
-    fl_set_spinner_value( curobj, get_finput_value( obj ) );
+    fl_set_spinner_value( curobj,
get_finput_value( spn_attrib->initialval ) ); redraw_the_form( 0 );
 }


Cheers!

Sirius.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]