This commit is contained in:
Frank Skare
2019-07-08 18:18:55 +02:00
parent 7575a2d736
commit 3b149aea54
6 changed files with 41 additions and 31 deletions

View File

@@ -1,3 +1,7 @@
###
- left mouse double click MBTN_LEFT_DBL was not working
### 4.6
- fix for middle mouse button not working

View File

@@ -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);

View File

@@ -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);
}
}
}

View File

@@ -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
MBTN_LEFT_DBL cycle fullscreen
KP_ENTER cycle fullscreen

View File

@@ -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;

View File

@@ -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");