| 379 | } |
| 380 | |
| 381 | LRESULT WinNativeWidget::hitTest(HWND hWnd, WPARAM wParam, LPARAM lParam) |
| 382 | { |
| 383 | int k = GetDevicePixelRatio(); |
| 384 | const LONG borderWidth = 4 * k; |
| 385 | RECT rc; |
| 386 | GetWindowRect(hWnd, &rc); |
| 387 | |
| 388 | int left = rc.left; |
| 389 | int right = rc.right; |
| 390 | int top = rc.top; |
| 391 | int bottom = rc.bottom; |
| 392 | |
| 393 | long x = GET_X_LPARAM(lParam); |
| 394 | long y = GET_Y_LPARAM(lParam); |
| 395 | |
| 396 | if (!g_enable_ncclient){ |
| 397 | return HTCLIENT; |
| 398 | } |
| 399 | |
| 400 | // Check if the size can to resize. |
| 401 | if (!IsMaxsized()) |
| 402 | { |
| 403 | //bottom left corner |
| 404 | if (x >= left && x < left + borderWidth && |
| 405 | y < bottom && y >= bottom - borderWidth) |
| 406 | { |
| 407 | return HTBOTTOMLEFT; |
| 408 | } |
| 409 | //bottom right corner |
| 410 | if (x < right && x >= right - borderWidth && |
| 411 | y < bottom && y >= bottom - borderWidth) |
| 412 | { |
| 413 | return HTBOTTOMRIGHT; |
| 414 | } |
| 415 | //top left corner |
| 416 | if (x >= left && x < left + borderWidth && |
| 417 | y >= top && y < top + borderWidth) |
| 418 | { |
| 419 | return HTTOPLEFT; |
| 420 | } |
| 421 | //top right corner |
| 422 | if (x < right && x >= right - borderWidth && |
| 423 | y >= top && y < top + borderWidth) |
| 424 | { |
| 425 | return HTTOPRIGHT; |
| 426 | } |
| 427 | //left border |
| 428 | if (x >= left && x < left + borderWidth) |
| 429 | { |
| 430 | return HTLEFT; |
| 431 | } |
| 432 | //right border |
| 433 | if (x < right && x >= right - borderWidth) |
| 434 | { |
| 435 | return HTRIGHT; |
| 436 | } |
| 437 | //bottom border |
| 438 | if (y < bottom && y >= bottom - borderWidth) |