summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java32
6 files changed, 100 insertions, 64 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c
index 63714d561b..11c92f905f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c
@@ -36,7 +36,7 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1default_1han
fprintf(stderr, "g_log_default_handler");
#endif
- g_log_default_handler((gchar *)log_domain, (GLogLevelFlags)log_levels, (gchar *) message, (gpointer) unused_data);
+ g_log_default_handler((gchar *)log_domain, (GLogLevelFlags)log_levels, (gchar *)message, (gpointer)unused_data);
}
/*
@@ -45,13 +45,23 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1default_1han
* Signature:
*/
JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1set_1handler
- (JNIEnv *env, jclass that, jint log_domain, jint log_levels, jint log_func, jint user_data)
+ (JNIEnv *env, jclass that, jbyteArray log_domain, jint log_levels, jint log_func, jint user_data)
{
+ jint rc;
+ jbyte *log_domain1 = NULL;
+
#ifdef DEBUG_CALL_PRINTS
fprintf(stderr, "g_log_set_handler");
#endif
- return g_log_set_handler((gchar *)log_domain, (GLogLevelFlags)log_levels, (GLogFunc) log_func, (gpointer) user_data);
+ if (log_domain) {
+ log_domain1 = (*env)->GetByteArrayElements(env, log_domain, NULL);
+ }
+ rc = (jint) g_log_set_handler((gchar *)log_domain1, (GLogLevelFlags)log_levels, (GLogFunc) log_func, (gpointer) user_data);
+ if (log_domain) {
+ (*env)->ReleaseByteArrayElements(env, log_domain, log_domain1, 0);
+ }
+ return rc;
}
/*
@@ -60,13 +70,21 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1set_1handler
* Signature:
*/
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1remove_1handler
- (JNIEnv *env, jclass that, jint log_domain, jint handler_id)
+ (JNIEnv *env, jclass that, jbyteArray log_domain, jint handler_id)
{
+ jbyte *log_domain1 = NULL;
+
#ifdef DEBUG_CALL_PRINTS
fprintf(stderr, "g_log_remove_handler");
#endif
- g_log_remove_handler((gchar *)log_domain, handler_id);
+ if (log_domain) {
+ log_domain1 = (*env)->GetByteArrayElements(env, log_domain, NULL);
+ }
+ g_log_remove_handler((gchar *)log_domain1, handler_id);
+ if (log_domain) {
+ (*env)->ReleaseByteArrayElements(env, log_domain, log_domain1, 0);
+ }
}
/*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 711634b35a..7d4e535bb9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -214,15 +214,15 @@ public class OS {
public static final int GTK_TOOLBAR_CHILD_RADIOBUTTON = 3;
public static final int GTK_TOOLBAR_CHILD_WIDGET = 4;
-public static final int G_LOG_FLAG_RECURSION = 1 << 0;
-public static final int G_LOG_FLAG_FATAL = 1 << 1;
-public static final int G_LOG_LEVEL_ERROR = 1 << 2;
-public static final int G_LOG_LEVEL_CRITICAL = 1 << 3;
-public static final int G_LOG_LEVEL_WARNING = 1 << 4;
-public static final int G_LOG_LEVEL_MESSAGE = 1 << 5;
-public static final int G_LOG_LEVEL_INFO = 1 << 6;
-public static final int G_LOG_LEVEL_DEBUG = 1 << 7;
-public static final int G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL);
+//public static final int G_LOG_FLAG_RECURSION = 1 << 0;
+//public static final int G_LOG_FLAG_FATAL = 1 << 1;
+//public static final int G_LOG_LEVEL_ERROR = 1 << 2;
+//public static final int G_LOG_LEVEL_CRITICAL = 1 << 3;
+//public static final int G_LOG_LEVEL_WARNING = 1 << 4;
+//public static final int G_LOG_LEVEL_MESSAGE = 1 << 5;
+//public static final int G_LOG_LEVEL_INFO = 1 << 6;
+//public static final int G_LOG_LEVEL_DEBUG = 1 << 7;
+//public static final int G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL);
public static final native int GTK_WIDGET_FLAGS(int wid);
public static final native void GTK_WIDGET_SET_FLAGS(int wid,int flag);
@@ -241,8 +241,8 @@ public static final native void gtk_object_unref(int object);
public static final native void gtk_object_destroy(int object);
public static final native int GTK_WIDGET_TYPE(int wid);
public static final native int gtk_label_get_type();
-public static final native int g_log_set_handler(int log_domain, int log_levels, int log_func, int user_data);
-public static final native void g_log_remove_handler(int log_domain, int handler_id);
+public static final native int g_log_set_handler(byte [] log_domain, int log_levels, int log_func, int user_data);
+public static final native void g_log_remove_handler(byte [] log_domain, int handler_id);
public static final native void g_log_default_handler(int log_domain, int log_levels, int message, int unused_data);
public static final native void g_free(int mem);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c
index 63714d561b..11c92f905f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c
@@ -36,7 +36,7 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1default_1han
fprintf(stderr, "g_log_default_handler");
#endif
- g_log_default_handler((gchar *)log_domain, (GLogLevelFlags)log_levels, (gchar *) message, (gpointer) unused_data);
+ g_log_default_handler((gchar *)log_domain, (GLogLevelFlags)log_levels, (gchar *)message, (gpointer)unused_data);
}
/*
@@ -45,13 +45,23 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1default_1han
* Signature:
*/
JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1set_1handler
- (JNIEnv *env, jclass that, jint log_domain, jint log_levels, jint log_func, jint user_data)
+ (JNIEnv *env, jclass that, jbyteArray log_domain, jint log_levels, jint log_func, jint user_data)
{
+ jint rc;
+ jbyte *log_domain1 = NULL;
+
#ifdef DEBUG_CALL_PRINTS
fprintf(stderr, "g_log_set_handler");
#endif
- return g_log_set_handler((gchar *)log_domain, (GLogLevelFlags)log_levels, (GLogFunc) log_func, (gpointer) user_data);
+ if (log_domain) {
+ log_domain1 = (*env)->GetByteArrayElements(env, log_domain, NULL);
+ }
+ rc = (jint) g_log_set_handler((gchar *)log_domain1, (GLogLevelFlags)log_levels, (GLogFunc) log_func, (gpointer) user_data);
+ if (log_domain) {
+ (*env)->ReleaseByteArrayElements(env, log_domain, log_domain1, 0);
+ }
+ return rc;
}
/*
@@ -60,13 +70,21 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1set_1handler
* Signature:
*/
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1log_1remove_1handler
- (JNIEnv *env, jclass that, jint log_domain, jint handler_id)
+ (JNIEnv *env, jclass that, jbyteArray log_domain, jint handler_id)
{
+ jbyte *log_domain1 = NULL;
+
#ifdef DEBUG_CALL_PRINTS
fprintf(stderr, "g_log_remove_handler");
#endif
- g_log_remove_handler((gchar *)log_domain, handler_id);
+ if (log_domain) {
+ log_domain1 = (*env)->GetByteArrayElements(env, log_domain, NULL);
+ }
+ g_log_remove_handler((gchar *)log_domain1, handler_id);
+ if (log_domain) {
+ (*env)->ReleaseByteArrayElements(env, log_domain, log_domain1, 0);
+ }
}
/*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java
index 711634b35a..7d4e535bb9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java
@@ -214,15 +214,15 @@ public class OS {
public static final int GTK_TOOLBAR_CHILD_RADIOBUTTON = 3;
public static final int GTK_TOOLBAR_CHILD_WIDGET = 4;
-public static final int G_LOG_FLAG_RECURSION = 1 << 0;
-public static final int G_LOG_FLAG_FATAL = 1 << 1;
-public static final int G_LOG_LEVEL_ERROR = 1 << 2;
-public static final int G_LOG_LEVEL_CRITICAL = 1 << 3;
-public static final int G_LOG_LEVEL_WARNING = 1 << 4;
-public static final int G_LOG_LEVEL_MESSAGE = 1 << 5;
-public static final int G_LOG_LEVEL_INFO = 1 << 6;
-public static final int G_LOG_LEVEL_DEBUG = 1 << 7;
-public static final int G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL);
+//public static final int G_LOG_FLAG_RECURSION = 1 << 0;
+//public static final int G_LOG_FLAG_FATAL = 1 << 1;
+//public static final int G_LOG_LEVEL_ERROR = 1 << 2;
+//public static final int G_LOG_LEVEL_CRITICAL = 1 << 3;
+//public static final int G_LOG_LEVEL_WARNING = 1 << 4;
+//public static final int G_LOG_LEVEL_MESSAGE = 1 << 5;
+//public static final int G_LOG_LEVEL_INFO = 1 << 6;
+//public static final int G_LOG_LEVEL_DEBUG = 1 << 7;
+//public static final int G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL);
public static final native int GTK_WIDGET_FLAGS(int wid);
public static final native void GTK_WIDGET_SET_FLAGS(int wid,int flag);
@@ -241,8 +241,8 @@ public static final native void gtk_object_unref(int object);
public static final native void gtk_object_destroy(int object);
public static final native int GTK_WIDGET_TYPE(int wid);
public static final native int gtk_label_get_type();
-public static final native int g_log_set_handler(int log_domain, int log_levels, int log_func, int user_data);
-public static final native void g_log_remove_handler(int log_domain, int handler_id);
+public static final native int g_log_set_handler(byte [] log_domain, int log_levels, int log_func, int user_data);
+public static final native void g_log_remove_handler(byte [] log_domain, int handler_id);
public static final native void g_log_default_handler(int log_domain, int log_levels, int message, int unused_data);
public static final native void g_free(int mem);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index a5dbeaa2fe..937ac7da86 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.internal.gtk.*;
public abstract class Device implements Drawable {
/* Debugging */
- public static boolean DEBUG = true;
+ public static boolean DEBUG;
boolean debug = DEBUG;
boolean tracking = DEBUG;
Error [] errors;
@@ -371,12 +371,8 @@ protected void init () {
/* Set GTK warning and error handlers */
if (debug) {
- int domain = OS.g_malloc(4);
- byte[] domainb = Converter.wcsToMbcs(null, "Gtk");
- OS.memmove(domain, domainb, 3);
- byte[] term = new byte[] { 0 };
- OS.memmove(domain+3, term, 1);
- handler_id = OS.g_log_set_handler (domain, OS.G_LOG_LEVEL_CRITICAL | OS.G_LOG_LEVEL_WARNING, logProc, 0);
+ byte [] log_domain = Converter.wcsToMbcs (null, "Gtk", true);
+ handler_id = OS.g_log_set_handler (log_domain, 0xFF, logProc, 0);
}
/* Create the standard colors */
@@ -447,7 +443,7 @@ public boolean isDisposed () {
}
int logProc (int log_domain, int log_level, int message, int user_data) {
- if (debug && warnings) {
+ if (DEBUG || (debug && warnings)) {
new Error ().printStackTrace ();
OS.g_log_default_handler (log_domain, log_level, message, 0);
}
@@ -493,12 +489,10 @@ protected void release () {
COLOR_GREEN = COLOR_YELLOW = COLOR_BLUE = COLOR_MAGENTA = COLOR_CYAN = COLOR_WHITE = null;
/* Free the GTK error and warning handler */
- int domain = OS.g_malloc(4);
- byte[] domainb = Converter.wcsToMbcs(null, "Gtk");
- OS.memmove(domain, domainb, 3);
- byte[] term = new byte[] { 0 };
- OS.memmove(domain+3, term, 1);
- if (handler_id != 0) OS.g_log_remove_handler (domain, handler_id);
+ if (handler_id != 0) {
+ byte [] log_domain = Converter.wcsToMbcs (null, "Gtk", true);
+ OS.g_log_remove_handler (log_domain, handler_id);
+ }
logCallback.dispose (); logCallback = null;
handler_id = logProc = 0;
}
@@ -519,9 +513,15 @@ public void setWarnings (boolean warnings) {
checkDevice ();
this.warnings = warnings;
if (debug) return;
- if (handler_id != 0) OS.g_log_remove_handler (0, handler_id);
+ if (handler_id != 0) {
+ byte [] log_domain = Converter.wcsToMbcs (null, "Gtk", true);
+ OS.g_log_remove_handler (log_domain, handler_id);
+ }
handler_id = 0;
- if (warnings) handler_id = OS.g_log_set_handler (0, -1, logProc, 0);
+ if (warnings) {
+ byte [] log_domain = Converter.wcsToMbcs (null, "Gtk", true);
+ handler_id = OS.g_log_set_handler (log_domain, 0xFF, logProc, 0);
+ }
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java
index a5dbeaa2fe..937ac7da86 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.internal.gtk.*;
public abstract class Device implements Drawable {
/* Debugging */
- public static boolean DEBUG = true;
+ public static boolean DEBUG;
boolean debug = DEBUG;
boolean tracking = DEBUG;
Error [] errors;
@@ -371,12 +371,8 @@ protected void init () {
/* Set GTK warning and error handlers */
if (debug) {
- int domain = OS.g_malloc(4);
- byte[] domainb = Converter.wcsToMbcs(null, "Gtk");
- OS.memmove(domain, domainb, 3);
- byte[] term = new byte[] { 0 };
- OS.memmove(domain+3, term, 1);
- handler_id = OS.g_log_set_handler (domain, OS.G_LOG_LEVEL_CRITICAL | OS.G_LOG_LEVEL_WARNING, logProc, 0);
+ byte [] log_domain = Converter.wcsToMbcs (null, "Gtk", true);
+ handler_id = OS.g_log_set_handler (log_domain, 0xFF, logProc, 0);
}
/* Create the standard colors */
@@ -447,7 +443,7 @@ public boolean isDisposed () {
}
int logProc (int log_domain, int log_level, int message, int user_data) {
- if (debug && warnings) {
+ if (DEBUG || (debug && warnings)) {
new Error ().printStackTrace ();
OS.g_log_default_handler (log_domain, log_level, message, 0);
}
@@ -493,12 +489,10 @@ protected void release () {
COLOR_GREEN = COLOR_YELLOW = COLOR_BLUE = COLOR_MAGENTA = COLOR_CYAN = COLOR_WHITE = null;
/* Free the GTK error and warning handler */
- int domain = OS.g_malloc(4);
- byte[] domainb = Converter.wcsToMbcs(null, "Gtk");
- OS.memmove(domain, domainb, 3);
- byte[] term = new byte[] { 0 };
- OS.memmove(domain+3, term, 1);
- if (handler_id != 0) OS.g_log_remove_handler (domain, handler_id);
+ if (handler_id != 0) {
+ byte [] log_domain = Converter.wcsToMbcs (null, "Gtk", true);
+ OS.g_log_remove_handler (log_domain, handler_id);
+ }
logCallback.dispose (); logCallback = null;
handler_id = logProc = 0;
}
@@ -519,9 +513,15 @@ public void setWarnings (boolean warnings) {
checkDevice ();
this.warnings = warnings;
if (debug) return;
- if (handler_id != 0) OS.g_log_remove_handler (0, handler_id);
+ if (handler_id != 0) {
+ byte [] log_domain = Converter.wcsToMbcs (null, "Gtk", true);
+ OS.g_log_remove_handler (log_domain, handler_id);
+ }
handler_id = 0;
- if (warnings) handler_id = OS.g_log_set_handler (0, -1, logProc, 0);
+ if (warnings) {
+ byte [] log_domain = Converter.wcsToMbcs (null, "Gtk", true);
+ handler_id = OS.g_log_set_handler (log_domain, 0xFF, logProc, 0);
+ }
}
}