< prev index next >

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

Print this page




  26 #include "jni_util.h"
  27 #include "awt_p.h"
  28 #include "awt.h"
  29 #include "color.h"
  30 #include <java_awt_DisplayMode.h>
  31 #include <sun_awt_X11GraphicsEnvironment.h>
  32 #include <sun_awt_X11GraphicsDevice.h>
  33 #include <sun_awt_X11GraphicsConfig.h>
  34 #ifndef HEADLESS
  35 #include <X11/extensions/Xdbe.h>
  36 #include <X11/XKBlib.h>
  37 #include "Xrandr.h"
  38 #include "GLXGraphicsConfig.h"
  39 #endif /* !HEADLESS */
  40 
  41 #include <jni.h>
  42 #include <jni_util.h>
  43 #include <jvm.h>
  44 #include <jvm_md.h>
  45 #include <jlong.h>
  46 
  47 #include <stdlib.h>
  48 
  49 #include "awt_GraphicsEnv.h"
  50 #include "awt_util.h"
  51 #include "gdefs.h"
  52 #include <dlfcn.h>
  53 #include "Trace.h"
  54 
  55 #ifdef NETSCAPE
  56 #include <signal.h>
  57 extern int awt_init_xt;
  58 #endif
  59 
  60 #ifndef HEADLESS
  61 
  62 int awt_numScreens;     /* Xinerama-aware number of screens */
  63 
  64 AwtScreenDataPtr x11Screens;
  65 
  66 /*


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 }


  26 #include "jni_util.h"
  27 #include "awt_p.h"
  28 #include "awt.h"
  29 #include "color.h"
  30 #include <java_awt_DisplayMode.h>
  31 #include <sun_awt_X11GraphicsEnvironment.h>
  32 #include <sun_awt_X11GraphicsDevice.h>
  33 #include <sun_awt_X11GraphicsConfig.h>
  34 #ifndef HEADLESS
  35 #include <X11/extensions/Xdbe.h>
  36 #include <X11/XKBlib.h>
  37 #include "Xrandr.h"
  38 #include "GLXGraphicsConfig.h"
  39 #endif /* !HEADLESS */
  40 
  41 #include <jni.h>
  42 #include <jni_util.h>
  43 #include <jvm.h>
  44 #include <jvm_md.h>
  45 #include <jlong.h>
  46 #include "systemScale.h"
  47 #include <stdlib.h>
  48 
  49 #include "awt_GraphicsEnv.h"
  50 #include "awt_util.h"
  51 #include "gdefs.h"
  52 #include <dlfcn.h>
  53 #include "Trace.h"
  54 
  55 #ifdef NETSCAPE
  56 #include <signal.h>
  57 extern int awt_init_xt;
  58 #endif
  59 
  60 #ifndef HEADLESS
  61 
  62 int awt_numScreens;     /* Xinerama-aware number of screens */
  63 
  64 AwtScreenDataPtr x11Screens;
  65 
  66 /*


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 
2087 /*
2088  * Class:     sun_awt_X11GraphicsDevice
2089  * Method:    getNativeScaleFactor
2090  * Signature: (I)I
2091  */
2092 JNIEXPORT jint JNICALL
2093 Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor
2094     (JNIEnv *env, jobject this, jint screen) {
2095 
2096     // for debug purposes
2097     static int scale = -2.0;
2098 
2099     if (scale == -2) {
2100         scale = getNativeScaleFactor("J2D_UISCALE");
2101     }
2102 
2103     if (scale >= 1) {
2104         return scale;
2105     }
2106 
2107     return getNativeScaleFactor("GDK_SCALE");
2108 }
< prev index next >