Blame SOURCES/rh1176206-jdk.patch

2b939e
--- openjdk/jdk/make/lib/Awt2dLibraries.gmk	2016-02-29 17:11:00.497484904 +0100
2b939e
+++ openjdk/jdk/make/lib/Awt2dLibraries.gmk	2016-02-29 17:11:00.402486574 +0100
2b939e
@@ -618,7 +618,7 @@
2b939e
         XRSurfaceData.c \
2b939e
         XRBackendNative.c
2b939e
 
2b939e
-    LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
2b939e
+    LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender -lXcomposite $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
2b939e
 
2b939e
     ifeq ($(OPENJDK_TARGET_OS), linux)
2b939e
       # To match old build, add this to LDFLAGS instead of suffix.
2b939e
--- openjdk/jdk/src/solaris/native/sun/awt/awt_Robot.c	2016-02-29 17:11:00.777479982 +0100
2b939e
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_Robot.c	2016-02-29 17:11:00.677481740 +0100
2b939e
@@ -38,6 +38,7 @@
2b939e
 #include <X11/extensions/XTest.h>
2b939e
 #include <X11/extensions/XInput.h>
2b939e
 #include <X11/extensions/XI.h>
2b939e
+#include <X11/extensions/Xcomposite.h>
2b939e
 #include <jni.h>
2b939e
 #include <sizecalc.h>
2b939e
 #include "robot_common.h"
2b939e
@@ -88,6 +89,32 @@
2b939e
     return isXTestAvailable;
2b939e
 }
2b939e
 
2b939e
+static Bool hasXCompositeOverlayExtension(Display *display) {
2b939e
+
2b939e
+    int xoverlay = False;
2b939e
+    int eventBase, errorBase;
2b939e
+    if (XCompositeQueryExtension(display, &eventBase, &errorBase)) {
2b939e
+        int major = 0;
2b939e
+        int minor = 0;
2b939e
+
2b939e
+        XCompositeQueryVersion(display, &major, &minor);
2b939e
+        if (major > 0 || minor >= 3)
2b939e
+            xoverlay = True;
2b939e
+    }
2b939e
+
2b939e
+    return xoverlay;
2b939e
+}
2b939e
+
2b939e
+static jboolean isXCompositeDisplay(Display *display, int screenNumber) {
2b939e
+
2b939e
+    char NET_WM_CM_Sn[25];
2b939e
+    snprintf(NET_WM_CM_Sn, sizeof(NET_WM_CM_Sn), "_NET_WM_CM_S%d\0", screenNumber);
2b939e
+
2b939e
+    Atom managerSelection = XInternAtom(display, NET_WM_CM_Sn, 0);
2b939e
+    Window owner = XGetSelectionOwner(display, managerSelection);
2b939e
+
2b939e
+    return owner != 0;
2b939e
+}
2b939e
 
2b939e
 static XImage *getWindowImage(Display * display, Window window,
2b939e
                               int32_t x, int32_t y,
2b939e
@@ -232,6 +259,12 @@
2b939e
     DASSERT(adata != NULL);
2b939e
 
2b939e
     rootWindow = XRootWindow(awt_display, adata->awt_visInfo.screen);
2b939e
+    if (isXCompositeDisplay(awt_display, adata->awt_visInfo.screen) &&
2b939e
+        hasXCompositeOverlayExtension(awt_display))
2b939e
+    {
2b939e
+        rootWindow = XCompositeGetOverlayWindow(awt_display, rootWindow);
2b939e
+    }
2b939e
+
2b939e
     image = getWindowImage(awt_display, rootWindow, x, y, width, height);
2b939e
 
2b939e
     /* Array to use to crunch around the pixel values */