Mercurial > hg > Applications > TreeVNC
diff src/viewer_swing/java/com/glavsoft/viewer/Viewer.java @ 448:344a35b7c47f
send both frame buffer size and selected screen size in Disktop size change (INIT_DATA)
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 18 Jun 2016 20:09:46 +0900 |
parents | cee43ceac9b3 |
children | d5bcae14c2cd |
line wrap: on
line diff
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Fri Jun 17 17:06:22 2016 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sat Jun 18 20:09:46 2016 +0900 @@ -28,10 +28,13 @@ import com.glavsoft.transport.Reader; import com.glavsoft.transport.Writer; import com.glavsoft.viewer.cli.Parser; -import com.glavsoft.viewer.swing.*; +import com.glavsoft.viewer.swing.ConnectionParams; +import com.glavsoft.viewer.swing.ParametersHandler; +import com.glavsoft.viewer.swing.SwingViewerWindow; +import jp.ac.u_ryukyu.treevnc.CreateConnectionParam; +import jp.ac.u_ryukyu.treevnc.TreeRFBProto; import javax.swing.*; - import java.awt.*; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; @@ -41,10 +44,10 @@ import java.util.ArrayList; import java.util.jar.Attributes; import java.util.jar.Manifest; -import java.util.logging.*; - -import jp.ac.u_ryukyu.treevnc.CreateConnectionParam; -import jp.ac.u_ryukyu.treevnc.TreeRFBProto; +import java.util.logging.ConsoleHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; @SuppressWarnings("serial") public class Viewer extends JApplet implements Runnable, WindowListener , ViewerInterface { @@ -417,7 +420,6 @@ myRfb.fixingSizeWidth = fixingSizeWidth; myRfb.fixingSizeHeight = fixingSizeHeight; } - myRfb.setFilterSingleDisplay(filterSingleDisplay); myRfb.setCuiVersion(false); myRfb.setHasViewer(true); // this flag will be overwrited after this method. Do we have to set here? if (myRfb.getAcceptThread() == null) { @@ -498,12 +500,25 @@ for (GraphicsDevice gd : gs) { for (GraphicsConfiguration r : gd.getConfigurations()) { - rectangles.add(r.getBounds()); + Rectangle rect = r.getBounds(); + rectangles.add(rect); } } return rectangles; } + public Point getScreenOffset(ArrayList<Rectangle> rectangles) { + // position of screen may negavie, but RFBscreen position is always positive + // compute offset to make them positive + int offsetx = 0; + int offsety = 0; + for (Rectangle rect : rectangles) { + if (rect.x < offsetx) offsetx = rect.x; + if (rect.y < offsety) offsety = rect.y; + } + return new Point(-offsetx,-offsety); + } + @Override public void setFitScreen() {