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