Mercurial > hg > Applications > TreeVNC
changeset 275:0f9b3de45fb2
set main display size.
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/CopyRectDecoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/CopyRectDecoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -32,7 +32,7 @@ @Override public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException { + FramebufferUpdateRectangle rect) throws TransportException { int srcX = reader.readUInt16(); int srcY = reader.readUInt16(); if (rect.width == 0 || rect.height == 0) return;
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/Decoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/Decoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -38,7 +38,7 @@ * @throws UnsupportedEncodingException */ abstract public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException, UnsupportedEncodingException; + FramebufferUpdateRectangle rect) throws TransportException, UnsupportedEncodingException; /** * Reset decoder when needed. Ex. reset ZLib stream inflaters for Z* and Tight decoders.
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/HextileDecoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/HextileDecoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -41,7 +41,7 @@ @Override public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException { + FramebufferUpdateRectangle rect) throws TransportException { if (rect.width == 0 || rect.height == 0) return; int[] colors = new int[] {-1, -1}; int maxX = rect.x + rect.width;
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/RREDecoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/RREDecoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -32,7 +32,7 @@ @Override public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException { + FramebufferUpdateRectangle rect) throws TransportException { int numOfSubrectangles = reader.readInt32(); int color = renderer.readPixelColor(reader); renderer.fillRect(color, rect);
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/RawDecoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/RawDecoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -37,7 +37,7 @@ @Override public void decode(Reader reader, - Renderer renderer, FramebufferUpdateRectangle rect) throws TransportException { + Renderer renderer, FramebufferUpdateRectangle rect) throws TransportException { decode(reader, renderer, rect.x, rect.y, rect.width, rect.height); }
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/RichCursorDecoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/RichCursorDecoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -42,7 +42,7 @@ @Override public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException { + FramebufferUpdateRectangle rect) throws TransportException { int bytesPerPixel = renderer.getBytesPerPixel(); int length = rect.width * rect.height * bytesPerPixel; if (0 == length)
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/TightDecoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/TightDecoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -62,7 +62,7 @@ @Override public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException { + FramebufferUpdateRectangle rect) throws TransportException { int bytesPerPixel = renderer.getBytesPerPixelTight(); /**
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -35,7 +35,7 @@ @Override public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException { + FramebufferUpdateRectangle rect) throws TransportException { int zippedLength = (int) reader.readUInt32(); if (0 == zippedLength) return; int length = rect.width * rect.height * renderer.getBytesPerPixel();
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEESender.java Tue Jan 06 19:07:27 2015 +0900 @@ -22,7 +22,7 @@ @Override public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException, UnsupportedEncodingException { + FramebufferUpdateRectangle rect) throws TransportException, UnsupportedEncodingException { // TreeVNC handling int dataLen = getZrleLength(rect, reader); byte[] bytes = new byte[rect.width * rect.height * renderer.getBytesPerPixel()];
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZlibDecoder.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZlibDecoder.java Tue Jan 06 19:07:27 2015 +0900 @@ -38,7 +38,7 @@ @Override public void decode(Reader reader, Renderer renderer, - FramebufferUpdateRectangle rect) throws TransportException { + FramebufferUpdateRectangle rect) throws TransportException { int zippedLength = (int) reader.readUInt32(); if (0 == zippedLength) return; int length = rect.width * rect.height * renderer.getBytesPerPixel();
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Tue Jan 06 19:07:27 2015 +0900 @@ -77,12 +77,13 @@ private boolean firstTime = true; public int numberOfRectangles = 0; private Timer timer = null; + int singleWidth = 0; public ReceiverTask(Reader reader, - IRepaintController repaintController, ClipboardController clipboardController, - DecodersContainer decoders, ProtocolContext context, - TreeRFBProto _rfb) { + IRepaintController repaintController, ClipboardController clipboardController, + DecodersContainer decoders, ProtocolContext context, + TreeRFBProto _rfb) { rfb = _rfb; this.reader = reader; this.repaintController = repaintController; @@ -119,25 +120,25 @@ } byte messageId = reader.readByte(); switch (messageId) { - case FRAMEBUFFER_UPDATE: - // logger.fine("Server message: FramebufferUpdate (0)"); - framebufferUpdateMessage(); - break; - case SET_COLOR_MAP_ENTRIES: - logger.severe("Server message SetColorMapEntries is not implemented. Skip."); - setColorMapEntries(); - break; - case BELL: - logger.fine("Server message: Bell"); - // System.out.print("\0007"); - // System.out.flush(); - break; - case SERVER_CUT_TEXT: - logger.fine("Server message: CutText (3)"); - serverCutText(); - break; - default: - logger.severe("Unsupported server message. Id = " + messageId); + case FRAMEBUFFER_UPDATE: + // logger.fine("Server message: FramebufferUpdate (0)"); + framebufferUpdateMessage(); + break; + case SET_COLOR_MAP_ENTRIES: + logger.severe("Server message SetColorMapEntries is not implemented. Skip."); + setColorMapEntries(); + break; + case BELL: + logger.fine("Server message: Bell"); + // System.out.print("\0007"); + // System.out.flush(); + break; + case SERVER_CUT_TEXT: + logger.fine("Server message: CutText (3)"); + serverCutText(); + break; + default: + logger.severe("Unsupported server message. Id = " + messageId); } } catch (TransportException e) { logger.severe("Close session: " + e.getMessage()); @@ -218,14 +219,12 @@ if(numberOfRectangles != 1) System.out.println("numberofrectangle : " + numberOfRectangles); - if(rfb.isTreeManager() && firstTime) { + if(rfb.isTreeManager() && firstTime) { if(rfb.checkDelay) { SendCheckDelay sendCheckDelay = new SendCheckDelay(rfb); Thread sendCheckDelayThread = new Thread(sendCheckDelay, "send-check-delay"); sendCheckDelayThread.start(); - this.firstTime = false; } - if(rfb.fixingSize) { timer = new Timer(true); timer.schedule(new TimerTask() { @@ -237,8 +236,8 @@ } }, 0, 100); } - this.firstTime = false; - } + this.firstTime = false; + } while (numberOfRectangles-- > 0) { FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle(); @@ -254,7 +253,7 @@ decoder.decode(reader, renderer, rect); // TreeVNC processing here if(!(rfb.getCuiVersion())) { if (rfb.filterSingleDisplay) { - if (rect.x < 1920) { + if (rect.x < rfb.singleWidth) { repaintController.repaintBitmap(rect); } } else { @@ -304,9 +303,9 @@ } else throw new CommonException("Unprocessed encoding: " + rect.toString()); } - + if (!rfb.isTreeManager()) { - return; + return; } synchronized (this) { if (needSendPixelFormat) {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Tue Jan 06 15:31:14 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Tue Jan 06 19:07:27 2015 +0900 @@ -76,6 +76,8 @@ public int fixingSizeWidth; public int fixingSizeHeight; + public int singleWidth = 0; + public TreeRFBProto(boolean isTreeManager) { @@ -624,7 +626,7 @@ bufs.addFirst(header); addSerialNumber(bufs); if (filterSingleDisplay) { - if (rect.x < 1920) { + if (rect.x < singleWidth) { multicastqueue.put(bufs); } } else { @@ -693,21 +695,22 @@ /** * chnageVNCServer is called when host change. * - * @param vncProxyService + * @param vncProxyService * @param hostName * HostAddress * @param width * FrameWidth * @param height * FrameHeight - * @param id - * @throws InterruptedException + * @param id + * @throws InterruptedException */ public void changeVNCServer(ViewerInterface vncProxyService, String hostName, int width, int height, short id) throws UnknownHostException, IOException, InterruptedException { this.frameSizeWidth = width; this.frameSizeHeight = height; + this.singleWidth = width; // stop reader stop stopReceiverTask();