From f01001207c8c0d4e0667cc098b219bdd14fe28d6 Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Mon, 16 May 2011 18:40:10 +0400 Subject: [PATCH] 7010721: Frame#setMaximizedbounds not working properly on dual screen environment Reviewed-by: art, anthony --- .../windows/classes/sun/awt/windows/WFramePeer.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java index a3e4a1d17fc..94cde03850f 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java @@ -107,8 +107,16 @@ class WFramePeer extends WWindowPeer implements FramePeer { 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); + } } }