diff --git a/Changelog.md b/Changelog.md index e9605bd..fe60077 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,10 +1,16 @@ -5.4.7.3 Beta (not yet released) +5.4.7.4 Beta (not yet released) ============ - +5.4.7.3 Beta +============ + +- new setting media-keys added, can be found in the config editor in the input tab. + + 5.4.7.2 Beta ============ diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index fc51754..3574ff5 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -24,6 +24,7 @@ namespace mpvnet public static string DarkTheme { get; set; } = "dark"; public static string LightTheme { get; set; } = "light"; public static string StartSize { get; set; } = "previous"; + public static string MediaKeys { get; set; } = "mpvnet"; public static bool RememberPosition { get; set; } public static bool DebugMode { get; set; } @@ -177,6 +178,7 @@ namespace mpvnet case "auto-load-folder": AutoLoadFolder = value == "yes"; return true; case "update-check": UpdateCheck = value == "yes"; return true; case "start-size": StartSize = value; return true; + case "media-keys": MediaKeys = value; return true; case "process-instance": ProcessInstance = value; return true; case "dark-mode": DarkMode = value; return true; case "start-threshold": StartThreshold = value.Int(); return true; diff --git a/mpv.net/Properties/AssemblyInfo.cs b/mpv.net/Properties/AssemblyInfo.cs index ceb4a34..b15f679 100644 --- a/mpv.net/Properties/AssemblyInfo.cs +++ b/mpv.net/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("5.4.7.2")] -[assembly: AssemblyFileVersion("5.4.7.2")] +[assembly: AssemblyVersion("5.4.7.3")] +[assembly: AssemblyFileVersion("5.4.7.3")] diff --git a/mpv.net/Resources/editor.toml.txt b/mpv.net/Resources/editor.toml.txt index 793d20e..81963bb 100644 --- a/mpv.net/Resources/editor.toml.txt +++ b/mpv.net/Resources/editor.toml.txt @@ -528,6 +528,17 @@ file = "mpv" filter = "Input" help = "Number of key presses to generate per second on autorepeat." +[[settings]] +name = "media-keys" +file = "mpvnet" +default = "mpvnet" +filter = "Input" +help = "Defines how WM_APPCOMMAND messages are handled. (mpv.net specific setting)" +options = [{ name = "discard", help = "Blocks WM_APPCOMMAND messages, virtual key codes are still processed." }, + { name = "pass", help = "Let WM_APPCOMMAND messages pass to default handling." }, + { name = "mpv", help = "Forward WM_APPCOMMAND messages to libmpv." }, + { name = "mpvnet", help = "Translate WM_APPCOMMAND messages to mpv keys and send as keypress command." }] + [[settings]] name = "update-check" file = "mpvnet" diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index 904166a..9b76029 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -524,21 +524,28 @@ namespace mpvnet if (core.WindowHandle != IntPtr.Zero && !skip) m.Result = WinAPI.SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam); } - break; case 0x319: // WM_APPCOMMAND { - string value = mpvHelp.WM_APPCOMMAND_to_mpv_key((int)(m.LParam.ToInt64() >> 16 & ~0xf000)); - - if (value != null) - { - core.command("keypress " + value); + if (App.MediaKeys == "discard") { m.Result = new IntPtr(1); - LastAppCommand = Environment.TickCount; return; + } else if (App.MediaKeys == "mpv") { + if (core.WindowHandle != IntPtr.Zero) { + m.Result = WinAPI.SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam); + if (m.Result != IntPtr.Zero) + return; + } + } else if (App.MediaKeys == "mpvnet") { + string value = mpvHelp.WM_APPCOMMAND_to_mpv_key((int)(m.LParam.ToInt64() >> 16 & ~0xf000)); + if (value != null) { + core.command("keypress " + value); + m.Result = new IntPtr(1); + LastAppCommand = Environment.TickCount; + return; + } } } - break; case 0x0200: // WM_MOUSEMOVE if (Environment.TickCount - LastCycleFullscreen > 500)