]> source.dussan.org Git - tigervnc.git/commitdiff
Fix Viewport initial sizing issue on OS X
authorBrian P. Hinz <bphinz@users.sf.net>
Mon, 14 Sep 2015 01:29:31 +0000 (21:29 -0400)
committerBrian P. Hinz <bphinz@users.sf.net>
Mon, 14 Sep 2015 01:32:18 +0000 (21:32 -0400)
The layout manager on OS X sometimes sets the preferredSize to 0,
so only call pack if that's not the case.

java/com/tigervnc/vncviewer/Viewport.java

index acc6bfd1bfe91d031c4e81ab3ac7bc47a5d9b495..f509901f64f8c28d939fb67865f5b49bc0233f29 100644 (file)
@@ -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);