| 2705 | #ifdef _WIN32 |
| 2706 | |
| 2707 | bool MainWindow::nativeEvent(const QByteArray& eventType, void* message, qintptr* result) |
| 2708 | { |
| 2709 | static constexpr const char win_type[] = "windows_generic_MSG"; |
| 2710 | if (eventType == QByteArray(win_type, sizeof(win_type) - 1)) |
| 2711 | { |
| 2712 | const MSG* msg = static_cast<const MSG*>(message); |
| 2713 | if (msg->message == WM_DEVICECHANGE && msg->wParam == DBT_DEVNODES_CHANGED) |
| 2714 | { |
| 2715 | g_emu_thread->reloadInputDevices(); |
| 2716 | *result = 1; |
| 2717 | return true; |
| 2718 | } |
| 2719 | |
| 2720 | if (msg->message == WM_INPUT) |
| 2721 | { |
| 2722 | UINT dwSize = 0; |
| 2723 | GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, nullptr, &dwSize, sizeof(RAWINPUTHEADER)); |
| 2724 | |
| 2725 | if (dwSize > 0) |
| 2726 | { |
| 2727 | std::vector<BYTE> lpb(dwSize); |
| 2728 | if (GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, lpb.data(), &dwSize, sizeof(RAWINPUTHEADER)) == dwSize) |
| 2729 | { |
| 2730 | const RAWINPUT* raw = reinterpret_cast<const RAWINPUT*>(lpb.data()); |
| 2731 | if (raw->header.dwType == RIM_TYPEMOUSE) |
| 2732 | { |
| 2733 | const RAWMOUSE& mouse = raw->data.mouse; |
| 2734 | if (mouse.usFlags == MOUSE_MOVE_ABSOLUTE || mouse.usFlags == MOUSE_MOVE_RELATIVE) |
| 2735 | { |
| 2736 | POINT cursorPos; |
| 2737 | if (GetCursorPos(&cursorPos)) |
| 2738 | checkMousePosition(cursorPos.x, cursorPos.y); |
| 2739 | } |
| 2740 | } |
| 2741 | } |
| 2742 | } |
| 2743 | } |
| 2744 | } |
| 2745 | |
| 2746 | return QMainWindow::nativeEvent(eventType, message, result); |
| 2747 | } |
| 2748 | |
| 2749 | #endif |
| 2750 |
nothing calls this directly
no test coverage detected