From ce0dd9ceec15bfb8ab99dacea8d7b2b80892e60d Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Thu, 1 Jul 2021 16:30:55 +0200 Subject: [PATCH] globalization bug fix --- src/Misc/CorePlayer.cs | 5 +++-- src/WinForms/MainForm.cs | 13 +++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Misc/CorePlayer.cs b/src/Misc/CorePlayer.cs index 3b79ea6..ed505f2 100644 --- a/src/Misc/CorePlayer.cs +++ b/src/Misc/CorePlayer.cs @@ -228,7 +228,8 @@ namespace mpvnet float scale = Native.GetDPI(IntPtr.Zero) / 96.0f; if (scale != 1) - conf = conf.Replace("console-scale=1", "console-scale=" + scale); + conf = conf.Replace("console-scale=1", "console-scale=" + + scale.ToString(CultureInfo.InvariantCulture)); File.WriteAllText(_ConfigFolder + "mpv.conf", conf); } @@ -740,7 +741,7 @@ namespace mpvnet public void set_property_bool(string name, bool value, bool throwException = false) { - long val = (value) ? 1 : 0; + long val = value ? 1 : 0; mpv_error err = mpv_set_property(Handle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_FLAG, ref val); if (err < 0) diff --git a/src/WinForms/MainForm.cs b/src/WinForms/MainForm.cs index b95a175..fd90765 100644 --- a/src/WinForms/MainForm.cs +++ b/src/WinForms/MainForm.cs @@ -25,7 +25,6 @@ namespace mpvnet int LastCursorChanged; int LastCycleFullscreen; - int LastAppCommand; int TaskbarButtonCreatedMessage; int ShownTickCount; @@ -698,13 +697,8 @@ namespace mpvnet case 0x20e: // WM_MOUSEHWHEEL case 0x20b: // WM_XBUTTONDOWN case 0x20c: // WM_XBUTTONUP - { - bool skip = m.Msg == 0x100 && LastAppCommand != 0 && - (Environment.TickCount - LastAppCommand) < 1000; - - if (Core.WindowHandle != IntPtr.Zero && !skip) - m.Result = SendMessage(Core.WindowHandle, m.Msg, m.WParam, m.LParam); - } + if (Core.WindowHandle != IntPtr.Zero) + m.Result = SendMessage(Core.WindowHandle, m.Msg, m.WParam, m.LParam); break; case 0x319: // WM_APPCOMMAND { @@ -712,9 +706,8 @@ namespace mpvnet if (value != null) { - Core.command("keypress " + value); + Core.Command("keypress " + value); m.Result = new IntPtr(1); - LastAppCommand = Environment.TickCount; return; } }