Video: Exclusive fullscreen fixes
-Ensure window takes up the entire screen -Ensure scale is set properly -Fix issues when scale is set to be bigger than the screen
This commit is contained in:
parent
7834eb285b
commit
6e8b79f0b2
3 changed files with 28 additions and 2 deletions
3
GUI.NET/Forms/Config/frmVideoConfig.Designer.cs
generated
3
GUI.NET/Forms/Config/frmVideoConfig.Designer.cs
generated
|
@ -291,7 +291,8 @@ namespace Mesen.GUI.Forms.Config
|
|||
"1280x720",
|
||||
"1152x864",
|
||||
"1024x768",
|
||||
"800x600"});
|
||||
"800x600",
|
||||
"640x480"});
|
||||
this.cboFullscreenResolution.Location = new System.Drawing.Point(120, 3);
|
||||
this.cboFullscreenResolution.Name = "cboFullscreenResolution";
|
||||
this.cboFullscreenResolution.Size = new System.Drawing.Size(85, 21);
|
||||
|
|
|
@ -401,6 +401,10 @@ namespace Mesen.GUI.Forms
|
|||
|
||||
private void UpdateViewerSize(bool forceUpdate = false)
|
||||
{
|
||||
if(_frmFullscreenRenderer != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.Resize -= frmMain_Resize;
|
||||
|
||||
InteropEmu.ScreenSize size = InteropEmu.GetScreenSize(false);
|
||||
|
@ -531,6 +535,9 @@ namespace Mesen.GUI.Forms
|
|||
private void StartExclusiveFullscreenMode()
|
||||
{
|
||||
Size screenSize = GetFullscreenResolution();
|
||||
Size originalWindowSize = this.Size;
|
||||
double originalScale = ConfigManager.Config.VideoInfo.VideoScale;
|
||||
this.Resize -= frmMain_Resize;
|
||||
|
||||
_frmFullscreenRenderer = new frmFullscreenRenderer();
|
||||
_frmFullscreenRenderer.Shown += (object sender, EventArgs e) => {
|
||||
|
@ -540,16 +547,20 @@ namespace Mesen.GUI.Forms
|
|||
};
|
||||
_frmFullscreenRenderer.FormClosing += (object sender, FormClosingEventArgs e) => {
|
||||
InteropEmu.SetFullscreenMode(false, ctrlRenderer.Handle, (UInt32)screenSize.Width, (UInt32)screenSize.Height);
|
||||
this.Resize += frmMain_Resize;
|
||||
_frmFullscreenRenderer = null;
|
||||
ctrlRenderer.Visible = true;
|
||||
_fullscreenMode = false;
|
||||
frmMain_Resize(null, EventArgs.Empty);
|
||||
|
||||
this.SetScale(originalScale);
|
||||
this.Size = originalWindowSize;
|
||||
};
|
||||
|
||||
Screen currentScreen = Screen.FromHandle(this.Handle);
|
||||
_frmFullscreenRenderer.StartPosition = FormStartPosition.Manual;
|
||||
_frmFullscreenRenderer.Top = currentScreen.Bounds.Top;
|
||||
_frmFullscreenRenderer.Left = currentScreen.Bounds.Left;
|
||||
_frmFullscreenRenderer.Size = screenSize;
|
||||
_frmFullscreenRenderer.Show();
|
||||
}
|
||||
|
||||
|
@ -778,6 +789,10 @@ namespace Mesen.GUI.Forms
|
|||
|
||||
private void ProcessResolutionChanged()
|
||||
{
|
||||
if(_frmFullscreenRenderer != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Force scale specified by command line options, when using /fullscreen
|
||||
if(_fullscreenRequested) {
|
||||
SetFullscreenState(true);
|
||||
|
|
|
@ -71,6 +71,16 @@ void Renderer::SetScreenSize(uint32_t width, uint32_t height)
|
|||
if(_fullscreen) {
|
||||
_realScreenHeight = _monitorHeight;
|
||||
_realScreenWidth = _monitorWidth;
|
||||
|
||||
if(_monitorHeight < _screenHeight || _monitorWidth < _screenWidth) {
|
||||
double scale = (double)screenSize.Width / (double)screenSize.Height;
|
||||
_screenHeight = _monitorHeight;
|
||||
_screenWidth = (uint32_t)(scale * _screenHeight);
|
||||
if(_monitorWidth < _screenWidth) {
|
||||
_screenWidth = _monitorWidth;
|
||||
_screenHeight = (uint32_t)(_screenWidth / scale);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_realScreenHeight = screenSize.Height;
|
||||
_realScreenWidth = screenSize.Width;
|
||||
|
|
Loading…
Add table
Reference in a new issue