# HG changeset patch # User Omair Majid # Date 1231519987 18000 # Node ID 508839ea3465a4a83b4acf5aa9742abcf5a450d3 # Parent bc82fc344da8fd35aee13051d55e0952d2d02ad7 2009-01-09 Omair Majid * patches/icedtea-awt-window-size.patch: New file. Fix X11 window size calculation. * Makefile.am: Apply patch. * HACKING: Document the above. diff -r bc82fc344da8 -r 508839ea3465 ChangeLog --- a/ChangeLog Fri Jan 09 07:22:45 2009 -0500 +++ b/ChangeLog Fri Jan 09 11:53:07 2009 -0500 @@ -1,3 +1,10 @@ +2009-01-09 Omair Majid + + * patches/icedtea-awt-window-size.patch: New file. Fix X11 window size + calculation. + * Makefile.am: Apply patch. + * HACKING: Document the above. + 2009-01-09 Gary Benson * contrib/mixtec-sleep-on-bomb.patch: New file. diff -r bc82fc344da8 -r 508839ea3465 HACKING --- a/HACKING Fri Jan 09 07:22:45 2009 -0500 +++ b/HACKING Fri Jan 09 11:53:07 2009 -0500 @@ -83,6 +83,7 @@ * icedtea-hotspot-dispatch.patch: Fix build failure with GCC-4.4 (PR 38725). * icedtea-no-precompiled.patch: Don't use precompiled header files in hotspot. * icedtea-includedb.patch: Add missing include. +* icedtea-awt-window-size.patch: Fix X11 window size calculation (S6721088). The following patches are only applied to OpenJDK6 in IcedTea6: diff -r bc82fc344da8 -r 508839ea3465 Makefile.am --- a/Makefile.am Fri Jan 09 07:22:45 2009 -0500 +++ b/Makefile.am Fri Jan 09 11:53:07 2009 -0500 @@ -691,7 +691,8 @@ ICEDTEA_PATCHES += \ $(DISTRIBUTION_PATCHES) \ patches/icedtea-a11y-property-change.patch \ - patches/icedtea-demo-swingapplet.patch + patches/icedtea-demo-swingapplet.patch \ + patches/icedtea-awt-window-size.patch stamps/extract.stamp: stamps/download.stamp if OPENJDK_SRC_DIR_FOUND diff -r bc82fc344da8 -r 508839ea3465 patches/icedtea-awt-window-size.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-awt-window-size.patch Fri Jan 09 11:53:07 2009 -0500 @@ -0,0 +1,67 @@ +--- openjdk/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java.orig 2009-01-08 16:53:54.000000000 -0500 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java 2009-01-08 16:54:08.000000000 -0500 +@@ -478,7 +478,10 @@ + // do nothing but accept it. + Rectangle reqBounds = newDimensions.getBounds(); + Rectangle newBounds = constrainBounds(reqBounds.x, reqBounds.y, reqBounds.width, reqBounds.height); +- newDimensions = new WindowDimensions(newBounds, newDimensions.getInsets(), newDimensions.isClientSizeSet()); ++ Insets insets = newDimensions.getInsets(); ++ Rectangle fixedBounds = new Rectangle(newBounds.x, newBounds.y, newBounds.width - insets.left - insets.right, ++ newBounds.height - insets.top - insets.bottom); ++ newDimensions = new WindowDimensions(fixedBounds, insets, newDimensions.isClientSizeSet()); + } + XToolkit.awtLock(); + try { +--- /dev/null 2009-01-09 04:32:08.413012246 -0500 ++++ openjdk/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java 2009-01-09 11:30:54.000000000 -0500 +@@ -0,0 +1,50 @@ ++/* ++ @test ++ @bug 6721088 ++ @summary X11 Window sizes should be what we set them to ++ @author Omair Majid ++ @run main TestFrameSize ++ */ ++ ++import java.awt.Dimension; ++import java.awt.Frame; ++ ++/** ++ * TestFrameSize.java ++ * ++ * Summary: test that X11 Awt windows are drawn with correct sizes ++ * ++ * Test fails if size of window is wrong ++ */ ++ ++public class TestFrameSize { ++ ++ static Dimension desiredDimensions = new Dimension(200, 200); ++ static int ERROR_MARGIN = 15; ++ static Frame mainWindow; ++ ++ public static void drawGui() { ++ mainWindow = new Frame(""); ++ mainWindow.setPreferredSize(desiredDimensions); ++ mainWindow.pack(); ++ // mainWindow.setVisible(true); ++ ++ Dimension actualDimensions = mainWindow.getSize(); ++ // System.out.println(desiredDimensions); ++ // System.out.println(actualDimensions); ++ if (Math.abs(actualDimensions.height - desiredDimensions.height) > ERROR_MARGIN) { ++ throw new RuntimeException("Incorrect widow size"); ++ } ++ ++ } ++ ++ public static void main(String[] args) { ++ try { ++ drawGui(); ++ } finally { ++ if (mainWindow != null) { ++ mainWindow.dispose(); ++ } ++ } ++ } ++}