diff --git a/docs/Changelog.md b/docs/Changelog.md index 54db982..293382a 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,6 +1,9 @@ -- Fix keyboard layout change. -- Fix multi monitor setup with different DPI values. +5.9.0.0 Beta (2022-05-08) + +- Fix startup without media file not working with gpu-api=vulkan. +- Fix keyboard layout change not working. +- Fix multi monitor setup with different DPI values not working. - Fix config editor handling `keep-open` and `keep-open-pause` incorrectly. - New mpv.net specific option `keep-open-exit` added. If set to yes and keep-open is set to no, mpv.net exits after the last file ends. diff --git a/src/Misc/MainForm.cs b/src/Misc/MainForm.cs index 2c9d5b6..449534f 100644 --- a/src/Misc/MainForm.cs +++ b/src/Misc/MainForm.cs @@ -44,7 +44,6 @@ namespace mpvnet try { Instance = this; - Core.Init(Handle); Core.Shutdown += Core_Shutdown; Core.ShowMenu += Core_ShowMenu; @@ -55,27 +54,8 @@ namespace mpvnet Core.Seek += () => UpdateProgressBar(); Core.PlaylistPosChanged += (value) => SetTitle(); - Core.ObserveProperty("window-maximized", PropChangeWindowMaximized); - Core.ObserveProperty("window-minimized", PropChangeWindowMinimized); - - Core.ObservePropertyBool("border", PropChangeBorder); - Core.ObservePropertyBool("fullscreen", PropChangeFullscreen); - Core.ObservePropertyBool("keepaspect-window", value => Core.KeepaspectWindow = value); - Core.ObservePropertyBool("ontop", PropChangeOnTop); - Core.ObservePropertyBool("pause", PropChangePause); - - Core.ObservePropertyString("sid", PropChangeSid); - Core.ObservePropertyString("aid", PropChangeAid); - Core.ObservePropertyString("vid", PropChangeVid); - - Core.ObservePropertyString("title", PropChangeTitle); - - Core.ObservePropertyInt("edition", PropChangeEdition); - - Core.ObservePropertyDouble("window-scale", WindowScale); - if (Core.GPUAPI != "vulkan") - Core.ProcessCommandLine(false); + Init(); AppDomain.CurrentDomain.UnhandledException += (sender, e) => App.ShowException(e.ExceptionObject); Application.ThreadException += (sender, e) => App.ShowException(e.Exception); @@ -135,7 +115,33 @@ namespace mpvnet } } - private void Core_ShowMenu() + void Init() + { + Core.Init(Handle); + + Core.ObserveProperty("window-maximized", PropChangeWindowMaximized); + Core.ObserveProperty("window-minimized", PropChangeWindowMinimized); + + Core.ObservePropertyBool("border", PropChangeBorder); + Core.ObservePropertyBool("fullscreen", PropChangeFullscreen); + Core.ObservePropertyBool("keepaspect-window", value => Core.KeepaspectWindow = value); + Core.ObservePropertyBool("ontop", PropChangeOnTop); + Core.ObservePropertyBool("pause", PropChangePause); + + Core.ObservePropertyString("sid", PropChangeSid); + Core.ObservePropertyString("aid", PropChangeAid); + Core.ObservePropertyString("vid", PropChangeVid); + + Core.ObservePropertyString("title", PropChangeTitle); + + Core.ObservePropertyInt("edition", PropChangeEdition); + + Core.ObservePropertyDouble("window-scale", WindowScale); + + Core.ProcessCommandLine(false); + } + + void Core_ShowMenu() { BeginInvoke(new Action(() => { if (IsMouseInOSC()) @@ -1026,7 +1032,8 @@ namespace mpvnet protected override void OnLoad(EventArgs e) { base.OnLoad(e); - Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold); + if (Core.GPUAPI != "vulkan") + Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold); LastCycleFullscreen = Environment.TickCount; SetFormPosAndSize(); } @@ -1041,12 +1048,12 @@ namespace mpvnet { base.OnShown(e); + if (Core.GPUAPI == "vulkan") + Init(); + if (WindowState == FormWindowState.Maximized) Core.SetPropertyBool("window-maximized", true); - if (Core.GPUAPI == "vulkan") - Core.ProcessCommandLine(false); - WPF.Init(); App.UpdateWpfColors(); MessageBoxEx.MessageForeground = Theme.Current.GetBrush("heading"); diff --git a/src/Misc/Player.cs b/src/Misc/Player.cs index 2d170a3..83caaac 100644 --- a/src/Misc/Player.cs +++ b/src/Misc/Player.cs @@ -116,7 +116,6 @@ namespace mpvnet if (Handle == IntPtr.Zero) throw new Exception("error mpv_create"); - mpv_request_log_messages(Handle, "terminal-default"); App.RunTask(() => EventLoop()); @@ -1287,7 +1286,7 @@ namespace mpvnet public void ShowLogo() { - if (!App.ShowLogo || MainForm.Instance == null) + if (!App.ShowLogo || MainForm.Instance == null || Core.Handle == IntPtr.Zero) return; bool december = DateTime.Now.Month == 12; diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index eb2c7f9..53d98e5 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("5.8.0.0")] -[assembly: AssemblyFileVersion("5.8.0.0")] +[assembly: AssemblyVersion("5.9.0.0")] +[assembly: AssemblyFileVersion("5.9.0.0")]