39 |
#include "gtkpeer.h" |
#include "gtkpeer.h" |
40 |
#include "gnu_java_awt_peer_gtk_GtkToolkit.h" |
#include "gnu_java_awt_peer_gtk_GtkToolkit.h" |
41 |
#include "gthread-jni.h" |
#include "gthread-jni.h" |
42 |
|
#include "jcl.h" |
43 |
|
|
44 |
#include <sys/time.h> |
#include <sys/time.h> |
45 |
|
|
103 |
static void dpi_changed_cb (GtkSettings *settings, |
static void dpi_changed_cb (GtkSettings *settings, |
104 |
GParamSpec *pspec); |
GParamSpec *pspec); |
105 |
|
|
106 |
|
#if GTK_MINOR_VERSION > 4 |
107 |
|
static GLogFunc old_glog_func; |
108 |
|
static void glog_func (const gchar *log_domain, |
109 |
|
GLogLevelFlags log_level, |
110 |
|
const gchar *message, |
111 |
|
gpointer user_data); |
112 |
|
#endif |
113 |
|
|
114 |
/* |
/* |
115 |
* 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 |
116 |
* gtk calls. |
* gtk calls. |
186 |
g_free (argv[0]); |
g_free (argv[0]); |
187 |
g_free (argv); |
g_free (argv); |
188 |
|
|
189 |
|
/* On errors or warning print a whole stacktrace. */ |
190 |
|
#if GTK_MINOR_VERSION > 4 |
191 |
|
old_glog_func = g_log_set_default_handler (&glog_func, NULL); |
192 |
|
#endif |
193 |
|
|
194 |
/* setup cached IDs for posting GTK events to Java */ |
/* setup cached IDs for posting GTK events to Java */ |
195 |
|
|
196 |
window = (*env)->FindClass (env, "java/awt/Window"); |
window = (*env)->FindClass (env, "java/awt/Window"); |
376 |
return milliseconds_elapsed < 100; |
return milliseconds_elapsed < 100; |
377 |
} |
} |
378 |
|
|
379 |
|
#if GTK_MINOR_VERSION > 4 |
380 |
|
static void |
381 |
|
glog_func (const gchar *log_domain, |
382 |
|
GLogLevelFlags log_level, |
383 |
|
const gchar *message, |
384 |
|
gpointer user_data) |
385 |
|
{ |
386 |
|
old_glog_func (log_domain, log_level, message, user_data); |
387 |
|
if (log_level & (G_LOG_LEVEL_ERROR |
388 |
|
| G_LOG_LEVEL_CRITICAL |
389 |
|
| G_LOG_LEVEL_WARNING)) |
390 |
|
{ |
391 |
|
JNIEnv *env = gdk_env (); |
392 |
|
jthrowable *exc = (*env)->ExceptionOccurred(env); |
393 |
|
gchar *detail = g_strconcat (log_domain, ": ", message, NULL); |
394 |
|
JCL_ThrowException (env, "java/lang/InternalError", detail); |
395 |
|
g_free (detail); |
396 |
|
(*env)->ExceptionDescribe (env); |
397 |
|
if (exc != NULL) |
398 |
|
(*env)->Throw (env, exc); |
399 |
|
else |
400 |
|
(*env)->ExceptionClear (env); |
401 |
|
} |
402 |
|
} |
403 |
|
#endif |
404 |
|
|
405 |
JNIEXPORT void JNICALL |
JNIEXPORT void JNICALL |
406 |
Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue |
Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue |