Mercurial > hg > Members > riono > TreeVNC_ja_comment
comparison src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java @ 461:b7d43b12651c
fix getFbRectangles x may have minus value now, but xFb is always plus
author | kono |
---|---|
date | Mon, 04 Jul 2016 18:41:14 +0900 |
parents | c6058c4e2a79 |
children | 2107b954e285 |
comparison
equal
deleted
inserted
replaced
460:c6058c4e2a79 | 461:b7d43b12651c |
---|---|
964 final int thatScreenX = presenter.getX(); | 964 final int thatScreenX = presenter.getX(); |
965 final int thatScreenY = presenter.getY(); | 965 final int thatScreenY = presenter.getY(); |
966 int thatRetinaScale = presenter.getRetinaScale(); | 966 int thatRetinaScale = presenter.getRetinaScale(); |
967 final int thatScreenWidth = presenter.getSingleWidth(); | 967 final int thatScreenWidth = presenter.getSingleWidth(); |
968 final int thatScreenHeight = presenter.getSingleHeight(); | 968 final int thatScreenHeight = presenter.getSingleHeight(); |
969 // showScreenInfo("that", 0, thatScreenX, thatScreenY, thatScreenWidth, thatScreenHeight, thatRetinaScale); | 969 showScreenInfo("that", 0, thatScreenX, thatScreenY, thatScreenWidth, thatScreenHeight, thatRetinaScale); |
970 // System.out.println("that FB x:" + viewer.getRfb().getContext().getFbWidth() + " y:" + viewer.getRfb().getContext().getFbHeight()); | 970 System.out.println("that FB w:" + viewer.getRfb().getContext().getFbWidth() + " h:" + viewer.getRfb().getContext().getFbHeight()); |
971 | 971 |
972 frame.setSize(thisScreenWidth, thisScreenHeight); | 972 frame.setSize(thisScreenWidth, thisScreenHeight); |
973 double scale = uiSettings.fitScreen(thisScreenWidth, thisScreenHeight, thatScreenWidth, thatScreenHeight); | 973 double scale = uiSettings.fitScreen(thisScreenWidth, thisScreenHeight, thatScreenWidth, thatScreenHeight); |
974 // final Rectangle visible = new Rectangle((int)(thatScreenX*scale),(int)(thatScreenY*scale),(int)(thatScreenWidth*scale)-1,(int)(thatScreenHeight*scale)-1); | 974 // final Rectangle visible = new Rectangle((int)(thatScreenX*scale),(int)(thatScreenY*scale),(int)(thatScreenWidth*scale)-1,(int)(thatScreenHeight*scale)-1); |
975 // showScreenInfo("this", thisScreenNumber, 0, 0,thisScreenWidth, thisScreenHeight, thisRetinaScale); | 975 showScreenInfo("this", thisScreenNumber, 0, 0,thisScreenWidth, thisScreenHeight, thisRetinaScale); |
976 final int scrollx = (int)(thatScreenX * scale); | 976 final int scrollx = (int)(thatScreenX * scale); |
977 final int scrolly = (int)(thatScreenY * scale); | 977 final int scrolly = (int)(thatScreenY * scale); |
978 // System.out.println("thisScrollScale: " + scale + " xmax:"+scroller.getHorizontalScrollBar().getMaximum() + " scrollx:"+scrollx); | 978 // System.out.println("thisScrollScale: " + scale + " xmax:"+scroller.getHorizontalScrollBar().getMaximum() + " scrollx:"+scrollx); |
979 // System.out.println("thisScrollScale: " + scale + " ymax:"+scroller.getVerticalScrollBar().getMaximum() + " scrolly:"+scrolly); | 979 // System.out.println("thisScrollScale: " + scale + " ymax:"+scroller.getVerticalScrollBar().getMaximum() + " scrolly:"+scrolly); |
980 SwingUtilities.invokeLater(new Runnable() { | 980 SwingUtilities.invokeLater(new Runnable() { |
988 | 988 |
989 private int getThisScreenNumber(ArrayList<FbRectangle> rectangles) { | 989 private int getThisScreenNumber(ArrayList<FbRectangle> rectangles) { |
990 // find which screen we are on | 990 // find which screen we are on |
991 Point thisScreenLocation = frame.getLocation(); | 991 Point thisScreenLocation = frame.getLocation(); |
992 Point mouse = frame.getMousePosition(); | 992 Point mouse = frame.getMousePosition(); |
993 System.out.println("finding this screeen number " + thisScreenLocation + " mouse " + mouse + " on screen 0 " + rectangles.get(0)) ; | |
993 int thisScreenNumber = 0; | 994 int thisScreenNumber = 0; |
994 for(Rectangle rect : rectangles) { | 995 for(Rectangle rect : rectangles) { |
995 if ( rect.contains(thisScreenLocation) ) break; | 996 if ( rect.contains(thisScreenLocation) ) return thisScreenNumber; |
996 thisScreenNumber++; | 997 thisScreenNumber++; |
997 } | |
998 if (thisScreenNumber<rectangles.size()) { | |
999 return thisScreenNumber; | |
1000 } | 998 } |
1001 // frame may out of screen, try mouse position ... | 999 // frame may out of screen, try mouse position ... |
1002 thisScreenLocation.translate(mouse.x,mouse.y); | 1000 thisScreenLocation.translate(mouse.x,mouse.y); |
1003 thisScreenNumber = 0; | 1001 thisScreenNumber = 0; |
1004 for(Rectangle rect : rectangles) { | 1002 for(Rectangle rect : rectangles) { |
1005 if ( rect.contains(thisScreenLocation) ) break; | 1003 if ( rect.contains(thisScreenLocation) ) return thisScreenNumber; |
1006 thisScreenNumber++; | |
1007 } | |
1008 if (thisScreenNumber<rectangles.size()) { | |
1009 return thisScreenNumber; | |
1010 } | 1004 } |
1011 return 0; | 1005 return 0; |
1012 } | 1006 } |
1013 | 1007 |
1014 private void showScreenInfo(String name, int thisScreenNumber,int thisScreenX, int thisScreenY, int thisScreenWidth, int thisScreenHeight, int retinaScale) { | 1008 private void showScreenInfo(String name, int thisScreenNumber,int thisScreenX, int thisScreenY, int thisScreenWidth, int thisScreenHeight, int retinaScale) { |