8214343: Handle the absence of Xrandr more generically
authorsimonis
Wed, 28 Nov 2018 13:56:32 +0100
changeset 52719 91ae63450fa8
parent 52718 263c7685a22a
child 52720 fab77e2d8146
8214343: Handle the absence of Xrandr more generically Reviewed-by: stuefe, erikj, prr
make/autoconf/lib-x11.m4
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c
--- a/make/autoconf/lib-x11.m4	Wed Nov 28 13:24:56 2018 +0300
+++ b/make/autoconf/lib-x11.m4	Wed Nov 28 13:56:32 2018 +0100
@@ -101,7 +101,9 @@
 
     HEADERS_TO_CHECK="X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h"
     # There is no Xrandr extension on AIX
-    if test "x$OPENJDK_TARGET_OS" != xaix; then
+    if test "x$OPENJDK_TARGET_OS" = xaix; then
+      X_CFLAGS="$X_CFLAGS -DNO_XRANDR"
+    else
       HEADERS_TO_CHECK="$HEADERS_TO_CHECK X11/extensions/Xrandr.h"
     fi
 
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Wed Nov 28 13:24:56 2018 +0300
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Wed Nov 28 13:56:32 2018 +0100
@@ -34,7 +34,7 @@
 #ifndef HEADLESS
 #include <X11/extensions/Xdbe.h>
 #include <X11/XKBlib.h>
-#ifndef _AIX
+#ifndef NO_XRANDR
 #include <X11/extensions/Xrandr.h>
 #endif
 #include "GLXGraphicsConfig.h"
@@ -1627,7 +1627,7 @@
 
 #ifndef HEADLESS
 
-#ifndef _AIX
+#ifndef NO_XRANDR
 
 #define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
 #define REFRESH_RATE_UNKNOWN java_awt_DisplayMode_REFRESH_RATE_UNKNOWN
@@ -1834,7 +1834,7 @@
     }
 }
 
-#endif /* !_AIX */
+#endif /* !NO_XRANDR */
 
 static void
 X11GD_SetFullscreenMode(Window win, jboolean enabled)
@@ -1875,7 +1875,7 @@
 Java_sun_awt_X11GraphicsDevice_initXrandrExtension
     (JNIEnv *env, jclass x11gd)
 {
-#if defined(HEADLESS) || defined(_AIX)
+#if defined(HEADLESS) || defined(NO_XRANDR)
     return JNI_FALSE;
 #else
     int opcode = 0, firstEvent = 0, firstError = 0;
@@ -1902,7 +1902,7 @@
 Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode
     (JNIEnv* env, jclass x11gd, jint screen)
 {
-#if defined(HEADLESS) || defined(_AIX)
+#if defined(HEADLESS) || defined(NO_XRANDR)
     return NULL;
 #else
     XRRScreenConfiguration *config;
@@ -1998,7 +1998,7 @@
     (JNIEnv* env, jclass x11gd,
      jint screen, jobject arrayList)
 {
-#if !defined(HEADLESS) && !defined(_AIX)
+#if !defined(HEADLESS) && !defined(NO_XRANDR)
 
     AWT_LOCK();
 
@@ -2086,7 +2086,7 @@
     (JNIEnv* env, jclass x11gd,
      jint screen, jint width, jint height, jint refreshRate)
 {
-#if !defined(HEADLESS) && !defined(_AIX)
+#if !defined(HEADLESS) && !defined(NO_XRANDR)
     jboolean success = JNI_FALSE;
     XRRScreenConfiguration *config;
     Drawable root;
@@ -2203,7 +2203,7 @@
  */
 
 static char *get_output_screen_name(JNIEnv *env, int screen) {
-#ifdef _AIX
+#ifdef NO_XRANDR
     return NULL;
 #else
     if (!awt_XRRGetScreenResources || !awt_XRRGetOutputInfo) {
@@ -2235,7 +2235,7 @@
     }
     AWT_UNLOCK();
     return name;
-#endif /* _AIX */
+#endif /* NO_XRANDR */
 }
 
 /*