mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
restore dialog size with respect to location, to fit to the right screen
This commit is contained in:
@@ -560,10 +560,14 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
}
|
||||
|
||||
public void setSize(int width, int height) {
|
||||
Point location = getLocation();
|
||||
_setSizeForLocation(width, height, null);
|
||||
}
|
||||
|
||||
private void _setSizeForLocation(int width, int height, @Nullable Point initial) {
|
||||
Point location = initial != null ? initial : getLocation();
|
||||
Rectangle rect = new Rectangle(location.x, location.y, width, height);
|
||||
ScreenUtil.fitToScreen(rect);
|
||||
if (location.x != rect.x || location.y != rect.y) {
|
||||
if (initial != null || location.x != rect.x || location.y != rect.y) {
|
||||
setLocation(rect.x, rect.y);
|
||||
}
|
||||
|
||||
@@ -609,7 +613,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
Dimension size = DimensionService.getInstance().getSize(myDimensionServiceKey, projectGuess);
|
||||
if (size != null) {
|
||||
myInitialSize = (Dimension)size.clone();
|
||||
setSize(myInitialSize);
|
||||
_setSizeForLocation(myInitialSize.width, myInitialSize.height, location);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user