mirror of
https://github.com/Drezil/imgui.git
synced 2025-09-17 16:43:14 +02:00
Merge misc changes from docking branch to reduce small drift.
In particular: - imgui.cpp : move UpdateInputEvents() higher in NewFrame() to match docking + update RenderMouseCursor() to match. - imgui_draw.cpp: ImDrawList::_ResetForNewFrame() change from c807192ab - Backends: SDL2. Add MouseWindowID + change SDL_CaptureMouse() test to match docking branch. Not strictly necessary but aimed at reducing drift because we go on and fork this file. + moved responsability of checking valid names to TabBarGetTabName() to simplify both branches.
This commit is contained in:
@ -254,7 +254,8 @@ static void ImGui_ImplWin32_UpdateMouseData()
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(bd->hWnd != 0);
|
||||
|
||||
const bool is_app_focused = (::GetForegroundWindow() == bd->hWnd);
|
||||
HWND focused_window = ::GetForegroundWindow();
|
||||
const bool is_app_focused = (focused_window == bd->hWnd);
|
||||
if (is_app_focused)
|
||||
{
|
||||
// (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
|
||||
@ -514,6 +515,7 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
||||
switch (msg)
|
||||
{
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
// We need to call TrackMouseEvent in order to receive WM_MOUSELEAVE events
|
||||
bd->MouseHwnd = hwnd;
|
||||
if (!bd->MouseTracked)
|
||||
@ -522,8 +524,10 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
||||
::TrackMouseEvent(&tme);
|
||||
bd->MouseTracked = true;
|
||||
}
|
||||
io.AddMousePosEvent((float)GET_X_LPARAM(lParam), (float)GET_Y_LPARAM(lParam));
|
||||
POINT mouse_pos = { (LONG)GET_X_LPARAM(lParam), (LONG)GET_Y_LPARAM(lParam) };
|
||||
io.AddMousePosEvent((float)mouse_pos.x, (float)mouse_pos.y);
|
||||
break;
|
||||
}
|
||||
case WM_MOUSELEAVE:
|
||||
if (bd->MouseHwnd == hwnd)
|
||||
bd->MouseHwnd = nullptr;
|
||||
|
Reference in New Issue
Block a user