WindowHints is set[enum] now

This commit is contained in:
Stefan Salewski 2020-05-24 20:44:25 +02:00
commit 487e8f99ef

View file

@ -1,6 +1,6 @@
# High level gobject-introspection based GTK3/GTK4 bindings for the Nim programming language # High level gobject-introspection based GTK3/GTK4 bindings for the Nim programming language
# nimpretty --maxLineLen:130 gen.nim # nimpretty --maxLineLen:130 gen.nim
# v 0.7.5 2020-MAY-20 # v 0.7.6 2020-MAY-24
# (c) S. Salewski 2018 # (c) S. Salewski 2018
# https://wiki.gnome.org/Projects/GObjectIntrospection # https://wiki.gnome.org/Projects/GObjectIntrospection
@ -646,7 +646,7 @@ proc genPars(info: GICallableInfo; genProxy = false; binfo: GIBaseInfo = nil): (
info) and ( info) and (
gFunctionInfoGetFlags(info).int and gFunctionInfoGetFlags(info).int and
GIFunctionInfoFlags.WRAPS_VFUNC.ord) == 0: GIFunctionInfoFlags.WRAPS_VFUNC.ord) == 0:
if userAlloc and mayBeNil: if userAlloc and mayBeNil:# or (sym == "gdk_window_set_geometry_hints" and str == "Geometry"): # gir bug!
var h = str var h = str
h.removePrefix("var ") h.removePrefix("var ")
str.add(" = cast[ptr " & h & "](nil)[]") str.add(" = cast[ptr " & h & "](nil)[]")
@ -1505,7 +1505,7 @@ proc writeInterface(info: GIInterfaceInfo) =
# write a few of the strange enum sets # write a few of the strange enum sets
proc writeModifierType(info: GIEnumInfo) = proc writeModifierType(info: GIEnumInfo) =
let we = gBaseInfoGetName(info) let we = gBaseInfoGetName(info)
assert(we in ["ModifierType", "EventMask", "AccelFlags", "AttachOptions", "MessageType"]) assert(we in ["ModifierType", "EventMask", "AccelFlags", "AttachOptions", "MessageType", "WindowHints"])
type T = tuple[v: int64; n: string] type T = tuple[v: int64; n: string]
var s: seq[T] var s: seq[T]
var alias: seq[string] var alias: seq[string]
@ -1522,6 +1522,7 @@ proc writeModifierType(info: GIEnumInfo) =
if result == 0: if result == 0:
result = cmp(x.n, y.n) result = cmp(x.n, y.n)
var tname = mangleName(gBaseInfoGetName(info)) var tname = mangleName(gBaseInfoGetName(info))
if tname != "WindowHints":
firstPart(tname) firstPart(tname)
output.writeLine(" ", tname & "Flag" & EM, " {.size: sizeof(cint), pure.} = enum") output.writeLine(" ", tname & "Flag" & EM, " {.size: sizeof(cint), pure.} = enum")
if s[0].v != 0 and s[0].v != 1: # flags may start with none = 0 or with flag1 = 1 if s[0].v != 0 and s[0].v != 1: # flags may start with none = 0 or with flag1 = 1
@ -1554,14 +1555,14 @@ proc writeModifierType(info: GIEnumInfo) =
writeMethod(info, minfo) writeMethod(info, minfo)
proc writeEnum(info: GIEnumInfo) = proc writeEnum(info: GIEnumInfo) =
if mangleName(gBaseInfoGetName(info)) in ["ModifierType", "EventMask", "AccelFlags", "AttachOptions"] or if mangleName(gBaseInfoGetName(info)) in ["ModifierType", "EventMask", "AccelFlags", "AttachOptions", "WindowHints"] or
(moduleNameSpace == "gst" and mangleName(gBaseInfoGetName(info)) == "MessageType"): (moduleNameSpace == "gst" and mangleName(gBaseInfoGetName(info)) == "MessageType"):
writeModifierType(info) writeModifierType(info)
return return
type T = tuple[v: int64; n: string] type T = tuple[v: int64; n: string]
var s: seq[T] var s: seq[T]
var alias: seq[string] var alias: seq[string]
var flags = ($gBaseInfoGetName(info)).endsWith("Flags") var flags = ($gBaseInfoGetName(info)).endsWith("Flags")# or $gBaseInfoGetName(info) == "WindowHints"
output.writeLine("type") output.writeLine("type")
let n = info.gEnumInfoGetNValues() let n = info.gEnumInfoGetNValues()
for j in 0.cint ..< n: for j in 0.cint ..< n:
@ -2708,4 +2709,4 @@ proc launch() =
supmod4.close supmod4.close
launch() launch()
# 2711 lines # 2712 lines