Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: [XForms] Bug in fdesign with spinner bounds

1 view
Skip to first unread message

SBP

unread,
Nov 10, 2015, 8:39:15 PM11/10/15
to xforms-de...@nongnu.org
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.

Jens Thoms Toerring

unread,
Nov 11, 2015, 4:25:04 PM11/11/15
to Development with and of XForms
Hi Sirius,

On Tue, Nov 10, 2015 at 07:38:39PM -0600, SBP wrote:
> 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.

Thanks a lot for your patch! I'll try it out as soon as possible,
hopefully I'll get to it over the weekend.

Thank you very much and best regards, Jens
--
\ Jens Thoms Toerring ________ j...@toerring.de
\_______________________________ http://toerring.de

0 new messages