Re: patch for bug: use double for Gtk Adjustment.set_value

Felix Ruess <[email protected]> Wed, 20 Aug 2014 13:01:53 +0200
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <CAEc+GFfut_QMTO6JZB8Y4DHk0aDNFtjTgh3nZqn5XbrMK5=vXg@mail.gmail.com>
--===============6673909830152472111==
Content-Type: multipart/alternative; boundary=089e0122f372225e9905010d88f9

--089e0122f372225e9905010d88f9
Content-Type: text/plain; charset=UTF-8

Hi again,

it actually seems like all the occurrences of Float_val (for functions of
gtkadjustment) in ml_gtk.c should be changed to Double_val

Cheers, Felix


On Sun, Aug 17, 2014 at 8:45 PM, Felix Ruess <[email protected]> wrote:

> Hi all,
>
> I found a problem when using sliders spin buttons and the like via gtk
> adjustment:
> Trying to set them to large values (that don't fit into a single precision
> float) to it results in a wrong valuing being displayed.
> The gtk functions actually use doubles, the problem is
> that gtk_adjustment_set_value uses Float_val instead of Double_val
>
> I quickly built a new package using the attached patch and it fixes the
> bug (although there might be a few more places where Float_val should
> actually be Double_val).
> Now it correctly displays values like 2467627534 that are otherwise
> displayed as 2467627520 since the conversion to float removes the lower
> nibble...
>
> Cheers, Felix
>
>

--089e0122f372225e9905010d88f9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi again,<div><br></div><div>it actually seems like all th=
e occurrences of Float_val (for functions of gtkadjustment) in ml_gtk.c sho=
uld be changed to Double_val</div><div><br></div><div>Cheers, Felix</div></=
div>
<div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Sun, Aug 1=
7, 2014 at 8:45 PM, Felix Ruess <span dir=3D"ltr">&lt;<a href=3D"mailto:fel=
[email protected]" target=3D"_blank">[email protected]</a>&gt;</span> =
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">Hi all,<div><br></div><div>=
I found a problem when using sliders spin buttons and the like via gtk adju=
stment:</div>
<div>Trying to set them to large values (that don&#39;t fit into a single p=
recision float) to it results in a wrong valuing being displayed.</div>
<div>The gtk functions actually use doubles, the problem is that=C2=A0gtk_a=
djustment_set_value uses Float_val instead of Double_val</div><div><br></di=
v><div>I quickly built a new package using the attached patch and it fixes =
the bug (although there might be a few more places where Float_val should a=
ctually be Double_val).</div>

<div>Now it correctly displays values like=C2=A0<a href=3D"tel:2467627534" =
value=3D"+12467627534" target=3D"_blank">2467627534</a> that are otherwise =
displayed as=C2=A0<a href=3D"tel:2467627520" value=3D"+12467627520" target=
=3D"_blank">2467627520</a> since the conversion to float removes the lower =
nibble...</div>
<div><br></div><div>Cheers, Felix</div><div><br></div></div>
</blockquote></div><br></div>

--089e0122f372225e9905010d88f9--

--===============6673909830152472111==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Lablgtk-list mailing list
[email protected]
https://lists.ocamlcore.org/cgi-bin/listinfo/lablgtk-list

--===============6673909830152472111==--