diff options
author | Brian P. Hinz <bphinz@users.sf.net> | 2015-08-20 01:20:10 -0400 |
---|---|---|
committer | Brian P. Hinz <bphinz@users.sf.net> | 2015-08-20 01:20:10 -0400 |
commit | 8442509bca6db16a009784517fd1a2531b9476b6 (patch) | |
tree | 484197c281b5084bc09b0962f59985fa7d7ffe18 /java/com/tigervnc/vncviewer/CConn.java | |
parent | fa85642107e57195dd3a71e4b755f2474cf61649 (diff) | |
download | tigervnc-8442509bca6db16a009784517fd1a2531b9476b6.tar.gz tigervnc-8442509bca6db16a009784517fd1a2531b9476b6.zip |
Add multiple monitor spanning feature to java viewer
Adds support for spanning multiple monitors in "Extended" mode
to the Java viewer. Allows for spanning when maximizing in
addition to just full-screen mode. Seems a bit unpredictable on
MS Windows 7 (ie: depends on window placement, which screen is
set as primary, etc.), but this appears to be the behavior of
the OS itself.
Diffstat (limited to 'java/com/tigervnc/vncviewer/CConn.java')
-rw-r--r-- | java/com/tigervnc/vncviewer/CConn.java | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java index 71bd0901..280b1b4f 100644 --- a/java/com/tigervnc/vncviewer/CConn.java +++ b/java/com/tigervnc/vncviewer/CConn.java @@ -1,7 +1,7 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright 2009-2013 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright (C) 2011-2013 D. R. Commander. All Rights Reserved. - * Copyright (C) 2011-2014 Brian P. Hinz + * Copyright (C) 2011-2015 Brian P. Hinz * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -548,6 +548,7 @@ public class CConn extends CConnection implements menu.fullScreen.setEnabled(s); menu.newConn.setEnabled(s); options.fullScreen.setEnabled(s); + options.fullScreenAllMonitors.setEnabled(s); options.scalingFactor.setEnabled(s); } @@ -569,16 +570,17 @@ public class CConn extends CConnection implements } private void reconfigureViewport() { - //viewport.setMaxSize(cp.width, cp.height); boolean pack = true; - Dimension dpySize = viewport.getToolkit().getScreenSize(); + Dimension dpySize = viewport.getScreenSize(); desktop.setScaledSize(); int w = desktop.scaledWidth; int h = desktop.scaledHeight; if (fullScreen) { - viewport.setExtendedState(JFrame.MAXIMIZED_BOTH); - viewport.setGeometry(0, 0, dpySize.width, dpySize.height, false); - Viewport.setFullScreenWindow(viewport); + if (!viewer.fullScreenAllMonitors.getValue()) + viewport.setExtendedState(JFrame.MAXIMIZED_BOTH); + viewport.setBounds(viewport.getScreenBounds()); + if (!viewer.fullScreenAllMonitors.getValue()) + Viewport.setFullScreenWindow(viewport); } else { int wmDecorationWidth = viewport.getInsets().left + viewport.getInsets().right; int wmDecorationHeight = viewport.getInsets().top + viewport.getInsets().bottom; @@ -982,6 +984,7 @@ public class CConn extends CConnection implements } options.fullScreen.setSelected(fullScreen); + options.fullScreenAllMonitors.setSelected(viewer.fullScreenAllMonitors.getValue()); options.useLocalCursor.setSelected(viewer.useLocalCursor.getValue()); options.acceptBell.setSelected(viewer.acceptBell.getValue()); String scaleString = viewer.scalingFactor.getValue(); @@ -1211,8 +1214,19 @@ public class CConn extends CConnection implements String desktopSize = (options.desktopSize.isSelected()) ? options.desktopWidth.getText() + "x" + options.desktopHeight.getText() : ""; viewer.desktopSize.setParam(desktopSize); - if (options.fullScreen.isSelected() ^ fullScreen) + if (options.fullScreen.isSelected() ^ fullScreen) { + viewer.fullScreenAllMonitors.setParam(options.fullScreenAllMonitors.isSelected()); toggleFullScreen(); + } else { + if (viewer.fullScreenAllMonitors.getValue() != + options.fullScreenAllMonitors.isSelected()) { + viewer.fullScreenAllMonitors.setParam(options.fullScreenAllMonitors.isSelected()); + if (desktop != null) + recreateViewport(); + } else { + viewer.fullScreenAllMonitors.setParam(options.fullScreenAllMonitors.isSelected()); + } + } } public void toggleFullScreen() { |