From fc1e586a196e83dcb67bf513649fcf2499e36330 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Wed, 28 May 2014 19:48:35 -0400 Subject: [PATCH] Fix window activation in gnome-shell Backport fix for JDK-8012224 --- java-1.8.0-openjdk.spec | 8 ++++- set-active-window.patch | 77 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 set-active-window.patch diff --git a/java-1.8.0-openjdk.spec b/java-1.8.0-openjdk.spec index d2656ff..0aa1945 100644 --- a/java-1.8.0-openjdk.spec +++ b/java-1.8.0-openjdk.spec @@ -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 - 1:1.8.0.5-8.b13 +- Backport fix for JDK-8012224 + * Wed May 28 2014 Omair Majid - 1:1.8.0.5-7.b13 - Require fontconfig and minimal fonts (xorg-x11-fonts-Type1) explicitly - Resolves rhbz#1101394 diff --git a/set-active-window.patch b/set-active-window.patch new file mode 100644 index 0000000..923b9f2 --- /dev/null +++ b/set-active-window.patch @@ -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;