< prev index next >
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c
Print this page
@@ -1665,10 +1665,15 @@
typedef XRROutputInfo * (*XRRGetOutputInfoType)(Display *dpy,
XRRScreenResources *resources, RROutput output);
typedef void (*XRRFreeOutputInfoType)(XRROutputInfo *outputInfo);
+typedef XRRCrtcInfo* (*XRRGetCrtcInfoType)(Display *dpy,
+ XRRScreenResources *resources, RRCrtc crtc);
+
+typedef void (*XRRFreeCrtcInfoType)(XRRCrtcInfo *crtcInfo);
+
static XRRQueryVersionType awt_XRRQueryVersion;
static XRRGetScreenInfoType awt_XRRGetScreenInfo;
static XRRFreeScreenConfigInfoType awt_XRRFreeScreenConfigInfo;
static XRRConfigRatesType awt_XRRConfigRates;
static XRRConfigCurrentRateType awt_XRRConfigCurrentRate;
@@ -1678,10 +1683,12 @@
static XRRConfigRotationsType awt_XRRConfigRotations;
static XRRGetScreenResourcesType awt_XRRGetScreenResources;
static XRRFreeScreenResourcesType awt_XRRFreeScreenResources;
static XRRGetOutputInfoType awt_XRRGetOutputInfo;
static XRRFreeOutputInfoType awt_XRRFreeOutputInfo;
+static XRRGetCrtcInfoType awt_XRRGetCrtcInfo;
+static XRRFreeCrtcInfoType awt_XRRFreeCrtcInfo;
#define LOAD_XRANDR_FUNC(f) \
do { \
awt_##f = (f##Type)dlsym(pLibRandR, #f); \
if (awt_##f == NULL) { \
@@ -1753,10 +1760,12 @@
LOAD_XRANDR_FUNC(XRRConfigRotations);
LOAD_XRANDR_FUNC(XRRGetScreenResources);
LOAD_XRANDR_FUNC(XRRFreeScreenResources);
LOAD_XRANDR_FUNC(XRRGetOutputInfo);
LOAD_XRANDR_FUNC(XRRFreeOutputInfo);
+ LOAD_XRANDR_FUNC(XRRGetCrtcInfo);
+ LOAD_XRANDR_FUNC(XRRFreeCrtcInfo);
return JNI_TRUE;
}
static jobject
@@ -1893,11 +1902,53 @@
XRRScreenConfiguration *config;
jobject displayMode = NULL;
AWT_LOCK();
- if (screen < ScreenCount(awt_display)) {
+ 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) {
+ if (output_info->crtc) {
+ XRRCrtcInfo *crtc_info =
+ awt_XRRGetCrtcInfo (awt_display, res,
+ output_info->crtc);
+ if (crtc_info) {
+ if (crtc_info->mode) {
+ int i;
+ for (i = 0; i < res->nmode; i++) {
+ XRRModeInfo *mode = &res->modes[i];
+ if (mode->id == crtc_info->mode) {
+ float rate = 0;
+ if (mode->hTotal && mode->vTotal) {
+ rate = ((float)mode->dotClock /
+ ((float)mode->hTotal *
+ (float)mode->vTotal));
+ }
+ displayMode = X11GD_CreateDisplayMode(
+ env,
+ mode->width,
+ mode->height,
+ BIT_DEPTH_MULTI,
+ (int)(rate +.2));
+ break;
+ }
+ }
+ }
+ awt_XRRFreeCrtcInfo(crtc_info);
+ }
+ }
+ awt_XRRFreeOutputInfo(output_info);
+ }
+ }
+ awt_XRRFreeScreenResources(res);
+ }
+ } else {
config = awt_XRRGetScreenInfo(awt_display,
RootWindow(awt_display, screen));
if (config != NULL) {
Rotation rotation;
@@ -1952,11 +2003,11 @@
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++) {
+ for (i = 0; i < output_info->nmode; i++) {
RRMode m = output_info->modes[i];
int j;
XRRModeInfo *mode;
for (j = 0; j < res->nmode; j++) {
mode = &res->modes[j];
< prev index next >