[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
diff --git a/java/src/com/tightvnc/vncviewer/VncCanvas.java b/java/src/com/tightvnc/vncviewer/VncCanvas.java
index 7a8c76a..a457469 100644
--- a/java/src/com/tightvnc/vncviewer/VncCanvas.java
+++ b/java/src/com/tightvnc/vncviewer/VncCanvas.java
@@ -263,8 +263,11 @@
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);