view patches/openjdk/mutter.patch @ 2578:96394d394527

Add security patches for 2012/06/12. 2012-06-07 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: (ICEDTEA_PATCHES): Add security patches. Make more patches HotSpot-build specific. * patches/ecj/override.patch: Add additional cases from 7143872. * patches/arm.patch: Moved to HotSpot-specific versions. * patches/arch.patch, * patches/freetypeversion.patch, * patches/gcc-suffix.patch: Fix to work with no fuzz. * patches/hotspot/hs20/arm.patch, * patches/hotspot/hs20/gcc-stack-markings.patch, * patches/hotspot/hs20/numa_on_early_glibc.patch, * patches/hotspot/hs20/sparc-trapsfix.patch, * patches/hotspot/hs20/version-hotspot.patch: Split to work with hs20 with no fuzz. * patches/hotspot/original/arm.patch, * patches/hotspot/original/gcc-stack-markings.patch, * patches/hotspot/original/numa_on_early_glibc.patch, * patches/hotspot/original/sparc-trapsfix.patch, * patches/hotspot/original/version-hotspot.patch: Likewise for hs19 (original). * patches/jaxp-serial-version-uid.patch, * patches/libraries.patch, * patches/nio2.patch, * patches/no-static-linking.patch, * patches/openjdk/6693253-security_warning.patch, * patches/openjdk/6766342-AA-simple-shape-performance.patch, * patches/openjdk/6797139-jbutton_truncation.patch, * patches/openjdk/6851973-kerberos.patch, * patches/openjdk/7102369-7094468-rmiregistry.patch: Fixed to work with no fuzz. * patches/openjdk/hs20/7034464-hugepage.patch, * patches/openjdk/hs20/7103224-glibc_name_collision.patch, Fixed to work with hs20 and no fuzz. * patches/openjdk/mutter.patch: Fixed to work with no fuzz. * patches/openjdk/original/7034464-hugepage.patch, * patches/openjdk/original/7103224-glibc_name_collision.patch, Fixed to work with hs19 (original) and no fuzz. * patches/openjdk/remove-mimpure-option-to-gcc.patch: Fixed to work with no fuzz. * patches/security/20120612/7079902.patch, * patches/security/20120612/7143606.patch, * patches/security/20120612/7143614.patch, * patches/security/20120612/7143617.patch, * patches/security/20120612/7143851.patch, * patches/security/20120612/7143872.patch, * patches/security/20120612/7145239.patch, * patches/security/20120612/7157609.patch, * patches/security/20120612/7160677.patch, * patches/security/20120612/7160757.patch, * patches/security/20120612/hs20/7110720.patch, * patches/security/20120612/hs20/7152811.patch, * patches/security/20120612/original/7110720.patch, * patches/security/20120612/original/7152811.patch, Security patches for 2012/06/12. * NEWS: Updated.
author Andrew John Hughes <ahughes@redhat.com>
date Fri, 08 Jun 2012 14:23:28 +0100
parents 711c59eac969
children
line wrap: on
line source

diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java openjdk/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
--- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	2012-06-08 12:14:13.358805320 +0100
+++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	2012-06-08 12:14:54.643473010 +0100
@@ -767,7 +767,7 @@
             // Location, Client size + insets
             newLocation = new Point(xe.get_x() - currentInsets.left, xe.get_y() - currentInsets.top);
         } else {
-            // CDE/MWM/Metacity/Sawfish bug: if shell is resized using
+            // CDE/MWM/Metacity/Sawfish/Mutter bug: if shell is resized using
             // top or left border, we don't receive synthetic
             // ConfigureNotify, only the one from X with zero
             // coordinates.  This is the workaround to get real
@@ -777,6 +777,7 @@
                 case XWM.MOTIF_WM:
                 case XWM.METACITY_WM:
                 case XWM.SAWFISH_WM:
+                case XWM.MUTTER_WM:
                 {
                     Point xlocation = queryXLocation();
                     if (log.isLoggable(Level.FINE)) {
diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XWM.java openjdk/jdk/src/solaris/classes/sun/awt/X11/XWM.java
--- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XWM.java	2012-06-08 12:14:13.382805708 +0100
+++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWM.java	2012-06-08 12:14:54.643473010 +0100
@@ -98,7 +98,8 @@
         ICE_WM = 10,
         METACITY_WM = 11,
         COMPIZ_WM = 12,
-        LG3D_WM = 13;
+        LG3D_WM = 13,
+        MUTTER_WM = 14;
     public String toString() {
         switch  (WMID) {
           case NO_WM:
@@ -125,6 +126,8 @@
               return "Compiz";
           case LG3D_WM:
               return "LookingGlass";
+          case MUTTER_WM:
+              return "Mutter";
           case UNDETERMINED_WM:
           default:
               return "Undetermined WM";
@@ -569,6 +572,12 @@
 //                            getIntProperty(XToolkit.getDefaultRootWindow(), XAtom.XA_CARDINAL)) == 0);
     }
 
+    static boolean isMutter() {
+        return isNetWMName("Mutter");
+    }
+
+    // TODO: according to wikipedia, compiz is now reparenting. This should
+    // probably be updated.
     static boolean isNonReparentingWM() {
         return (XWM.getWMID() == XWM.COMPIZ_WM || XWM.getWMID() == XWM.LG3D_WM);
     }
@@ -744,10 +753,12 @@
                 awt_wmgr = XWM.ENLIGHTEN_WM;
             } else if (isMetacity()) {
                 awt_wmgr = XWM.METACITY_WM;
+            } else if (isMutter()) {
+                awt_wmgr = XWM.MUTTER_WM;
             } else if (isSawfish()) {
                 awt_wmgr = XWM.SAWFISH_WM;
             } else if (isKDE2()) {
-                awt_wmgr =XWM.KDE2_WM;
+                awt_wmgr = XWM.KDE2_WM;
             } else if (isCompiz()) {
                 awt_wmgr = XWM.COMPIZ_WM;
             } else if (isLookingGlass()) {
@@ -1043,6 +1054,8 @@
 
     boolean supportsDynamicLayout() {
         int wm = getWMID();
+        // TODO: does mutter support this? It's a fancy new WM, so it probably
+        // does. Confirm and fix this.
         switch (wm) {
           case XWM.ENLIGHTEN_WM:
           case XWM.KDE2_WM:
@@ -1379,6 +1392,7 @@
                 return insets;
             }
         }
+        // TODO: figure out if Mutter implements the insets property.
         switch(getWMID()) {
           case XWM.KDE2_WM:
               return getInsetsFromProp(window, XA_KDE_NET_WM_FRAME_STRUT);
@@ -1573,6 +1587,9 @@
                       correctWM.bottom = correctWM.left;
                       break;
                   }
+                  case XWM.MUTTER_WM:
+                      // TODO: Figure out if Mutter is double reparenting.
+                      // For now the fallback code is good enough.
                   case XWM.OTHER_WM:
                   default: {                /* this is very similar to the E! case above */
                       if (insLog.isLoggable(Level.FINEST)) {
diff -Nru openjdk.orig/jdk/test/java/awt/regtesthelpers/Util.java openjdk/jdk/test/java/awt/regtesthelpers/Util.java
--- openjdk.orig/jdk/test/java/awt/regtesthelpers/Util.java	2012-06-08 12:14:12.498791412 +0100
+++ openjdk/jdk/test/java/awt/regtesthelpers/Util.java	2012-06-08 12:14:54.643473010 +0100
@@ -140,6 +140,13 @@
         robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
     }
 
+    public static Point getTitlePoint(Window decoratedWindow) {
+        Point p = decoratedWindow.getLocationOnScreen();
+        Dimension d = decoratedWindow.getSize();
+        return new Point(p.x + (int)(d.getWidth()/2),
+                         p.y + (int)decoratedWindow.getInsets().top/2);
+    }
+
     /**
      * Moves mouse pointer in the center of a given {@code comp} component
      * and performs a left mouse button click using the {@code robot} parameter
@@ -167,11 +174,9 @@
      * WARNING: it may fail on some platforms when the window is not wide enough.
      */
     public static void clickOnTitle(final Window decoratedWindow, final Robot robot) {
-        Point p = decoratedWindow.getLocationOnScreen();
-        Dimension d = decoratedWindow.getSize();
-
         if (decoratedWindow instanceof Frame || decoratedWindow instanceof Dialog) {
-            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)decoratedWindow.getInsets().top/2);
+            Point p = getTitlePoint(decoratedWindow);
+            robot.mouseMove(p.x, p.y);
             robot.delay(50);
             robot.mousePress(InputEvent.BUTTON1_MASK);
             robot.delay(50);
@@ -409,7 +414,8 @@
         ICE_WM = 10,
         METACITY_WM = 11,
         COMPIZ_WM = 12,
-        LG3D_WM = 13;
+        LG3D_WM = 13,
+        MUTTER_WM = 14;
 
     /*
      * Returns -1 in case of not X Window or any problems.
diff -Nru openjdk.orig/jdk/test/java/awt/WMSpecificTests/Mutter/MutterMaximizeTest.java openjdk/jdk/test/java/awt/WMSpecificTests/Mutter/MutterMaximizeTest.java
--- openjdk.orig/jdk/test/java/awt/WMSpecificTests/Mutter/MutterMaximizeTest.java	1970-01-01 01:00:00.000000000 +0100
+++ openjdk/jdk/test/java/awt/WMSpecificTests/Mutter/MutterMaximizeTest.java	2012-06-08 12:14:54.643473010 +0100
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2011 Red Hat, Inc.  All Rights Reserved.
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+  @test
+  @bug      7043963
+  @summary  Tests  that the screen location of windows is
+            updated properly after a maximize.
+  @author   Denis Lila
+  @library  ../../regtesthelpers
+  @build    Util
+  @run      main MutterMaximizeTest
+*/
+
+import java.awt.AWTException;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Window;
+import java.awt.event.InputEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import test.java.awt.regtesthelpers.Util;
+
+@SuppressWarnings("serial")
+public class MutterMaximizeTest extends Frame {
+
+    public static void main(String[] args) throws InterruptedException {
+        if (Util.getWMID() != Util.MUTTER_WM) {
+            System.out.println("This test is only useful on Mutter");
+            return;
+        }
+        MutterMaximizeTest frame = new MutterMaximizeTest();
+        frame.addWindowListener(Util.getClosingWindowAdapter());
+
+        //Display the window.
+        frame.pack();
+        frame.setSize(500, 500);
+        Util.showWindowWait(frame);
+        runRobotTest(frame);
+    }
+
+    private static void runRobotTest(Frame frame) {
+        try {
+            Thread robotThread = startRegTest(frame);
+            robotThread.start();
+            waitForThread(robotThread);
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    private static void waitForThread(Thread t) {
+        while (t.isAlive()) {
+            try {
+                t.join();
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+
+    private static void sleepFor(long millis) {
+        long dT = 0;
+        long start = System.nanoTime();
+        while (dT < millis) {
+            try {
+                long toSleep = millis - dT/1000000;
+                if (toSleep > 0) {
+                    Thread.sleep(toSleep);
+                }
+                // if this ends without an interrupted exception,
+                // that's good enough.
+                break;
+            } catch (InterruptedException e) {
+                long now = System.nanoTime();
+                dT = now - start;
+            }
+        }
+    }
+
+    private static void rmove(Robot robot, Point p) {
+        robot.mouseMove(p.x, p.y);
+    }
+    private static void rdown(Robot robot) {
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(50);
+    }
+    private static void rup(Robot robot) {
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.delay(50);
+    }
+
+    public static void click(Robot robot) {
+        rdown(robot);
+        rup(robot);
+    }
+
+    public static void doubleClick(Robot robot) {
+        click(robot);
+        click(robot);
+    }
+
+    private static void dragWindow(Window w, int dx, int dy, Robot robot) {
+        Point p = Util.getTitlePoint(w);
+        rmove(robot, p);
+        rdown(robot);
+        p.translate(dx, dy);
+        rmove(robot, p);
+        rup(robot);
+    }
+
+    // f must be visible
+    private static Thread startRegTest(final Frame f) {
+        Thread robot = new Thread(new Runnable() {
+            public void run() {
+                Robot r = Util.createRobot();
+                dragWindow(f, 100, 100, r);
+                // wait for the location to be set.
+                sleepFor(2000);
+
+                final Point l2 = f.getLocationOnScreen();
+
+                // double click should maximize the frame
+                doubleClick(r);
+
+                // wait for location again.
+                sleepFor(2000);
+                final Point l3 = f.getLocationOnScreen();
+                if (l3.equals(l2)) {
+                    throw new RuntimeException("Bad location after maximize. Window location has not moved");
+                }
+            }
+        });
+        return robot;
+    }
+}
+