diff --git a/limelight-pc/src/com/limelight/Limelight.java b/limelight-pc/src/com/limelight/Limelight.java index 1598c13..1e2cb52 100644 --- a/limelight-pc/src/com/limelight/Limelight.java +++ b/limelight-pc/src/com/limelight/Limelight.java @@ -28,14 +28,14 @@ public class Limelight implements NvConnectionListener { this.host = host; } - private void startUp() { + private void startUp(boolean fullscreen) { streamFrame = new StreamFrame(); conn = new NvConnection(host, this); conn.start(PlatformBinding.getDeviceName(), streamFrame, VideoDecoderRenderer.FLAG_PREFER_QUALITY, PlatformBinding.getAudioRenderer(), PlatformBinding.getVideoDecoderRenderer()); - streamFrame.build(conn); + streamFrame.build(conn, fullscreen); startControllerListener(); } @@ -62,9 +62,9 @@ public class Limelight implements NvConnectionListener { limeFrame = main.getLimeFrame(); } - public static void createInstance(String host) { + public static void createInstance(String host, boolean fullscreen) { Limelight limelight = new Limelight(host); - limelight.startUp(); + limelight.startUp(fullscreen); } public static void main(String args[]) { diff --git a/limelight-pc/src/com/limelight/gui/MainFrame.java b/limelight-pc/src/com/limelight/gui/MainFrame.java index 846e3d6..3a84be9 100644 --- a/limelight-pc/src/com/limelight/gui/MainFrame.java +++ b/limelight-pc/src/com/limelight/gui/MainFrame.java @@ -14,6 +14,7 @@ import java.net.UnknownHostException; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; +import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -30,6 +31,7 @@ public class MainFrame { private JTextField hostField; private JButton pair; private JButton stream; + private JCheckBox fullscreen; private JFrame limeFrame; public JFrame getLimeFrame() { @@ -60,6 +62,7 @@ public class MainFrame { pair.addActionListener(createPairButtonListener()); pair.setToolTipText("Send pair request to GeForce PC"); + fullscreen = new JCheckBox("Fullscreen"); Box streamBox = Box.createHorizontalBox(); streamBox.add(Box.createHorizontalGlue()); @@ -80,7 +83,9 @@ public class MainFrame { Box contentBox = Box.createVerticalBox(); contentBox.add(Box.createVerticalStrut(20)); contentBox.add(hostBox); - contentBox.add(Box.createVerticalStrut(10)); + contentBox.add(Box.createVerticalStrut(5)); + contentBox.add(fullscreen); + contentBox.add(Box.createVerticalStrut(5)); contentBox.add(streamBox); contentBox.add(Box.createVerticalStrut(10)); contentBox.add(pairBox); @@ -89,8 +94,9 @@ public class MainFrame { centerPane.add(contentBox); mainPane.add(centerPane, "Center"); - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + + limeFrame.getRootPane().setDefaultButton(stream); limeFrame.setSize(300, 175); limeFrame.setLocation(dim.width/2-limeFrame.getSize().width/2, dim.height/2-limeFrame.getSize().height/2); limeFrame.setResizable(false); @@ -102,7 +108,7 @@ public class MainFrame { return new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - Limelight.createInstance(hostField.getText()); + Limelight.createInstance(hostField.getText(), fullscreen.isSelected()); } }; } diff --git a/limelight-pc/src/com/limelight/gui/StreamFrame.java b/limelight-pc/src/com/limelight/gui/StreamFrame.java index ff134c3..5f16ea1 100644 --- a/limelight-pc/src/com/limelight/gui/StreamFrame.java +++ b/limelight-pc/src/com/limelight/gui/StreamFrame.java @@ -32,7 +32,7 @@ public class StreamFrame extends JFrame { private JProgressBar spinner; private JLabel spinnerLabel; - public void build(NvConnection conn) { + public void build(NvConnection conn, boolean fullscreen) { keyboard = new KeyboardHandler(conn); mouse = new MouseHandler(conn, this); @@ -46,18 +46,24 @@ public class StreamFrame extends JFrame { this.setSize(1280,720); //This might break if the screen res is too small...not sure though - this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2); + this.setLocation(dim.width/2-this.getSize().width/2, 0); - //makeFullScreen(); + this.setUndecorated(true); + this.setBackground(Color.BLACK); + + if (fullscreen) { + makeFullScreen(); + this.setLocation(getLocation().x, dim.height/2-this.getSize().height/2); + } hideCursor(); this.setVisible(true); } private void makeFullScreen() { - this.setUndecorated(true); + this.setExtendedState(Frame.MAXIMIZED_BOTH); - this.setBackground(Color.BLACK); + GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); if (gd.isFullScreenSupported()) { gd.setFullScreenWindow(this);