]> source.dussan.org Git - tigervnc.git/commitdiff
Fixes a number of issues related to fullscreen mode. When switching out of fullscreen...
authorBrian Hinz <bphinz@users.sourceforge.net>
Wed, 23 Jan 2013 22:46:53 +0000 (22:46 +0000)
committerBrian Hinz <bphinz@users.sourceforge.net>
Wed, 23 Jan 2013 22:46:53 +0000 (22:46 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5034 3789f03b-4d11-0410-bbf8-ca57d06f2519

java/com/tigervnc/vncviewer/CConn.java
java/com/tigervnc/vncviewer/DesktopWindow.java
java/com/tigervnc/vncviewer/Dialog.java
java/com/tigervnc/vncviewer/Viewport.java

index 63db1ab49dc78cc2108f90ada4353748262281bb..fd07b27d24650b0bdcd9ab6545bef69df746197e 100644 (file)
@@ -995,28 +995,18 @@ public class CConn extends CConnection
     String scaleString =
       options.scalingFactor.getSelectedItem().toString();
     String oldScaleFactor = viewer.scalingFactor.getValue();
-    if (scaleString.equalsIgnoreCase("Auto")) {
-      if (!oldScaleFactor.equals(scaleString)) {
-      viewer.scalingFactor.setParam("Auto");
-        if (desktop != null && !(options.fullScreen.isSelected() && fullScreen))
-          reconfigureViewport();
-      }
-    } else if(scaleString.equalsIgnoreCase("Fixed Aspect Ratio")) {
-      if (!oldScaleFactor.equalsIgnoreCase("FixedRatio")) {
-        viewer.scalingFactor.setParam("FixedRatio");
-        if (desktop != null && !(options.fullScreen.isSelected() && fullScreen))
-          reconfigureViewport();
-      }
-    } else { 
+    if (scaleString.equalsIgnoreCase("Fixed Aspect Ratio")) {
+      scaleString = new String("FixedRatio");
+    } else if (scaleString.equalsIgnoreCase("Auto")) {
+      scaleString = new String("Auto");
+    } else {
       scaleString=scaleString.substring(0, scaleString.length()-1);
-      if (!oldScaleFactor.equals(scaleString)) {
-        viewer.scalingFactor.setParam(scaleString);
-        if ((desktop != null) && (!oldScaleFactor.equalsIgnoreCase("Auto") ||
-            !oldScaleFactor.equalsIgnoreCase("FixedRatio"))) {
-          if (!(options.fullScreen.isSelected() && fullScreen))
-            reconfigureViewport();
-        }
-      }
+    }
+    if (oldScaleFactor != scaleString) {
+      viewer.scalingFactor.setParam(scaleString);
+      if ((options.fullScreen.isSelected() == fullScreen) &&
+          (desktop != null))
+        recreateViewport();
     }
 
     clipboardDialog.setSendingEnabled(viewer.sendClipboard.getValue());
@@ -1148,7 +1138,7 @@ public class CConn extends CConnection
 
   public void toggleFullScreen() {
     fullScreen = !fullScreen;
-    if (!fullScreen) menu.fullScreen.setSelected(false);
+    menu.fullScreen.setSelected(fullScreen);
     if (viewport != null)
       recreateViewport();
   }
index d7a734f218a867d9f9293c76484c1d1bab4843b1..7254a0b8b333c5158216106f99d4700a439c0680 100644 (file)
@@ -125,7 +125,7 @@ class DesktopWindow extends JPanel implements
 
     hideLocalCursor();
 
-    cursor.hotspot = hotspot;
+    cursor.hotspot = (hotspot != null) ? hotspot : new Point(0, 0);
     cursor.setSize(w, h);
     cursor.setPF(getPF());
 
@@ -171,8 +171,8 @@ class DesktopWindow extends JPanel implements
     g2.dispose();
     srcImage.flush();
 
-    int x = (int)Math.floor((float)hotspot.x * scaleWidthRatio);
-    int y = (int)Math.floor((float)hotspot.y * scaleHeightRatio);
+    int x = (int)Math.floor((float)cursor.hotspot.x * scaleWidthRatio);
+    int y = (int)Math.floor((float)cursor.hotspot.y * scaleHeightRatio);
     x = (int)Math.min(x, Math.max(bestSize.width-1, 0));
     y = (int)Math.min(y, Math.max(bestSize.height-1, 0));
     java.awt.Point hs = new java.awt.Point(x, y);
index 5e6790febacb957a6f2c3fab0fb6d8514cdd68f2..c478d4a9efbc2738d1b5424ad011c2079ec32194 100644 (file)
@@ -74,6 +74,7 @@ class Dialog extends JDialog {
     setVisible(false);
     setFocusable(false);
     setAlwaysOnTop(false);
+    fullScreenWindow = Viewport.getFullScreenWindow();
     if (fullScreenWindow != null)
       Viewport.setFullScreenWindow(fullScreenWindow);
   }
index 95489fac157beb35c5e656c044e4206c5d97f7fd..bc19b642b64e13290f46505d60e0171705230830 100644 (file)
@@ -62,10 +62,6 @@ public class Viewport extends JFrame
     });
     addComponentListener(new ComponentAdapter() {
       public void componentResized(ComponentEvent e) {
-        if ((getExtendedState() != JFrame.MAXIMIZED_BOTH) &&
-            cc.fullScreen) {
-          cc.toggleFullScreen();
-        }
         String scaleString = cc.viewer.scalingFactor.getValue();
         if (scaleString.equalsIgnoreCase("Auto") ||
             scaleString.equalsIgnoreCase("FixedRatio")) {
@@ -78,22 +74,23 @@ public class Viewport extends JFrame
                                      cc.desktop.scaledHeight));
             sp.validate();
             if (getExtendedState() != JFrame.MAXIMIZED_BOTH &&
-                scaleString.equalsIgnoreCase("FixedRatio")) {
+                scaleString.equalsIgnoreCase("FixedRatio") &&
+                !cc.fullScreen) {
               int w = cc.desktop.scaledWidth + getInsets().left + getInsets().right;
               int h = cc.desktop.scaledHeight + getInsets().top + getInsets().bottom;
               setSize(w, h);
             }
-            if (cc.desktop.cursor != null) {
-              Cursor cursor = cc.desktop.cursor;
-              cc.setCursor(cursor.width(),cursor.height(),cursor.hotspot, 
-                           cursor.data, cursor.mask);
-            }
           }
         } else {
           int policy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
           sp.setHorizontalScrollBarPolicy(policy);
           sp.validate();
         }
+        if (cc.desktop.cursor != null) {
+          Cursor cursor = cc.desktop.cursor;
+          cc.setCursor(cursor.width(),cursor.height(),cursor.hotspot, 
+                       cursor.data, cursor.mask);
+        }
       }
     });
   }