Mercurial > hg > Applications > TreeVNC
changeset 278:69e821effec6
add comment
author | oc |
---|---|
date | Sat, 10 Jan 2015 18:08:40 +0900 |
parents | 2d39a1f9558d |
children | dce00f9ac98c |
files | src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/viewer_swing/java/com/glavsoft/viewer/UiSettings.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 3 files changed, 25 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Fri Jan 09 16:50:13 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sat Jan 10 18:08:40 2015 +0900 @@ -34,16 +34,13 @@ import com.glavsoft.rfb.client.SetPixelFormatMessage; import com.glavsoft.rfb.encoding.EncodingType; import com.glavsoft.rfb.encoding.PixelFormat; -import com.glavsoft.rfb.encoding.decoder.Decoder; -import com.glavsoft.rfb.encoding.decoder.DecodersContainer; -import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle; -import com.glavsoft.rfb.encoding.decoder.RichCursorDecoder; -import com.glavsoft.rfb.encoding.decoder.ZRLEESender; +import com.glavsoft.rfb.encoding.decoder.*; import com.glavsoft.transport.Reader; import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; +import java.util.LinkedList; import java.util.Timer; import java.util.TimerTask; import java.util.logging.Logger; @@ -242,6 +239,8 @@ if(rfb.singleWidth == 0 && firstTime) { rfb.singleWidth = rect.width; + // ここにsingleWidthを送信する処理を書く +// sendSingleWidth(rect.width); this.firstTime = false; } @@ -302,6 +301,8 @@ int port = rfb.acceptPort; String address = rfb.getMyAddress(); sendCheckDelayReply(rect.time, port, address); +// } else if (rect.getEncodingType() == EncodingType.SET_SINGLE_WIDTH) { +// rfb.singleWidth = rect.singleWidth; } else throw new CommonException("Unprocessed encoding: " + rect.toString()); } @@ -327,6 +328,13 @@ context.sendMessage(new CheckDelayReply(time, port, address)); } + /* + private void sendSingleWidth(int singleWidth) { + LinkedList<ByteBuffer> sendSingleWidth = new LinkedList<ByteBuffer>(); + rfb.multicastqueue.put(sendSingleWidth); + } + */ + public synchronized void queueUpdatePixelFormat(PixelFormat pf) { pixelFormat = pf; needSendPixelFormat = true;
--- a/src/viewer_swing/java/com/glavsoft/viewer/UiSettings.java Fri Jan 09 16:50:13 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/UiSettings.java Sat Jan 10 18:08:40 2015 +0900 @@ -108,11 +108,13 @@ fireListeners(); } - public void adjustHdSize() { + public void adjustHdSize(int width) { // 今の画面サイズを取得 // uiSettingsData.getScalePercent()を取得 // 1920x1080にするためにはscaleを何に設定すれば良いのかを計算する - double scaleFactor = (int)(this.uiSettingsData.getScalePercent() / SCALE_PERCENT_ZOOMING_STEP) * SCALE_PERCENT_ZOOMING_STEP + SCALE_PERCENT_ZOOMING_STEP; + double hdWidth = 1920.0; + double oldScaleFactor = uiSettingsData.getScalePercent(); + double scaleFactor = (hdWidth / width) * oldScaleFactor; if (scaleFactor > MAX_SCALE_PERCENT) { scaleFactor = MAX_SCALE_PERCENT; }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Fri Jan 09 16:50:13 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Sat Jan 10 18:08:40 2015 +0900 @@ -86,7 +86,7 @@ public int width; public int height; private JButton adjustHdSizeButton; - + private int singleWidth; private boolean isZoomToFitSelected; private List<JComponent> kbdButtons; @@ -368,7 +368,7 @@ @Override public void actionPerformed(ActionEvent e) { adjustHdSizeButton.setSelected(false); - uiSettings.adjustHdSize(); + uiSettings.adjustHdSize(singleWidth); } }); zoomAsIsButton = buttonsBar.createButton("zoom-100", "Zoom 100%", new ActionListener() { @@ -857,7 +857,8 @@ // should be stopped. viewer.setCuiVersion(false); - // main screen is rectangles[0] + // Host have screens in rectangles. + // Each screen number in order from left. ArrayList<Rectangle> rectangles = new ArrayList<Rectangle>(); GraphicsConfiguration[] gc = null; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); @@ -872,6 +873,9 @@ Dimension size = frame.getSize(); viewer.setFrameSize(size.width, size.height); + int leftScreenNumber = 0; + int rightScreenNumber = 1; + singleWidth = (int) rectangles.get(leftScreenNumber).getWidth(); if (viewer.getRfb().isTreeManager()) { try { @@ -882,7 +886,7 @@ return; } String adr = viewer.getRfb().getMyAddress(); - context.sendMessage(new ScreenChangeRequest(adr, viewer.getRfb().getId(), (int) rectangles.get(0).getWidth(), (int) rectangles.get(0).getHeight())); + context.sendMessage(new ScreenChangeRequest(adr, viewer.getRfb().getId(), (int) rectangles.get(leftScreenNumber).getWidth(), (int) rectangles.get(leftScreenNumber).getHeight())); } }); kbdButtons.add(screenButton);