< prev index next >

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

Print this page




2124  * Signature: (J)V
2125  */
2126 JNIEXPORT void JNICALL
2127 Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive
2128     (JNIEnv* env, jclass x11gd,
2129      jlong window)
2130 {
2131 #ifndef HEADLESS
2132     Window win = (Window)window;
2133 
2134     AWT_LOCK();
2135     X11GD_SetFullscreenMode(win, JNI_FALSE);
2136     AWT_UNLOCK();
2137 #endif /* !HEADLESS */
2138 }
2139 
2140 /**
2141  * End DisplayMode/FullScreen support
2142  */
2143 































2144 
2145 /*
2146  * Class:     sun_awt_X11GraphicsDevice
2147  * Method:    getNativeScaleFactor
2148  * Signature: (I)I
2149  */
2150 JNIEXPORT jint JNICALL
2151 Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor
2152     (JNIEnv *env, jobject this, jint screen) {
2153 
2154     return getNativeScaleFactor();




2155 }


2124  * Signature: (J)V
2125  */
2126 JNIEXPORT void JNICALL
2127 Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive
2128     (JNIEnv* env, jclass x11gd,
2129      jlong window)
2130 {
2131 #ifndef HEADLESS
2132     Window win = (Window)window;
2133 
2134     AWT_LOCK();
2135     X11GD_SetFullscreenMode(win, JNI_FALSE);
2136     AWT_UNLOCK();
2137 #endif /* !HEADLESS */
2138 }
2139 
2140 /**
2141  * End DisplayMode/FullScreen support
2142  */
2143 
2144 static char *get_output_screen_name(JNIEnv *env, int screen) {
2145     if (!awt_XRRGetScreenResources || !awt_XRRGetOutputInfo) {
2146         return NULL;
2147     }
2148     char *name = NULL;
2149     AWT_LOCK();
2150     int scr = 0, out = 0;
2151     if (usingXinerama && XScreenCount(awt_display) > 0) {
2152         out = screen;
2153     } else {
2154         scr = screen;
2155     }
2156 
2157     XRRScreenResources *res = awt_XRRGetScreenResources(awt_display,
2158                                                   RootWindow(awt_display, scr));
2159     if (res) {
2160        if (res->noutput > out) {
2161             XRROutputInfo *output_info = awt_XRRGetOutputInfo(awt_display,
2162                                                         res, res->outputs[out]);
2163             if (output_info) {
2164                 if (output_info->name) {
2165                     name = strdup(output_info->name);
2166                 }
2167                 awt_XRRFreeOutputInfo(output_info);
2168             }
2169         }
2170         awt_XRRFreeScreenResources(res);
2171     }
2172     AWT_UNLOCK();
2173     return name;
2174 }
2175 
2176 /*
2177  * Class:     sun_awt_X11GraphicsDevice
2178  * Method:    getNativeScaleFactor
2179  * Signature: (I)D
2180  */
2181 JNIEXPORT jdouble JNICALL
2182 Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor
2183     (JNIEnv *env, jobject this, jint screen) {
2184     char *name = get_output_screen_name(env, screen);
2185     double scale = getNativeScaleFactor(name);
2186     if (name) {
2187         free(name);
2188     }
2189     return scale;
2190 }
< prev index next >