# HG changeset patch # User kono # Date 1467625274 -32400 # Node ID b7d43b12651c680fb334b22fe39835b1f95fdacb # Parent c6058c4e2a794c503432e62ffbfc257f489399b9 fix getFbRectangles x may have minus value now, but xFb is always plus diff -r c6058c4e2a79 -r b7d43b12651c src/viewer_swing/java/com/glavsoft/viewer/Viewer.java --- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Mon Jun 27 18:07:29 2016 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Mon Jul 04 18:41:14 2016 +0900 @@ -502,7 +502,10 @@ ArrayList fbRectangles = new ArrayList(); int screenNumber = 0; for (Rectangle rect : rectangles) { - fbRectangles.add(new FbRectangle(rect.x + offset.x, rect.y + offset.y, rect.width, rect.height, screenNumber, retinaScale(screenNumber))); + FbRectangle fbrect = new FbRectangle(rect.x, rect.y, rect.width, rect.height, screenNumber, retinaScale(screenNumber)); + fbrect.setXfb(rect.x + offset.x); + fbrect.setXfb(rect.y + offset.y); + fbRectangles.add(fbrect); screenNumber++; } @@ -525,7 +528,7 @@ retinaOffsetX += fbRectanglesPrev.getWidth() * (fbRectanglesPrev.retinaScale - 1); } } - fbRect.setXfb((int) (fbRect.getX() + retinaOffsetX)); + fbRect.setXfb((int) (fbRect.getXfb() + retinaOffsetX)); fbRectanglesPrev = fbRect; } @@ -548,7 +551,7 @@ retinaOffsetY += fbRectanglesPrev.getHeight() * (fbRectanglesPrev.retinaScale - 1); } } - fbRect.setYfb((int) (fbRect.getY() + retinaOffsetY)); + fbRect.setYfb((int) (fbRect.getYfb() + retinaOffsetY)); fbRectanglesPrev = fbRect; } return fbRectangles; diff -r c6058c4e2a79 -r b7d43b12651c src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java --- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Mon Jun 27 18:07:29 2016 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Mon Jul 04 18:41:14 2016 +0900 @@ -966,13 +966,13 @@ int thatRetinaScale = presenter.getRetinaScale(); final int thatScreenWidth = presenter.getSingleWidth(); final int thatScreenHeight = presenter.getSingleHeight(); - // showScreenInfo("that", 0, thatScreenX, thatScreenY, thatScreenWidth, thatScreenHeight, thatRetinaScale); - // System.out.println("that FB x:" + viewer.getRfb().getContext().getFbWidth() + " y:" + viewer.getRfb().getContext().getFbHeight()); + showScreenInfo("that", 0, thatScreenX, thatScreenY, thatScreenWidth, thatScreenHeight, thatRetinaScale); + System.out.println("that FB w:" + viewer.getRfb().getContext().getFbWidth() + " h:" + viewer.getRfb().getContext().getFbHeight()); frame.setSize(thisScreenWidth, thisScreenHeight); double scale = uiSettings.fitScreen(thisScreenWidth, thisScreenHeight, thatScreenWidth, thatScreenHeight); // 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); + showScreenInfo("this", thisScreenNumber, 0, 0,thisScreenWidth, thisScreenHeight, thisRetinaScale); final int scrollx = (int)(thatScreenX * scale); final int scrolly = (int)(thatScreenY * scale); // System.out.println("thisScrollScale: " + scale + " xmax:"+scroller.getHorizontalScrollBar().getMaximum() + " scrollx:"+scrollx); @@ -990,23 +990,17 @@ // find which screen we are on Point thisScreenLocation = frame.getLocation(); Point mouse = frame.getMousePosition(); + System.out.println("finding this screeen number " + thisScreenLocation + " mouse " + mouse + " on screen 0 " + rectangles.get(0)) ; int thisScreenNumber = 0; for(Rectangle rect : rectangles) { - if ( rect.contains(thisScreenLocation) ) break; + if ( rect.contains(thisScreenLocation) ) return thisScreenNumber; thisScreenNumber++; } - if (thisScreenNumber