Mercurial > hg > Applications > TreeVNC
diff src/viewer_swing/java/com/glavsoft/viewer/Viewer.java @ 301:ae7deb002b5f
send and receive single display size
author | oc |
---|---|
date | Sun, 18 Jan 2015 08:36:06 +0900 |
parents | 0b75fdbb8c11 |
children | 5e55cc34f789 |
line wrap: on
line diff
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sat Jan 17 04:58:03 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jan 18 08:36:06 2015 +0900 @@ -42,6 +42,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.Socket; +import java.util.ArrayList; import java.util.jar.Attributes; import java.util.jar.Manifest; import java.util.logging.*; @@ -397,6 +398,12 @@ isApplet = true; settings.setViewOnly(true); // too avoid unnecessary upward traffic rfb.setReconnecting(true); + + ArrayList<Rectangle> rectangles = getScreenRectangles(); + int leftScreenNumber = 0; + getRfb().singleWidth = (int) rectangles.get(leftScreenNumber).getWidth(); + getRfb().singleHeight = (int) rectangles.get(leftScreenNumber).getHeight(); + run(); } @@ -441,4 +448,27 @@ this.fixingSizeWidth = width; this.fixingSizeHeight = height; } + + @Override + public ArrayList<Rectangle> getScreenRectangles() { + // before change server, data from previous server + // should be stopped. + setCuiVersion(false); + // Host have screens. + // Each screen number in order from left. + // put screens in rectangles. + ArrayList<Rectangle> rectangles = new ArrayList<Rectangle>(); + GraphicsConfiguration[] gc = null; + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gs = ge.getScreenDevices(); + for (int j = 0; j < gs.length; j++) { + GraphicsDevice gd = gs[j]; + gc = gd.getConfigurations(); + for (int i=0; i < gc.length; i++) { + rectangles.add(gc[i].getBounds()); + } + } + return rectangles; + } + }