mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-03 21:59:15 +08:00
Viewport: Fixed mouse hover flicker on mouse button release frame after moving a window. (#1542)
Platform: Clarifying some comments in back-ends.
This commit is contained in:
parent
679f4882a5
commit
e3e4b7bdf5
1
TODO.txt
1
TODO.txt
@ -262,6 +262,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- viewport: platform: introduce getfocus/setfocus api, so e.g. focus flags can be honored, imgui-side ctrl-tab can focus os window, OS alt-tab can focus imgui window etc.
|
||||
- viewport: store per-viewport/monitor DPI in .ini file so an application reload or main window changing DPI on reload can be properly patched for.
|
||||
- viewport: vulkan renderer implementation.
|
||||
- viewport: fallback calculation of hovered window is very currently wrong without ImGuiBackendFlags_HasMouseHoveredViewport. typically affect half-overlapping viewported menus.
|
||||
- viewport: need to clarify how to use GetMousePos() from a user point of view.
|
||||
|
||||
- inputs: we need an explicit flag about whether the imgui window is focused, to be able to distinguish focused key releases vs alt-tabbing all release behaviors.
|
||||
|
@ -504,7 +504,9 @@ void ImGui_ImplDX10_NewFrame()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Platform Interface (Optional, for multi-viewport support)
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
struct ImGuiViewportDataDx10
|
||||
@ -581,11 +583,7 @@ static void ImGui_ImplDX10_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
|
||||
ID3D10Texture2D* pBackBuffer = NULL;
|
||||
data->SwapChain->ResizeBuffers(0, (UINT)size.x, (UINT)size.y, DXGI_FORMAT_UNKNOWN, 0);
|
||||
data->SwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
|
||||
if (pBackBuffer == NULL)
|
||||
{
|
||||
fprintf(stderr, "ImGui_ImplDX10_SetWindowSize() can't created buffers.\n");
|
||||
return;
|
||||
}
|
||||
if (pBackBuffer == NULL) { fprintf(stderr, "ImGui_ImplDX10_SetWindowSize() failed creating buffers.\n"); return; }
|
||||
g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &data->RTView);
|
||||
pBackBuffer->Release();
|
||||
}
|
||||
|
@ -512,7 +512,9 @@ void ImGui_ImplDX11_NewFrame()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Platform Interface (Optional, for multi-viewport support)
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
struct ImGuiViewportDataDx11
|
||||
@ -589,11 +591,7 @@ static void ImGui_ImplDX11_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
|
||||
ID3D11Texture2D* pBackBuffer = NULL;
|
||||
data->SwapChain->ResizeBuffers(0, (UINT)size.x, (UINT)size.y, DXGI_FORMAT_UNKNOWN, 0);
|
||||
data->SwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
|
||||
if (pBackBuffer == NULL)
|
||||
{
|
||||
fprintf(stderr, "ImGui_ImplDX11_SetWindowSize() can't created buffers.\n");
|
||||
return;
|
||||
}
|
||||
if (pBackBuffer == NULL) { fprintf(stderr, "ImGui_ImplDX11_SetWindowSize() failed creating buffers.\n"); return; }
|
||||
g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &data->RTView);
|
||||
pBackBuffer->Release();
|
||||
}
|
||||
|
@ -637,7 +637,9 @@ void ImGui_ImplDX12_NewFrame(ID3D12GraphicsCommandList* command_list)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Platform Interface (Optional, for multi-viewport support)
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
struct ImGuiViewportDataDx12
|
||||
|
@ -317,9 +317,11 @@ void ImGui_ImplGlfw_NewFrame()
|
||||
ImGui::NewFrame();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
// Platform Windows
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
struct ImGuiViewportDataGlfw
|
||||
{
|
||||
|
@ -211,7 +211,9 @@ void ImGui_ImplOpenGL2_DestroyDeviceObjects()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Platform Interface (Optional, for multi-viewport support)
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
static void ImGui_ImplOpenGL2_RenderWindow(ImGuiViewport* viewport, void*)
|
||||
|
@ -330,7 +330,9 @@ void ImGui_ImplOpenGL3_DestroyDeviceObjects()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Platform Interface (Optional, for multi-viewport support)
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
static void ImGui_ImplOpenGL3_RenderWindow(ImGuiViewport* viewport, void*)
|
||||
|
@ -276,7 +276,9 @@ void ImGui_ImplSDL2_NewFrame(SDL_Window* window)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Platform Interface (Optional, for multi-viewport support)
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
struct ImGuiViewportDataSDL2
|
||||
|
@ -1059,7 +1059,10 @@ void ImGui_ImplVulkanH_DestroyWindowData(VkInstance instance, VkDevice device, I
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Platform Interface (Optional, for multi-viewport support)
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// FIXME-PLATFORM: Vulkan support unfinished
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -390,7 +390,9 @@ static void ImGui_ImplWin32_SetImeInputPos(ImGuiViewport* viewport, ImVec2 pos)
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Platform Windows
|
||||
// MULTI-VIEWPORT / PLATFORM INTERFACE SUPPORT
|
||||
// This is an _advanced_ and _optional_ feature, allowing the back-end to create and handle multiple viewports simultaneously.
|
||||
// If you are new to dear imgui or creating a new binding for dear imgui, it is recommended that you completely ignore this section first..
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
struct ImGuiViewportDataWin32
|
||||
|
@ -3357,7 +3357,11 @@ static void ImGui::UpdateMovingWindow()
|
||||
{
|
||||
UpdateTryMergeWindowIntoHostViewport(moving_window, g.MouseRefViewport);
|
||||
|
||||
// Clear the NoInput flag set by the Viewport system
|
||||
// Patch the mouse viewport so that we don't hover under the moved window during the mouse released frame
|
||||
if (!IsDragDropPayloadBeingAccepted())
|
||||
g.MouseRefViewport = moving_window->Viewport;
|
||||
|
||||
// Clear the NoInput window flag set by the Viewport system
|
||||
moving_window->Viewport->Flags &= ~ImGuiViewportFlags_NoInputs;
|
||||
|
||||
ClearActiveID();
|
||||
|
Loading…
Reference in New Issue
Block a user