From 5a726a01e0d2d850fd1274ad02da4e15a82373df Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Sun, 19 Apr 2020 20:14:46 +0200 Subject: [PATCH] window maximized issue --- Changelog.md | 3 ++- mpv.net/WinForms/MainForm.cs | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Changelog.md b/Changelog.md index 8535f28..29b8d81 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,7 +7,8 @@ - mpv property `window-maximized` support added, cycling it from input.conf might not be 100% reliable, use native Windows shortcuts Win+Up, Win+Down - the mpv.net `start-size` property supports `always` to always remember the window height - +- if the window was maximized before fullscreen was entered, it's now set to + maximized after fullscreen was left (it was requested on the tracker) ### 5.4.4.2 diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index ac78f8a..dd5ad4a 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -13,7 +13,6 @@ using System.Threading.Tasks; using UI; using ScriptHost; -using System.Threading; namespace mpvnet { @@ -371,9 +370,6 @@ namespace mpvnet { if (WindowState != FormWindowState.Maximized || FormBorderStyle != FormBorderStyle.None) { - if (WindowState == FormWindowState.Maximized) - WindowState = FormWindowState.Minimized; - FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; } @@ -382,7 +378,10 @@ namespace mpvnet { if (WindowState == FormWindowState.Maximized && FormBorderStyle == FormBorderStyle.None) { - WindowState = FormWindowState.Normal; + if (WasMaximized) + WindowState = FormWindowState.Maximized; + else + WindowState = FormWindowState.Normal; if (mp.Border) FormBorderStyle = FormBorderStyle.Sizable; @@ -701,8 +700,15 @@ namespace mpvnet if (mp.IsLogoVisible) mp.ShowLogo(); + + if (WindowState == FormWindowState.Maximized && FormBorderStyle != FormBorderStyle.None) + WasMaximized = true; + else if (WindowState == FormWindowState.Normal && FormBorderStyle != FormBorderStyle.None) + WasMaximized = false; } + bool WasMaximized; + protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e);