[Lazarus] [lazarus] Gtk?

Ales Katona almindor at gmail.com
Thu Aug 7 11:25:28 CEST 2008


Reenen Laurie  wrote / napĂ­sal(a):
> Hi Everybody
>
> I don't want to rehash stuff that's already been discussed at length,
> but I missed that part...
>
> According to the blog (lazarus-dev.blogspot.com) Gtk is just so
> complicated.  Why don't we just decide on Qt4 as it is now gpl, and
> focus all our energies on getting qt 4 stable.   Then we can have 1
> very cool looking stable widget set that has scalability, and pretty
> much will be able to satisfy 99% of the users needs (and that 1% isn't
> likely to be fulfilled by GTK anyway).
>
> Regards,
> -Reenen
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>   

Well I played with Gtk2 a bit lately (that is the native thing, not via 
LCL) and I think that later versions (2.10+ and especially 2.12) are 
actually becoming usable.

The thing is, our biggest problem is missing features and "2.6+" support 
which holds us back. I agree with it somewhat but I think we need to 
look into the future too so I started a "gtk2ext" unit which contains 
lazy linked Gtk2.8+ stuff.

Each new component can be checked with Available_componentname_2_x(). So 
say something (like tray icon) was added in 2.12 you can do if 
Available_GtkStatusIcon_2_12() then ...

Same goes for PARTS of components. There are new functions added each 
major release to older components too. I'm slowly mapping that and 
adding them, with same checking mechanism. So if you do 
Available_SomethingOld_2_10() you check if all the new 2_10 functions of 
that component are there (logically 2.12+ should be true as well).

Those who thing gtk2 needs help can help me with this as it's not a 
trivial task. It seems our old gtk2 2.6 binding is missing a lot of 
things. I'm currently going "down by the docs" and filling in stuff, but 
if someone wants to help, tell me which part you want to work on so we 
don't collide.

The structure is rather simple and very h2pas friendly:

unit gtk2ext (inside fpc/packages/gtk2/src/gtkext) contains include 
files for header and implementation parts named after the components 
they include/extend. If you want to extend an old component or add new 
one, just add the 2 new include files.

Adding new ones is especially easy, because gtk2 has header files in 
this exact fashion (this is very nice of them). So you can just h2pas 
them and then fiddle with the result (most work is making the macroes 
into inline functions).

After this is done, the unit can be added to lazarus too (under 
different name) until next fpc version which has it (2.2.4) and we can 
do "if xxx then" to e.g: use proper tray icon for example (the gtk2 
native tray icon works better, it doesn't "get missing" on gnome boot etc.)

Ales



More information about the Lazarus mailing list