Fix window activation in gnome-shell

Backport fix for JDK-8012224
This commit is contained in:
Omair Majid 2014-05-28 19:48:35 -04:00
parent afcdce9e6c
commit fc1e586a19
2 changed files with 84 additions and 1 deletions

View File

@ -135,7 +135,7 @@
Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}
Release: 7.%{buildver}%{?dist}
Release: 8.%{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
@ -203,6 +203,8 @@ Patch5: multiple-pkcs11-library-init.patch
Patch6: disable-doclint-by-default.patch
# Include all sources in src.zip
Patch7: include-all-srcs.patch
# Fix window activation in gnome-shell
Patch8: set-active-window.patch
#
# OpenJDK specific patches
@ -438,6 +440,7 @@ sh %{SOURCE12}
%patch5
%patch6
%patch7
%patch8
%patch99
@ -1125,6 +1128,9 @@ exit 0
%{_jvmdir}/%{jredir}/lib/accessibility.properties
%changelog
* Wed May 28 2014 Omair Majid <omajid@redhat.com> - 1:1.8.0.5-8.b13
- Backport fix for JDK-8012224
* Wed May 28 2014 Omair Majid <omajid@redhat.com> - 1:1.8.0.5-7.b13
- Require fontconfig and minimal fonts (xorg-x11-fonts-Type1) explicitly
- Resolves rhbz#1101394

77
set-active-window.patch Normal file
View File

@ -0,0 +1,77 @@
# HG changeset patch
# User azvegint
# Date 1395070254 -14400
# Mon Mar 17 19:30:54 2014 +0400
# Node ID 6406059d2620c8241f6e04398ee0c4591e8820ac
# Parent 37099d54a1483fffb9e51552cfda8ac956bd97ee
8012224: AWT_TopLevels/TopLevelEvents/Automated/WindowIconifyDeiconifyEventsTest02 fails on Ubuntu 12.04 Unity shell
Reviewed-by: anthony, serb
diff --git jdk8/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java jdk8/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
--- jdk8/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
+++ jdk8/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
@@ -284,6 +284,11 @@
if (stateLog.isLoggable(PlatformLogger.Level.FINER)) {
stateLog.finer("DeIconifying " + this);
}
+
+ XNETProtocol net_protocol = XWM.getWM().getNETProtocol();
+ if (net_protocol != null) {
+ net_protocol.setActiveWindow(this);
+ }
xSetVisible(true);
}
}
diff --git jdk8/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java jdk8/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java
--- jdk8/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java
+++ jdk8/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java
@@ -213,7 +213,7 @@
* If window is showing then it uses ClientMessage, otherwise adjusts NET_WM_STATE list
* @param window Window which NET_WM_STATE property is being modified
* @param state State atom to be set/reset
- * @param reset Indicates operation, 'set' if false, 'reset' if true
+ * @param set Indicates operation, 'set' if false, 'reset' if true
*/
private void setStateHelper(XWindowPeer window, XAtom state, boolean set) {
if (log.isLoggable(PlatformLogger.Level.FINER)) {
@@ -249,6 +249,7 @@
XAtom XA_UTF8_STRING = XAtom.get("UTF8_STRING"); /* like STRING but encoding is UTF-8 */
XAtom XA_NET_SUPPORTING_WM_CHECK = XAtom.get("_NET_SUPPORTING_WM_CHECK");
XAtom XA_NET_SUPPORTED = XAtom.get("_NET_SUPPORTED"); /* list of protocols (property of root) */
+ XAtom XA_NET_ACTIVE_WINDOW = XAtom.get("_NET_ACTIVE_WINDOW");
XAtom XA_NET_WM_NAME = XAtom.get("_NET_WM_NAME"); /* window property */
XAtom XA_NET_WM_STATE = XAtom.get("_NET_WM_STATE");/* both window property and request */
@@ -325,6 +326,32 @@
return res;
}
+ public void setActiveWindow(XWindow window) {
+ if (!active() || !checkProtocol(XA_NET_SUPPORTED, XA_NET_ACTIVE_WINDOW)) {
+ return;
+ }
+
+ XClientMessageEvent msg = new XClientMessageEvent();
+ msg.zero();
+ msg.set_type(XConstants.ClientMessage);
+ msg.set_message_type(XA_NET_ACTIVE_WINDOW.getAtom());
+ msg.set_display(XToolkit.getDisplay());
+ msg.set_window(window.getWindow());
+ msg.set_format(32);
+ msg.set_data(0, 1);
+ msg.set_data(1, XToolkit.getCurrentServerTime());
+ msg.set_data(2, 0);
+
+ XToolkit.awtLock();
+ try {
+ XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), false,
+ XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask, msg.getPData());
+ } finally {
+ XToolkit.awtUnlock();
+ msg.dispose();
+ }
+ }
+
boolean isWMName(String name) {
if (!active()) {
return false;