From: Brian P. Hinz Date: Mon, 14 Sep 2015 01:29:31 +0000 (-0400) Subject: Fix Viewport initial sizing issue on OS X X-Git-Tag: v1.5.90~42 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6262bac01e7d7f5a535cbac0cc6e879cec1cc829;p=tigervnc.git 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. --- 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);