Fix logo not hiding sometimes using gpu-api=vulkan
This commit is contained in:
@@ -17,13 +17,15 @@
|
|||||||
is created with defaults for osc and console.
|
is created with defaults for osc and console.
|
||||||
- Support mpv idle property, see manual for remarks.
|
- Support mpv idle property, see manual for remarks.
|
||||||
- Fix external audio and subtitle files not shown in all use cases.
|
- Fix external audio and subtitle files not shown in all use cases.
|
||||||
- Fix mpv options not working in case of existing same line comments.
|
- Fix various mpv options not working in case of existing same line comments.
|
||||||
- Fix crash choosing Matroska edition in the menu.
|
- Fix crash choosing Matroska edition in the menu.
|
||||||
- Fix auto-play and auto-load-folder not working with user scripts.
|
- Fix auto-play and auto-load-folder not working with user scripts.
|
||||||
- Fix slow startup using `osd-scale-by-window=no`.
|
- Fix slow startup using `osd-scale-by-window=no`.
|
||||||
- Fix URL shown instead of media title on file change OSD,
|
- Fix URL shown instead of media title on file change OSD,
|
||||||
in recent menu and in recent command palette.
|
in recent menu and in recent command palette.
|
||||||
- Fix chapter time display in menu.
|
- Fix chapter time display in menu.
|
||||||
|
- Fix incorrect startup window size using gpu-api=vulkan.
|
||||||
|
- Fix logo not hiding sometimes using gpu-api=vulkan.
|
||||||
- libmpv zhongfly 2022-06-03
|
- libmpv zhongfly 2022-06-03
|
||||||
|
|
||||||
input.conf changes:
|
input.conf changes:
|
||||||
|
|||||||
@@ -110,18 +110,15 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void PlaylistFirst()
|
public static void PlaylistFirst()
|
||||||
{
|
{
|
||||||
int pos = Core.GetPropertyInt("playlist-pos");
|
if (Core.PlaylistPos != 0)
|
||||||
|
|
||||||
if (pos != 0)
|
|
||||||
Core.SetPropertyInt("playlist-pos", 0);
|
Core.SetPropertyInt("playlist-pos", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PlaylistLast()
|
public static void PlaylistLast()
|
||||||
{
|
{
|
||||||
int pos = Core.GetPropertyInt("playlist-pos");
|
|
||||||
int count = Core.GetPropertyInt("playlist-count");
|
int count = Core.GetPropertyInt("playlist-count");
|
||||||
|
|
||||||
if (pos < count - 1)
|
if (Core.PlaylistPos < count - 1)
|
||||||
Core.SetPropertyInt("playlist-pos", count - 1);
|
Core.SetPropertyInt("playlist-pos", count - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +387,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void ScaleWindow(float factor) => Core.RaiseScaleWindow(factor);
|
public static void ScaleWindow(float factor) => Core.RaiseScaleWindow(factor);
|
||||||
|
|
||||||
public static void WindowScale(float value) => Core.RaiseWindowScale(value);
|
public static void WindowScale(float value) => Core.RaiseWindowScaleNET(value);
|
||||||
|
|
||||||
public static void ShowText(string text, int duration = 0, int fontSize = 0)
|
public static void ShowText(string text, int duration = 0, int fontSize = 0)
|
||||||
{
|
{
|
||||||
@@ -722,7 +719,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void PlaylistAdd(int value)
|
public static void PlaylistAdd(int value)
|
||||||
{
|
{
|
||||||
int pos = Core.GetPropertyInt("playlist-pos");
|
int pos = Core.PlaylistPos;
|
||||||
int count = Core.GetPropertyInt("playlist-count");
|
int count = Core.GetPropertyInt("playlist-count");
|
||||||
|
|
||||||
if (count < 2)
|
if (count < 2)
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ namespace mpvnet
|
|||||||
int TaskbarButtonCreatedMessage;
|
int TaskbarButtonCreatedMessage;
|
||||||
|
|
||||||
bool WasMaximized;
|
bool WasMaximized;
|
||||||
bool WasShown;
|
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
@@ -52,7 +51,8 @@ namespace mpvnet
|
|||||||
Core.ShowMenu += Core_ShowMenu;
|
Core.ShowMenu += Core_ShowMenu;
|
||||||
Core.Shutdown += Core_Shutdown;
|
Core.Shutdown += Core_Shutdown;
|
||||||
Core.VideoSizeChanged += Core_VideoSizeChanged;
|
Core.VideoSizeChanged += Core_VideoSizeChanged;
|
||||||
Core.WindowScale += Core_WindowScale;
|
Core.WindowScaleMpv += Core_WindowScaleMpv;
|
||||||
|
Core.WindowScaleNET += Core_WindowScaleNET;
|
||||||
|
|
||||||
if (Core.GPUAPI != "vulkan")
|
if (Core.GPUAPI != "vulkan")
|
||||||
Init();
|
Init();
|
||||||
@@ -136,8 +136,6 @@ namespace mpvnet
|
|||||||
|
|
||||||
Core.ObservePropertyInt("edition", PropChangeEdition);
|
Core.ObservePropertyInt("edition", PropChangeEdition);
|
||||||
|
|
||||||
Core.ObservePropertyDouble("window-scale", WindowScale);
|
|
||||||
|
|
||||||
Core.ProcessCommandLine(false);
|
Core.ProcessCommandLine(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +170,7 @@ namespace mpvnet
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core_WindowScale(float scale)
|
void Core_WindowScaleNET(float scale)
|
||||||
{
|
{
|
||||||
BeginInvoke(new Action(() => {
|
BeginInvoke(new Action(() => {
|
||||||
SetSize(
|
SetSize(
|
||||||
@@ -183,9 +181,9 @@ namespace mpvnet
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScale(double scale)
|
void Core_WindowScaleMpv(double scale)
|
||||||
{
|
{
|
||||||
if (!WasShown)
|
if (!Core.Shown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BeginInvoke(new Action(() => {
|
BeginInvoke(new Action(() => {
|
||||||
@@ -755,7 +753,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
void SaveWindowProperties()
|
void SaveWindowProperties()
|
||||||
{
|
{
|
||||||
if (WindowState == FormWindowState.Normal && WasShown)
|
if (WindowState == FormWindowState.Normal && Core.Shown)
|
||||||
{
|
{
|
||||||
SavePosition();
|
SavePosition();
|
||||||
App.Settings.WindowSize = ClientSize;
|
App.Settings.WindowSize = ClientSize;
|
||||||
@@ -866,7 +864,7 @@ namespace mpvnet
|
|||||||
break;
|
break;
|
||||||
case 0x02E0: // WM_DPICHANGED
|
case 0x02E0: // WM_DPICHANGED
|
||||||
{
|
{
|
||||||
if (!WasShown)
|
if (!Core.Shown)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
RECT rect = Marshal.PtrToStructure<RECT>(m.LParam);
|
RECT rect = Marshal.PtrToStructure<RECT>(m.LParam);
|
||||||
@@ -974,7 +972,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
void PropChangeWindowMaximized()
|
void PropChangeWindowMaximized()
|
||||||
{
|
{
|
||||||
if (!WasShown)
|
if (!Core.Shown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BeginInvoke(new Action(() =>
|
BeginInvoke(new Action(() =>
|
||||||
@@ -990,7 +988,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
void PropChangeWindowMinimized()
|
void PropChangeWindowMinimized()
|
||||||
{
|
{
|
||||||
if (!WasShown)
|
if (!Core.Shown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BeginInvoke(new Action(() =>
|
BeginInvoke(new Action(() =>
|
||||||
@@ -1037,6 +1035,8 @@ namespace mpvnet
|
|||||||
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
|
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
|
||||||
LastCycleFullscreen = Environment.TickCount;
|
LastCycleFullscreen = Environment.TickCount;
|
||||||
SetFormPosAndSize();
|
SetFormPosAndSize();
|
||||||
|
if (Core.PlaylistPos == -1)
|
||||||
|
Core.ShowLogo();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivated(EventArgs e)
|
protected override void OnActivated(EventArgs e)
|
||||||
@@ -1071,7 +1071,7 @@ namespace mpvnet
|
|||||||
App.RunTask(() => App.Extension = new Extension());
|
App.RunTask(() => App.Extension = new Extension());
|
||||||
App.RunTask(() => App.CopyMpvnetCom());
|
App.RunTask(() => App.CopyMpvnetCom());
|
||||||
CSharpScriptHost.ExecuteScriptsInFolder(Core.ConfigFolder + "scripts-cs");
|
CSharpScriptHost.ExecuteScriptsInFolder(Core.ConfigFolder + "scripts-cs");
|
||||||
WasShown = true;
|
Core.Shown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextMenu_Closed(object sender, System.Windows.RoutedEventArgs e)
|
void ContextMenu_Closed(object sender, System.Windows.RoutedEventArgs e)
|
||||||
@@ -1084,7 +1084,7 @@ namespace mpvnet
|
|||||||
base.OnResize(e);
|
base.OnResize(e);
|
||||||
SaveWindowProperties();
|
SaveWindowProperties();
|
||||||
|
|
||||||
if (Core.IsLogoVisible)
|
if (Core.PlaylistPos == -1 && Core.Shown)
|
||||||
Core.ShowLogo();
|
Core.ShowLogo();
|
||||||
|
|
||||||
if (FormBorderStyle != FormBorderStyle.None)
|
if (FormBorderStyle != FormBorderStyle.None)
|
||||||
@@ -1095,7 +1095,7 @@ namespace mpvnet
|
|||||||
WasMaximized = false;
|
WasMaximized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WasShown)
|
if (Core.Shown)
|
||||||
{
|
{
|
||||||
if (WindowState == FormWindowState.Minimized)
|
if (WindowState == FormWindowState.Minimized)
|
||||||
Core.SetPropertyBool("window-minimized", true);
|
Core.SetPropertyBool("window-minimized", true);
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ namespace mpvnet
|
|||||||
public event Action Pause;
|
public event Action Pause;
|
||||||
public event Action ShowMenu;
|
public event Action ShowMenu;
|
||||||
public event Action<float> ScaleWindow;
|
public event Action<float> ScaleWindow;
|
||||||
public event Action<float> WindowScale;
|
public event Action<float> WindowScaleNET;
|
||||||
|
public event Action<double> WindowScaleMpv;
|
||||||
public event Action<int> PlaylistPosChanged;
|
public event Action<int> PlaylistPosChanged;
|
||||||
public event Action<int> PlaylistPosChangedAsync;
|
public event Action<int> PlaylistPosChangedAsync;
|
||||||
public event Action<Size> VideoSizeChanged;
|
public event Action<Size> VideoSizeChanged;
|
||||||
@@ -94,17 +95,18 @@ namespace mpvnet
|
|||||||
public bool Border { get; set; } = true;
|
public bool Border { get; set; } = true;
|
||||||
public bool FileEnded { get; set; }
|
public bool FileEnded { get; set; }
|
||||||
public bool Fullscreen { get; set; }
|
public bool Fullscreen { get; set; }
|
||||||
public bool IsLogoVisible { set; get; } = true;
|
|
||||||
public bool IsQuitNeeded { set; get; } = true;
|
public bool IsQuitNeeded { set; get; } = true;
|
||||||
public bool KeepaspectWindow { get; set; }
|
public bool KeepaspectWindow { get; set; }
|
||||||
public bool Paused { get; set; }
|
public bool Paused { get; set; }
|
||||||
|
public bool Shown { get; set; }
|
||||||
public bool TaskbarProgress { get; set; } = true;
|
public bool TaskbarProgress { get; set; } = true;
|
||||||
public bool WasInitialSizeSet;
|
public bool WasInitialSizeSet;
|
||||||
public bool WindowMaximized { get; set; }
|
public bool WindowMaximized { get; set; }
|
||||||
public bool WindowMinimized { get; set; }
|
public bool WindowMinimized { get; set; }
|
||||||
|
|
||||||
public int Screen { get; set; } = -1;
|
|
||||||
public int Edition { get; set; }
|
public int Edition { get; set; }
|
||||||
|
public int PlaylistPos { get; set; } = -1;
|
||||||
|
public int Screen { get; set; } = -1;
|
||||||
public int VideoRotate { get; set; }
|
public int VideoRotate { get; set; }
|
||||||
|
|
||||||
public float Autofit { get; set; } = 0.6f;
|
public float Autofit { get; set; } = 0.6f;
|
||||||
@@ -168,6 +170,8 @@ namespace mpvnet
|
|||||||
// this means Lua scripts that use idle might not work correctly
|
// this means Lua scripts that use idle might not work correctly
|
||||||
SetPropertyString("idle", "yes");
|
SetPropertyString("idle", "yes");
|
||||||
|
|
||||||
|
ObservePropertyDouble("window-scale", value => WindowScaleMpv(value));
|
||||||
|
|
||||||
ObservePropertyBool("pause", value => {
|
ObservePropertyBool("pause", value => {
|
||||||
Paused = value;
|
Paused = value;
|
||||||
Pause();
|
Pause();
|
||||||
@@ -179,11 +183,18 @@ namespace mpvnet
|
|||||||
});
|
});
|
||||||
|
|
||||||
ObservePropertyInt("playlist-pos", value => {
|
ObservePropertyInt("playlist-pos", value => {
|
||||||
|
PlaylistPos = value;
|
||||||
InvokeEvent(PlaylistPosChanged, PlaylistPosChangedAsync, value);
|
InvokeEvent(PlaylistPosChanged, PlaylistPosChangedAsync, value);
|
||||||
|
|
||||||
|
if (value == -1 && Core.Shown)
|
||||||
|
ShowLogo();
|
||||||
|
|
||||||
|
if (value != -1)
|
||||||
|
HideLogo();
|
||||||
|
|
||||||
if (FileEnded && value == -1)
|
if (FileEnded && value == -1)
|
||||||
{
|
{
|
||||||
ShowLogo();
|
//ShowLogo();
|
||||||
|
|
||||||
if (GetPropertyString("keep-open") == "no" && App.Exit)
|
if (GetPropertyString("keep-open") == "no" && App.Exit)
|
||||||
Core.CommandV("quit");
|
Core.CommandV("quit");
|
||||||
@@ -193,7 +204,7 @@ namespace mpvnet
|
|||||||
ObservePropertyString("script-opts", value => {
|
ObservePropertyString("script-opts", value => {
|
||||||
if (value.ContainsEx("osc-visibility=never"))
|
if (value.ContainsEx("osc-visibility=never"))
|
||||||
HideLogo();
|
HideLogo();
|
||||||
else if (GetPropertyInt("playlist-pos") == -1)
|
else if (PlaylistPos == -1 && Shown)
|
||||||
ShowLogo();
|
ShowLogo();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -540,7 +551,9 @@ namespace mpvnet
|
|||||||
SetPropertyBool("pause", false);
|
SetPropertyBool("pause", false);
|
||||||
|
|
||||||
App.QuickBookmark = 0;
|
App.QuickBookmark = 0;
|
||||||
|
|
||||||
HideLogo();
|
HideLogo();
|
||||||
|
|
||||||
Duration = TimeSpan.FromSeconds(GetPropertyDouble("duration"));
|
Duration = TimeSpan.FromSeconds(GetPropertyDouble("duration"));
|
||||||
|
|
||||||
if (App.StartSize == "video")
|
if (App.StartSize == "video")
|
||||||
@@ -1168,8 +1181,6 @@ namespace mpvnet
|
|||||||
if (files is null || files.Length == 0)
|
if (files is null || files.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HideLogo();
|
|
||||||
|
|
||||||
if ((DateTime.Now - LastLoad).TotalMilliseconds < 1000)
|
if ((DateTime.Now - LastLoad).TotalMilliseconds < 1000)
|
||||||
append = true;
|
append = true;
|
||||||
|
|
||||||
@@ -1373,16 +1384,11 @@ namespace mpvnet
|
|||||||
int y = Convert.ToInt32((cr.Height - len) / 2.0 * (december ? 0.85 : 0.9));
|
int y = Convert.ToInt32((cr.Height - len) / 2.0 * (december ? 0.85 : 0.9));
|
||||||
CommandV("overlay-add", "0", $"{x}", $"{y}", "&" + bd.Scan0.ToInt64().ToString(), "0", "bgra", bd.Width.ToString(), bd.Height.ToString(), bd.Stride.ToString());
|
CommandV("overlay-add", "0", $"{x}", $"{y}", "&" + bd.Scan0.ToInt64().ToString(), "0", "bgra", bd.Width.ToString(), bd.Height.ToString(), bd.Stride.ToString());
|
||||||
bmp.UnlockBits(bd);
|
bmp.UnlockBits(bd);
|
||||||
IsLogoVisible = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HideLogo()
|
void HideLogo() => Command("overlay-remove 0");
|
||||||
{
|
|
||||||
Command("overlay-remove 0");
|
|
||||||
IsLogoVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
string GetLanguage(string id)
|
string GetLanguage(string id)
|
||||||
{
|
{
|
||||||
@@ -1416,7 +1422,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public void RaiseScaleWindow(float value) => ScaleWindow(value);
|
public void RaiseScaleWindow(float value) => ScaleWindow(value);
|
||||||
|
|
||||||
public void RaiseWindowScale(float value) => WindowScale(value);
|
public void RaiseWindowScaleNET(float value) => WindowScaleNET(value);
|
||||||
|
|
||||||
public void RaiseShowMenu() => ShowMenu();
|
public void RaiseShowMenu() => ShowMenu();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user