@@ -9,19 +9,6 @@ const libgdk = libgdk3
9
9
const libgtk = libgtk3
10
10
11
11
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
-
25
12
const suffix = :Leaf
26
13
include (" GLib/GLib.jl" )
27
14
using . GLib
@@ -84,6 +71,30 @@ include("theme.jl")
84
71
include (" gio.jl" )
85
72
include (" application.jl" )
86
73
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
+
87
98
const ser_version = Serialization. ser_version
88
99
let cachedir = joinpath (splitdir (@__FILE__ )[1 ], " .." , " gen" )
89
100
fastgtkcache = joinpath (cachedir, " gtk$(libgtk_version. major) _julia_ser$(ser_version) " )
0 commit comments