jdk/src/java.desktop/unix/native/libawt_xawt/xawt/awt_Desktop.c
changeset 37711 972001566d66
parent 26751 70bac69b37c9
equal deleted inserted replaced
37710:8d246cbf84b1 37711:972001566d66
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    22  * or visit www.oracle.com if you need additional information or have any
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 #include "jni_util.h"
    26 #include "jni_util.h"
    27 #include "gtk2_interface.h"
    27 #include "gtk_interface.h"
    28 #include "gnome_interface.h"
    28 #include "gnome_interface.h"
    29 
    29 
    30 static gboolean gtk_has_been_loaded = FALSE;
    30 static gboolean gtk_has_been_loaded = FALSE;
    31 static gboolean gnome_has_been_loaded = FALSE;
    31 static gboolean gnome_has_been_loaded = FALSE;
    32 
    32 
    34  * Class:     sun_awt_X11_XDesktopPeer
    34  * Class:     sun_awt_X11_XDesktopPeer
    35  * Method:    init
    35  * Method:    init
    36  * Signature: ()Z
    36  * Signature: ()Z
    37  */
    37  */
    38 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_init
    38 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_init
    39   (JNIEnv *env, jclass cls)
    39   (JNIEnv *env, jclass cls, jint version, jboolean verbose)
    40 {
    40 {
    41 
    41 
    42     if (gtk_has_been_loaded || gnome_has_been_loaded) {
    42     if (gtk_has_been_loaded || gnome_has_been_loaded) {
    43         return JNI_TRUE;
    43         return JNI_TRUE;
    44     }
    44     }
    45 
    45 
    46     if (gtk2_load(env) && gtk2_show_uri_load(env)) {
    46     if (gtk_load(env, version, verbose) && gtk->show_uri_load(env)) {
    47         gtk_has_been_loaded = TRUE;
    47         gtk_has_been_loaded = TRUE;
    48         return JNI_TRUE;
    48         return JNI_TRUE;
    49     } else if (gnome_load()) {
    49     } else if (gnome_load()) {
    50         gnome_has_been_loaded = TRUE;
    50         gnome_has_been_loaded = TRUE;
    51         return JNI_TRUE;
    51         return JNI_TRUE;
    72         }
    72         }
    73         return JNI_FALSE;
    73         return JNI_FALSE;
    74     }
    74     }
    75 
    75 
    76     if (gtk_has_been_loaded) {
    76     if (gtk_has_been_loaded) {
    77         fp_gdk_threads_enter();
    77         gtk->gdk_threads_enter();
    78         success = fp_gtk_show_uri(NULL, url_c, GDK_CURRENT_TIME, NULL);
    78         success = gtk->gtk_show_uri(NULL, url_c, GDK_CURRENT_TIME, NULL);
    79         fp_gdk_threads_leave();
    79         gtk->gdk_threads_leave();
    80     } else if (gnome_has_been_loaded) {
    80     } else if (gnome_has_been_loaded) {
    81         success = (*gnome_url_show)(url_c, NULL);
    81         success = (*gnome_url_show)(url_c, NULL);
    82     }
    82     }
    83 
    83 
    84     (*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);
    84     (*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);