jdk/src/solaris/native/sun/awt/awt_UNIXToolkit.c
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 6825 795e9fe949d3
child 18232 b538b71fb429
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 6825
diff changeset
     2
 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5444
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5444
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5444
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5444
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5444
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <string.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include <unistd.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include <dlfcn.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include <jni.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "sun_awt_UNIXToolkit.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#ifndef HEADLESS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "awt.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "gtk2_interface.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#endif /* !HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
static jclass this_class = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
static jmethodID icon_upcall_method = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * Class:     sun_awt_UNIXToolkit
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * Method:    check_gtk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * Signature: ()Z
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
Java_sun_awt_UNIXToolkit_check_1gtk(JNIEnv *env, jclass klass)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#ifndef HEADLESS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    return (jboolean)gtk2_check_version();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#endif /* !HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * Class:     sun_awt_UNIXToolkit
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * Method:    load_gtk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * Signature: ()Z
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
Java_sun_awt_UNIXToolkit_load_1gtk(JNIEnv *env, jclass klass)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
#ifndef HEADLESS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    return (jboolean)gtk2_load();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#endif /* !HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * Class:     sun_awt_UNIXToolkit
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * Method:    unload_gtk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * Signature: ()Z
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
Java_sun_awt_UNIXToolkit_unload_1gtk(JNIEnv *env, jclass klass)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
#ifndef HEADLESS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    return (jboolean)gtk2_unload();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
#endif /* !HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
jboolean _icon_upcall(JNIEnv *env, jobject this, GdkPixbuf *pixbuf)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    jboolean result = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    if (this_class == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        this_class = (*env)->NewGlobalRef(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                                          (*env)->GetObjectClass(env, this));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        icon_upcall_method = (*env)->GetMethodID(env, this_class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                                 "loadIconCallback", "([BIIIIIZ)V");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    if (pixbuf != NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        guchar *pixbuf_data = (*fp_gdk_pixbuf_get_pixels)(pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        int row_stride = (*fp_gdk_pixbuf_get_rowstride)(pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        int width = (*fp_gdk_pixbuf_get_width)(pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        int height = (*fp_gdk_pixbuf_get_height)(pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        int bps = (*fp_gdk_pixbuf_get_bits_per_sample)(pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        int channels = (*fp_gdk_pixbuf_get_n_channels)(pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        gboolean alpha = (*fp_gdk_pixbuf_get_has_alpha)(pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        /* Copy the data array into a Java structure so we can pass it back. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        jbyteArray data = (*env)->NewByteArray(env, (row_stride * height));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        (*env)->SetByteArrayRegion(env, data, 0, (row_stride * height),
6825
795e9fe949d3 6989721: awt native code compiler warnings
art
parents: 5506
diff changeset
   115
                                   (jbyte *)pixbuf_data);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        /* Release the pixbuf. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        (*fp_g_object_unref)(pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        /* Call the callback method to create the image on the Java side. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        (*env)->CallVoidMethod(env, this, icon_upcall_method, data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                width, height, row_stride, bps, channels, alpha);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        result = JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * Class:     sun_awt_UNIXToolkit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * Method:    load_gtk_icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * Signature: (Ljava/lang/String)Z
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * This method assumes that GTK libs are present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
Java_sun_awt_UNIXToolkit_load_1gtk_1icon(JNIEnv *env, jobject this,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        jstring filename)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
#ifndef HEADLESS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    int len;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    char *filename_str = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    GError **error = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    GdkPixbuf *pixbuf;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    if (filename == NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    len = (*env)->GetStringUTFLength(env, filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    filename_str = (char *)malloc(sizeof(char) * (len + 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    if (filename_str == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    (*env)->GetStringUTFRegion(env, filename, 0, len, filename_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    pixbuf = (*fp_gdk_pixbuf_new_from_file)(filename_str, error);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    /* Release the strings we've allocated. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    free(filename_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    return _icon_upcall(env, this, pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
#else /* HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
#endif /* !HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * Class:     sun_awt_UNIXToolkit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * Method:    load_stock_icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * Signature: (ILjava/lang/String;IILjava/lang/String;)Z
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * This method assumes that GTK libs are present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        jint widget_type, jstring stock_id, jint icon_size,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        jint text_direction, jstring detail)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
#ifndef HEADLESS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    int len;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    char *stock_id_str = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    char *detail_str = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    GdkPixbuf *pixbuf;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    if (stock_id == NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    len = (*env)->GetStringUTFLength(env, stock_id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    stock_id_str = (char *)malloc(sizeof(char) * (len + 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    if (stock_id_str == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    (*env)->GetStringUTFRegion(env, stock_id, 0, len, stock_id_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    /* Detail isn't required so check for NULL. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    if (detail != NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        len = (*env)->GetStringUTFLength(env, detail);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        detail_str = (char *)malloc(sizeof(char) * (len + 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        if (detail_str == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        (*env)->GetStringUTFRegion(env, detail, 0, len, detail_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    pixbuf = gtk2_get_stock_icon(widget_type, stock_id_str, icon_size,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                                 text_direction, detail_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    /* Release the strings we've allocated. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    free(stock_id_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    if (detail_str != NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        free(detail_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    return _icon_upcall(env, this, pixbuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
#else /* HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
#endif /* !HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 * Class:     sun_awt_UNIXToolkit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 * Method:    nativeSync
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 * Signature: ()V
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
Java_sun_awt_UNIXToolkit_nativeSync(JNIEnv *env, jobject this)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
#ifndef HEADLESS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    AWT_LOCK();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    XSync(awt_display, False);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    AWT_UNLOCK();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
#endif /* !HEADLESS */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 * Class:     sun_awt_SunToolkit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 * Method:    closeSplashScreen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * Signature: ()V
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    typedef void (*SplashClose_t)();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    SplashClose_t splashClose;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    void* hSplashLib = dlopen(0, RTLD_LAZY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    if (!hSplashLib) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    splashClose = (SplashClose_t)dlsym(hSplashLib,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        "SplashClose");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    if (splashClose) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        splashClose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    dlclose(hSplashLib);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
}
5444
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   263
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   264
/*
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   265
 * Class:     sun_awt_UNIXToolkit
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   266
 * Method:    gtkCheckVersionImpl
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   267
 * Signature: (III)Ljava/lang/String;
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   268
 */
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   269
JNIEXPORT jboolean JNICALL
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   270
Java_sun_awt_UNIXToolkit_gtkCheckVersionImpl(JNIEnv *env, jobject this,
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   271
        jint major, jint minor, jint micro)
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   272
{
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   273
    char *ret;
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   274
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   275
    ret = fp_gtk_check_version(major, minor, micro);
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   276
    if (ret == NULL) {
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   277
        return TRUE;
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   278
    }
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   279
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   280
    free(ret);
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   281
    return FALSE;
f7c5aeb82a14 6913179: The java.awt.FileDialog should use native GTK file chooser on linux distros
anthony
parents: 2
diff changeset
   282
}