aboutsummaryrefslogtreecommitdiff
path: root/src/solaris
diff options
context:
space:
mode:
authorprr <none@none>2008-05-13 16:57:04 -0700
committerprr <none@none>2008-05-13 16:57:04 -0700
commit31cdf31a8daad05e76a1e5d8f10d427153f32c52 (patch)
treeefc7c06e625e833bf3f1676e8d50d12648c1ae85 /src/solaris
parent2942d5f77e2b06c2a68aeb0d21064cd14f94ead5 (diff)
parentf8cb25d56a31c65f6a014879b4ddbc7e173d8439 (diff)
downloadjdk8u_jdk-31cdf31a8daad05e76a1e5d8f10d427153f32c52.tar.gz
Merge
Diffstat (limited to 'src/solaris')
-rw-r--r--src/solaris/native/sun/awt/awt_GraphicsEnv.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/src/solaris/native/sun/awt/awt_GraphicsEnv.c
index b3e52ee779..68299f7960 100644
--- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c
+++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c
@@ -1626,6 +1626,8 @@ Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint(JNIEnv *env,
#define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
+typedef Status
+ (*XRRQueryVersionType) (Display *dpy, int *major_versionp, int *minor_versionp);
typedef XRRScreenConfiguration*
(*XRRGetScreenInfoType)(Display *dpy, Drawable root);
typedef void
@@ -1650,6 +1652,7 @@ typedef Status
short rate,
Time timestamp);
+static XRRQueryVersionType awt_XRRQueryVersion;
static XRRGetScreenInfoType awt_XRRGetScreenInfo;
static XRRFreeScreenConfigInfoType awt_XRRFreeScreenConfigInfo;
static XRRConfigRatesType awt_XRRConfigRates;
@@ -1672,6 +1675,8 @@ static XRRSetScreenConfigAndRateType awt_XRRSetScreenConfigAndRate;
static jboolean
X11GD_InitXrandrFuncs(JNIEnv *env)
{
+ int rr_maj_ver = 0, rr_min_ver = 0;
+
void *pLibRandR = dlopen("libXrandr.so.2", RTLD_LAZY | RTLD_LOCAL);
if (pLibRandR == NULL) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
@@ -1679,6 +1684,41 @@ X11GD_InitXrandrFuncs(JNIEnv *env)
return JNI_FALSE;
}
+ LOAD_XRANDR_FUNC(XRRQueryVersion);
+
+ if (!(*awt_XRRQueryVersion)(awt_display, &rr_maj_ver, &rr_min_ver)) {
+ J2dRlsTraceLn(J2D_TRACE_ERROR,
+ "X11GD_InitXrandrFuncs: XRRQueryVersion returned an error status");
+ dlclose(pLibRandR);
+ return JNI_FALSE;
+ }
+
+ if (usingXinerama) {
+ /*
+ * We can proceed as long as this is RANDR 1.2 or above.
+ * As of Xorg server 1.3 onwards the Xinerama backend may actually be
+ * a fake one provided by RANDR itself. See Java bug 6636469 for info.
+ */
+ if (!(rr_maj_ver > 1 || (rr_maj_ver == 1 && rr_min_ver >= 2))) {
+ J2dRlsTraceLn2(J2D_TRACE_INFO, "X11GD_InitXrandrFuncs: Can't use Xrandr. "
+ "Xinerama is active and Xrandr version is %d.%d",
+ rr_maj_ver, rr_min_ver);
+ dlclose(pLibRandR);
+ return JNI_FALSE;
+ }
+
+ /*
+ * REMIND: Fullscreen mode doesn't work quite right with multi-monitor
+ * setups and RANDR 1.2. So for now we also require a single screen.
+ */
+ if (awt_numScreens > 1 ) {
+ J2dRlsTraceLn(J2D_TRACE_INFO, "X11GD_InitXrandrFuncs: Can't use Xrandr. "
+ "Multiple screens in use");
+ dlclose(pLibRandR);
+ return JNI_FALSE;
+ }
+ }
+
LOAD_XRANDR_FUNC(XRRGetScreenInfo);
LOAD_XRANDR_FUNC(XRRFreeScreenConfigInfo);
LOAD_XRANDR_FUNC(XRRConfigRates);
@@ -1814,15 +1854,6 @@ Java_sun_awt_X11GraphicsDevice_initXrandrExtension
int opcode = 0, firstEvent = 0, firstError = 0;
jboolean ret;
- if (usingXinerama) {
- /*
- * REMIND: we'll just punt if Xinerama is enabled; we can remove this
- * restriction in the future if we find Xinerama and XRandR playing
- * well together...
- */
- return JNI_FALSE;
- }
-
AWT_LOCK();
ret = (jboolean)XQueryExtension(awt_display, "RANDR",
&opcode, &firstEvent, &firstError);