< prev index next >

src/solaris/native/sun/awt/swing_GTKEngine.c

Print this page


   1 /*
   2  * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include <stdlib.h>
  27 #include "gtk2_interface.h"
  28 #include "com_sun_java_swing_plaf_gtk_GTKEngine.h"
  29 















  30 /*
  31  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
  32  * Method:    native_paint_arrow
  33  * Signature: (IIILjava/lang/String;IIIII)V
  34  */
  35 JNIEXPORT void JNICALL
  36 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow(
  37         JNIEnv *env, jobject this,
  38         jint widget_type, jint state, jint shadow_type, jstring detail,
  39         jint x, jint y, jint w, jint h, jint arrow_type)
  40 {
  41     fp_gdk_threads_enter();
  42     gtk2_paint_arrow(widget_type, state, shadow_type, getStrFor(env, detail),
  43             x, y, w, h, arrow_type, TRUE);
  44     fp_gdk_threads_leave();
  45 }
  46 
  47 /*
  48  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
  49  * Method:    native_paint_box
  50  * Signature: (IIILjava/lang/String;IIIIII)V
  51  */
  52 JNIEXPORT void JNICALL
  53 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box(
  54         JNIEnv *env, jobject this,
  55         jint widget_type, jint state, jint shadow_type, jstring detail,
  56         jint x, jint y, jint w, jint h,
  57         jint synth_state, jint dir)
  58 {
  59     fp_gdk_threads_enter();
  60     gtk2_paint_box(widget_type, state, shadow_type, getStrFor(env, detail),
  61                    x, y, w, h, synth_state, dir);
  62     fp_gdk_threads_leave();
  63 }
  64 
  65 /*
  66  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
  67  * Method:    native_paint_box_gap
  68  * Signature: (IIILjava/lang/String;IIIIIII)V
  69  */
  70 JNIEXPORT void JNICALL
  71 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box_1gap(
  72         JNIEnv *env, jobject this,
  73         jint widget_type, jint state, jint shadow_type, jstring detail,
  74         jint x, jint y, jint w, jint h,
  75         jint gap_side, jint gap_x, jint gap_w)
  76 {
  77     fp_gdk_threads_enter();
  78     gtk2_paint_box_gap(widget_type, state, shadow_type, getStrFor(env, detail),
  79             x, y, w, h, gap_side, gap_x, gap_w);
  80     fp_gdk_threads_leave();
  81 }
  82 
  83 /*
  84  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
  85  * Method:    native_paint_check
  86  * Signature: (IILjava/lang/String;IIII)V
  87  */
  88 JNIEXPORT void JNICALL
  89 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1check(
  90         JNIEnv *env, jobject this,
  91         jint widget_type, jint synth_state, jstring detail,
  92         jint x, jint y, jint w, jint h)
  93 {
  94     fp_gdk_threads_enter();
  95     gtk2_paint_check(widget_type, synth_state, getStrFor(env, detail),
  96                      x, y, w, h);
  97     fp_gdk_threads_leave();
  98 }
  99 
 100 /*
 101  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 102  * Method:    native_paint_expander
 103  * Signature: (IILjava/lang/String;IIIII)V
 104  */
 105 JNIEXPORT void JNICALL
 106 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1expander(
 107         JNIEnv *env, jobject this,
 108         jint widget_type, jint state, jstring detail,
 109         jint x, jint y, jint w, jint h, jint expander_style)
 110 {
 111     fp_gdk_threads_enter();
 112     gtk2_paint_expander(widget_type, state, getStrFor(env, detail),
 113             x, y, w, h, expander_style);
 114     fp_gdk_threads_leave();
 115 }
 116 
 117 /*
 118  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 119  * Method:    native_paint_extension
 120  * Signature: (IIILjava/lang/String;IIIII)V
 121  */
 122 JNIEXPORT void JNICALL
 123 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1extension(
 124         JNIEnv *env, jobject this,
 125         jint widget_type, jint state, jint shadow_type, jstring detail,
 126         jint x, jint y, jint w, jint h, jint placement)
 127 {
 128     fp_gdk_threads_enter();
 129     gtk2_paint_extension(widget_type, state, shadow_type,
 130             getStrFor(env, detail), x, y, w, h, placement);
 131     fp_gdk_threads_leave();
 132 }
 133 
 134 /*
 135  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 136  * Method:    native_paint_flat_box
 137  * Signature: (IIILjava/lang/String;IIII)V
 138  */
 139 JNIEXPORT void JNICALL
 140 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1flat_1box(
 141         JNIEnv *env, jobject this,
 142         jint widget_type, jint state, jint shadow_type, jstring detail,
 143         jint x, jint y, jint w, jint h, jboolean has_focus)
 144 {
 145     fp_gdk_threads_enter();
 146     gtk2_paint_flat_box(widget_type, state, shadow_type,
 147             getStrFor(env, detail), x, y, w, h, has_focus);
 148     fp_gdk_threads_leave();
 149 }
 150 
 151 /*
 152  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 153  * Method:    native_paint_focus
 154  * Signature: (IILjava/lang/String;IIII)V
 155  */
 156 JNIEXPORT void JNICALL
 157 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1focus(
 158         JNIEnv *env, jobject this,
 159         jint widget_type, jint state, jstring detail,
 160         jint x, jint y, jint w, jint h)
 161 {
 162     fp_gdk_threads_enter();
 163     gtk2_paint_focus(widget_type, state, getStrFor(env, detail),
 164             x, y, w, h);
 165     fp_gdk_threads_leave();
 166 }
 167 
 168 /*
 169  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 170  * Method:    native_paint_handle
 171  * Signature: (IIILjava/lang/String;IIIII)V
 172  */
 173 JNIEXPORT void JNICALL
 174 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1handle(
 175         JNIEnv *env, jobject this,
 176         jint widget_type, jint state, jint shadow_type, jstring detail,
 177         jint x, jint y, jint w, jint h, jint orientation)
 178 {
 179     fp_gdk_threads_enter();
 180     gtk2_paint_handle(widget_type, state, shadow_type, getStrFor(env, detail),
 181             x, y, w, h, orientation);
 182     fp_gdk_threads_leave();
 183 }
 184 
 185 /*
 186  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 187  * Method:    native_paint_hline
 188  * Signature: (IILjava/lang/String;IIII)V
 189  */
 190 JNIEXPORT void JNICALL
 191 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1hline(
 192         JNIEnv *env, jobject this,
 193         jint widget_type, jint state, jstring detail,
 194         jint x, jint y, jint w, jint h)
 195 {
 196     fp_gdk_threads_enter();
 197     gtk2_paint_hline(widget_type, state, getStrFor(env, detail),
 198             x, y, w, h);
 199     fp_gdk_threads_leave();
 200 }
 201 
 202 /*
 203  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 204  * Method:    native_paint_option
 205  * Signature: (IILjava/lang/String;IIII)V
 206  */
 207 JNIEXPORT void JNICALL
 208 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1option(
 209         JNIEnv *env, jobject this,
 210         jint widget_type, jint synth_state, jstring detail,
 211         jint x, jint y, jint w, jint h)
 212 {
 213     fp_gdk_threads_enter();
 214     gtk2_paint_option(widget_type, synth_state, getStrFor(env, detail),
 215                       x, y, w, h);
 216     fp_gdk_threads_leave();
 217 }
 218 
 219 /*
 220  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 221  * Method:    native_paint_shadow
 222  * Signature: (IIILjava/lang/String;IIIIII)V
 223  */
 224 JNIEXPORT void JNICALL
 225 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1shadow(
 226         JNIEnv *env, jobject this,
 227         jint widget_type, jint state, jint shadow_type, jstring detail,
 228         jint x, jint y, jint w, jint h,
 229         jint synth_state, jint dir)
 230 {
 231     fp_gdk_threads_enter();
 232     gtk2_paint_shadow(widget_type, state, shadow_type, getStrFor(env, detail),
 233                       x, y, w, h, synth_state, dir);
 234     fp_gdk_threads_leave();
 235 }
 236 
 237 /*
 238  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 239  * Method:    native_paint_slider
 240  * Signature: (IIILjava/lang/String;IIIII)V
 241  */
 242 JNIEXPORT void JNICALL
 243 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1slider(
 244         JNIEnv *env, jobject this,
 245         jint widget_type, jint state, jint shadow_type, jstring detail,
 246         jint x, jint y, jint w, jint h, jint orientation)
 247 {
 248     fp_gdk_threads_enter();
 249     gtk2_paint_slider(widget_type, state, shadow_type, getStrFor(env, detail),
 250             x, y, w, h, orientation);
 251     fp_gdk_threads_leave();
 252 }
 253 
 254 /*
 255  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 256  * Method:    native_paint_vline
 257  * Signature: (IILjava/lang/String;IIII)V
 258  */
 259 JNIEXPORT void JNICALL
 260 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1vline(
 261         JNIEnv *env, jobject this,
 262         jint widget_type, jint state, jstring detail,
 263         jint x, jint y, jint w, jint h)
 264 {
 265     fp_gdk_threads_enter();
 266     gtk2_paint_vline(widget_type, state, getStrFor(env, detail),
 267             x, y, w, h);
 268     fp_gdk_threads_leave();
 269 }
 270 
 271 /*
 272  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 273  * Method:    native_paint_background
 274  * Signature: (IIIIII)V
 275  */
 276 JNIEXPORT void JNICALL
 277 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1background(
 278         JNIEnv *env, jobject this, jint widget_type, jint state,
 279         jint x, jint y, jint w, jint h)
 280 {
 281     fp_gdk_threads_enter();
 282     gtk_paint_background(widget_type, state, x, y, w, h);
 283     fp_gdk_threads_leave();
 284 }
 285 
 286 /*
 287  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 288  * Method:    nativeStartPainting
 289  * Signature: (II)V
 290  */
 291 JNIEXPORT void JNICALL
 292 Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeStartPainting(
 293         JNIEnv *env, jobject this, jint w, jint h)
 294 {
 295     fp_gdk_threads_enter();
 296     gtk2_init_painting(env, w, h);
 297     fp_gdk_threads_leave();
 298 }
 299 
 300 /*
 301  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 302  * Method:    nativeFinishPainting
 303  * Signature: ([III)I
 304  */
 305 JNIEXPORT jint JNICALL
 306 Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeFinishPainting(
 307         JNIEnv *env, jobject this, jintArray dest, jint width, jint height)
 308 {
 309     jint transparency;
 310     gint *buffer = (gint*) (*env)->GetPrimitiveArrayCritical(env, dest, 0);
 311     fp_gdk_threads_enter();
 312     transparency = gtk2_copy_image(buffer, width, height);
 313     fp_gdk_threads_leave();
 314     (*env)->ReleasePrimitiveArrayCritical(env, dest, buffer, 0);
 315     return transparency;
 316 }
 317 
 318 /*
 319  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 320  * Method:    native_switch_theme
 321  * Signature: ()V
 322  */
 323 JNIEXPORT void JNICALL Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1switch_1theme(
 324         JNIEnv *env, jobject this)
 325 {
 326     // Note that flush_gtk_event_loop takes care of locks (7053002)
 327     flush_gtk_event_loop();


 328 }
 329 
 330 /*
 331  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 332  * Method:    native_get_gtk_setting
 333  * Signature: (I)Ljava/lang/Object;
 334  */
 335 JNIEXPORT jobject JNICALL Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1get_1gtk_1setting(
 336         JNIEnv *env, jobject this, jint property)
 337 {
 338     jobject obj;
 339     fp_gdk_threads_enter();
 340     obj = gtk2_get_setting(env, property);
 341     fp_gdk_threads_leave();
 342     return obj;
 343 }
 344 
 345 /*
 346  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 347  * Method:    nativeSetRangeValue
 348  * Signature: (IDDDD)V
 349  */
 350 JNIEXPORT void JNICALL
 351 Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeSetRangeValue(
 352         JNIEnv *env, jobject this, jint widget_type,
 353         jdouble value, jdouble min, jdouble max, jdouble visible)
 354 {
 355     fp_gdk_threads_enter();
 356     gtk2_set_range_value(widget_type, value, min, max, visible);
 357     fp_gdk_threads_leave();
 358 }
   1 /*
   2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include <stdlib.h>
  27 #include "gtk_interface.h"
  28 #include "com_sun_java_swing_plaf_gtk_GTKEngine.h"
  29 
  30 /* Static buffer for conversion from java.lang.String to UTF-8 */
  31 static char conversionBuffer[CONV_BUFFER_SIZE];
  32 
  33 const char *getStrFor(JNIEnv *env, jstring val)
  34 {
  35     int length = (*env)->GetStringLength(env, val);
  36     if (length > CONV_BUFFER_SIZE-1)
  37     {
  38         length = CONV_BUFFER_SIZE-1;
  39     }
  40 
  41     (*env)->GetStringUTFRegion(env, val, 0, length, conversionBuffer);
  42     return conversionBuffer;
  43 }
  44 
  45 /*
  46  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
  47  * Method:    native_paint_arrow
  48  * Signature: (IIILjava/lang/String;IIIII)V
  49  */
  50 JNIEXPORT void JNICALL
  51 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow(
  52         JNIEnv *env, jobject this,
  53         jint widget_type, jint state, jint shadow_type, jstring detail,
  54         jint x, jint y, jint w, jint h, jint arrow_type)
  55 {
  56     gtk->gdk_threads_enter();
  57     gtk->paint_arrow(widget_type, state, shadow_type, getStrFor(env, detail),
  58             x, y, w, h, arrow_type, TRUE);
  59     gtk->gdk_threads_leave();
  60 }
  61 
  62 /*
  63  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
  64  * Method:    native_paint_box
  65  * Signature: (IIILjava/lang/String;IIIIII)V
  66  */
  67 JNIEXPORT void JNICALL
  68 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box(
  69         JNIEnv *env, jobject this,
  70         jint widget_type, jint state, jint shadow_type, jstring detail,
  71         jint x, jint y, jint w, jint h,
  72         jint synth_state, jint dir)
  73 {
  74     gtk->gdk_threads_enter();
  75     gtk->paint_box(widget_type, state, shadow_type, getStrFor(env, detail),
  76                    x, y, w, h, synth_state, dir);
  77     gtk->gdk_threads_leave();
  78 }
  79 
  80 /*
  81  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
  82  * Method:    native_paint_box_gap
  83  * Signature: (IIILjava/lang/String;IIIIIII)V
  84  */
  85 JNIEXPORT void JNICALL
  86 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box_1gap(
  87         JNIEnv *env, jobject this,
  88         jint widget_type, jint state, jint shadow_type, jstring detail,
  89         jint x, jint y, jint w, jint h,
  90         jint gap_side, jint gap_x, jint gap_w)
  91 {
  92     gtk->gdk_threads_enter();
  93     gtk->paint_box_gap(widget_type, state, shadow_type, getStrFor(env, detail),
  94             x, y, w, h, gap_side, gap_x, gap_w);
  95     gtk->gdk_threads_leave();
  96 }
  97 
  98 /*
  99  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 100  * Method:    native_paint_check
 101  * Signature: (IILjava/lang/String;IIII)V
 102  */
 103 JNIEXPORT void JNICALL
 104 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1check(
 105         JNIEnv *env, jobject this,
 106         jint widget_type, jint synth_state, jstring detail,
 107         jint x, jint y, jint w, jint h)
 108 {
 109     gtk->gdk_threads_enter();
 110     gtk->paint_check(widget_type, synth_state, getStrFor(env, detail),
 111                      x, y, w, h);
 112     gtk->gdk_threads_leave();
 113 }
 114 
 115 /*
 116  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 117  * Method:    native_paint_expander
 118  * Signature: (IILjava/lang/String;IIIII)V
 119  */
 120 JNIEXPORT void JNICALL
 121 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1expander(
 122         JNIEnv *env, jobject this,
 123         jint widget_type, jint state, jstring detail,
 124         jint x, jint y, jint w, jint h, jint expander_style)
 125 {
 126     gtk->gdk_threads_enter();
 127     gtk->paint_expander(widget_type, state, getStrFor(env, detail),
 128             x, y, w, h, expander_style);
 129     gtk->gdk_threads_leave();
 130 }
 131 
 132 /*
 133  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 134  * Method:    native_paint_extension
 135  * Signature: (IIILjava/lang/String;IIIII)V
 136  */
 137 JNIEXPORT void JNICALL
 138 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1extension(
 139         JNIEnv *env, jobject this,
 140         jint widget_type, jint state, jint shadow_type, jstring detail,
 141         jint x, jint y, jint w, jint h, jint placement)
 142 {
 143     gtk->gdk_threads_enter();
 144     gtk->paint_extension(widget_type, state, shadow_type,
 145             getStrFor(env, detail), x, y, w, h, placement);
 146     gtk->gdk_threads_leave();
 147 }
 148 
 149 /*
 150  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 151  * Method:    native_paint_flat_box
 152  * Signature: (IIILjava/lang/String;IIII)V
 153  */
 154 JNIEXPORT void JNICALL
 155 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1flat_1box(
 156         JNIEnv *env, jobject this,
 157         jint widget_type, jint state, jint shadow_type, jstring detail,
 158         jint x, jint y, jint w, jint h, jboolean has_focus)
 159 {
 160     gtk->gdk_threads_enter();
 161     gtk->paint_flat_box(widget_type, state, shadow_type,
 162             getStrFor(env, detail), x, y, w, h, has_focus);
 163     gtk->gdk_threads_leave();
 164 }
 165 
 166 /*
 167  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 168  * Method:    native_paint_focus
 169  * Signature: (IILjava/lang/String;IIII)V
 170  */
 171 JNIEXPORT void JNICALL
 172 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1focus(
 173         JNIEnv *env, jobject this,
 174         jint widget_type, jint state, jstring detail,
 175         jint x, jint y, jint w, jint h)
 176 {
 177     gtk->gdk_threads_enter();
 178     gtk->paint_focus(widget_type, state, getStrFor(env, detail),
 179             x, y, w, h);
 180     gtk->gdk_threads_leave();
 181 }
 182 
 183 /*
 184  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 185  * Method:    native_paint_handle
 186  * Signature: (IIILjava/lang/String;IIIII)V
 187  */
 188 JNIEXPORT void JNICALL
 189 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1handle(
 190         JNIEnv *env, jobject this,
 191         jint widget_type, jint state, jint shadow_type, jstring detail,
 192         jint x, jint y, jint w, jint h, jint orientation)
 193 {
 194     gtk->gdk_threads_enter();
 195     gtk->paint_handle(widget_type, state, shadow_type, getStrFor(env, detail),
 196             x, y, w, h, orientation);
 197     gtk->gdk_threads_leave();
 198 }
 199 
 200 /*
 201  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 202  * Method:    native_paint_hline
 203  * Signature: (IILjava/lang/String;IIII)V
 204  */
 205 JNIEXPORT void JNICALL
 206 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1hline(
 207         JNIEnv *env, jobject this,
 208         jint widget_type, jint state, jstring detail,
 209         jint x, jint y, jint w, jint h)
 210 {
 211     gtk->gdk_threads_enter();
 212     gtk->paint_hline(widget_type, state, getStrFor(env, detail),
 213             x, y, w, h);
 214     gtk->gdk_threads_leave();
 215 }
 216 
 217 /*
 218  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 219  * Method:    native_paint_option
 220  * Signature: (IILjava/lang/String;IIII)V
 221  */
 222 JNIEXPORT void JNICALL
 223 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1option(
 224         JNIEnv *env, jobject this,
 225         jint widget_type, jint synth_state, jstring detail,
 226         jint x, jint y, jint w, jint h)
 227 {
 228     gtk->gdk_threads_enter();
 229     gtk->paint_option(widget_type, synth_state, getStrFor(env, detail),
 230                       x, y, w, h);
 231     gtk->gdk_threads_leave();
 232 }
 233 
 234 /*
 235  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 236  * Method:    native_paint_shadow
 237  * Signature: (IIILjava/lang/String;IIIIII)V
 238  */
 239 JNIEXPORT void JNICALL
 240 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1shadow(
 241         JNIEnv *env, jobject this,
 242         jint widget_type, jint state, jint shadow_type, jstring detail,
 243         jint x, jint y, jint w, jint h,
 244         jint synth_state, jint dir)
 245 {
 246     gtk->gdk_threads_enter();
 247     gtk->paint_shadow(widget_type, state, shadow_type, getStrFor(env, detail),
 248                       x, y, w, h, synth_state, dir);
 249     gtk->gdk_threads_leave();
 250 }
 251 
 252 /*
 253  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 254  * Method:    native_paint_slider
 255  * Signature: (IIILjava/lang/String;IIIII)V
 256  */
 257 JNIEXPORT void JNICALL
 258 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1slider(
 259         JNIEnv *env, jobject this,
 260         jint widget_type, jint state, jint shadow_type, jstring detail,
 261         jint x, jint y, jint w, jint h, jint orientation, jboolean has_focus)
 262 {
 263     gtk->gdk_threads_enter();
 264     gtk->paint_slider(widget_type, state, shadow_type, getStrFor(env, detail),
 265             x, y, w, h, orientation, has_focus);
 266     gtk->gdk_threads_leave();
 267 }
 268 
 269 /*
 270  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 271  * Method:    native_paint_vline
 272  * Signature: (IILjava/lang/String;IIII)V
 273  */
 274 JNIEXPORT void JNICALL
 275 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1vline(
 276         JNIEnv *env, jobject this,
 277         jint widget_type, jint state, jstring detail,
 278         jint x, jint y, jint w, jint h)
 279 {
 280     gtk->gdk_threads_enter();
 281     gtk->paint_vline(widget_type, state, getStrFor(env, detail),
 282             x, y, w, h);
 283     gtk->gdk_threads_leave();
 284 }
 285 
 286 /*
 287  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 288  * Method:    native_paint_background
 289  * Signature: (IIIIII)V
 290  */
 291 JNIEXPORT void JNICALL
 292 Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1background(
 293         JNIEnv *env, jobject this, jint widget_type, jint state,
 294         jint x, jint y, jint w, jint h)
 295 {
 296     gtk->gdk_threads_enter();
 297     gtk->paint_background(widget_type, state, x, y, w, h);
 298     gtk->gdk_threads_leave();
 299 }
 300 
 301 /*
 302  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 303  * Method:    nativeStartPainting
 304  * Signature: (II)V
 305  */
 306 JNIEXPORT void JNICALL
 307 Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeStartPainting(
 308         JNIEnv *env, jobject this, jint w, jint h)
 309 {
 310     gtk->gdk_threads_enter();
 311     gtk->init_painting(env, w, h);
 312     gtk->gdk_threads_leave();
 313 }
 314 
 315 /*
 316  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 317  * Method:    nativeFinishPainting
 318  * Signature: ([III)I
 319  */
 320 JNIEXPORT jint JNICALL
 321 Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeFinishPainting(
 322         JNIEnv *env, jobject this, jintArray dest, jint width, jint height)
 323 {
 324     jint transparency;
 325     gint *buffer = (gint*) (*env)->GetPrimitiveArrayCritical(env, dest, 0);
 326     gtk->gdk_threads_enter();
 327     transparency = gtk->copy_image(buffer, width, height);
 328     gtk->gdk_threads_leave();
 329     (*env)->ReleasePrimitiveArrayCritical(env, dest, buffer, 0);
 330     return transparency;
 331 }
 332 
 333 /*
 334  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 335  * Method:    native_switch_theme
 336  * Signature: ()V
 337  */
 338 JNIEXPORT void JNICALL Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1switch_1theme(
 339         JNIEnv *env, jobject this)
 340 {
 341     // Note that flush_gtk_event_loop takes care of locks (7053002)
 342     gtk->gdk_threads_enter();
 343     gtk->flush_event_loop();
 344     gtk->gdk_threads_leave();
 345 }
 346 
 347 /*
 348  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 349  * Method:    native_get_gtk_setting
 350  * Signature: (I)Ljava/lang/Object;
 351  */
 352 JNIEXPORT jobject JNICALL Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1get_1gtk_1setting(
 353         JNIEnv *env, jobject this, jint property)
 354 {
 355     jobject obj;
 356     gtk->gdk_threads_enter();
 357     obj = gtk->get_setting(env, property);
 358     gtk->gdk_threads_leave();
 359     return obj;
 360 }
 361 
 362 /*
 363  * Class:     com_sun_java_swing_plaf_gtk_GTKEngine
 364  * Method:    nativeSetRangeValue
 365  * Signature: (IDDDD)V
 366  */
 367 JNIEXPORT void JNICALL
 368 Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeSetRangeValue(
 369         JNIEnv *env, jobject this, jint widget_type,
 370         jdouble value, jdouble min, jdouble max, jdouble visible)
 371 {
 372     gtk->gdk_threads_enter();
 373     gtk->set_range_value(widget_type, value, min, max, visible);
 374     gtk->gdk_threads_leave();
 375 }
< prev index next >