< prev index next >

src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c

Print this page


   1 /*
   2  * Copyright (c) 2002, 2019, 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 <X11/Xlib.h>
  27 #include <X11/Xutil.h>
  28 #include <X11/Xos.h>
  29 #include <X11/Xatom.h>
  30 #ifdef __linux__
  31 #include <execinfo.h>
  32 #endif
  33 
  34 #include <jvm.h>
  35 #include <jni.h>
  36 #include <jlong.h>
  37 #include <jni_util.h>
  38 
  39 #include "awt_p.h"
  40 #include "awt_Component.h"
  41 #include "awt_MenuComponent.h"
  42 #include "awt_util.h"
  43 
  44 #include "sun_awt_X11_XToolkit.h"
  45 #include "java_awt_SystemColor.h"


  56 
  57 extern JavaVM *jvm;
  58 
  59 // Tracing level
  60 static int tracing = 0;
  61 #ifdef PRINT
  62 #undef PRINT
  63 #endif
  64 #ifdef PRINT2
  65 #undef PRINT2
  66 #endif
  67 
  68 #define PRINT if (tracing) printf
  69 #define PRINT2 if (tracing > 1) printf
  70 
  71 
  72 struct ComponentIDs componentIDs;
  73 
  74 struct MenuComponentIDs menuComponentIDs;
  75 
  76 #ifndef HEADLESS
  77 
  78 extern Display* awt_init_Display(JNIEnv *env, jobject this);
  79 extern void freeNativeStringArray(char **array, jsize length);
  80 extern char** stringArrayToNative(JNIEnv *env, jobjectArray array, jsize * ret_length);
  81 #endif /* !HEADLESS */
  82 
  83 /* This function gets called from the static initializer for FileDialog.java
  84    to initialize the fieldIDs for fields that may be accessed from C */
  85 
  86 JNIEXPORT void JNICALL
  87 Java_java_awt_FileDialog_initIDs
  88   (JNIEnv *env, jclass cls)
  89 {
  90 
  91 }
  92 
  93 JNIEXPORT void JNICALL
  94 Java_sun_awt_X11_XToolkit_initIDs
  95   (JNIEnv *env, jclass clazz)
  96 {
  97     jfieldID fid = (*env)->GetStaticFieldID(env, clazz, "numLockMask", "I");
  98     CHECK_NULL(fid);
  99     awt_NumLockMask = (*env)->GetStaticIntField(env, clazz, fid);
 100     DTRACE_PRINTLN1("awt_NumLockMask = %u", awt_NumLockMask);
 101     fid = (*env)->GetStaticFieldID(env, clazz, "modLockIsShiftLock", "I");


 293 
 294 JNIEXPORT void JNICALL
 295 Java_java_awt_Checkbox_initIDs
 296   (JNIEnv *env, jclass cls)
 297 {
 298 }
 299 
 300 
 301 JNIEXPORT void JNICALL Java_java_awt_ScrollPane_initIDs
 302   (JNIEnv *env, jclass cls)
 303 {
 304 }
 305 
 306 JNIEXPORT void JNICALL
 307 Java_java_awt_TextField_initIDs
 308   (JNIEnv *env, jclass cls)
 309 {
 310 }
 311 
 312 JNIEXPORT jboolean JNICALL AWTIsHeadless() {
 313 #ifdef HEADLESS
 314     return JNI_TRUE;
 315 #else
 316     return JNI_FALSE;
 317 #endif
 318 }
 319 
 320 JNIEXPORT void JNICALL Java_java_awt_Dialog_initIDs (JNIEnv *env, jclass cls)
 321 {
 322 }
 323 
 324 
 325 /* ========================== Begin poll section ================================ */
 326 
 327 // Includes
 328 
 329 #include <sys/time.h>
 330 #include <limits.h>
 331 #include <locale.h>
 332 #include <pthread.h>
 333 
 334 #include <dlfcn.h>
 335 #include <fcntl.h>
 336 
 337 #include <poll.h>


   1 /*
   2  * Copyright (c) 2002, 2020, 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 #ifdef HEADLESS
  27     #error This file should not be included in headless library
  28 #endif
  29 
  30 #include <X11/Xlib.h>
  31 #include <X11/Xutil.h>
  32 #include <X11/Xos.h>
  33 #include <X11/Xatom.h>
  34 #ifdef __linux__
  35 #include <execinfo.h>
  36 #endif
  37 
  38 #include <jvm.h>
  39 #include <jni.h>
  40 #include <jlong.h>
  41 #include <jni_util.h>
  42 
  43 #include "awt_p.h"
  44 #include "awt_Component.h"
  45 #include "awt_MenuComponent.h"
  46 #include "awt_util.h"
  47 
  48 #include "sun_awt_X11_XToolkit.h"
  49 #include "java_awt_SystemColor.h"


  60 
  61 extern JavaVM *jvm;
  62 
  63 // Tracing level
  64 static int tracing = 0;
  65 #ifdef PRINT
  66 #undef PRINT
  67 #endif
  68 #ifdef PRINT2
  69 #undef PRINT2
  70 #endif
  71 
  72 #define PRINT if (tracing) printf
  73 #define PRINT2 if (tracing > 1) printf
  74 
  75 
  76 struct ComponentIDs componentIDs;
  77 
  78 struct MenuComponentIDs menuComponentIDs;
  79 


  80 extern Display* awt_init_Display(JNIEnv *env, jobject this);
  81 extern void freeNativeStringArray(char **array, jsize length);
  82 extern char** stringArrayToNative(JNIEnv *env, jobjectArray array, jsize * ret_length);

  83 
  84 /* This function gets called from the static initializer for FileDialog.java
  85    to initialize the fieldIDs for fields that may be accessed from C */
  86 
  87 JNIEXPORT void JNICALL
  88 Java_java_awt_FileDialog_initIDs
  89   (JNIEnv *env, jclass cls)
  90 {
  91 
  92 }
  93 
  94 JNIEXPORT void JNICALL
  95 Java_sun_awt_X11_XToolkit_initIDs
  96   (JNIEnv *env, jclass clazz)
  97 {
  98     jfieldID fid = (*env)->GetStaticFieldID(env, clazz, "numLockMask", "I");
  99     CHECK_NULL(fid);
 100     awt_NumLockMask = (*env)->GetStaticIntField(env, clazz, fid);
 101     DTRACE_PRINTLN1("awt_NumLockMask = %u", awt_NumLockMask);
 102     fid = (*env)->GetStaticFieldID(env, clazz, "modLockIsShiftLock", "I");


 294 
 295 JNIEXPORT void JNICALL
 296 Java_java_awt_Checkbox_initIDs
 297   (JNIEnv *env, jclass cls)
 298 {
 299 }
 300 
 301 
 302 JNIEXPORT void JNICALL Java_java_awt_ScrollPane_initIDs
 303   (JNIEnv *env, jclass cls)
 304 {
 305 }
 306 
 307 JNIEXPORT void JNICALL
 308 Java_java_awt_TextField_initIDs
 309   (JNIEnv *env, jclass cls)
 310 {
 311 }
 312 
 313 JNIEXPORT jboolean JNICALL AWTIsHeadless() {



 314     return JNI_FALSE;

 315 }
 316 
 317 JNIEXPORT void JNICALL Java_java_awt_Dialog_initIDs (JNIEnv *env, jclass cls)
 318 {
 319 }
 320 
 321 
 322 /* ========================== Begin poll section ================================ */
 323 
 324 // Includes
 325 
 326 #include <sys/time.h>
 327 #include <limits.h>
 328 #include <locale.h>
 329 #include <pthread.h>
 330 
 331 #include <dlfcn.h>
 332 #include <fcntl.h>
 333 
 334 #include <poll.h>


< prev index next >