From 0bc5b5e42fbea7ed80f8492b11bd700ae55d6baf Mon Sep 17 00:00:00 2001 From: Brian Hinz Date: Thu, 21 Feb 2013 03:11:14 +0000 Subject: [PATCH] Fixes yet another case where the viewport background wasn't painted black when the desktop size was less than the viewport size. Also set both scrollbar policies just as a precaution. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5049 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- java/com/tigervnc/vncviewer/Viewport.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index e8793a1b..31acc0e1 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -68,23 +68,23 @@ public class Viewport extends JFrame scaleString.equalsIgnoreCase("FixedRatio")) { if ((sp.getSize().width != cc.desktop.scaledWidth) || (sp.getSize().height != cc.desktop.scaledHeight)) { - int policy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER; - sp.setHorizontalScrollBarPolicy(policy); cc.desktop.setScaledSize(); - sp.setSize(new Dimension(cc.desktop.scaledWidth, - cc.desktop.scaledHeight)); + sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); sp.validate(); if (getExtendedState() != JFrame.MAXIMIZED_BOTH && - scaleString.equalsIgnoreCase("FixedRatio") && !cc.fullScreen) { + sp.setSize(new Dimension(cc.desktop.scaledWidth, + cc.desktop.scaledHeight)); int w = cc.desktop.scaledWidth + getInsets().left + getInsets().right; int h = cc.desktop.scaledHeight + getInsets().top + getInsets().bottom; - setSize(w, h); + if (scaleString.equalsIgnoreCase("FixedRatio")) + setSize(w, h); } } } else { - int policy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; - sp.setHorizontalScrollBarPolicy(policy); + sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); sp.validate(); } if (cc.desktop.cursor != null) { -- 2.39.5