summaryrefslogtreecommitdiffstats
path: root/java/com/tigervnc
diff options
context:
space:
mode:
authorBrian P. Hinz <bphinz@users.sf.net>2015-09-13 21:29:31 -0400
committerBrian P. Hinz <bphinz@users.sf.net>2015-09-13 21:32:18 -0400
commit6262bac01e7d7f5a535cbac0cc6e879cec1cc829 (patch)
tree1d62f5de20328be08a70baec0cf1bfb09d832a44 /java/com/tigervnc
parent3ee966ed4e2334368c40f4f3e28de1d1c6bb4159 (diff)
downloadtigervnc-6262bac01e7d7f5a535cbac0cc6e879cec1cc829.tar.gz
tigervnc-6262bac01e7d7f5a535cbac0cc6e879cec1cc829.zip
Fix Viewport initial sizing issue on OS X
The layout manager on OS X sometimes sets the preferredSize to 0, so only call pack if that's not the case.
Diffstat (limited to 'java/com/tigervnc')
-rw-r--r--java/com/tigervnc/vncviewer/Viewport.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java
index acc6bfd1..f509901f 100644
--- a/java/com/tigervnc/vncviewer/Viewport.java
+++ b/java/com/tigervnc/vncviewer/Viewport.java
@@ -182,8 +182,10 @@ public class Viewport extends JFrame
for (GraphicsDevice gd : ge.getScreenDevices())
for (GraphicsConfiguration gc : gd.getConfigurations())
r = r.union(gc.getBounds());
+ Dimension d = getPreferredSize();
if (!cc.fullScreen)
- pack();
+ if ((d.width > 0) && (d.height > 0))
+ pack();
Rectangle mb = new Rectangle(r);
mb.grow(getInsets().left, getInsets().bottom);
setMaximizedBounds(mb);