IDEA-154396 Floating tool window resize incorrect with Windows taskbar on the left

the screen size is not equal to max coordinates if top/left insets are not zero
This commit is contained in:
Sergey Malenkov
2016-04-11 22:29:25 +03:00
parent 6c9dfc06f1
commit 3327a75a63
@@ -221,9 +221,11 @@ public final class FloatingDecorator extends JDialog {
final Point newPoint=e.getPoint();
SwingUtilities.convertPointToScreen(newPoint,this);
final Rectangle screenBounds=WindowManagerEx.getInstanceEx().getScreenBounds();
int screenMaxX = screenBounds.x + screenBounds.width;
int screenMaxY = screenBounds.y + screenBounds.height;
newPoint.x=Math.min(Math.max(newPoint.x,screenBounds.x),screenBounds.width);
newPoint.y=Math.min(Math.max(newPoint.y,screenBounds.y),screenBounds.height);
newPoint.x = Math.min(Math.max(newPoint.x, screenBounds.x), screenMaxX);
newPoint.y = Math.min(Math.max(newPoint.y, screenBounds.y), screenMaxY);
final Rectangle oldBounds=FloatingDecorator.this.getBounds();
final Rectangle newBounds=new Rectangle(oldBounds);
@@ -248,16 +250,16 @@ public final class FloatingDecorator extends JDialog {
}
if((myMotionMask&ANCHOR_BOTTOM)>0){
newPoint.y=Math.max(newPoint.y,oldBounds.y+2*DIVIDER_WIDTH);
if(newPoint.y>screenBounds.height-DIVIDER_WIDTH){
newPoint.y=screenBounds.height;
if (newPoint.y > screenMaxY - DIVIDER_WIDTH) {
newPoint.y = screenMaxY;
}
final Point offset=new Point(newPoint.x-myLastPoint.x,newPoint.y-myLastPoint.y);
newBounds.height=oldBounds.height+offset.y;
}
if((myMotionMask&ANCHOR_RIGHT)>0){
newPoint.x=Math.max(newPoint.x,oldBounds.x+2*DIVIDER_WIDTH);
if(newPoint.x>screenBounds.width-DIVIDER_WIDTH){
newPoint.x=screenBounds.width;
if (newPoint.x > screenMaxX - DIVIDER_WIDTH) {
newPoint.x = screenMaxX;
}
final Point offset=new Point(newPoint.x-myLastPoint.x,newPoint.y-myLastPoint.y);
newBounds.width=oldBounds.width+offset.x;