65 |
|
|
66 |
GtkWindowGroup *global_gtk_window_group; |
GtkWindowGroup *global_gtk_window_group; |
67 |
|
|
68 |
|
static void init_glib_threads(JNIEnv *, jint); |
69 |
|
|
70 |
double dpi_conversion_factor; |
double dpi_conversion_factor; |
71 |
|
|
72 |
static void init_dpi_conversion_factor (); |
static void init_dpi_conversion_factor (); |
76 |
/* |
/* |
77 |
* Call gtk_init. It is very important that this happen before any other |
* Call gtk_init. It is very important that this happen before any other |
78 |
* gtk calls. |
* gtk calls. |
79 |
|
* |
80 |
|
* The portableNativeSync argument may have the values: |
81 |
|
* 1 if the Java property gnu.classpath.awt.gtk.portable.native.sync |
82 |
|
* is set to "true". |
83 |
|
* 0 if it is set to "false" |
84 |
|
* -1 if unset. |
85 |
*/ |
*/ |
86 |
|
|
87 |
JNIEXPORT void JNICALL |
JNIEXPORT void JNICALL |
88 |
Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz) |
Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz, |
89 |
|
jint portableNativeSync) |
90 |
{ |
{ |
91 |
int argc = 1; |
int argc = 1; |
92 |
char **argv; |
char **argv; |
110 |
#endif |
#endif |
111 |
argv[1] = NULL; |
argv[1] = NULL; |
112 |
|
|
113 |
/* until we have JDK 1.2 JNI, assume we have a VM with threads that |
init_glib_threads(env, portableNativeSync); |
|
match what GLIB was compiled for */ |
|
|
#ifdef PORTABLE_NATIVE_SYNC |
|
|
(*env)->GetJavaVM( env, &the_vm ); |
|
|
g_thread_init ( &portable_native_sync_jni_functions ); |
|
|
/* Debugging progress message; uncomment if needed: */ |
|
|
/* printf("called gthread init\n"); */ |
|
|
#else |
|
|
g_thread_init ( NULL ); |
|
|
#endif |
|
114 |
|
|
115 |
/* From GDK 2.0 onwards we have to explicitly call gdk_threads_init */ |
/* From GDK 2.0 onwards we have to explicitly call gdk_threads_init */ |
116 |
gdk_threads_init(); |
gdk_threads_init(); |
206 |
init_dpi_conversion_factor (); |
init_dpi_conversion_factor (); |
207 |
} |
} |
208 |
|
|
209 |
|
|
210 |
|
/** Initialize GLIB's threads properly, based on the value of the |
211 |
|
gnu.classpath.awt.gtk.portable.native.sync Java system property. If |
212 |
|
that's unset, use the PORTABLE_NATIVE_SYNC config.h macro. (TODO: |
213 |
|
In some release following 0.10, that config.h macro will go away.) |
214 |
|
*/ |
215 |
|
static void |
216 |
|
init_glib_threads(JNIEnv *env, jint portableNativeSync) |
217 |
|
{ |
218 |
|
if (portableNativeSync < 0) |
219 |
|
{ |
220 |
|
#ifdef PORTABLE_NATIVE_SYNC /* Default value, if not set by the Java system |
221 |
|
property */ |
222 |
|
portableNativeSync = 1; |
223 |
|
#else |
224 |
|
portableNativeSync = 0; |
225 |
|
#endif |
226 |
|
} |
227 |
|
|
228 |
|
(*env)->GetJavaVM( env, &the_vm ); |
229 |
|
if (portableNativeSync) |
230 |
|
g_thread_init ( &portable_native_sync_jni_functions ); |
231 |
|
else |
232 |
|
g_thread_init ( NULL ); |
233 |
|
|
234 |
|
/* Debugging progress message; uncomment if needed: */ |
235 |
|
/* printf("called gthread init\n"); */ |
236 |
|
} |
237 |
|
|
238 |
|
|
239 |
|
|
240 |
/* |
/* |
241 |
* Run gtk_main and block. |
* Run gtk_main and block. |
242 |
*/ |
*/ |