diff --git a/src/net/java/sip/communicator/util/swing/SIPCommDialog.java b/src/net/java/sip/communicator/util/swing/SIPCommDialog.java index 0f82f183e..a9af2c4e1 100644 --- a/src/net/java/sip/communicator/util/swing/SIPCommDialog.java +++ b/src/net/java/sip/communicator/util/swing/SIPCommDialog.java @@ -244,9 +244,17 @@ private void setSizeAndLocation() this.setSize(width, height); if(xString != null && yString != null) - this.setLocation( - Integer.parseInt(xString), - Integer.parseInt(yString)); + { + int x = Integer.parseInt(xString); + int y = Integer.parseInt(yString); + if(ScreenInformation. + isTitleOnScreen(new Rectangle(x, y, width, height)) + || config.getBoolean( + SIPCommFrame.PNAME_CALCULATED_POSITIONING, true)) + { + this.setLocation(x, y); + } + } else this.setCenterLocation(); } @@ -265,12 +273,16 @@ private void setCenterLocation() */ private void ensureOnScreenLocationAndSize() { + ConfigurationService config = UtilActivator.getConfigurationService(); + if(!config.getBoolean(SIPCommFrame.PNAME_CALCULATED_POSITIONING, true)) + return; + int x = this.getX(); int y = this.getY(); int width = this.getWidth(); int height = this.getHeight(); - + Rectangle virtualBounds = ScreenInformation.getScreenBounds(); // the default distance to the screen border diff --git a/src/net/java/sip/communicator/util/swing/SIPCommFrame.java b/src/net/java/sip/communicator/util/swing/SIPCommFrame.java index 0cc41d3ec..802502882 100644 --- a/src/net/java/sip/communicator/util/swing/SIPCommFrame.java +++ b/src/net/java/sip/communicator/util/swing/SIPCommFrame.java @@ -33,6 +33,16 @@ public class SIPCommFrame extends JFrame implements Observer { + /** + * Property that disables the automatic resizing and positioning when a + * window's top edge is outside the visible area of the screen. + *

+ * true use automatic repositioning (default)
+ * false rely on the window manager to place the window + */ + static final String PNAME_CALCULATED_POSITIONING + = "net.sip.communicator.util.swing.USE_CALCULATED_POSITIONING"; + /** * The Logger used by the SIPCommFrame class and its * instances for logging output. @@ -352,7 +362,13 @@ public void setSizeAndLocation() x = Integer.parseInt(xString); y = Integer.parseInt(yString); - this.setLocation(x, y); + if(ScreenInformation. + isTitleOnScreen(new Rectangle(x, y, width, height)) + || configService.getBoolean( + SIPCommFrame.PNAME_CALCULATED_POSITIONING, true)) + { + this.setLocation(x, y); + } } else { @@ -374,6 +390,10 @@ private void setCenterLocation() */ private void ensureOnScreenLocationAndSize() { + ConfigurationService config = UtilActivator.getConfigurationService(); + if(!config.getBoolean(SIPCommFrame.PNAME_CALCULATED_POSITIONING, true)) + return; + int x = this.getX(); int y = this.getY();