< prev index next >

src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c

Print this page


   1 /*
   2  * Copyright (c) 1997, 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


 767 static void ensureConfigsInited(JNIEnv* env, int screen) {
 768    if (x11Screens[screen].numConfigs == 0) {
 769        if (env == NULL) {
 770            env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 771        }
 772        getAllConfigs (env, screen, &(x11Screens[screen]));
 773     }
 774 }
 775 #endif
 776 
 777 #ifdef HEADLESS
 778 void* getDefaultConfig(int screen) {
 779     return NULL;
 780 }
 781 #else
 782 AwtGraphicsConfigDataPtr
 783 getDefaultConfig(int screen) {
 784     ensureConfigsInited(NULL, screen);
 785     return x11Screens[screen].defaultConfig;
 786 }
 787 
 788 AwtScreenDataPtr
 789 getScreenData(int screen) {
 790     return &(x11Screens[screen]);
 791 }
 792 #endif /* !HEADLESS */
 793 
 794 /*
 795  * Class:     sun_awt_X11GraphicsEnvironment
 796  * Method:    initDisplay
 797  * Signature: (Z)V
 798  */
 799 JNIEXPORT void JNICALL
 800 Java_sun_awt_X11GraphicsEnvironment_initDisplay(JNIEnv *env, jobject this,
 801                                                 jboolean glxReq)
 802 {
 803 #ifndef HEADLESS
 804     glxRequested = glxReq;
 805     (void) awt_init_Display(env, this);
 806 #endif /* !HEADLESS */
 807 }
 808 
 809 /*
 810  * Class:     sun_awt_X11GraphicsEnvironment
 811  * Method:    initGLX


   1 /*
   2  * Copyright (c) 1997, 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


 767 static void ensureConfigsInited(JNIEnv* env, int screen) {
 768    if (x11Screens[screen].numConfigs == 0) {
 769        if (env == NULL) {
 770            env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 771        }
 772        getAllConfigs (env, screen, &(x11Screens[screen]));
 773     }
 774 }
 775 #endif
 776 
 777 #ifdef HEADLESS
 778 void* getDefaultConfig(int screen) {
 779     return NULL;
 780 }
 781 #else
 782 AwtGraphicsConfigDataPtr
 783 getDefaultConfig(int screen) {
 784     ensureConfigsInited(NULL, screen);
 785     return x11Screens[screen].defaultConfig;
 786 }





 787 #endif /* !HEADLESS */
 788 
 789 /*
 790  * Class:     sun_awt_X11GraphicsEnvironment
 791  * Method:    initDisplay
 792  * Signature: (Z)V
 793  */
 794 JNIEXPORT void JNICALL
 795 Java_sun_awt_X11GraphicsEnvironment_initDisplay(JNIEnv *env, jobject this,
 796                                                 jboolean glxReq)
 797 {
 798 #ifndef HEADLESS
 799     glxRequested = glxReq;
 800     (void) awt_init_Display(env, this);
 801 #endif /* !HEADLESS */
 802 }
 803 
 804 /*
 805  * Class:     sun_awt_X11GraphicsEnvironment
 806  * Method:    initGLX


< prev index next >