< prev index next >
src/java.desktop/windows/classes/sun/awt/windows/WFramePeer.java
Print this page
rev 60071 : 8211999: Window positioning bugs due to overlapping GraphicsDevice bounds (Windows/HiDPI)
Reviewed-by: XXX
*** 36,46 ****
import sun.awt.AWTAccessor;
import sun.awt.im.InputMethodManager;
import sun.security.action.GetPropertyAction;
! import static sun.java2d.SunGraphicsEnvironment.convertToDeviceSpace;
class WFramePeer extends WWindowPeer implements FramePeer {
static {
initIDs();
--- 36,48 ----
import sun.awt.AWTAccessor;
import sun.awt.im.InputMethodManager;
import sun.security.action.GetPropertyAction;
! import static sun.java2d.SunGraphicsEnvironment.getGCDeviceBounds;
! import static sun.java2d.SunGraphicsEnvironment.toDeviceSpaceAbs;
! import static sun.java2d.SunGraphicsEnvironment.toUserSpace;
class WFramePeer extends WWindowPeer implements FramePeer {
static {
initIDs();
*** 95,108 ****
* The method translates the incoming bounds to the values acceptable
* by the window manager. For more details, please refer to 6699851.
*/
private Rectangle adjustMaximizedBounds(Rectangle bounds) {
// All calculations should be done in the device space
! bounds = convertToDeviceSpace(bounds);
!
GraphicsConfiguration gc = getGraphicsConfiguration();
! Rectangle currentDevBounds = convertToDeviceSpace(gc, gc.getBounds());
// Prepare data for WM_GETMINMAXINFO message.
// ptMaxPosition should be in coordinate system of the current monitor,
// not the main monitor, or monitor on which we maximize the window.
bounds.x -= currentDevBounds.x;
bounds.y -= currentDevBounds.y;
--- 97,109 ----
* The method translates the incoming bounds to the values acceptable
* by the window manager. For more details, please refer to 6699851.
*/
private Rectangle adjustMaximizedBounds(Rectangle bounds) {
// All calculations should be done in the device space
! bounds = toDeviceSpaceAbs(bounds);
GraphicsConfiguration gc = getGraphicsConfiguration();
! Rectangle currentDevBounds = getGCDeviceBounds(gc);
// Prepare data for WM_GETMINMAXINFO message.
// ptMaxPosition should be in coordinate system of the current monitor,
// not the main monitor, or monitor on which we maximize the window.
bounds.x -= currentDevBounds.x;
bounds.y -= currentDevBounds.y;
*** 146,162 ****
}
}
@Override
public final Dimension getMinimumSize() {
Dimension d = new Dimension();
if (!((Frame)target).isUndecorated()) {
! d.setSize(scaleDownX(getSysMinWidth()),
! scaleDownY(getSysMinHeight()));
}
! if (((Frame)target).getMenuBar() != null) {
! d.height += scaleDownY(getSysMenuHeight());
}
return d;
}
// Note: Because this method calls resize(), which may be overridden
--- 147,163 ----
}
}
@Override
public final Dimension getMinimumSize() {
+ GraphicsConfiguration gc = getGraphicsConfiguration();
Dimension d = new Dimension();
if (!((Frame)target).isUndecorated()) {
! d.setSize(toUserSpace(gc, getSysMinWidth(), getSysMinHeight()));
}
! if (((Frame) target).getMenuBar() != null) {
! d.height += toUserSpace(gc, 0, getSysMenuHeight()).height;
}
return d;
}
// Note: Because this method calls resize(), which may be overridden
< prev index next >