Skip to content

Commit

Permalink
adjust deps compatability to prevent situations where GI-generated ty…
Browse files Browse the repository at this point in the history
…pes are not present in the library

Also add version checks for some libraries. Given that we have compat versions, these checks should only fail when a library other than the JLL is being pulled in.
  • Loading branch information
jwahlstrand committed May 25, 2024
1 parent 8648c03 commit ba189bd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Gtk4"
uuid = "9db2cae5-386f-4011-9d63-a5602296539b"
version = "0.6.5"
version = "0.6.6"

[deps]
BitFlags = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35"
Expand Down Expand Up @@ -33,20 +33,20 @@ Cairo = "1.0.0"
Cairo_jll = "1.16.0"
ColorTypes = "0.10, 0.11"
FixedPointNumbers = "0.5, 0.6, 0.7, 0.8"
GTK4_jll = "4.6.0"
Glib_jll = "2.74.0"
GTK4_jll = "4.12.0"
Glib_jll = "2.78.0"
Graphene_jll = "1.10"
Graphics = "1"
JLLWrappers = "1.4.0"
Libdl = "1.6"
libpng_jll = "<1.6.42"
Librsvg_jll = "2.54"
Pango_jll = "1.50"
Pango_jll = "1.51"
Preferences = "1"
Reexport = "1.0"
Scratch = "1.1.0"
Xorg_xkeyboard_config_jll = "2.27.0"
adwaita_icon_theme_jll = "3,43"
gdk_pixbuf_jll = "2.38.2"
gdk_pixbuf_jll = "2.42.0"
hicolor_icon_theme_jll = "0.17.0"
julia = "1.6"
5 changes: 5 additions & 0 deletions src/GLib/GLib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ include("gio.jl")

const exiting = Ref(false)
function __init__()
# check that libglib is compatible with what the GI generated code expects
vercheck = G_.check_version(MAJOR_VERSION,MINOR_VERSION,0)
if vercheck !== nothing
@warn "GLib version check failed: $vercheck"
end
global JuliaClosureMarshal = @cfunction(GClosureMarshal, Nothing,
(Ptr{Nothing}, Ptr{GValue}, Cuint, Ptr{GValue}, Ptr{Nothing}, Ptr{Nothing}))
exiting[] = false
Expand Down
6 changes: 6 additions & 0 deletions src/Gtk4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ end
function __init__()
in("Gtk",[x.name for x in keys(Base.loaded_modules)]) && error("Gtk4 is incompatible with Gtk.")

# check that GTK is compatible with what the GI generated code expects
vercheck = G_.check_version(MAJOR_VERSION,MINOR_VERSION,0)
if vercheck !== nothing
@warn "Gtk4 version check failed: $vercheck"
end

# Set XDG_DATA_DIRS so that Gtk can find its icons and schemas
ENV["XDG_DATA_DIRS"] = join(filter(x -> x !== nothing, [
dirname(adwaita_icons_dir),
Expand Down
9 changes: 7 additions & 2 deletions src/Pango/Pango.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ for func in filter(x->startswith(string(x),"set_"),Base.names(G_,all=true))
end

function __init__()
gtype_wrapper_cache_init()
gboxed_cache_init()
# check that libpango is compatible with what the GI generated code expects
vercheck = G_.version_check(VERSION_MAJOR,VERSION_MINOR,0)
if vercheck !== nothing
@warn "Pango version check failed: $vercheck"
end
gtype_wrapper_cache_init()
gboxed_cache_init()
end

default_font_map() = G_.font_map_get_default()
Expand Down

0 comments on commit ba189bd

Please sign in to comment.