window-scale property support

This commit is contained in:
stax76
2021-11-05 15:23:47 +01:00
parent ef6b453673
commit ad1ea92cbd

View File

@@ -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();