diff src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java @ 225:5e3594021e79

fix --width --height mode.
author oc
date Tue, 15 Jul 2014 07:18:13 +0900
parents b31903e5b02d
children dd154ffe1a53
line wrap: on
line diff
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java	Sun Jul 06 17:50:00 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java	Tue Jul 15 07:18:13 2014 +0900
@@ -82,13 +82,15 @@
     private ProtocolSettings rfbSettings;
     private UiSettings uiSettings;
     private Protocol workingProtocol;
+    public int width;
+    public int height;
 
     private boolean isZoomToFitSelected;
     private List<JComponent> kbdButtons;
 
     public SwingViewerWindow(Protocol workingProtocol, ProtocolSettings rfbSettings, UiSettings uiSettings, Surface surface,
                              boolean isSeparateFrame, boolean isApplet, ViewerInterface viewer, String connectionString,
-                             ConnectionPresenter presenter) {
+                             ConnectionPresenter presenter, int w, int h) {
         this.workingProtocol = workingProtocol;
         this.rfbSettings = rfbSettings;
         this.uiSettings = uiSettings;
@@ -98,6 +100,8 @@
         this.viewer = viewer;
         this.connectionString = connectionString;
         this.presenter = presenter;
+        this.width = w;
+        this.height = h;
         if(viewer instanceof Viewer)
         	createContainer(surface, isApplet, (Viewer)viewer);
         
@@ -327,8 +331,14 @@
 
 		screenBounds.x += screenInsets.left;
 		screenBounds.y += screenInsets.top;
-		screenBounds.width -= screenInsets.left + screenInsets.right;
-		screenBounds.height -= screenInsets.top + screenInsets.bottom;
+		if (width != 0) {
+		    screenBounds.width = width;
+		    screenBounds.height = height;
+		} else {
+		    screenBounds.width -= screenInsets.left + screenInsets.right;
+		    screenBounds.height -= screenInsets.top + screenInsets.bottom;
+        }
+
 		return screenBounds;
 	}