# HG changeset patch # User oc # Date 1425373121 -32400 # Node ID 59b1ef1b0a89ddeed17112c5689cee0ab0e96edf # Parent 7c763b2a01a5023fa5d554d661507dfe384a7cc8 fix ilter single display (HiDPI) diff -r 7c763b2a01a5 -r 59b1ef1b0a89 src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java --- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Tue Feb 24 18:28:48 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Tue Mar 03 17:58:41 2015 +0900 @@ -70,6 +70,13 @@ private long checkCounter = 0; public int numberOfRectangles = 0; private Timer timer = null; + private int singleWidth; + private int singleHeight; + private int nextWidth; + private int nextHeight; + private boolean isHiDPI = false; + private int hiDPIWidth; + private int hiDPIHeight; public ReceiverTask(Reader reader, IRepaintController repaintController, ClipboardController clipboardController, @@ -114,9 +121,16 @@ } }, 0, 100); } + if(rfb.filterSingleDisplay) { + singleWidth = rfb.getSingleWidth(); + nextWidth = rfb.getNextWidth(); + isHiDPI = rfb.setHiDPI(singleWidth, singleHeight, nextWidth); + } } } + + @Override public void run() { isRunning = true; @@ -239,7 +253,17 @@ try { decoder.decode(reader, renderer, rect); // TreeVNC processing here if (rfb.getCuiVersion()) continue; - if (rfb.filterSingleDisplay && rect.x >= rfb.getSingleWidth()) continue; + if (rfb.filterSingleDisplay) { + if (!isHiDPI) { + if (rect.x >= rfb.getSingleWidth()) { + continue; + } + } else { + if (rect.x >= rfb.getHiDPIWidth()) { + continue; + } + } + } repaintController.repaintBitmap(rect); } catch (Exception e) { throw e; diff -r 7c763b2a01a5 -r 59b1ef1b0a89 src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Tue Feb 24 18:28:48 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Tue Mar 03 17:58:41 2015 +0900 @@ -74,12 +74,15 @@ private int singleWidth = 0; private int singleHeight = 0; + private int hiDPIWidth = 0; + private int hiDPIHeight = 0; + private DatagramSocket socket = null; private byte[] originalInitData = null; private boolean childrenMulticast = true; - public int nextSingleWidth; - public int nextSingleHeight; + private int nextSingleWidth; + private int nextSingleHeight; public TreeRFBProto(boolean isTreeManager, ViewerInterface viewer) { rThread = new RequestScreenThread(this); @@ -739,6 +742,22 @@ bufs.addFirst(blen); bufs.addFirst(header); addSerialNumber(bufs); + + if (filterSingleDisplay) { + if (setHiDPI(singleWidth, singleHeight, nextSingleWidth)) { + if (rect.x <= hiDPIWidth) { + multicastqueue.put(bufs); + } + } else { + if (rect.x <= getSingleWidth()) { + multicastqueue.put(bufs); + } + } + } else { + multicastqueue.put(bufs); + } + + /* if (filterSingleDisplay) { if (rect.x < singleWidth) { multicastqueue.put(bufs); @@ -746,6 +765,8 @@ } else { multicastqueue.put(bufs); } + */ + } catch (IOException e) { throw new TransportException(e); } catch (DataFormatException e) { @@ -936,6 +957,25 @@ this.nextSingleHeight = singleHeight; } + public void setHiDPISize(int hiDPIWidth, int hiDPIHeight) { + this.hiDPIWidth = hiDPIWidth; + this.hiDPIHeight = hiDPIHeight; + } + + public int getHiDPIWidth() { + return hiDPIWidth; + } + + public boolean setHiDPI(int singleWidth, int singleHeight, int nextWidth) { + int fbWidth = context.getFbWidth(); + if(fbWidth - nextWidth == singleWidth * 2) { + setHiDPISize(singleWidth * 2, singleHeight * 2); + return true; + } + return false; + } + + public int getSingleWidth() { return singleWidth; } @@ -944,6 +984,14 @@ return singleHeight; } + public int getNextWidth() { + return nextSingleWidth; + } + + public int getNextHeight() { + return nextSingleHeight; + } + public boolean hasParent() { return id != -1; }