added new setting to start with maximized window

This commit is contained in:
Frank Skare
2019-08-21 16:52:09 +02:00
parent e230f0f474
commit 8debcc171c
6 changed files with 23 additions and 14 deletions

View File

@@ -1,7 +1,6 @@
### ###
- osc=yes and input-media-keys=yes was enforced, - added new setting to start with maximized window
now it can be disabled in mpv.conf
### 5.3 ### 5.3

View File

@@ -80,7 +80,7 @@ Table of contents
- Screenshot feature with many options - Screenshot feature with many options
- File history feature to log time and filename - File history feature to log time and filename
- A-B loop feature - A-B loop feature
- watch later feature to save the position - Watch later feature to save the position
- [Manual](#manual) - [Manual](#manual)
### Screenshots ### Screenshots

View File

@@ -23,6 +23,7 @@ namespace mpvnet
public static bool RememberHeight { get; set; } = true; public static bool RememberHeight { get; set; } = true;
public static bool RememberPosition { get; set; } public static bool RememberPosition { get; set; }
public static bool Maximized { get; set; }
public static bool DebugMode { get; set; } public static bool DebugMode { get; set; }
public static bool IsStartedFromTerminal { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes"; public static bool IsStartedFromTerminal { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes";
public static bool RememberVolume { get; set; } = true; public static bool RememberVolume { get; set; } = true;
@@ -106,6 +107,7 @@ namespace mpvnet
switch (name) switch (name)
{ {
case "remember-position": RememberPosition = value == "yes"; return true; case "remember-position": RememberPosition = value == "yes"; return true;
case "maximized": Maximized = value == "yes"; return true;
case "start-size": RememberHeight = value == "previous"; return true; case "start-size": RememberHeight = value == "previous"; return true;
case "process-instance": ProcessInstance = value; return true; case "process-instance": ProcessInstance = value; return true;
case "dark-mode": DarkMode = value; return true; case "dark-mode": DarkMode = value; return true;

View File

@@ -45,6 +45,14 @@ help = "Save the window position on exit. (mpv.net specific setting)"
options = [{ name = "yes" }, options = [{ name = "yes" },
{ name = "no" }] { name = "no" }]
[[settings]]
name = "maximized"
default = "no"
filter = "Screen"
help = "Start with a maximized window. (mpv.net specific setting)"
options = [{ name = "yes" },
{ name = "no" }]
[[settings]] [[settings]]
name = "remember-volume" name = "remember-volume"
default = "yes" default = "yes"

View File

@@ -83,6 +83,8 @@ namespace mpvnet
Left = posX - Width / 2; Left = posX - Width / 2;
Top = posY - Height / 2; Top = posY - Height / 2;
} }
if (App.Maximized) WindowState = FormWindowState.Maximized;
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -104,7 +106,7 @@ namespace mpvnet
void ContextMenu_Opened(object sender, EventArgs e) => CursorHelp.Show(); void ContextMenu_Opened(object sender, EventArgs e) => CursorHelp.Show();
bool IsFullscreen => WindowState == FormWindowState.Maximized; bool IsFullscreen => WindowState == FormWindowState.Maximized && FormBorderStyle == FormBorderStyle.None;
bool IsMouseInOSC() => PointToClient(Control.MousePosition).Y > ClientSize.Height * 0.9; bool IsMouseInOSC() => PointToClient(Control.MousePosition).Y > ClientSize.Height * 0.9;
@@ -228,6 +230,9 @@ namespace mpvnet
void SetFormPosAndSize() void SetFormPosAndSize()
{ {
if (WindowState == FormWindowState.Maximized)
return;
if (mp.Fullscreen) if (mp.Fullscreen)
{ {
CycleFullscreen(true); CycleFullscreen(true);
@@ -320,7 +325,7 @@ namespace mpvnet
} }
else else
{ {
if (WindowState == FormWindowState.Maximized) if (WindowState == FormWindowState.Maximized && FormBorderStyle == FormBorderStyle.None)
{ {
WindowState = FormWindowState.Normal; WindowState = FormWindowState.Normal;

View File

@@ -103,10 +103,8 @@ namespace mpvnet
} }
set_property_string("wid", MainForm.Hwnd.ToString()); set_property_string("wid", MainForm.Hwnd.ToString());
set_property_string("osc", "yes");
if (!Conf.Keys.Contains("osc")) set_property_string("osc", "yes"); set_property_string("input-media-keys", "yes");
if (!Conf.Keys.Contains("input-media-keys")) set_property_string("input-media-keys", "yes");
set_property_string("force-window", "yes"); set_property_string("force-window", "yes");
set_property_string("config-dir", ConfigFolder); set_property_string("config-dir", ConfigFolder);
set_property_string("config", "yes"); set_property_string("config", "yes");
@@ -418,12 +416,9 @@ namespace mpvnet
static void HideLogo() static void HideLogo()
{ {
if (IsLogoVisible) command("overlay-remove 0");
{
commandv("overlay-remove", "0");
IsLogoVisible = false; IsLogoVisible = false;
} }
}
static List<PythonEventObject> PythonEventObjects = new List<PythonEventObject>(); static List<PythonEventObject> PythonEventObjects = new List<PythonEventObject>();