|
23 | 23 | // CHANGELOG
|
24 | 24 | // (minor and older changes stripped away, please see git history for details)
|
25 | 25 | // 2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
| 26 | +// 2024-09-16: [Docking] Inputs: fixed an issue where a viewport destroyed while clicking would hog mouse tracking and temporary lead to incorrect update of HoveredWindow. (#7971) |
26 | 27 | // 2024-07-08: Inputs: Fixed ImGuiMod_Super being mapped to VK_APPS instead of VK_LWIN||VK_RWIN. (#7768)
|
27 | 28 | // 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys, app back/forward keys.
|
28 | 29 | // 2023-09-25: Inputs: Synthesize key-down event on key-up for VK_SNAPSHOT / ImGuiKey_PrintScreen as Windows doesn't emit it (same behavior as GLFW/SDL).
|
@@ -114,7 +115,7 @@ struct ImGui_ImplWin32_Data
|
114 | 115 | {
|
115 | 116 | HWND hWnd;
|
116 | 117 | HWND MouseHwnd;
|
117 |
| - int MouseTrackedArea; // 0: not tracked, 1: client are, 2: non-client area |
| 118 | + int MouseTrackedArea; // 0: not tracked, 1: client area, 2: non-client area |
118 | 119 | int MouseButtonsDown;
|
119 | 120 | INT64 Time;
|
120 | 121 | INT64 TicksPerSecond;
|
@@ -705,6 +706,16 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
705 | 706 | }
|
706 | 707 | return 0;
|
707 | 708 | }
|
| 709 | + case WM_DESTROY: |
| 710 | + if (bd->MouseHwnd == hwnd && bd->MouseTrackedArea != 0) |
| 711 | + { |
| 712 | + TRACKMOUSEEVENT tme_cancel = { sizeof(tme_cancel), TME_CANCEL, hwnd, 0 }; |
| 713 | + ::TrackMouseEvent(&tme_cancel); |
| 714 | + bd->MouseHwnd = nullptr; |
| 715 | + bd->MouseTrackedArea = 0; |
| 716 | + io.AddMousePosEvent(-FLT_MAX, -FLT_MAX); |
| 717 | + } |
| 718 | + return 0; |
708 | 719 | case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
709 | 720 | case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
710 | 721 | case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
|
|
0 commit comments