added initial support for libadwaita
This commit is contained in:
parent
f4113ebab7
commit
6f51436616
1 changed files with 37 additions and 4 deletions
|
|
@ -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
|
# nimpretty --maxLineLen:130 gen.nim
|
||||||
# v 0.8.9 2021-MAR-16
|
# v 0.8.9 2021-APR-11
|
||||||
# (c) S. Salewski 2018
|
# (c) S. Salewski 2018, 2019, 2020, 2021
|
||||||
|
|
||||||
# usefull for finding death code:
|
# usefull for finding death code:
|
||||||
# https://forum.nim-lang.org/t/5898
|
# 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
|
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
|
type
|
||||||
GstInit = proc (argc: ptr cint; argv: ptr ptr cstring) {.cdecl.}
|
GstInit = proc (argc: ptr cint; argv: ptr ptr cstring) {.cdecl.}
|
||||||
|
|
||||||
|
|
@ -117,6 +140,9 @@ proc tryInitGst(): LibHandle =
|
||||||
return gstLib
|
return gstLib
|
||||||
# unloadLib(gstLib)
|
# unloadLib(gstLib)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
Gtk3Init = proc (argc: ptr cint; argv: ptr ptr cstring) {.cdecl.}
|
Gtk3Init = proc (argc: ptr cint; argv: ptr ptr cstring) {.cdecl.}
|
||||||
|
|
||||||
|
|
@ -3288,6 +3314,7 @@ import macros, strutils
|
||||||
|
|
||||||
var
|
var
|
||||||
gstLib: LibHandle
|
gstLib: LibHandle
|
||||||
|
adwLib: LibHandle
|
||||||
gtk3Lib: LibHandle
|
gtk3Lib: LibHandle
|
||||||
gtk4Lib: LibHandle
|
gtk4Lib: LibHandle
|
||||||
|
|
||||||
|
|
@ -3325,6 +3352,9 @@ proc main(namespace: string; version: cstring = nil) =
|
||||||
if namespace == "Gst" and gstLib == nil:
|
if namespace == "Gst" and gstLib == nil:
|
||||||
gstLib = tryInitGst()
|
gstLib = tryInitGst()
|
||||||
|
|
||||||
|
if namespace == "Adw" and adwLib == nil:
|
||||||
|
adwLib = tryInitAdw()
|
||||||
|
|
||||||
if namespace == "Gtk" and version == "3.0" and gtk3Lib == nil:
|
if namespace == "Gtk" and version == "3.0" and gtk3Lib == nil:
|
||||||
gtk3Lib = tryInitGtk3()
|
gtk3Lib = tryInitGtk3()
|
||||||
|
|
||||||
|
|
@ -4030,6 +4060,7 @@ proc launch() =
|
||||||
# main("Vte") # not yet available for GTK4
|
# main("Vte") # not yet available for GTK4
|
||||||
main("Notify")
|
main("Notify")
|
||||||
# main("Handy") # not yet available for GTK4
|
# main("Handy") # not yet available for GTK4
|
||||||
|
main("Adw") # replaces libhandy for GTK4
|
||||||
main("Nice")
|
main("Nice")
|
||||||
main("cairo")
|
main("cairo")
|
||||||
main("WebKit2", "5.0")
|
main("WebKit2", "5.0")
|
||||||
|
|
@ -4073,6 +4104,8 @@ proc launch() =
|
||||||
supmod4.close
|
supmod4.close
|
||||||
if gstLib != nil:
|
if gstLib != nil:
|
||||||
unloadLib(gstLib)
|
unloadLib(gstLib)
|
||||||
|
if adwLib != nil:
|
||||||
|
unloadLib(adwLib)
|
||||||
if gtk3Lib != nil:
|
if gtk3Lib != nil:
|
||||||
unloadLib(gtk3Lib)
|
unloadLib(gtk3Lib)
|
||||||
if gtk4Lib != nil:
|
if gtk4Lib != nil:
|
||||||
|
|
@ -4089,7 +4122,7 @@ launch()
|
||||||
# if not xcallerAlloc.contains(el):
|
# if not xcallerAlloc.contains(el):
|
||||||
# echo el
|
# echo el
|
||||||
|
|
||||||
# 4092 lines
|
# 4125 lines
|
||||||
# gtk_icon_view_get_tooltip_context bug Candidate
|
# gtk_icon_view_get_tooltip_context bug Candidate
|
||||||
# gtk_tree_view_get_cursor bug
|
# gtk_tree_view_get_cursor bug
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue