Revision: 5034 http://tigervnc.svn.sourceforge.net/tigervnc/?rev=5034&view=rev Author: bphinz Date: 2013-01-23 22:46:53 +0000 (Wed, 23 Jan 2013) Log Message: ----------- Fixes a number of issues related to fullscreen mode. When switching out of fullscreen mode via the options dialog, setFullScreenWindow was being applied to the old reference, causing the whole screen to be blanked and unresponsive. The checkmark in the F8 menu could sometimes get out of sync with the state of the option. Cursor wasn't always being re-scaled when scale factor was changed. It seems that setCursor can still sometimes be passed a null pointer for the hotspot, so add back in a check that was removed in r5025
Revision Links: -------------- http://tigervnc.svn.sourceforge.net/tigervnc/?rev=5025&view=rev Modified Paths: -------------- trunk/java/com/tigervnc/vncviewer/CConn.java trunk/java/com/tigervnc/vncviewer/DesktopWindow.java trunk/java/com/tigervnc/vncviewer/Dialog.java trunk/java/com/tigervnc/vncviewer/Viewport.java Modified: trunk/java/com/tigervnc/vncviewer/CConn.java =================================================================== --- trunk/java/com/tigervnc/vncviewer/CConn.java 2013-01-23 14:18:52 UTC (rev 5033) +++ trunk/java/com/tigervnc/vncviewer/CConn.java 2013-01-23 22:46:53 UTC (rev 5034) @@ -995,29 +995,19 @@ 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()); viewer.menuKey.setParam(MenuKey.getMenuKeySymbols()[options.menuKey.getSelectedIndex()].name); @@ -1148,7 +1138,7 @@ public void toggleFullScreen() { fullScreen = !fullScreen; - if (!fullScreen) menu.fullScreen.setSelected(false); + menu.fullScreen.setSelected(fullScreen); if (viewport != null) recreateViewport(); } Modified: trunk/java/com/tigervnc/vncviewer/DesktopWindow.java =================================================================== --- trunk/java/com/tigervnc/vncviewer/DesktopWindow.java 2013-01-23 14:18:52 UTC (rev 5033) +++ trunk/java/com/tigervnc/vncviewer/DesktopWindow.java 2013-01-23 22:46:53 UTC (rev 5034) @@ -125,7 +125,7 @@ hideLocalCursor(); - cursor.hotspot = hotspot; + cursor.hotspot = (hotspot != null) ? hotspot : new Point(0, 0); cursor.setSize(w, h); cursor.setPF(getPF()); @@ -171,8 +171,8 @@ 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); Modified: trunk/java/com/tigervnc/vncviewer/Dialog.java =================================================================== --- trunk/java/com/tigervnc/vncviewer/Dialog.java 2013-01-23 14:18:52 UTC (rev 5033) +++ trunk/java/com/tigervnc/vncviewer/Dialog.java 2013-01-23 22:46:53 UTC (rev 5034) @@ -74,6 +74,7 @@ setVisible(false); setFocusable(false); setAlwaysOnTop(false); + fullScreenWindow = Viewport.getFullScreenWindow(); if (fullScreenWindow != null) Viewport.setFullScreenWindow(fullScreenWindow); } Modified: trunk/java/com/tigervnc/vncviewer/Viewport.java =================================================================== --- trunk/java/com/tigervnc/vncviewer/Viewport.java 2013-01-23 14:18:52 UTC (rev 5033) +++ trunk/java/com/tigervnc/vncviewer/Viewport.java 2013-01-23 22:46:53 UTC (rev 5034) @@ -62,10 +62,6 @@ }); 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 @@ 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); + } } }); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ Tigervnc-commits mailing list Tigervnc-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tigervnc-commits