diff --git a/Changelog.md b/Changelog.md index 11d50ca..d50ea25 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +### + +- left mouse double click MBTN_LEFT_DBL was not working + ### 4.6 - fix for middle mouse button not working diff --git a/mpv.net/Native/Native.cs b/mpv.net/Native/Native.cs index 77c7b02..0ef8d9e 100644 --- a/mpv.net/Native/Native.cs +++ b/mpv.net/Native/Native.cs @@ -39,7 +39,7 @@ namespace mpvnet [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")] private static extern IntPtr GetWindowLong64(IntPtr hWnd, int nIndex); - public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex) + public static IntPtr GetWindowLong(IntPtr hWnd, int nIndex) { if (IntPtr.Size == 8) return GetWindowLong64(hWnd, nIndex); diff --git a/mpv.net/Native/NativeHelp.cs b/mpv.net/Native/NativeHelp.cs index a79340a..6e0b0c8 100644 --- a/mpv.net/Native/NativeHelp.cs +++ b/mpv.net/Native/NativeHelp.cs @@ -32,7 +32,7 @@ namespace mpvnet public static void AddWindowBorders(IntPtr hwnd, ref Native.RECT rc) { - Native.AdjustWindowRect(ref rc, (uint)Native.GetWindowLongPtr(hwnd, -16 /* GWL_STYLE */), false); + Native.AdjustWindowRect(ref rc, (uint)Native.GetWindowLong(hwnd, -16 /* GWL_STYLE */), false); } } } \ No newline at end of file diff --git a/mpv.net/Resources/inputConf.txt b/mpv.net/Resources/inputConf.txt index 5a82545..92e3af8 100644 --- a/mpv.net/Resources/inputConf.txt +++ b/mpv.net/Resources/inputConf.txt @@ -182,4 +182,5 @@ Next playlist-next Ctrl+Wheel_Up no-osd seek 7 Ctrl+Wheel_Down no-osd seek -7 - MBTN_LEFT_DBL cycle fullscreen \ No newline at end of file + MBTN_LEFT_DBL cycle fullscreen + KP_ENTER cycle fullscreen \ No newline at end of file diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index 7563ab3..bba4f3f 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -205,10 +205,10 @@ namespace mpvnet Rectangle target = screen.Bounds; Left = target.X + Convert.ToInt32((target.Width - Width) / 2.0); Top = target.Y + Convert.ToInt32((target.Height - Height) / 2.0); - SetStartFormPositionAndSize(); + SetStartFormPosAndSize(); } - void SetStartFormPositionAndSize() + void SetStartFormPosAndSize() { if (IsFullscreen || mp.VideoSize.Width == 0) return; Screen screen = Screen.FromControl(this); @@ -231,10 +231,10 @@ namespace mpvnet Screen screen = Screen.FromControl(this); int fixedHeight = Convert.ToInt32(screen.Bounds.Height * mp.Autofit); - if (size.Height == 0 || size.Width == 0 || size.Width / (float)size.Height < 1.2) + if (size.Height == 0 || size.Width == 0 || size.Width / (float)size.Height < 1.3) { size.Height = fixedHeight; - size.Width = (int)(fixedHeight * 1.8); + size.Width = (int)(fixedHeight * 1.7); } int height = size.Height; @@ -344,16 +344,18 @@ namespace mpvnet case 0x0101: // WM_KEYUP case 0x0104: // WM_SYSKEYDOWN case 0x0105: // WM_SYSKEYUP - case 0x020A: // WM_MOUSEWHEEL case 0x0207: // WM_MBUTTONDOWN case 0x0208: // WM_MBUTTONUP + case 0x020A: // WM_MOUSEWHEEL if (mp.WindowHandle != IntPtr.Zero) Native.SendMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam); break; case 0x0200: // WM_MOUSEMOVE - Point pos = PointToClient(Cursor.Position); - mp.command_string($"mouse {pos.X} {pos.Y}"); - if (CursorHelp.IsPosDifferent(LastCursorPosChanged)) CursorHelp.Show(); + { + Point pos = PointToClient(Cursor.Position); + mp.command_string($"mouse {pos.X} {pos.Y}"); + if (CursorHelp.IsPosDifferent(LastCursorPosChanged)) CursorHelp.Show(); + } break; case 0x2a3: // WM_MOUSELEAVE mp.command_string("mouse 1 1"); // osc won't always auto hide @@ -363,7 +365,10 @@ namespace mpvnet Native.PostMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam); break; case 0x203: // Native.WM.LBUTTONDBLCLK - if (!IsMouseInOSC()) mp.command_string("cycle fullscreen"); + { + Point pos = PointToClient(Cursor.Position); + mp.command_string($"mouse {pos.X} {pos.Y} 0 double"); + } break; case 0x02E0: // WM_DPICHANGED if (IgnoreDpiChanged) break; @@ -439,7 +444,7 @@ namespace mpvnet CursorHelp.Hide(); } - void PropChangeOnTop(bool value) => BeginInvoke(new Action(() => TopMost = value)); + void PropChangeOnTop(bool value) => BeginInvoke(new Action(() => TopMost = value)); void PropChangeAid(string value) => mp.Aid = value; diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 028c857..cf5533d 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -79,6 +79,24 @@ namespace mpvnet public static float Autofit { get; set; } = 0.5f; + public static void Init() + { + string dummy = ConfFolder; + LoadLibrary("mpv-1.dll"); + Handle = mpv_create(); + set_property_string("osc", "yes"); + set_property_string("config", "yes"); + set_property_string("wid", MainForm.Hwnd.ToString()); + set_property_string("force-window", "yes"); + set_property_string("input-media-keys", "yes"); + mpv_initialize(Handle); + ShowLogo(); + ProcessCommandLine(); + Task.Run(() => { LoadScripts(); }); + Task.Run(() => { Addon = new Addon(); }); + Task.Run(() => { EventLoop(); }); + } + public static void ProcessProperty(string name, string value) { switch (name) @@ -161,24 +179,6 @@ namespace mpvnet } } - public static void Init() - { - string dummy = ConfFolder; - LoadLibrary("mpv-1.dll"); - Handle = mpv_create(); - set_property_string("osc", "yes"); - set_property_string("config", "yes"); - set_property_string("wid", MainForm.Hwnd.ToString()); - set_property_string("force-window", "yes"); - set_property_string("input-media-keys", "yes"); - mpv_initialize(Handle); - ShowLogo(); - ProcessCommandLine(); - Task.Run(() => { LoadScripts(); }); - Task.Run(() => { Addon = new Addon(); }); - Task.Run(() => { EventLoop(); }); - } - public static void LoadScripts() { string[] startupScripts = Directory.GetFiles(Application.StartupPath + "\\Scripts");