Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-06

gtk2 bugfix gfloat

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

A c float is a fpc single, right?

If yes, then there was a heavy bug in the gtk2 bindings. Attached patch fixes the gfloat.

Mattias

Reply by email

Mattias Gaertner
to Micha Nelissen
Show quoted text 11 lines
On Tue, 14 Jun 2005 22:11:40 +0200 Mattias Gaertner wrote: > A c float is a fpc single, right? Yes, AFAIK. > If yes, then there was a heavy bug in the gtk2 bindings. Attached patch > fixes the gfloat. There is no patch ?

Take this.

Mattias

Reply by email

Florian Klaempfl
to Mattias Gaertner
Mattias Gaertner wrote 20 lines
On Tue, 14 Jun 2005 22:34:19 +0200 Micha Nelissen wrote: >On Tue, 14 Jun 2005 22:11:40 +0200 >Mattias Gaertner wrote: > > >>A c float is a fpc single, right? > >Yes, AFAIK. > > >>If yes, then there was a heavy bug in the gtk2 bindings. Attached patch >>fixes the gfloat. > >There is no patch ? Take this.

Applied, hopefully it is correct ;)

Reply by email

Micha Nelissen
to Mattias Gaertner: On Tue, 14 Jun 2005 22:34:19 +0200 Take this. Mattias
Show quoted text 7 lines
On Tue, 14 Jun 2005 22:34:19 +0200 Micha Nelissen wrote: > On Tue, 14 Jun 2005 22:11:40 +0200 > Mattias Gaertner wrote: > > > A c float is a fpc single, right?

So why did you do:

-   {$IFDEF KYLIX}
-     gfloat = single;   //  Don't know why, but some routines requires this
-   {$ELSE}
-     gfloat = double;
-   {$ENDIF}
+   gfloat = double;

If you weren't using KYLIX, nothing has changed :S, shouldn't that be:

+   gfloat = single;

?

Micha

Reply by email

Mattias Gaertner
to Micha Nelissen
Show quoted text 25 lines
On Tue, 14 Jun 2005 23:33:17 +0200 Mattias Gaertner wrote: > On Tue, 14 Jun 2005 22:34:19 +0200 > Micha Nelissen wrote: > > > On Tue, 14 Jun 2005 22:11:40 +0200 > > Mattias Gaertner wrote: > > > > > A c float is a fpc single, right? So why did you do: - {$IFDEF KYLIX} - gfloat = single; // Don't know why, but some routines requires this - {$ELSE} - gfloat = double; - {$ENDIF} + gfloat = double; If you weren't using KYLIX, nothing has changed :S, shouldn't that be: + gfloat = single; ?

You are right, I'm right, but my patch was insufficient. Of course it must be single.

Marko Peric pointed me to a strange bug with some gtk2 examples translated to pascal. After some debugging I saw, that with double it doesn't work, but with single it works. According to the gtk2 sources and docs, gfloat must be a c float. So definitely double is wrong and single works in my test cases. I tested it with gtk2forpascal. But at the moment I have some trouble building fpc and its rpms. Maybe the gfloat bug explains some of the strange lazarus gtk2 interface bugs.
The reason, why this bug was not spotted before, is that the gtk2 always bounds all gfloat input. This results in most cases to no effect, not even a warning.

Mattias

Reply by email

Florian Klaempfl
to Mattias Gaertner
Mattias Gaertner wrote 47 lines
On Wed, 15 Jun 2005 09:20:48 +0200 Micha Nelissen wrote: >On Tue, 14 Jun 2005 23:33:17 +0200 >Mattias Gaertner wrote: > > >>On Tue, 14 Jun 2005 22:34:19 +0200 >>Micha Nelissen wrote: >> >> >>>On Tue, 14 Jun 2005 22:11:40 +0200 >>>Mattias Gaertner wrote: >>> >>> >>>>A c float is a fpc single, right? > >So why did you do: > >- {$IFDEF KYLIX} >- gfloat = single; // Don't know why, but some routines requires >this - {$ELSE} >- gfloat = double; >- {$ENDIF} >+ gfloat = double; > >If you weren't using KYLIX, nothing has changed :S, shouldn't that be: > >+ gfloat = single; > >? You are right, I'm right, but my patch was insufficient. Of course it must be single. Marko Peric pointed me to a strange bug with some gtk2 examples translated to pascal. After some debugging I saw, that with double it doesn't work, but with single it works. According to the gtk2 sources and docs, gfloat must be a c float. So definitely double is wrong and single works in my test cases. I tested it with gtk2forpascal. But at the moment I have some trouble building fpc and its rpms. Maybe the gfloat bug explains some of the strange lazarus gtk2 interface bugs. The reason, why this bug was not spotted before, is that the gtk2 always bounds all gfloat input. This results in most cases to no effect, not even a warning.

Changed again. The correct solution would be imo to use the ctypes unit and make it a cfloat. Mattias, afaik you've write permissions to the fpc repository so you can do further changes to the gtk2 interface units yourself :)

Reply by email