setting media-keys added

This commit is contained in:
Frank Skare
2020-05-08 15:32:47 +02:00
parent da1a78cfa3
commit 4a045d6a91
5 changed files with 37 additions and 11 deletions

View File

@@ -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 5.4.7.2 Beta
============ ============

View File

@@ -24,6 +24,7 @@ namespace mpvnet
public static string DarkTheme { get; set; } = "dark"; public static string DarkTheme { get; set; } = "dark";
public static string LightTheme { get; set; } = "light"; public static string LightTheme { get; set; } = "light";
public static string StartSize { get; set; } = "previous"; public static string StartSize { get; set; } = "previous";
public static string MediaKeys { get; set; } = "mpvnet";
public static bool RememberPosition { get; set; } public static bool RememberPosition { get; set; }
public static bool DebugMode { get; set; } public static bool DebugMode { get; set; }
@@ -177,6 +178,7 @@ namespace mpvnet
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true; case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
case "update-check": UpdateCheck = value == "yes"; return true; case "update-check": UpdateCheck = value == "yes"; return true;
case "start-size": StartSize = value; return true; case "start-size": StartSize = value; return true;
case "media-keys": MediaKeys = value; 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;
case "start-threshold": StartThreshold = value.Int(); return true; case "start-threshold": StartThreshold = value.Int(); return true;

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.7.2")] [assembly: AssemblyVersion("5.4.7.3")]
[assembly: AssemblyFileVersion("5.4.7.2")] [assembly: AssemblyFileVersion("5.4.7.3")]

View File

@@ -528,6 +528,17 @@ file = "mpv"
filter = "Input" filter = "Input"
help = "Number of key presses to generate per second on autorepeat." 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]] [[settings]]
name = "update-check" name = "update-check"
file = "mpvnet" file = "mpvnet"

View File

@@ -524,21 +524,28 @@ namespace mpvnet
if (core.WindowHandle != IntPtr.Zero && !skip) if (core.WindowHandle != IntPtr.Zero && !skip)
m.Result = WinAPI.SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam); m.Result = WinAPI.SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam);
} }
break; break;
case 0x319: // WM_APPCOMMAND case 0x319: // WM_APPCOMMAND
{ {
string value = mpvHelp.WM_APPCOMMAND_to_mpv_key((int)(m.LParam.ToInt64() >> 16 & ~0xf000)); if (App.MediaKeys == "discard") {
if (value != null)
{
core.command("keypress " + value);
m.Result = new IntPtr(1); m.Result = new IntPtr(1);
LastAppCommand = Environment.TickCount;
return; 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; break;
case 0x0200: // WM_MOUSEMOVE case 0x0200: // WM_MOUSEMOVE
if (Environment.TickCount - LastCycleFullscreen > 500) if (Environment.TickCount - LastCycleFullscreen > 500)