diff --git a/tests/gen.nim b/tests/gen.nim index daef10f..135a88f 100644 --- a/tests/gen.nim +++ b/tests/gen.nim @@ -1,7 +1,7 @@ -# High level gobject-introspection based GTK3/GTK4 bindings for the Nim programming language +# High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language # nimpretty --maxLineLen:130 gen.nim -# v 0.8.9 2021-MAR-16 -# (c) S. Salewski 2018 +# v 0.8.9 2021-APR-11 +# (c) S. Salewski 2018, 2019, 2020, 2021 # usefull for finding death code: # https://forum.nim-lang.org/t/5898 @@ -94,6 +94,29 @@ int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64 import dynlib +type + AdwInit = proc (argc: ptr cint; argv: ptr ptr cstring) {.cdecl.} + +proc tryInitAdw(): LibHandle = + # echo "Try to init gst" + when defined(windows): + const AdwLibName = "adwaita-1-0.dll" + elif defined(macosx): + const AdwLibName = "libadwaita-1.dylib" + else: + const AdwLibName = "libadwaita-1.so(|.0)" + let adwLib = loadLibPattern(AdwLibName) # dlopen + if adwLib != nil: + let adwInit = cast[AdwInit](adwLib.symAddr("adw_init")) + if adwInit != nil: + adwInit(nil, nil) + else: + echo "Can't init adw library!" + else: + echo "Can't load adw library!" + return adwLib + # unloadLib(adwLib) + type GstInit = proc (argc: ptr cint; argv: ptr ptr cstring) {.cdecl.} @@ -117,6 +140,9 @@ proc tryInitGst(): LibHandle = return gstLib # unloadLib(gstLib) + + + type Gtk3Init = proc (argc: ptr cint; argv: ptr ptr cstring) {.cdecl.} @@ -3288,6 +3314,7 @@ import macros, strutils var gstLib: LibHandle + adwLib: LibHandle gtk3Lib: LibHandle gtk4Lib: LibHandle @@ -3325,6 +3352,9 @@ proc main(namespace: string; version: cstring = nil) = if namespace == "Gst" and gstLib == nil: gstLib = tryInitGst() + if namespace == "Adw" and adwLib == nil: + adwLib = tryInitAdw() + if namespace == "Gtk" and version == "3.0" and gtk3Lib == nil: gtk3Lib = tryInitGtk3() @@ -4030,6 +4060,7 @@ proc launch() = # main("Vte") # not yet available for GTK4 main("Notify") # main("Handy") # not yet available for GTK4 + main("Adw") # replaces libhandy for GTK4 main("Nice") main("cairo") main("WebKit2", "5.0") @@ -4073,6 +4104,8 @@ proc launch() = supmod4.close if gstLib != nil: unloadLib(gstLib) + if adwLib != nil: + unloadLib(adwLib) if gtk3Lib != nil: unloadLib(gtk3Lib) if gtk4Lib != nil: @@ -4089,7 +4122,7 @@ launch() # if not xcallerAlloc.contains(el): # echo el -# 4092 lines +# 4125 lines # gtk_icon_view_get_tooltip_context bug Candidate # gtk_tree_view_get_cursor bug #