From c87ce3b66f27ce1b1d9c00d32a238955bfba08d8 Mon Sep 17 00:00:00 2001 From: stax76 Date: Tue, 28 Jun 2022 07:53:48 +0200 Subject: [PATCH] fix #449 --- src/WinForms/MainForm.cs | 50 ++++++++++++---------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/src/WinForms/MainForm.cs b/src/WinForms/MainForm.cs index 5981daa..2070bff 100644 --- a/src/WinForms/MainForm.cs +++ b/src/WinForms/MainForm.cs @@ -940,8 +940,9 @@ namespace mpvnet } return; case 0x84: // WM_NCHITTEST - if (!Core.Border) { - // resize borderless window + // resize borderless window + if (!Core.Border && !Core.Fullscreen) { + const int HTCLIENT = 1; const int HTLEFT = 10; const int HTRIGHT = 11; const int HTTOP = 12; @@ -951,52 +952,31 @@ namespace mpvnet const int HTBOTTOMLEFT = 16; const int HTBOTTOMRIGHT = 17; - int x = (int)(m.LParam.ToInt64() & 0xFFFF); - int y = (int)((m.LParam.ToInt64() & 0xFFFF0000) >> 16); + int x = (int)(m.LParam.ToInt64() & 0xFFFF); // loword + int y = (int)((m.LParam.ToInt64() & 0xFFFF0000) >> 16); // hiword Point pt = PointToClient(new Point(x, y)); Size cs = ClientSize; + m.Result = new IntPtr(HTCLIENT); if (pt.X >= cs.Width - 16 && pt.Y >= cs.Height - 16 && cs.Height >= 16) - { m.Result = (IntPtr)(IsMirrored ? HTBOTTOMLEFT : HTBOTTOMRIGHT); - return; - } - if (pt.X <= 16 && pt.Y >= cs.Height - 16 && cs.Height >= 16) - { + else if (pt.X <= 16 && pt.Y >= cs.Height - 16 && cs.Height >= 16) m.Result = (IntPtr)(IsMirrored ? HTBOTTOMRIGHT : HTBOTTOMLEFT); - return; - } - if (pt.X <= 16 && pt.Y <= 16 && cs.Height >= 16) - { + else if (pt.X <= 16 && pt.Y <= 16 && cs.Height >= 16) m.Result = (IntPtr)(IsMirrored ? HTTOPRIGHT : HTTOPLEFT); - return; - } - if (pt.X >= cs.Width - 16 && pt.Y <= 16 && cs.Height >= 16) - { + else if (pt.X >= cs.Width - 16 && pt.Y <= 16 && cs.Height >= 16) m.Result = (IntPtr)(IsMirrored ? HTTOPLEFT : HTTOPRIGHT); - return; - } - if (pt.Y <= 16 && cs.Height >= 16) - { + else if (pt.Y <= 16 && cs.Height >= 16) m.Result = (IntPtr)HTTOP; - return; - } - if (pt.Y >= cs.Height - 16 && cs.Height >= 16) - { + else if (pt.Y >= cs.Height - 16 && cs.Height >= 16) m.Result = (IntPtr)HTBOTTOM; - return; - } - if (pt.X <= 16 && cs.Height >= 16) - { + else if (pt.X <= 16 && cs.Height >= 16) m.Result = (IntPtr)HTLEFT; - return; - } - if (pt.X >= cs.Width - 16 && cs.Height >= 16) - { + else if (pt.X >= cs.Width - 16 && cs.Height >= 16) m.Result = (IntPtr)HTRIGHT; - return; - } + + return; } break; case 0x231: // WM_ENTERSIZEMOVE