| 389 | int ElaAppBar::takeOverNativeEvent(const QByteArray& eventType, void* message, qintptr* result) |
| 390 | #else |
| 391 | int ElaAppBar::takeOverNativeEvent(const QByteArray& eventType, void* message, long* result) |
| 392 | #endif |
| 393 | { |
| 394 | Q_D(ElaAppBar); |
| 395 | if ((eventType != "windows_generic_MSG") || !message) |
| 396 | { |
| 397 | return 0; |
| 398 | } |
| 399 | const auto msg = static_cast<const MSG*>(message); |
| 400 | const HWND hwnd = msg->hwnd; |
| 401 | if (!hwnd || !msg) |
| 402 | { |
| 403 | return 0; |
| 404 | } |
| 405 | d->_currentWinID = (qint64)hwnd; |
| 406 | const UINT uMsg = msg->message; |
| 407 | const WPARAM wParam = msg->wParam; |
| 408 | const LPARAM lParam = msg->lParam; |
| 409 | switch (uMsg) |
| 410 | { |
| 411 | case WM_WINDOWPOSCHANGING: |
| 412 | { |
| 413 | WINDOWPOS* wp = reinterpret_cast<WINDOWPOS*>(lParam); |
| 414 | if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) |
| 415 | { |
| 416 | wp->flags |= SWP_NOCOPYBITS; |
| 417 | *result = ::DefWindowProcW(hwnd, uMsg, wParam, lParam); |
| 418 | return 1; |
| 419 | } |
| 420 | return 0; |
| 421 | } |
| 422 | case WM_NCPAINT: |
| 423 | { |
| 424 | if (!eWinHelper->getIsCompositionEnabled()) |
| 425 | { |
| 426 | *result = FALSE; |
| 427 | return 1; |
| 428 | } |
| 429 | else |
| 430 | { |
| 431 | return -1; |
| 432 | } |
| 433 | } |
| 434 | case WM_NCACTIVATE: |
| 435 | { |
| 436 | if (eWinHelper->getIsCompositionEnabled()) |
| 437 | { |
| 438 | *result = ::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1); |
| 439 | } |
| 440 | else |
| 441 | { |
| 442 | *result = TRUE; |
| 443 | } |
| 444 | return 1; |
| 445 | } |
| 446 | case WM_SIZE: |
| 447 | { |
| 448 | if (wParam == SIZE_RESTORED) |
nothing calls this directly
no test coverage detected