diff options
author | enikey <enikey@3789f03b-4d11-0410-bbf8-ca57d06f2519> | 2008-12-03 09:17:25 +0000 |
---|---|---|
committer | enikey <enikey@3789f03b-4d11-0410-bbf8-ca57d06f2519> | 2008-12-03 09:17:25 +0000 |
commit | 73683202a937456b296115ba53c96795400ffbb8 (patch) | |
tree | 12a3d8d17316dc16319f64182142417c42ad13e3 /java | |
parent | 2659b592643c8c01b8923ae3dc6b0c9ccf87dcf6 (diff) | |
download | tigervnc-73683202a937456b296115ba53c96795400ffbb8.tar.gz tigervnc-73683202a937456b296115ba53c96795400ffbb8.zip |
[Developement] Added "auto scaling" feature to Applet.
[BugFix] NullPointerException when changing option before canvas created.
[BugFix] Wrong default value in "Auto Scroll" combo box (class OptionsFrame).
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3287 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java')
-rw-r--r-- | java/src/com/tightvnc/vncviewer/OptionsFrame.java | 7 | ||||
-rw-r--r-- | java/src/com/tightvnc/vncviewer/VncCanvas.java | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/java/src/com/tightvnc/vncviewer/OptionsFrame.java b/java/src/com/tightvnc/vncviewer/OptionsFrame.java index c8d1b04b..5034af6b 100644 --- a/java/src/com/tightvnc/vncviewer/OptionsFrame.java +++ b/java/src/com/tightvnc/vncviewer/OptionsFrame.java @@ -183,8 +183,8 @@ class OptionsFrame extends Frame String s = viewer.readParameter("Scaling Factor", false); if (s == null) s = "100%"; setScalingFactor(s); - if (!s.equalsIgnoreCase("Auto")) { - choices[scalingFactorIndex].select(s.trim() + '%'); + if (autoScale) { + choices[scalingFactorIndex].select("Auto"); } else { choices[scalingFactorIndex].select(s); } @@ -447,7 +447,8 @@ class OptionsFrame extends Frame } else if (source == choices[scalingFactorIndex]){ // Tell VNC canvas that scaling factor has changed setScalingFactor(choices[scalingFactorIndex].getSelectedItem()); - viewer.vc.setScalingFactor(scalingFactor); + if (viewer.vc != null) + viewer.vc.setScalingFactor(scalingFactor); } } diff --git a/java/src/com/tightvnc/vncviewer/VncCanvas.java b/java/src/com/tightvnc/vncviewer/VncCanvas.java index 7a8c76a8..a457469a 100644 --- a/java/src/com/tightvnc/vncviewer/VncCanvas.java +++ b/java/src/com/tightvnc/vncviewer/VncCanvas.java @@ -263,8 +263,11 @@ class VncCanvas extends Canvas int fbWidth = rfb.framebufferWidth; int fbHeight = rfb.framebufferHeight; - // Calculate scaling factor for auto scaling. - if (maxWidth > 0 && maxHeight > 0) { + if (viewer.options.autoScale) { + if (!(maxWidth > 0 && maxHeight > 0)) { + maxWidth = fbWidth; + maxHeight = fbHeight; + } int f1 = maxWidth * 100 / fbWidth; int f2 = maxHeight * 100 / fbHeight; scalingFactor = Math.min(f1, f2); |