Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 274:f80c9789f63e
get single display size in multidisplay
author | oc |
---|---|
date | Tue, 06 Jan 2015 15:31:14 +0900 |
parents | 5bab82abcc4f |
children | 0f9b3de45fb2 |
files | .DS_Store src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 2 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Dec 18 01:23:26 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Tue Jan 06 15:31:14 2015 +0900 @@ -44,6 +44,7 @@ import java.awt.*; import java.awt.event.*; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Executors; @@ -848,6 +849,19 @@ // should be stopped. viewer.setCuiVersion(false); + // main screen is rectangles[0] + ArrayList<Rectangle> rectangles = new ArrayList<Rectangle>(); + GraphicsConfiguration[] gc = null; + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gs = ge.getScreenDevices(); + for (int j = 0; j < gs.length; j++) { + GraphicsDevice gd = gs[j]; + gc = gd.getConfigurations(); + for (int i=0; i < gc.length; i++) { + rectangles.add(gc[i].getBounds()); + } + } + Dimension size = frame.getSize(); viewer.setFrameSize(size.width, size.height); @@ -860,7 +874,7 @@ return; } String adr = viewer.getRfb().getMyAddress(); - context.sendMessage(new ScreenChangeRequest(adr, viewer.getRfb().getId(), size.width, size.height)); + context.sendMessage(new ScreenChangeRequest(adr, viewer.getRfb().getId(), (int) rectangles.get(0).getWidth(), (int) rectangles.get(0).getHeight())); } }); kbdButtons.add(screenButton);