--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Thu Oct 10 11:40:06 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Thu Oct 10 19:27:21 2013 +0400
@@ -56,15 +56,6 @@
private final PlatformWindow platformWindow;
- // Window bounds reported by the native system (as opposed to
- // regular bounds inherited from LWComponentPeer which are
- // requested by user and may haven't been applied yet because
- // of asynchronous requests to the windowing system)
- private int sysX;
- private int sysY;
- private int sysW;
- private int sysH;
-
private static final int MINIMUM_WIDTH = 1;
private static final int MINIMUM_HEIGHT = 1;
@@ -320,10 +311,18 @@
// Don't post ComponentMoved/Resized and Paint events
// until we've got a notification from the delegate
Rectangle cb = constrainBounds(x, y, w, h);
- setBounds(cb.x, cb.y, cb.width, cb.height, op, false, false);
- // Get updated bounds, so we don't have to handle 'op' here manually
- Rectangle r = getBounds();
- platformWindow.setBounds(r.x, r.y, r.width, r.height);
+
+ Rectangle newBounds = new Rectangle(getBounds());
+ if ((op & (SET_LOCATION | SET_BOUNDS)) != 0) {
+ newBounds.x = cb.x;
+ newBounds.y = cb.y;
+ }
+ if ((op & (SET_SIZE | SET_BOUNDS)) != 0) {
+ newBounds.width = cb.width;
+ newBounds.height = cb.height;
+ }
+ // Native system could constraint bounds, so the peer wold be updated in the callback
+ platformWindow.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
}
public Rectangle constrainBounds(Rectangle bounds) {
@@ -614,17 +613,10 @@
*/
@Override
public void notifyReshape(int x, int y, int w, int h) {
- final boolean moved;
- final boolean resized;
+ Rectangle oldBounds = getBounds();
final boolean invalid = updateInsets(platformWindow.getInsets());
- synchronized (getStateLock()) {
- moved = (x != sysX) || (y != sysY);
- resized = (w != sysW) || (h != sysH);
- sysX = x;
- sysY = y;
- sysW = w;
- sysH = h;
- }
+ final boolean moved = (x != oldBounds.x) || (y != oldBounds.y);
+ final boolean resized = (w != oldBounds.width) || (h != oldBounds.height);
// Check if anything changed
if (!moved && !resized && !invalid) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/bug8024864.java Thu Oct 10 19:27:21 2013 +0400
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2013, 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 8024864
+ * @summary [macosx] Problems with rendering of controls
+ * @author Petr Pchelko
+ * @library ../regtesthelpers
+ * @build Util
+ * @run main bug8024864
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class bug8024864
+{
+ private static final int REPEATS = 30;
+
+ private static volatile JFrame frame;
+
+ private static void showTestUI() {
+ frame = new JFrame();
+ frame.setBackground(Color.green);
+ JPanel p = new JPanel();
+ p.setBackground(Color.red);
+ JLabel l = new JLabel("Test!");
+ p.add(l);
+ frame.add(p);
+ frame.pack();
+ frame.setLocation(100,100);
+ frame.setVisible(true);
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ Robot r = new Robot();
+ for (int i = 0; i < REPEATS; i++) {
+ try {
+ SwingUtilities.invokeAndWait(bug8024864::showTestUI);
+ //Thread.sleep(100);
+ Util.waitTillShown(frame);
+ Util.waitForIdle(r);
+
+ Dimension frameSize = frame.getSize();
+ Point loc = new Point(frameSize.width - 5, frameSize.height - 5);
+ SwingUtilities.convertPointToScreen(loc, frame);
+ Color c = r.getPixelColor(loc.x, loc.y);
+
+ if (c.getGreen() > 200) {
+ throw new RuntimeException("TEST FAILED. Unexpected pixel color " + c);
+ }
+
+ } finally {
+ if (frame != null) {
+ frame.dispose();
+ }
+ Util.waitForIdle(r);
+ }
+ }
+ }
+}