diff options
author | Bogdan Gheorghe <gheorghe> | 2010-10-04 20:52:19 +0000 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe> | 2010-10-04 20:52:19 +0000 |
commit | 1293381740736d414aa67aeb2f3ae1e0b6a69bdf (patch) | |
tree | 59dfef821e57ca86a9e21ef540d06723b8308413 | |
parent | a9f9891d4b02dd953542d507750312238cb17507 (diff) | |
download | eclipse.platform.swt-1293381740736d414aa67aeb2f3ae1e0b6a69bdf.tar.gz eclipse.platform.swt-1293381740736d414aa67aeb2f3ae1e0b6a69bdf.tar.xz eclipse.platform.swt-1293381740736d414aa67aeb2f3ae1e0b6a69bdf.zip |
More GTK AIX/HPUX port work
9 files changed, 86 insertions, 33 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index c29ec2fc9b..f08359206a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -1107,6 +1107,42 @@ JNIEXPORT jint JNICALL OS_NATIVE(PangoRectangle_1sizeof) } #endif +#ifndef NO_RTLD_1GLOBAL +JNIEXPORT jint JNICALL OS_NATIVE(RTLD_1GLOBAL) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, RTLD_1GLOBAL_FUNC); + rc = (jint)RTLD_GLOBAL; + OS_NATIVE_EXIT(env, that, RTLD_1GLOBAL_FUNC); + return rc; +} +#endif + +#ifndef NO_RTLD_1LAZY +JNIEXPORT jint JNICALL OS_NATIVE(RTLD_1LAZY) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, RTLD_1LAZY_FUNC); + rc = (jint)RTLD_LAZY; + OS_NATIVE_EXIT(env, that, RTLD_1LAZY_FUNC); + return rc; +} +#endif + +#ifndef NO_RTLD_1NOW +JNIEXPORT jint JNICALL OS_NATIVE(RTLD_1NOW) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, RTLD_1NOW_FUNC); + rc = (jint)RTLD_NOW; + OS_NATIVE_EXIT(env, that, RTLD_1NOW_FUNC); + return rc; +} +#endif + #ifndef NO_XAnyEvent_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(XAnyEvent_1sizeof) (JNIEnv *env, jclass that) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c index 5d757b0889..704af6cb66 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c @@ -66,8 +66,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1dialog_1new) rc = (jintLong)gtk_file_chooser_dialog_new(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); */ { - static int initialized = 0; - static void *handle = NULL; /* * On AMD64, it is critical that functions which have a variable number of * arguments, indicated by '...', include the '...' in their prototype. This @@ -76,17 +74,10 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1dialog_1new) * For some reason, we must also explicitly declare all of the arguments we * are passing in, otherwise it crashes. */ -/* typedef jintLong (*FPTR)(jbyte *, jintLong, jint, jintLong, ...); */ - typedef jintLong (*FPTR)(jbyte *, jintLong, jint, jintLong, jint, jintLong, jint, jintLong, ...); - static FPTR fptr; - rc = 0; - if (!initialized) { - if (!handle) handle = dlopen(gtk_file_chooser_dialog_new_LIB, RTLD_LAZY); - if (handle) fptr = (FPTR)dlsym(handle, "gtk_file_chooser_dialog_new"); - initialized = 1; - } - if (fptr) { - rc = (jintLong)(*fptr)(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); + typedef jintLong (CALLING_CONVENTION* FPTR)(jbyte *, jintLong, jint, jintLong, jint, jintLong, jint, jintLong, ...); + LOAD_FUNCTION(fp, gtk_file_chooser_dialog_new) + if (fp) { + rc = (jintLong)((FPTR) fp)(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); } } fail: @@ -107,8 +98,6 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1cell_1layout_1set_1attributes) gtk_cell_layout_set_attributes(arg0, arg1, lparg2, arg3, arg4); */ { - static int initialized = 0; - static void *handle = NULL; /* * On AMD64, it is critical that functions which have a variable number of * arguments, indicated by '...', include the '...' in their prototype. This @@ -117,16 +106,10 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1cell_1layout_1set_1attributes) * For some reason, we must also explicitly declare all of the arguments we * are passing in, otherwise it crashes. */ -/* typedef void (*FPTR)(jintLong, jintLong, ...); */ typedef void (*FPTR)(jintLong, jintLong, jbyte *, jint, jintLong, ...); - static FPTR fptr; - if (!initialized) { - if (!handle) handle = dlopen(gtk_cell_layout_set_attributes_LIB, RTLD_LAZY); - if (handle) fptr = (FPTR)dlsym(handle, "gtk_cell_layout_set_attributes"); - initialized = 1; - } - if (fptr) { - (*fptr)(arg0, arg1, lparg2, arg3, arg4); + LOAD_FUNCTION(fp, gtk_cell_layout_set_attributes) + if (fp) { + ((FPTR)fp)(arg0, arg1, lparg2, arg3, arg4); } } fail: diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c index ac9cebeeea..9224911b32 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1370; -int OS_nativeFunctionCallCount[1370]; +int OS_nativeFunctionCount = 1373; +int OS_nativeFunctionCallCount[1373]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -120,6 +120,9 @@ char * OS_nativeFunctionNames[] = { "PangoLayoutRun_1sizeof", "PangoLogAttr_1sizeof", "PangoRectangle_1sizeof", + "RTLD_1GLOBAL", + "RTLD_1LAZY", + "RTLD_1NOW", "XAnyEvent_1sizeof", "XClientMessageEvent_1sizeof", "XCrossingEvent_1sizeof", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h index d99fead8fa..289af46c85 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h @@ -128,6 +128,9 @@ typedef enum { PangoLayoutRun_1sizeof_FUNC, PangoLogAttr_1sizeof_FUNC, PangoRectangle_1sizeof_FUNC, + RTLD_1GLOBAL_FUNC, + RTLD_1LAZY_FUNC, + RTLD_1NOW_FUNC, XAnyEvent_1sizeof_FUNC, XClientMessageEvent_1sizeof_FUNC, XCrossingEvent_1sizeof_FUNC, 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 c3f13eaa5c..104b5e16d0 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 @@ -422,9 +422,10 @@ public class OS extends C { public static final int PANGO_WEIGHT_NORMAL = 0x190; public static final int PANGO_WRAP_WORD = 0; public static final int PANGO_WRAP_WORD_CHAR = 2; - public static final int RTLD_GLOBAL = 0x100; - public static final int RTLD_LAZY = 1; - public static final int RTLD_NOW = 2; + public static final int RTLD_GLOBAL = OS.RTLD_GLOBAL(); + public static final int RTLD_LAZY = OS.RTLD_LAZY(); + public static final int RTLD_MEMBER = 0x00040000; + public static final int RTLD_NOW = OS.RTLD_NOW(); public static final int X_OK = 0x01; public static final int XA_CARDINAL = 6; public static final int XA_WINDOW = 33; @@ -1294,6 +1295,13 @@ public static final native void memmove(XFocusChangeEvent dest, int /*long*/ src */ public static final native void memmove(XVisibilityEvent dest, int /*long*/ src, int /*long*/ size); +/** @method flags=const */ +public static final native int RTLD_GLOBAL(); +/** @method flags=const */ +public static final native int RTLD_NOW(); +/** @method flags=const */ +public static final native int RTLD_LAZY(); + /** X render natives and constants */ public static final int PictStandardARGB32 = 0; public static final int PictStandardRGB24 = 1; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java index 6f78ce277c..9d4d4fed57 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java @@ -115,8 +115,17 @@ static int getDesktop(final Display display) { } }); /* Check for the existence of libgio libraries */ - byte[] buffer = Converter.wcsToMbcs(null, "libgio-2.0.so.0", true); - int /*long*/ libgio = OS.dlopen(buffer, OS.RTLD_LAZY); + byte[] buffer ; + int flags = OS.RTLD_LAZY; + if (OS.IsAIX) { + buffer = Converter.wcsToMbcs(null, "libgio-2.0.a(libgio-2.0.so.0)", true); + flags |= OS.RTLD_MEMBER; + } else if (OS.IsHPUX) { + buffer = Converter.wcsToMbcs(null, "libgio-2.0.so", true); + } else { + buffer = Converter.wcsToMbcs(null, "libgio-2.0.so.0", true); + } + int /*long*/ libgio = OS.dlopen(buffer, flags); if (libgio != 0) { buffer = Converter.wcsToMbcs(null, "g_app_info_launch_default_for_uri", true); int /*long*/ g_app_info_launch_default_for_uri = OS.dlsym(libgio, buffer); 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 2fff1d230d..32e16e8e87 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 @@ -161,8 +161,17 @@ void checkCairo() { if (CAIRO_LOADED) return; try { /* Check if cairo is available on the system */ - byte[] buffer = Converter.wcsToMbcs(null, "libcairo.so.2", true); - int /*long*/ libcairo = OS.dlopen(buffer, OS.RTLD_LAZY); + byte[] buffer ; + int flags = OS.RTLD_LAZY; + if (OS.IsAIX) { + buffer = Converter.wcsToMbcs(null, "libcairo.a(libcairo.so.2)", true); + flags |= OS.RTLD_MEMBER; + } else if (OS.IsHPUX) { + buffer = Converter.wcsToMbcs(null, "libcairo.so", true); + } else { + buffer = Converter.wcsToMbcs(null, "libcairo.so.2", true); + } + int /*long*/ libcairo = OS.dlopen(buffer, flags); if (libcairo != 0) { OS.dlclose(libcairo); } else { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java index 06e08e1d5e..3e04cf2905 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java @@ -133,6 +133,7 @@ String openChooserDialog () { } else { handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, OS.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, 0); } + if (handle == 0) error (SWT.ERROR_NO_HANDLES); if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { int /*long*/ group = OS.gtk_window_get_group(0); OS.gtk_window_group_add_window (group, handle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java index 1dd69215db..71d3f9ad67 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java @@ -413,6 +413,7 @@ String openChooserDialog () { } else { handle = OS.gtk_file_chooser_dialog_new (titleBytes, shellHandle, action, OS.GTK_STOCK_OK (), OS.GTK_RESPONSE_OK, OS.GTK_STOCK_CANCEL (), OS.GTK_RESPONSE_CANCEL, 0); } + if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_window_set_modal (handle, true); if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { int /*long*/ group = OS.gtk_window_get_group(0); |