@@ -39,7 +39,7 @@ class WindowManagerPlugin : public flutter::Plugin
3939
4040 void WindowManagerPlugin::_EmitEvent (std::string eventName);
4141 // Called for top-level WindowProc delegation.
42- std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc (HWND hwnd , UINT message, WPARAM wparam , LPARAM lparam );
42+ std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc (HWND hWnd , UINT message, WPARAM wParam , LPARAM lParam );
4343 // Called when a method is called on this plugin's channel from Dart.
4444 void HandleMethodCall (const flutter::MethodCall<flutter::EncodableValue> &method_call,
4545 std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
@@ -64,8 +64,8 @@ WindowManagerPlugin::WindowManagerPlugin(flutter::PluginRegistrarWindows *regist
6464{
6565 window_manager = new WindowManager ();
6666 window_proc_id =
67- registrar->RegisterTopLevelWindowProcDelegate ([this ](HWND hwnd , UINT message, WPARAM wparam , LPARAM lparam ) {
68- return HandleWindowProc (hwnd , message, wparam, lparam );
67+ registrar->RegisterTopLevelWindowProcDelegate ([this ](HWND hWnd , UINT message, WPARAM wParam , LPARAM lParam ) {
68+ return HandleWindowProc (hWnd , message, wParam, lParam );
6969 });
7070}
7171
@@ -85,7 +85,12 @@ std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc(HWND hWnd, UINT mes
8585{
8686 std::optional<LRESULT> result = std::nullopt ;
8787
88- if (message == WM_NCCALCSIZE)
88+ if (message == WM_NCACTIVATE || message == WM_NCPAINT)
89+ {
90+ if (window_manager->title_bar_style == " hidden" )
91+ return 1 ;
92+ }
93+ else if (message == WM_NCCALCSIZE)
8994 {
9095 if (wParam && window_manager->is_frameless )
9196 {
@@ -104,38 +109,12 @@ std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc(HWND hWnd, UINT mes
104109 NCCALCSIZE_PARAMS *sz = reinterpret_cast <NCCALCSIZE_PARAMS *>(lParam);
105110 // Add 1 pixel to the top border to make the window resizable from the top border
106111 sz->rgrc [0 ].top -= 1 ;
107- sz->rgrc [0 ].right -= borderThickness.right ;
108- sz->rgrc [0 ].bottom -= borderThickness.bottom ;
112+ sz->rgrc [0 ].right -= ( borderThickness.right - 3 ) ;
113+ sz->rgrc [0 ].bottom -= ( borderThickness.bottom - 3 ) ;
109114
110115 return (WVR_HREDRAW | WVR_VREDRAW);
111116 }
112117 }
113- else if (message == WM_NCHITTEST)
114- {
115- LONG width = 10 ;
116- POINT mouse = {LOWORD (lParam), HIWORD (lParam)};
117- RECT window;
118- GetWindowRect (hWnd, &window);
119- RECT rcFrame = {0 };
120- // AdjustWindowRectEx(&rcFrame, WS_OVERLAPPEDWINDOW & ~WS_CAPTION, FALSE, NULL);
121- USHORT x = 1 ;
122- USHORT y = 1 ;
123- bool fOnResizeBorder = false ;
124- if (mouse.y >= window.top && mouse.y < window.top + width)
125- x = 0 ;
126- else if (mouse.y < window.bottom && mouse.y >= window.bottom - width)
127- x = 2 ;
128- if (mouse.x >= window.left && mouse.x < window.left + width)
129- y = 0 ;
130- else if (mouse.x < window.right && mouse.x >= window.right - width)
131- y = 2 ;
132- LRESULT hitTests[3 ][3 ] = {
133- {HTTOPLEFT, fOnResizeBorder ? HTTOP : HTCAPTION, HTTOPRIGHT},
134- {HTLEFT, HTNOWHERE, HTRIGHT},
135- {HTBOTTOMLEFT, HTBOTTOM, HTBOTTOMRIGHT},
136- };
137- return hitTests[x][y];
138- }
139118 else if (message == WM_GETMINMAXINFO)
140119 {
141120 MINMAXINFO *info = reinterpret_cast <MINMAXINFO *>(lParam);
0 commit comments