mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-06-15 21:31:12 +00:00
Terminate the stream when stream frame is closed
This commit is contained in:
@@ -10,6 +10,9 @@ import java.awt.GraphicsDevice;
|
|||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.awt.event.WindowListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -27,6 +30,8 @@ import javax.swing.JProgressBar;
|
|||||||
import com.limelight.Limelight;
|
import com.limelight.Limelight;
|
||||||
import com.limelight.input.KeyboardHandler;
|
import com.limelight.input.KeyboardHandler;
|
||||||
import com.limelight.input.MouseHandler;
|
import com.limelight.input.MouseHandler;
|
||||||
|
import com.limelight.input.gamepad.GamepadHandler;
|
||||||
|
import com.limelight.input.gamepad.GamepadListener;
|
||||||
import com.limelight.nvstream.NvConnection;
|
import com.limelight.nvstream.NvConnection;
|
||||||
import com.limelight.nvstream.NvConnectionListener.Stage;
|
import com.limelight.nvstream.NvConnectionListener.Stage;
|
||||||
import com.limelight.nvstream.StreamConfiguration;
|
import com.limelight.nvstream.StreamConfiguration;
|
||||||
@@ -90,6 +95,8 @@ public class StreamFrame extends JFrame {
|
|||||||
this.getContentPane().setBackground(Color.BLACK);
|
this.getContentPane().setBackground(Color.BLACK);
|
||||||
this.getRootPane().setBackground(Color.BLACK);
|
this.getRootPane().setBackground(Color.BLACK);
|
||||||
|
|
||||||
|
this.addWindowListener(createWindowListener());
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
makeFullScreen(streamConfig);
|
makeFullScreen(streamConfig);
|
||||||
}
|
}
|
||||||
@@ -247,6 +254,19 @@ public class StreamFrame extends JFrame {
|
|||||||
}
|
}
|
||||||
spinnerLabel.setText("Starting " + stage.getName() + "...");
|
spinnerLabel.setText("Starting " + stage.getName() + "...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the listener for the window.
|
||||||
|
* It terminates the connection when the window is closed
|
||||||
|
*/
|
||||||
|
private WindowListener createWindowListener() {
|
||||||
|
return new WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the spinner and the label
|
* Hides the spinner and the label
|
||||||
|
|||||||
Reference in New Issue
Block a user