--- old/src/solaris/native/sun/awt/gtk2_interface.c 2012-03-27 16:45:48.293225216 +0400 +++ new/src/solaris/native/sun/awt/gtk2_interface.c 2012-03-27 16:45:47.994241876 +0400 @@ -432,6 +432,22 @@ } /** + * Functions for awt_Desktop.c + */ +gboolean gtk2_show_uri_load() { + dlerror(); + fp_gtk_show_uri = dl_symbol("gtk_show_uri"); + const char *dlsym_error = dlerror(); + if (dlsym_error) { + #ifdef INTERNAL_BUILD + fprintf (stderr, "Cannot load symbol: %s \n", dlsym_error); + #endif /* INTERNAL_BUILD */ + return FALSE; + } + return TRUE; +} + +/** * Functions for sun_awt_X11_GtkFileDialogPeer.c */ void gtk2_file_chooser_load() --- old/src/solaris/native/sun/awt/gtk2_interface.h 2012-03-27 16:45:49.110923377 +0400 +++ new/src/solaris/native/sun/awt/gtk2_interface.h 2012-03-27 16:45:48.815136415 +0400 @@ -42,6 +42,7 @@ #define GTK_STOCK_CANCEL "gtk-cancel" #define GTK_STOCK_SAVE "gtk-save" #define GTK_STOCK_OPEN "gtk-open" +#define GDK_CURRENT_TIME 0L typedef enum _WidgetType { @@ -279,6 +280,7 @@ typedef void GdkColormap; typedef void GdkDrawable; +typedef void GdkScreen; typedef void GdkGC; typedef void GdkPixbuf; typedef void GdkPixmap; @@ -795,4 +797,7 @@ void (*fp_gdk_threads_enter)(void); void (*fp_gdk_threads_leave)(void); +gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri, + guint32 timestamp, GError **error); + #endif /* !_GTK2_INTERFACE_H */ --- old/src/solaris/native/sun/xawt/awt_Desktop.c 2012-03-27 16:45:49.889887230 +0400 +++ new/src/solaris/native/sun/xawt/awt_Desktop.c 2012-03-27 16:45:49.590954677 +0400 @@ -24,62 +24,11 @@ */ #include -#include - -typedef int gboolean; - -typedef gboolean (GNOME_URL_SHOW_TYPE)(const char *, void **); -typedef gboolean (GNOME_VFS_INIT_TYPE)(void); - -GNOME_URL_SHOW_TYPE *gnome_url_show; -GNOME_VFS_INIT_TYPE *gnome_vfs_init; +#include "gtk2_interface.h" +#include "gnome_interface.h" int init(){ - void *vfs_handle; - void *gnome_handle; - const char *errmsg; - - vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY); - if (vfs_handle == NULL) { -#ifdef INTERNAL_BUILD - fprintf(stderr, "can not load libgnomevfs-2.so\n"); -#endif - return 0; - } - dlerror(); /* Clear errors */ - gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init"); - if (gnome_vfs_init == NULL){ -#ifdef INTERNAL_BUILD - fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n"); -#endif - return 0; - } - if ((errmsg = dlerror()) != NULL) { -#ifdef INTERNAL_BUILD - fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg); -#endif - return 0; - } - // call gonme_vfs_init() - (*gnome_vfs_init)(); - - gnome_handle = dlopen("libgnome-2.so.0", RTLD_LAZY); - if (gnome_handle == NULL) { -#ifdef INTERNAL_BUILD - fprintf(stderr, "can not load libgnome-2.so\n"); -#endif - return 0; - } - dlerror(); /* Clear errors */ - gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show"); - if ((errmsg = dlerror()) != NULL) { -#ifdef INTERNAL_BUILD - fprintf(stderr, "can not find symble gnome_url_show\n"); -#endif - return 0; - } - - return 1; + return (gtk2_load() && gtk2_show_uri_load()) || gnome_load(); } /* @@ -103,15 +52,20 @@ (JNIEnv *env, jobject obj, jbyteArray url_j) { gboolean success; - const char* url_c; + const gchar* url_c; - if (gnome_url_show == NULL) { - return JNI_FALSE; + url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL); + + if (fp_gtk_show_uri != NULL) { + fp_gdk_threads_enter(); + success = fp_gtk_show_uri(NULL, url_c, GDK_CURRENT_TIME, NULL); + fp_gdk_threads_leave(); + } else if (gnome_url_show != NULL) { + // call gnome_url_show(const char* , GError**) + success = (*gnome_url_show)(url_c, NULL); } - url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL); - // call gnome_url_show(const char* , GError**) - success = (*gnome_url_show)(url_c, NULL); + (*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0); return success ? JNI_TRUE : JNI_FALSE; --- /dev/null 2012-03-27 16:45:50.000000000 +0400 +++ new/src/solaris/native/sun/xawt/gnome_interface.c 2012-03-27 16:45:50.363520399 +0400 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include +#include "gnome_interface.h" + +int gnome_load() { + fprintf(stderr, "gnome_load\n"); + void *vfs_handle; + void *gnome_handle; + const char *errmsg; + + vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY); + if (vfs_handle == NULL) { +#ifdef INTERNAL_BUILD + fprintf(stderr, "can not load libgnomevfs-2.so\n"); +#endif + return FALSE; + } + dlerror(); /* Clear errors */ + gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init"); + if (gnome_vfs_init == NULL){ +#ifdef INTERNAL_BUILD + fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n"); +#endif + return 0; + } + if ((errmsg = dlerror()) != NULL) { +#ifdef INTERNAL_BUILD + fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg); +#endif + return 0; + } + // call gonme_vfs_init() + (*gnome_vfs_init)(); + + gnome_handle = dlopen("libgnome-2.so.0", RTLD_LAZY); + if (gnome_handle == NULL) { +#ifdef INTERNAL_BUILD + fprintf(stderr, "can not load libgnome-2.so\n"); +#endif + return FALSE; + } + dlerror(); /* Clear errors */ + gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show"); + if ((errmsg = dlerror()) != NULL) { +#ifdef INTERNAL_BUILD + fprintf(stderr, "can not find symble gnome_url_show\n"); +#endif + return FALSE; + } + return TRUE; +} + --- /dev/null 2012-03-27 16:45:51.000000000 +0400 +++ new/src/solaris/native/sun/xawt/gnome_interface.h 2012-03-27 16:45:51.115662652 +0400 @@ -0,0 +1,11 @@ +#ifndef _GNOME_INTERFACE_H +#define _GNOME_INTERFACE_H +#include "gtk2_interface.h" +typedef gboolean (GNOME_URL_SHOW_TYPE)(const char *, void **); +typedef gboolean (GNOME_VFS_INIT_TYPE)(void); + +GNOME_URL_SHOW_TYPE *gnome_url_show; +GNOME_VFS_INIT_TYPE *gnome_vfs_init; +int gnome_load(); + +#endif /* !_GNOME_INTERFACE_H */ --- old/make/sun/xawt/FILES_c_unix.gmk 2012-03-27 16:45:52.120027815 +0400 +++ new/make/sun/xawt/FILES_c_unix.gmk 2012-03-27 16:45:51.829580941 +0400 @@ -77,6 +77,7 @@ debug_util.c \ awt_Plugin.c \ gtk2_interface.c \ + gnome_interface.c \ swing_GTKEngine.c \ swing_GTKStyle.c \ rect.c \