@@ -9,19 +9,6 @@ const libgdk = libgdk3
99const libgtk = libgtk3
1010
1111
12- function __init__ ()
13- # Set up environment variables so that gdk-pixbuf can find its loaders
14- if get (ENV , " GDK_PIXBUF_MODULEDIR" , " " ) == " "
15- ENV [" GDK_PIXBUF_MODULEDIR" ] = joinpath (
16- dirname (gdk_pixbuf_jll. libgdkpixbuf_path),
17- " gdk-pixbuf-2.0" ,
18- " 2.10.0" ,
19- " loaders" ,
20- )
21- end
22- end
23-
24-
2512const suffix = :Leaf
2613include (" GLib/GLib.jl" )
2714using . GLib
@@ -84,6 +71,30 @@ include("theme.jl")
8471include (" gio.jl" )
8572include (" application.jl" )
8673
74+ function __init__ ()
75+ # Set up environment variables so that gdk-pixbuf can find its loaders
76+ if get (ENV , " GDK_PIXBUF_MODULEDIR" , " " ) == " "
77+ ENV [" GDK_PIXBUF_MODULEDIR" ] = joinpath (
78+ dirname (gdk_pixbuf_jll. libgdkpixbuf_path),
79+ " gdk-pixbuf-2.0" ,
80+ " 2.10.0" ,
81+ " loaders" ,
82+ )
83+ end
84+
85+ GError () do error_check
86+ ccall ((:gtk_init_with_args , libgtk), Bool,
87+ (Ptr{Nothing}, Ptr{Nothing}, Ptr{UInt8}, Ptr{Nothing}, Ptr{UInt8}, Ptr{GError}),
88+ C_NULL , C_NULL , " Julia Gtk Bindings" , C_NULL , C_NULL , error_check)
89+ end
90+
91+ # if g_main_depth > 0, a glib main-loop is already running,
92+ # so we don't need to start a new one
93+ if ccall ((:g_main_depth , GLib. libglib), Cint, ()) == 0
94+ global gtk_main_task = schedule (Task (gtk_main))
95+ end
96+ end
97+
8798const ser_version = Serialization. ser_version
8899let cachedir = joinpath (splitdir (@__FILE__ )[1 ], " .." , " gen" )
89100 fastgtkcache = joinpath (cachedir, " gtk$(libgtk_version. major) _julia_ser$(ser_version) " )
0 commit comments