added proc fixedgTypeInfoIsPointer()

This commit is contained in:
Stefan Salewski 2022-07-11 08:38:58 +02:00
commit 7d3dceb3df
3 changed files with 31 additions and 15 deletions

View file

@ -1,6 +1,6 @@
= High level GTK4 and GTK3 bindings for the Nim programming language
//(c) Stefan Salewski
//Version 0.9.8
//Version 0.9.9
:experimental:
:imagesdir: http://ssalewski.de/tmp
//:source-highlighter: pygments
@ -29,7 +29,19 @@ with code inserted from files directly.
NOTE: This work is partly based on earlier works of J. Mansour and has been supported by E. Bassi and other _GTK/Gnome_ developers.
The `combinatorics` module was kindly provided by R. Behrends.
NOTE: This is version 0.9.8 of the gintro Nim GTK bindings. It contains some small fixes,
NOTE: This is finally version 0.9.9 of the gintro Nim GTK bindings. It contains some small fixes, that
we applied in the last months. Note that gintro's version numbers are unsigned integers and so wrap around, so
whenever there should be one more new release, that may get the tag 0.1 again.
(More seriously, we hesitate to call next gintro version 1.0 already, because 1.0 would indicate some final state,
which gintro can never archive. All the GTK related libraries are so complex, that it is nearly impossible to
create perfect bindings.)
But as the number of serious
gintro users is tiny, we may fully remove gintro from GitHub by end of 2022. This will save us some work
of continous bug fixes, and users can choose one of the 20 other Nim GUI toolkits. It is indeed very questionable
if gintro would work with Nim 2.0 or GTK 5.0 at all. And after having worked on gintro for more than 1600 hours,
it may be a good decision to just retire now.
NOTE: Version 0.9.8 of the gintro Nim GTK bindings contains some small fixes,
including a fix for the latest uref/unref name change in gobject.
NOTE: In version 0.9.7 of the gintro Nim GTK bindings we tried to fix an

View file

@ -1,6 +1,6 @@
# Package
version = "0.9.8"
version = "0.9.9"
author = "Stefan Salewski"
description = "High level GObject-Introspection based GTK4/GTK3 bindings"
license = "MIT"

View file

@ -1,6 +1,6 @@
# High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language
# nimpretty --maxLineLen:130 gen.nim
# v 0.9.9 2022-JUL-10
# v 0.9.9 2022-JUL-11
# (c) S. Salewski 2018, 2019, 2020, 2021, 2022
# usefull for finding death code:
@ -906,6 +906,16 @@ type
proc genPars(info: GICallableInfo; genProxy = false; binfo: GIBaseInfo = nil; genArrayMark = false; tryOut2Ret: bool = false; modPrefix: bool = false): GPars
proc fixedgTypeInfoIsPointer(t: GITypeInfo): bool =
var p = gTypeInfoIsPointer(t)
if not p:
let tag = gTypeInfoGetTag(t)
if tag == GITypeTag.INTERFACE:
let iface = gTypeInfoGetInterface(t)
if gBaseInfoGetNamespace(iface) == "freetype2" and gBaseInfoGetName(iface) == "Face":
p = true # see issue https://discourse.gnome.org/t/the-gintro-nim-bindings-do-not-compile-with-latest-harfbuzz-4-4-1/10408
return p
# recursive investigate that type -- resolve Arrays and Interfaces
proc newGenRec(t: GITypeInfo; genProxy = false): RecRes =
result[1] = GenRecRes.none
@ -914,15 +924,7 @@ proc newGenRec(t: GITypeInfo; genProxy = false): RecRes =
var cAlloc = false
var newrawmark = ""
var proxyResult = false
var p = gTypeInfoIsPointer(t)
if not p:
let tag = gTypeInfoGetTag(t)
if tag == GITypeTag.INTERFACE:
let iface = gTypeInfoGetInterface(t)
if gBaseInfoGetNamespace(iface) == "freetype2" and gBaseInfoGetName(iface) == "Face":
p = true # see issue https://discourse.gnome.org/t/the-gintro-nim-bindings-do-not-compile-with-latest-harfbuzz-4-4-1/10408
var p = fixedgTypeInfoIsPointer(t)
let tag = gTypeInfoGetTag(t)
if tag == GITypeTag.GLIST:
let arrayType = gTypeInfoGetParamType(t, 0)
@ -1594,7 +1596,9 @@ proc genPars(info: GICallableInfo; genProxy = false; binfo: GIBaseInfo = nil; ge
if hhh.startsWith("gtk4", "gdk4"):
hhh.delete(3, 3)
if gTypeInfoIsPointer(ret) and callerAlloc.contains(hhh) and (not r.startsWith("ptr")):
#if gTypeInfoIsPointer(ret) and callerAlloc.contains(hhh) and (not r.startsWith("ptr")):
if fixedgTypeInfoIsPointer(ret) and callerAlloc.contains(hhh) and (not r.startsWith("ptr")):
r = "ptr " & r
if r != "void":
if genProxy:
@ -4578,6 +4582,6 @@ proc gst_structure_take(oldstrPtr: var ptr Structure00; newstr: ptr Structure00)
proc take*(oldstrPtr: var Structure; newstr: Structure = nil): bool =
toBool(gst_structure_take(if oldstrPtr.isNil: nil else: cast[ptr Structure00](oldstrPtr.impl), if newstr.isNil: nil else: cast[ptr Structure00](newstr.impl)))
gtk4 CssLocation may be userAlloc !
gtk4 CssLocation may be userAlloc ! Face
]#