From ad1ea92cbd32e07470897588c697be029a181f0e Mon Sep 17 00:00:00 2001 From: stax76 Date: Fri, 5 Nov 2021 15:23:47 +0100 Subject: [PATCH] window-scale property support --- src/Misc/MainForm.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Misc/MainForm.cs b/src/Misc/MainForm.cs index c405465..879434b 100644 --- a/src/Misc/MainForm.cs +++ b/src/Misc/MainForm.cs @@ -72,6 +72,8 @@ namespace mpvnet Core.ObservePropertyInt("edition", PropChangeEdition); + Core.ObservePropertyDouble("window-scale", WindowScale); + if (Core.GPUAPI != "vulkan") Core.ProcessCommandLine(false); @@ -163,6 +165,19 @@ namespace mpvnet })); } + void WindowScale(double scale) + { + if (!WasShown) + return; + + BeginInvoke(new Action(() => { + SetSize( + (int)(Core.VideoSize.Width * scale), + (int)Math.Ceiling(Core.VideoSize.Height * scale), + Screen.FromControl(this), false); + })); + } + void Core_Shutdown() => BeginInvoke(new Action(() => Close())); void Core_Idle() => SetTitle();