From 204cb4d226951f98dc8bfc13c7bccff9995e2690 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 15 Feb 2023 15:35:50 +0100 Subject: [PATCH 1/3] Version 1.89.4 WIP --- docs/CHANGELOG.txt | 5 +++++ imgui.cpp | 2 +- imgui.h | 6 +++--- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- imgui_internal.h | 2 +- imgui_tables.cpp | 2 +- imgui_widgets.cpp | 2 +- 8 files changed, 14 insertions(+), 9 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 06f7e1af..09732689 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -31,6 +31,11 @@ HOW TO UPDATE? - Please report any issue! +----------------------------------------------------------------------- + VERSION 1.89.4 WIP (In Progress) +----------------------------------------------------------------------- + + ----------------------------------------------------------------------- VERSION 1.89.3 (Released 2023-02-14) ----------------------------------------------------------------------- diff --git a/imgui.cpp b/imgui.cpp index c39d19f9..6759bcd2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.3 +// dear imgui, v1.89.4 WIP // (main code and documentation) // Help: diff --git a/imgui.h b/imgui.h index 4c2c93b0..647fc3cd 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.89.3 +// dear imgui, v1.89.4 WIP // (headers) // Help: @@ -22,8 +22,8 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345') -#define IMGUI_VERSION "1.89.3" -#define IMGUI_VERSION_NUM 18930 +#define IMGUI_VERSION "1.89.4 WIP" +#define IMGUI_VERSION_NUM 18931 #define IMGUI_HAS_TABLE /* diff --git a/imgui_demo.cpp b/imgui_demo.cpp index aa2ed498..072a4410 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.3 +// dear imgui, v1.89.4 WIP // (demo code) // Help: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 97097cef..741ce0c7 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.3 +// dear imgui, v1.89.4 WIP // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index 6fd5aabf..c648b65f 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.89.3 +// dear imgui, v1.89.4 WIP // (internal structures/api) // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility. diff --git a/imgui_tables.cpp b/imgui_tables.cpp index ce5213e0..6b273f6d 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.3 +// dear imgui, v1.89.4 WIP // (tables and columns code) /* diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index fc71faff..27731f4f 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.89.3 +// dear imgui, v1.89.4 WIP // (widgets code) /* From 4f630b04491c3fc2febefa93b4095bd4754c1573 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 15 Feb 2023 16:43:08 +0100 Subject: [PATCH 2/3] imgui_freetype: fixed non-ASCII characters in sources. (#6166) --- misc/freetype/imgui_freetype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index 17700f16..69417d7b 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -52,7 +52,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used -#pragma GCC diagnostic ignored "-Wsubobject-linkage" // warning: 'xxxx' has a field ‘xxxx’ whose type uses the anonymous namespace +#pragma GCC diagnostic ignored "-Wsubobject-linkage" // warning: 'xxxx' has a field 'xxxx' whose type uses the anonymous namespace #endif //------------------------------------------------------------------------- From 5d74891285d97fe4160690389296d1448aa24afa Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 15 Feb 2023 17:17:34 +0100 Subject: [PATCH 3/3] Backends: Win32: Use WM_NCMOUSEMOVE / WM_NCMOUSELEAVE to track mouse positions over non-client area (OS decorations) when app is not focused. (#6045, #6162) --- backends/imgui_impl_win32.cpp | 36 +++++++++++++++++++++++++---------- docs/CHANGELOG.txt | 10 +++++++++- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/backends/imgui_impl_win32.cpp b/backends/imgui_impl_win32.cpp index 7ebb58c5..7cc57178 100644 --- a/backends/imgui_impl_win32.cpp +++ b/backends/imgui_impl_win32.cpp @@ -34,6 +34,7 @@ typedef DWORD (WINAPI *PFN_XInputGetState)(DWORD, XINPUT_STATE*); // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2023-02-15: Inputs: Use WM_NCMOUSEMOVE / WM_NCMOUSELEAVE to track mouse position over non-client area (e.g. OS decorations) when app is not focused. (#6045, #6162) // 2023-02-02: Inputs: Flipping WM_MOUSEHWHEEL (horizontal mouse-wheel) value to match other backends and offer consistent horizontal scrolling direction. (#4019, #6096, #1463) // 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11. // 2022-09-28: Inputs: Convert WM_CHAR values with MultiByteToWideChar() when window class was registered as MBCS (not Unicode). @@ -84,7 +85,7 @@ struct ImGui_ImplWin32_Data { HWND hWnd; HWND MouseHwnd; - bool MouseTracked; + int MouseTrackedArea; // 0: not tracked, 1: client are, 2: non-client area int MouseButtonsDown; INT64 Time; INT64 TicksPerSecond; @@ -267,7 +268,8 @@ static void ImGui_ImplWin32_UpdateMouseData() } // (Optional) Fallback to provide mouse position when focused (WM_MOUSEMOVE already provides this when hovered or captured) - if (!io.WantSetMousePos && !bd->MouseTracked) + // This also fills a short gap when clicking non-client area: WM_NCMOUSELEAVE -> modal OS move -> gap -> WM_NCMOUSEMOVE + if (!io.WantSetMousePos && bd->MouseTrackedArea == 0) { POINT pos; if (::GetCursorPos(&pos) && ::ScreenToClient(bd->hWnd, &pos)) @@ -515,25 +517,39 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA switch (msg) { case WM_MOUSEMOVE: + case WM_NCMOUSEMOVE: { // We need to call TrackMouseEvent in order to receive WM_MOUSELEAVE events + const int area = (msg == WM_MOUSEMOVE) ? 1 : 2; bd->MouseHwnd = hwnd; - if (!bd->MouseTracked) + if (bd->MouseTrackedArea != area) { - TRACKMOUSEEVENT tme = { sizeof(tme), TME_LEAVE, hwnd, 0 }; - ::TrackMouseEvent(&tme); - bd->MouseTracked = true; + TRACKMOUSEEVENT tme_cancel = { sizeof(tme_cancel), TME_CANCEL, hwnd, 0 }; + TRACKMOUSEEVENT tme_track = { sizeof(tme_track), (DWORD)((area == 2) ? (TME_LEAVE | TME_NONCLIENT) : TME_LEAVE), hwnd, 0 }; + if (bd->MouseTrackedArea != 0) + ::TrackMouseEvent(&tme_cancel); + ::TrackMouseEvent(&tme_track); + bd->MouseTrackedArea = area; } POINT mouse_pos = { (LONG)GET_X_LPARAM(lParam), (LONG)GET_Y_LPARAM(lParam) }; + if (msg == WM_NCMOUSEMOVE && ::ScreenToClient(hwnd, &mouse_pos) == FALSE) // WM_NCMOUSEMOVE are provided in absolute coordinates. + break; io.AddMousePosEvent((float)mouse_pos.x, (float)mouse_pos.y); break; } case WM_MOUSELEAVE: - if (bd->MouseHwnd == hwnd) - bd->MouseHwnd = nullptr; - bd->MouseTracked = false; - io.AddMousePosEvent(-FLT_MAX, -FLT_MAX); + case WM_NCMOUSELEAVE: + { + const int area = (msg == WM_MOUSELEAVE) ? 1 : 2; + if (bd->MouseTrackedArea == area) + { + if (bd->MouseHwnd == hwnd) + bd->MouseHwnd = nullptr; + bd->MouseTrackedArea = 0; + io.AddMousePosEvent(-FLT_MAX, -FLT_MAX); + } break; + } case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 09732689..642a1ac3 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -35,6 +35,14 @@ HOW TO UPDATE? VERSION 1.89.4 WIP (In Progress) ----------------------------------------------------------------------- +Breaking Changes: + +Other changes: + +- Backends: Win32: Use WM_NCMOUSEMOVE / WM_NCMOUSELEAVE to track mouse positions over + non-client area (e.g. OS decorations) when app is not focused. (#6045, #6162) + + ----------------------------------------------------------------------- VERSION 1.89.3 (Released 2023-02-14) @@ -50,7 +58,7 @@ Breaking Changes: - imgui_impl_sdl.h -> imgui_impl_sdl2.h - example_sdl_xxxx/ -> example_sdl2_xxxx/ (folders and projects) -All changes: +Other changes: - SeparatorText(): Added SeparatorText() widget. (#1643) [@phed, @ocornut] - Added to style: float SeparatorTextBorderSize.