Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 451:65ffb64cfb51
try to fix scroll y in fitScreen
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 20 Jun 2016 12:04:13 +0900 |
parents | aa3822daf75a |
children | e94489c9a0bb |
files | src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 2 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jun 19 19:35:40 2016 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Mon Jun 20 12:04:13 2016 +0900 @@ -505,7 +505,7 @@ } public Point getScreenOffset(ArrayList<Rectangle> rectangles) { - // position of screen may negavie, but RFBscreen position is always positive + // position of screen may negative, but RFBscreen position is always positive // compute offset to make them positive int offsetx = 0; int offsety = 0;
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Sun Jun 19 19:35:40 2016 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Mon Jun 20 12:04:13 2016 +0900 @@ -916,26 +916,27 @@ } public void screenChangeRequest(ProtocolContext context, int shareScreenNumber) { - ArrayList<Rectangle> rectangles = viewer.getScreenRectangles(); + ArrayList<Rectangle> rectangles = viewer.getScreenRectangles(); Point offset = viewer.getScreenOffset(rectangles); Rectangle rectangle1 = rectangles.get(shareScreenNumber); int singleWidth = (int) (rectangle1.getWidth()); int singleHeight = (int) (rectangle1.getHeight()); - int x = (int) (rectangle1.getX())+offset.x; // convert double to int - int y = (int) (rectangle1.getY())+offset.y; + int x = (int) (rectangle1.getX()) + offset.x; // convert double to int + int y = (int) (rectangle1.getY()) + offset.y; int scale = retinaScale(shareScreenNumber); viewer.getRfb().setSingleDisplaySize(singleWidth, singleHeight); - showScreenInfo("request screen change",0, x,y,singleWidth,singleHeight,scale); + showScreenInfo("request screen change", 0, x, y, singleWidth, singleHeight, scale); if (viewer.getRfb().isTreeManager()) { - changeVncServer(viewer, x, y, singleWidth*scale, singleHeight*scale, scale, viewer.getRfb().getId()); - } else if (viewer.getRfb().hasParent()) { + changeVncServer(viewer, x, y, singleWidth * scale, singleHeight * scale, scale, viewer.getRfb().getId()); + } + if (viewer.getRfb().hasParent()) { String adr = viewer.getRfb().getMyAddress(); - if (scanPort(adr, ConnectionParams.DEFAULT_RFB_PORT)) { - // -1 means request to reverse direct connection socket - short id = viewer.getRfb().isTreeManager()? (short)-1 : viewer.getRfb().getId(); - context.sendMessage(new ScreenChangeRequest(adr, ConnectionParams.DEFAULT_VNC_ROOT, id, x, y, singleWidth*scale, singleHeight*scale, scale)); - } + if (scanPort(adr, ConnectionParams.DEFAULT_RFB_PORT)) { + // -1 means request to reverse direct connection socket + short id = viewer.getRfb().isTreeManager() ? (short) -1 : viewer.getRfb().getId(); + context.sendMessage(new ScreenChangeRequest(adr, ConnectionParams.DEFAULT_VNC_ROOT, id, x, y, singleWidth * scale, singleHeight * scale, scale)); + } } } @@ -975,7 +976,7 @@ } /** - * change screen viewer scale to fit the server screen size + * change screen viewer scale to fit the selected server screen size in multi screens */ public void fitScreen() { ArrayList<Rectangle> rectangles = viewer.getScreenRectangles(); @@ -1005,9 +1006,9 @@ // final Rectangle visible = new Rectangle((int)(thatScreenX*scale),(int)(thatScreenY*scale),(int)(thatScreenWidth*scale)-1,(int)(thatScreenHeight*scale)-1); showScreenInfo("this", thisScreenNumber, 0, 0,thisScreenWidth, thisScreenHeight, thisRetinaScale); System.out.println("this FB x:" + viewer.getConnectionPresenter().getFrameSizeWidth() + " y:" + viewer.getConnectionPresenter().getFrameSizeHeight()); - System.out.println("thisScrollScale: " + scale); + System.out.println("thisScrollScale: " + scale + " ymax:"+scroller.getVerticalScrollBar().getMaximum()); final int scrollx = (int)(thatScreenX * scale); - final int scrolly = (thatScreenY!=0) ? (int)((thatScreenHeight - thatScreenY) * scale) : 0; + final int scrolly = (int)((presenter.getFrameSizeHeight()-thatScreenY) * scale) ; SwingUtilities.invokeLater(new Runnable() { public void run() { scroller.getHorizontalScrollBar().setValue(scrollx);