From 6262bac01e7d7f5a535cbac0cc6e879cec1cc829 Mon Sep 17 00:00:00 2001 From: "Brian P. Hinz" Date: Sun, 13 Sep 2015 21:29:31 -0400 Subject: [PATCH] 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. --- java/com/tigervnc/vncviewer/Viewport.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.39.5