< prev index next >

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

Print this page

        

*** 1655,1673 **** --- 1655,1687 ---- Time timestamp); typedef Rotation (*XRRConfigRotationsType)(XRRScreenConfiguration *config, Rotation *current_rotation); + typedef XRRScreenResources* (*XRRGetScreenResourcesType)(Display *dpy, + Window window); + + typedef void (*XRRFreeScreenResourcesType)(XRRScreenResources *resources); + + typedef XRROutputInfo * (*XRRGetOutputInfoType)(Display *dpy, + XRRScreenResources *resources, RROutput output); + + typedef void (*XRRFreeOutputInfoType)(XRROutputInfo *outputInfo); + static XRRQueryVersionType awt_XRRQueryVersion; static XRRGetScreenInfoType awt_XRRGetScreenInfo; static XRRFreeScreenConfigInfoType awt_XRRFreeScreenConfigInfo; static XRRConfigRatesType awt_XRRConfigRates; static XRRConfigCurrentRateType awt_XRRConfigCurrentRate; static XRRConfigSizesType awt_XRRConfigSizes; static XRRConfigCurrentConfigurationType awt_XRRConfigCurrentConfiguration; static XRRSetScreenConfigAndRateType awt_XRRSetScreenConfigAndRate; static XRRConfigRotationsType awt_XRRConfigRotations; + static XRRGetScreenResourcesType awt_XRRGetScreenResources; + static XRRFreeScreenResourcesType awt_XRRFreeScreenResources; + static XRRGetOutputInfoType awt_XRRGetOutputInfo; + static XRRFreeOutputInfoType awt_XRRFreeOutputInfo; #define LOAD_XRANDR_FUNC(f) \ do { \ awt_##f = (f##Type)dlsym(pLibRandR, #f); \ if (awt_##f == NULL) { \
*** 1735,1744 **** --- 1749,1762 ---- LOAD_XRANDR_FUNC(XRRConfigCurrentRate); LOAD_XRANDR_FUNC(XRRConfigSizes); LOAD_XRANDR_FUNC(XRRConfigCurrentConfiguration); LOAD_XRANDR_FUNC(XRRSetScreenConfigAndRate); LOAD_XRANDR_FUNC(XRRConfigRotations); + LOAD_XRANDR_FUNC(XRRGetScreenResources); + LOAD_XRANDR_FUNC(XRRFreeScreenResources); + LOAD_XRANDR_FUNC(XRRGetOutputInfo); + LOAD_XRANDR_FUNC(XRRFreeOutputInfo); return JNI_TRUE; } static jobject
*** 1922,1935 **** Java_sun_awt_X11GraphicsDevice_enumDisplayModes (JNIEnv* env, jclass x11gd, jint screen, jobject arrayList) { #ifndef HEADLESS - XRRScreenConfiguration *config; AWT_LOCK(); config = awt_XRRGetScreenInfo(awt_display, RootWindow(awt_display, screen)); if (config != NULL) { int nsizes, i, j; XRRScreenSize *sizes = awt_XRRConfigSizes(config, &nsizes); --- 1940,1989 ---- Java_sun_awt_X11GraphicsDevice_enumDisplayModes (JNIEnv* env, jclass x11gd, jint screen, jobject arrayList) { #ifndef HEADLESS AWT_LOCK(); + if (usingXinerama && XScreenCount(awt_display) > 0) { + XRRScreenResources *res = awt_XRRGetScreenResources(awt_display, + RootWindow(awt_display, 0)); + if (res) { + if (res->noutput > screen) { + XRROutputInfo *output_info = awt_XRRGetOutputInfo(awt_display, + res, res->outputs[screen]); + if (output_info) { + int i; + for (i = 0; i < res->nmode; i++) { + RRMode m = output_info->modes[i]; + int j; + XRRModeInfo *mode; + for (j = 0; j < res->nmode; j++) { + mode = &res->modes[j]; + if (mode->id == m) { + float rate = 0; + if (mode->hTotal && mode->vTotal) { + rate = ((float)mode->dotClock / + ((float)mode->hTotal * + (float)mode->vTotal)); + } + X11GD_AddDisplayMode(env, arrayList, + mode->width, mode->height, + BIT_DEPTH_MULTI, (int)(rate +.2)); + break; + } + } + } + awt_XRRFreeOutputInfo(output_info); + } + } + awt_XRRFreeScreenResources(res); + } + } else { + XRRScreenConfiguration *config; + config = awt_XRRGetScreenInfo(awt_display, RootWindow(awt_display, screen)); if (config != NULL) { int nsizes, i, j; XRRScreenSize *sizes = awt_XRRConfigSizes(config, &nsizes);
*** 1953,1962 **** --- 2007,2017 ---- } } awt_XRRFreeScreenConfigInfo(config); } + } AWT_FLUSH_UNLOCK(); #endif /* !HEADLESS */ }
< prev index next >