@@ -108,12 +108,39 @@ std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc(HWND hWnd, UINT mes
108108 AdjustWindowRectEx (&borderThickness, GetWindowLongPtr (hWnd, GWL_STYLE) & ~WS_CAPTION, FALSE , NULL );
109109 NCCALCSIZE_PARAMS *sz = reinterpret_cast <NCCALCSIZE_PARAMS *>(lParam);
110110 // Add 1 pixel to the top border to make the window resizable from the top border
111- sz->rgrc [0 ].top -= 1 ;
112- sz->rgrc [0 ].right -= (borderThickness.right - 3 );
113- sz->rgrc [0 ].bottom -= (borderThickness.bottom - 3 );
111+ sz->rgrc [0 ].top += 1 ;
112+ sz->rgrc [0 ].right -= borderThickness.right ;
113+ sz->rgrc [0 ].bottom -= borderThickness.bottom ;
114+ sz->rgrc [0 ].left -= borderThickness.left ;
114115
115116 return (WVR_HREDRAW | WVR_VREDRAW);
116117 }
118+ }
119+ else if (message == WM_NCHITTEST)
120+ {
121+ LONG width = 10 ;
122+ POINT mouse = {LOWORD (lParam), HIWORD (lParam)};
123+ RECT window;
124+ GetWindowRect (hWnd, &window);
125+ RECT rcFrame = {0 };
126+ // AdjustWindowRectEx(&rcFrame, WS_OVERLAPPEDWINDOW & ~WS_CAPTION, FALSE, NULL);
127+ USHORT x = 1 ;
128+ USHORT y = 1 ;
129+ bool fOnResizeBorder = true ;
130+ if (mouse.y >= window.top && mouse.y < window.top + width)
131+ x = 0 ;
132+ else if (mouse.y < window.bottom && mouse.y >= window.bottom - width)
133+ x = 2 ;
134+ if (mouse.x >= window.left && mouse.x < window.left + width)
135+ y = 0 ;
136+ else if (mouse.x < window.right && mouse.x >= window.right - width)
137+ y = 2 ;
138+ LRESULT hitTests[3 ][3 ] = {
139+ {HTTOPLEFT, fOnResizeBorder ? HTTOP : HTCAPTION, HTTOPRIGHT},
140+ {HTLEFT, HTNOWHERE, HTRIGHT},
141+ {HTBOTTOMLEFT, HTBOTTOM, HTBOTTOMRIGHT},
142+ };
143+ return hitTests[x][y];
117144 }
118145 else if (message == WM_GETMINMAXINFO)
119146 {
0 commit comments