When using a compositing WM, the overlay window should be used, not the root window.

This commit is contained in:
Jiri Vanek 2016-03-04 10:06:19 +01:00
parent da0851abce
commit 6721cbbc51
3 changed files with 114 additions and 3 deletions

View File

@ -737,7 +737,7 @@ Obsoletes: java-1.7.0-openjdk-accessibility%1
Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}
Release: 12.%{buildver}%{?dist}
Release: 13.%{buildver}%{?dist}
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons,
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a
@ -757,8 +757,9 @@ URL: http://openjdk.java.net/
# aarch64-port now contains integration forest of both aarch64 and normal jdk
# Source from upstream OpenJDK8 project. To regenerate, use
# VERSION=aarch64-jdk8u72-b15 FILE_NAME_ROOT=aarch64-port-jdk8u-${VERSION}-ec
# VERSION=aarch64-jdk8u72-b16 FILE_NAME_ROOT=aarch64-port-jdk8u-${VERSION}-ec
# REPO_ROOT=<path to checked-out repository> generate_source_tarball.sh
# where the source is obtained from http://hg.openjdk.java.net/%%{project}/%%{repo}
Source0: %{project}-%{repo}-%{revision}-ec.tar.xz
# Custom README for -src subpackage
@ -826,6 +827,8 @@ Patch103: s390-size_t_format_flags.patch
# AArch64-specific upstreamable patches
# Remove template in AArch64 port which causes issues with GCC 6
Patch106: remove_aarch64_template_for_gcc6.patch
# AArch64-specific upstreamed patches
# Remove accidentally included global large code cache changes which break S390
Patch107: make_reservedcodecachesize_changes_aarch64_only.patch
@ -844,10 +847,15 @@ Patch203: system-lcms.patch
# This fixes printf warnings that lead to build failure with -Werror=format-security from optflags
Patch502: pr2462.patch
# S8140620, PR2769: Find and load default.sf2 as the default soundbank on Linux
# waiting on upstream: http://mail.openjdk.java.net/pipermail/jdk8u-dev/2016-January/004916.html
Patch605: soundFontPatch.patch
# S8148351, PR2842: Only display resolved symlink for compiler, do not change path
Patch506: pr2842-01.patch
Patch507: pr2842-02.patch
# S8150954, RH1176206, PR2866: Taking screenshots on x11 composite desktop produces wrong result
# In progress: http://mail.openjdk.java.net/pipermail/awt-dev/2016-March/010742.html
Patch508: rh1176206-jdk.patch
Patch509: rh1176206-root.patch
# Patches upstream and appearing in 8u76
# Fixes StackOverflowError on ARM32 bit Zero. See RHBZ#1206656
@ -1142,6 +1150,8 @@ sh %{SOURCE12}
%patch505
%patch506
%patch507
%patch508
%patch509
%patch511
%patch512
%patch513
@ -1711,8 +1721,11 @@ require "copy_jdk_configs.lua"
%endif
%changelog
* Thu Mar 03 2016 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.72-13.b16
- When using a compositing WM, the overlay window should be used, not the root window.
* Mon Feb 29 2016 Omair Majid <omajid@redhat.com> - 1:1.8.0.72-12.b15
- Use a simple backport for PRPR2462/8074839.
- Use a simple backport for PR2462/8074839.
- Don't backport the crc check for pack.gz. It's not tested well upstream.
* Mon Feb 29 2016 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.72-5.b16

67
rh1176206-jdk.patch Normal file
View File

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

31
rh1176206-root.patch Normal file
View File

@ -0,0 +1,31 @@
--- openjdk/common/autoconf/help.m4 2016-02-29 17:10:45.542747800 +0100
+++ openjdk/common/autoconf/help.m4 2016-02-29 17:10:45.500748539 +0100
@@ -112,7 +112,7 @@
pulse)
PKGHANDLER_COMMAND="sudo apt-get install libpulse-dev" ;;
x11)
- PKGHANDLER_COMMAND="sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev" ;;
+ PKGHANDLER_COMMAND="sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev libXcomposite-dev" ;;
ccache)
PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
esac
--- openjdk/common/autoconf/libraries.m4 2016-02-29 17:10:45.716744742 +0100
+++ openjdk/common/autoconf/libraries.m4 2016-02-29 17:10:45.675745462 +0100
@@ -153,7 +153,7 @@
CFLAGS="$CFLAGS $X_CFLAGS"
# Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
- AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
+ AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h X11/extensions/Xcomposite.h],
[X11_A_OK=yes],
[X11_A_OK=no; break],
[
@@ -167,7 +167,7 @@
if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
HELP_MSG_MISSING_DEPENDENCY([x11])
- AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
+ AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h Xcomposite.h). $HELP_MSG])
fi
AC_SUBST(X_CFLAGS)