diff src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java @ 432:a80d190a9fc1

trying to fix fitScreen
author Nozomi
date Wed, 08 Jun 2016 21:18:38 +0900
parents 7eaa95ca7e45
children ff7fa81f3616
line wrap: on
line diff
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java	Wed Jun 08 20:54:07 2016 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java	Wed Jun 08 21:18:38 2016 +0900
@@ -881,9 +881,11 @@
             @Override
             public void actionPerformed(ActionEvent e) {
                 fitScreen();
+                /*
                 if (!viewer.getRfb().isTreeManager()) {
                     context.sendMessage(new RequestSingleDisplaySize());
                 }
+                */
             }
         });
 
@@ -1014,9 +1016,13 @@
         int singleWidth = viewer.getRfb().getSingleWidth() * viewer.getRfb().getRetinaScale();
         int singleHeight = viewer.getRfb().getSingleHeight() * viewer.getRfb().getRetinaScale();
         frame.setSize(thisScreenWidth, thisScreenHeight);
-        Rectangle visible = new Rectangle(thatScreenX,thatScreenY,thisScreenWidth,thisScreenHeight);
-        scroller.scrollRectToVisible(visible);
         uiSettings.fitScreen(thisScreenWidth, thisScreenHeight, singleWidth, singleHeight);
+        final Rectangle visible = new Rectangle(thatScreenX,thatScreenY,thisScreenWidth,thisScreenHeight);
+        SwingUtilities.invokeLater(new Runnable(){
+            public void run() {
+                scroller.scrollRectToVisible(visible);
+            }
+        });
     }
 
     private void sendCtrlAltDel(ProtocolContext context) {