changeset 4200:0b7f41c14605

7010721: Frame#setMaximizedbounds not working properly on dual screen environment Reviewed-by: art, anthony
author dcherepanov
date Mon, 16 May 2011 18:40:10 +0400
parents 368e1da134aa
children 52a9555dbbb1
files src/windows/classes/sun/awt/windows/WFramePeer.java
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/classes/sun/awt/windows/WFramePeer.java	Sat May 14 16:51:25 2011 -0700
+++ b/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);
+            }
         }
     }