7010721: Frame#setMaximizedbounds not working properly on dual screen environment
Reviewed-by: art, anthony
--- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java Sat May 14 16:51:25 2011 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java Mon May 16 18:40:10 2011 +0400
@@ -107,8 +107,16 @@
Rectangle currentDevBounds = currentDevGC.getBounds();
Rectangle primaryDevBounds = primaryDevGC.getBounds();
- b.width -= (currentDevBounds.width - primaryDevBounds.width);
- b.height -= (currentDevBounds.height - primaryDevBounds.height);
+ boolean isCurrentDevLarger =
+ ((currentDevBounds.width - primaryDevBounds.width > 0) ||
+ (currentDevBounds.height - primaryDevBounds.height > 0));
+
+ // the window manager doesn't seem to compensate for differences when
+ // the primary monitor is larger than the monitor that display the window
+ if (isCurrentDevLarger) {
+ b.width -= (currentDevBounds.width - primaryDevBounds.width);
+ b.height -= (currentDevBounds.height - primaryDevBounds.height);
+ }
}
}