Window size flicker issue fix when changing files

This commit is contained in:
Frank Skare
2021-09-23 19:46:38 +02:00
parent 38a816a255
commit 819b026ec7
4 changed files with 16 additions and 13 deletions

View File

@@ -94,7 +94,7 @@ namespace mpvnet
public string ConfPath { get => ConfigFolder + "mpv.conf"; }
public string GPUAPI { get; set; } = "auto";
public string InputConfPath { get => ConfigFolder + "input.conf"; }
public string VID { get; set; } = "";
public string AID { get; set; } = "";
public string SID { get; set; } = "";
@@ -324,16 +324,17 @@ namespace mpvnet
{
Size size = new Size(GetPropertyInt(w), GetPropertyInt(h));
if (size.Width == 0 || size.Height == 0)
return;
if (VideoRotate == 90 || VideoRotate == 270)
size = new Size(size.Height, size.Width);
if (size.Width == 0 || size.Height == 0)
size = new Size(16, 9);
if (VideoSize != size)
{
VideoSize = size;
InvokeEvent(VideoSizeChanged, VideoSizeChangedAsync);
VideoSizeAutoResetEvent.Set();
}
}
@@ -425,15 +426,17 @@ namespace mpvnet
if (App.StartSize == "video")
WasInitialSizeSet = false;
UpdateVideoSize("width", "height");
string path = GetPropertyString("path");
VideoSizeAutoResetEvent.Set();
if (!VideoTypes.Contains(path.Ext()) || AudioTypes.Contains(path.Ext()))
{
UpdateVideoSize("width", "height");
VideoSizeAutoResetEvent.Set();
}
App.RunTask(new Action(() => ReadMetaData()));
App.RunTask(new Action(() => {
string path = GetPropertyString("path");
if (path.Contains("://"))
path = GetPropertyString("media-title");

View File

@@ -68,7 +68,7 @@ public static class ConvertStringExtension
public static class PathStringExtension
{
// return extension with lower case and without dot.
// returns the extension with lower case and without preceding dot.
public static string Ext(this string instance)
{
if (instance == null)

View File

@@ -1000,10 +1000,7 @@ namespace mpvnet
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (Core.GPUAPI != "vulkan")
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
LastCycleFullscreen = Environment.TickCount;
SetFormPosAndSize();
}