Updated GTK headers (GTK-2 and GTK-3)

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by dkl »

These new GTK+ headers and the examples and import libraries are now added to FB 0.24, and thanks for doing the translation. I removed the h_2_bi notices, but besides that only few other adjustments:

- glib.bi: G_WIN32_DLLMAIN_FOR_DLL_NAME(): changed DllMain cdecl to DllMain stdcall alias "DllMain"
- removed #lang "fb" statements, the headers work for -lang fblite/deprecated too
- goocanvas.bi: Removed __gtk_bi__ check, since it's already using __GTK_H__
- For FB 0.24, __FB_UNIX__ works like the other OS defines (optionally defined), changed #ELSEIF __FB_UNIX__ to #ELSEIF DEFINED(__FB_UNIX__)

Also, in your libintl.bi, unsigned long int (32bit) was translated as ULONGINT (64bit) instead of ULONG.

I didn't change __FB_GTK3__ to something else for now, because I don't know what alternative to choose. Should we establish a standard for such "controlling" defines? We do have others too:
- WIN_INCLUDEALL (windows.bi)
- PTC_WIN (tinyptc.bi)
- __BFD_VER__ (bfd.bi)
We could use a naming convention like __USE_*, that's also used in glibc and MinGW. But the old ones would have to be kept too, for backwards compatibility.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by TJF »

@dkl:

Congratulations for doing the GTK job! And thanks for your hints and for checking more than 3 Mb of source code.

But sorry, meanwhile I made a newer translation for GTK-3.2 and all it's dependencies. Now I reviewed this newer package and implemented your changes (and some others):
  • reduced h_2_bi notices (I think the remaining are essential, don't remove the protocol -- users can find important info here!!)
  • glib.bi: DllMain STDCALL ALIAS "DllMain"
  • all: #LANG "fb" statements removed (doesn't work in #LANG "qb" due to EXTERN blocks)
  • goocanvas.bi: __gtk_bi__ check removed, it's working with GTK-3 now.
  • all: __FB_UNIX__ replaced by DEFINED(__FB_UNIX__)
  • libintl.bi: ULONGINT replaced by ULONG
  • __FB_GTK3__: replaced by __USE_GTK3__
  • __FB_GTK_OLD__: replaced by __USE_GTK_OLD__
You (and all users) can download the latest package (headers, import libraries and matching examples) here:
Gtk-2.24&3.2_Headers-Importlibs-Examples.zip
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by dkl »

Ok, updated to 3.2 (download file is named *.zip.zip so needed to append a .zip to your URL).

- I forgot to mention it before, but I also removed the extern/__declspec() defines (GLIB_VAR etc.), they couldn't be used anyways.

- glib.bi: cleaned up the alloca() stuff to be the same as your previous version again (#include crt's alloca.bi and #define alloca _alloca)

- gdk-pixbuf.bi had a duplicate <#ifndef GDK_PIXBUF_DISABLE_DEPRECATED> line
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by TJF »

dkl wrote:Ok, updated to 3.2 ...
Good job!
dkl wrote:... (download file is named *.zip.zip so needed to append a .zip to your URL).
Sorry! I rename the file at the server so that the original link works now.
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by dkl »

I'm also trying to update the wiki, specifically this page:
http://www.freebasic.net/wiki/wikka.php?wakka=ExtLibTOC

I updated the GTK+ page already:
http://www.freebasic.net/wiki/wikka.php?wakka=ExtLibgtk

However, should we list GDK, Pango, glib (which I think includes GIO and GModule?), ATK, libart and libglade as separate libraries, or as part of the GTK+ page?
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by TJF »

libgalde is deprecated and completely replaced by GtkBuilder (since GTK-2.16 in 2009). I think we should remove it.

I never used GDK, ATK or libart without GTK, so I think these can be bundled in the GTK-page.

But IMO it makes sense to mention as separate libraries
  • glib@'System APIs' (including GIO, GModule, GObject, GThread):
    GLib is an LGPL licensed general-purpose utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on. It works on many UNIX-like platforms, Windows, OS/2 and BeOS.
  • Pango/PangoCairo@'Graphics':
    Pango is an LGPL licensed open source computing library for laying out and rendering text in high quality, emphasising support for multilingual text. Different font backends can be used, allowing cross-platform support, so that Pango-rendered text will appear similar under different operating systems, such as Linux, Apple's Mac OS and Microsoft Windows.
BTW:

I'd love to see information on OSs, header versions, licenses and examples at this page (ie in a table)
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by TJF »

Sorry, I just found 3 bugs in gtk-2.24.bi. The lines
  • DECLARE SUB gtk_icon_theme_set_search_path(BYVAL AS GtkIconTheme PTR, BYVAL AS CONST gchar PTR PTR, BYVAL AS gint PTR)
    DECLARE SUB gtk_icon_theme_get_search_path(BYVAL AS GtkIconTheme PTR, BYVAL AS gchar PTR PTR PTR, BYVAL AS gint PTR PTR)
    ...
    DECLARE FUNCTION gtk_icon_theme_choose_icon(BYVAL AS GtkIconTheme PTR, BYVAL AS CONST gchar PTR PTR, BYVAL AS gint PTR, BYVAL AS GtkIconLookupFlags PTR) AS GtkIconInfo PTR
should get
  • DECLARE SUB gtk_icon_theme_set_search_path(BYVAL AS GtkIconTheme PTR, BYVAL AS CONST gchar PTR PTR, BYVAL AS gint)
    DECLARE SUB gtk_icon_theme_get_search_path(BYVAL AS GtkIconTheme PTR, BYVAL AS gchar PTR PTR PTR, BYVAL AS gint PTR)
    ...
    DECLARE FUNCTION gtk_icon_theme_choose_icon(BYVAL AS GtkIconTheme PTR, BYVAL AS CONST gchar PTR PTR, BYVAL AS gint, BYVAL AS GtkIconLookupFlags) AS GtkIconInfo PTR
(As in gtk-3.2.bi.)
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by dkl »

The fixes are now applied, thanks.

Yea it seems like libglade, similar to libart, has been replaced by better things in GNOME and GTK+, although both are still available and used, so I'm reluctant removing their FB headers. They're now separate from the GTK+ headers though, so it should be fine.

I agree, it seems ok to include GDK on the GTK+ page, and have separate entries for glib and Pango. I put the status/example/usage/background information on the individual library pages (those linked from ExtLibTOC) for now, because making a true table is too impractical on the FB wiki (see also this).
scottmcardle
Posts: 8
Joined: Jan 05, 2017 17:11

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by scottmcardle »

apologies if this is a dumb question but are the libs not part of freebasic by default?

is this still the most current?
http://users.freebasic-portal.de/tjf/GTK/Gtk.7z

so there isnt any point in having gta3 latest version as there is no current matching header for FB?

thanks
scott
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by MrSwiss »

scottmcardle wrote:apologies if this is a dumb question but are the libs not part of freebasic by default?
No, they are not. Only the bindings (*.bi files) are part of the distribution.
Reason(s): maintenance (aka: staying current), as well as (download) package size.
scottmcardle
Posts: 8
Joined: Jan 05, 2017 17:11

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by scottmcardle »

MrSwiss wrote:
scottmcardle wrote:apologies if this is a dumb question but are the libs not part of freebasic by default?
No, they are not. Only the bindings (*.bi files) are part of the distribution.
Reason(s): maintenance (aka: staying current), as well as (download) package size.
i only appear to have 3 bi files in my inc\gtk folder currently, this whole download is necessary then?

thanks
scott
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Updated GTK headers (GTK-2 and GTK-3)

Post by MrSwiss »

Just checked the GTK stuff. Version: GTK3.bi --> GTK ver. 3.16
scottmcardle wrote:this whole download is necessary then?
If you're referring to GTK, then yes.

GTK is NOT a Lib (in the common sense), it's a collection of (other) Lib's (aka: it is a Lib of Lib's).
Therefore, quite huge ... (maybe to big for starters). Complexity rating: very high!

Have a look at GTK3.bi --> see the amount of other included Lib's ... (near the top)
Post Reply