< prev index next >

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

Print this page




2065  * Method:    exitFullScreenExclusive
2066  * Signature: (J)V
2067  */
2068 JNIEXPORT void JNICALL
2069 Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive
2070     (JNIEnv* env, jclass x11gd,
2071      jlong window)
2072 {
2073 #ifndef HEADLESS
2074     Window win = (Window)window;
2075 
2076     AWT_LOCK();
2077     X11GD_SetFullscreenMode(win, JNI_FALSE);
2078     AWT_UNLOCK();
2079 #endif /* !HEADLESS */
2080 }
2081 
2082 /**
2083  * End DisplayMode/FullScreen support
2084  */





































2065  * Method:    exitFullScreenExclusive
2066  * Signature: (J)V
2067  */
2068 JNIEXPORT void JNICALL
2069 Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive
2070     (JNIEnv* env, jclass x11gd,
2071      jlong window)
2072 {
2073 #ifndef HEADLESS
2074     Window win = (Window)window;
2075 
2076     AWT_LOCK();
2077     X11GD_SetFullscreenMode(win, JNI_FALSE);
2078     AWT_UNLOCK();
2079 #endif /* !HEADLESS */
2080 }
2081 
2082 /**
2083  * End DisplayMode/FullScreen support
2084  */
2085 
2086 int getScale(const char *name) {
2087     char *uiScale = getenv(name);
2088     if (uiScale != NULL) {
2089         double scale = strtod(uiScale, NULL);
2090         if (errno == ERANGE || scale < 1) {
2091             return -1;
2092         }
2093         return (int) scale;
2094     }
2095     return -1;
2096 }
2097 
2098 /*
2099  * Class:     sun_awt_X11GraphicsDevice
2100  * Method:    getNativeScaleFactor
2101  * Signature: (I)I
2102  */
2103 JNIEXPORT jint JNICALL
2104 Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor
2105     (JNIEnv *env, jobject this, jint screen) {
2106 
2107     // for debug purposes
2108     static int scale = -2.0;
2109 
2110     if (scale == -2) {
2111         scale = getScale("J2D_UISCALE");
2112     }
2113 
2114     if (scale >= 1) {
2115         return scale;
2116     }
2117 
2118     return getScale("GDK_SCALE");
2119 }
< prev index next >