window-maximized support added

This commit is contained in:
Frank Skare
2020-04-13 03:42:36 +02:00
parent 2f76d2b775
commit 722e06a02b
5 changed files with 40 additions and 12 deletions

View File

@@ -1,7 +1,14 @@
### 5.4.4.3
5.4.4.3
=======
new
---
- update MediaInfo 20.03
- mpv property window-maximized support added, cycling it from input.conf
might not be 100% reliable, it's likely a bug in the mpv client API and
will be further investigated soon
- update: MediaInfo 20.03
### 5.4.4.2

View File

@@ -30,7 +30,6 @@ namespace mpvnet
public static bool RememberHeight { get; set; } = true;
public static bool RememberPosition { get; set; }
public static bool Maximized { get; set; }
public static bool DebugMode { get; set; }
public static bool IsStartedFromTerminal { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes";
public static bool RememberVolume { get; set; } = true;
@@ -171,7 +170,6 @@ namespace mpvnet
switch (name)
{
case "remember-position": RememberPosition = value == "yes"; return true;
case "maximized": Maximized = value == "yes"; return true;
case "debug-mode": DebugMode = value == "yes"; return true;
case "remember-volume": RememberVolume = value == "yes"; return true;
case "queue": Queue = value == "yes"; return true;

View File

@@ -359,11 +359,11 @@ options = [{ name = "yes" },
{ name = "no" }]
[[settings]]
name = "maximized"
file = "mpvnet"
name = "window-maximized"
file = "mpv"
default = "no"
filter = "Screen"
help = "Start with a maximized window. (mpv.net specific setting)"
help = "Start with a maximized window."
options = [{ name = "yes" },
{ name = "no" }]

View File

@@ -53,13 +53,16 @@ namespace mpvnet
mp.Idle += Idle;
mp.Seek += () => UpdateProgressBar();
mp.observe_property_bool("window-maximized", PropChangeWindowMaximized);
mp.observe_property_bool("pause", PropChangePause);
mp.observe_property_bool("fullscreen", PropChangeFullscreen);
mp.observe_property_bool("ontop", PropChangeOnTop);
mp.observe_property_bool("border", PropChangeBorder);
mp.observe_property_string("sid", PropChangeSid);
mp.observe_property_string("aid", PropChangeAid);
mp.observe_property_string("vid", PropChangeVid);
mp.observe_property_int("edition", PropChangeEdition);
mp.observe_property_double("window-scale", PropChangeWindowScale);
@@ -102,7 +105,7 @@ namespace mpvnet
Top = posY - Height / 2;
}
if (App.Maximized)
if (mp.WindowMaximized)
{
SetFormPosAndSize(1, true);
WindowState = FormWindowState.Maximized;
@@ -601,6 +604,22 @@ namespace mpvnet
}
}
void PropChangeWindowMaximized(bool enabled)
{
//TODO: this might not be reliable
if (!WasShown)
return;
mp.WindowMaximized = enabled;
Invoke(new Action(() => {
if (mp.WindowMaximized && WindowState != FormWindowState.Maximized)
WindowState = FormWindowState.Maximized;
else if (!mp.WindowMaximized && WindowState == FormWindowState.Maximized)
WindowState = FormWindowState.Normal;
}));
}
void PropChangeBorder(bool enabled) {
mp.Border = enabled;

View File

@@ -59,10 +59,11 @@ namespace mpvnet
public static event Action Initialized;
public static List<KeyValuePair<string, Action<bool>>> BoolPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<bool>>>();
public static List<KeyValuePair<string, Action<int>>> IntPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<int>>>();
public static List<KeyValuePair<string, Action<bool>>> BoolPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<bool>>>();
public static List<KeyValuePair<string, Action<int>>> IntPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<int>>>();
public static List<KeyValuePair<string, Action<double>>> DoublePropChangeActions { get; set; } = new List<KeyValuePair<string, Action<double>>>();
public static List<KeyValuePair<string, Action<string>>> StringPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<string>>>();
public static List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
public static List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>();
public static IntPtr Handle { get; set; }
@@ -80,11 +81,12 @@ namespace mpvnet
public static string Vid { get; set; } = "";
public static string GPUAPI { get; set; } = "auto";
public static bool Border { get; set; } = true;
public static bool Fullscreen { get; set; }
public static bool IsLogoVisible { set; get; }
public static bool IsQuitNeeded { set; get; } = true;
public static bool Fullscreen { get; set; }
public static bool Border { get; set; } = true;
public static bool TaskbarProgress { get; set; } = true;
public static bool WindowMaximized { get; set; }
public static int Screen { get; set; } = -1;
public static int Edition { get; set; }
@@ -150,6 +152,7 @@ namespace mpvnet
case "fs":
case "fullscreen": Fullscreen = value == "yes"; break;
case "border": Border = value == "yes"; break;
case "window-maximized": WindowMaximized = value == "yes"; break;
case "taskbar-progress": TaskbarProgress = value == "yes"; break;
case "screen": Screen = Convert.ToInt32(value); break;
case "gpu-api": GPUAPI = value; break;
@@ -251,6 +254,7 @@ namespace mpvnet
foreach (var i in _Conf)
ProcessProperty(i.Key, i.Value);
}
return _Conf;
}
}