Skip to content

Commit

Permalink
IO: WantCaptureKeyboard is never set when ImGuiConfigFlags_NoKeyboard…
Browse files Browse the repository at this point in the history
… is enabled. (#4921)

+ Retroactively add missing changelog item in 1.90
+ Backends: Vulkan: use GetTexID() for consistency.
  • Loading branch information
ocornut committed Oct 11, 2024
1 parent 98d52b7 commit c4bc674
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions backends/imgui_impl_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,11 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
vkCmdSetScissor(command_buffer, 0, 1, &scissor);

// Bind DescriptorSet with font or user texture
VkDescriptorSet desc_set[1] = { (VkDescriptorSet)pcmd->TextureId };
VkDescriptorSet desc_set[1] = { (VkDescriptorSet)pcmd->GetTexID() };
if (sizeof(ImTextureID) < sizeof(ImU64))
{
// We don't support texture switches if ImTextureID hasn't been redefined to be 64-bit. Do a flaky check that other textures haven't been used.
IM_ASSERT(pcmd->TextureId == (ImTextureID)bd->FontDescriptorSet);
IM_ASSERT(pcmd->GetTexID() == (ImTextureID)bd->FontDescriptorSet);
desc_set[0] = bd->FontDescriptorSet;
}
vkCmdBindDescriptorSets(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, bd->PipelineLayout, 0, 1, desc_set, 0, nullptr);
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Other changes:
- IO: added 'void* platform_io.Renderer_RenderState' which is set during the
ImGui_ImplXXXX_RenderDrawData() of standard backend to expose selected render
state to draw callbacks. (#6969, #5834, #7468, #3590)
- IO: WantCaptureKeyboard is never set when ImGuiConfigFlags_NoKeyboard is enabled. (#4921)
- DrawList: AddCallback() added an optional size parameter allowing to copy and
store any amount of user data for usage by callbacks: (#6969, #4770, #7665)
- If userdata_size == 0: we copy/store the 'userdata' argument as-is (existing behavior).
Expand Down Expand Up @@ -480,6 +481,7 @@ Other changes:
which was pressed over void/underlying app, which is consistent/needed to allow the
mouse up event of a drag over void/underlying app to catch release. (#1392) [@Moka42]
- IO: Added io.ClearInputMouse() to clear mouse state. (#4921)
- IO: Added ImGuiConfigFlags_NoKeyboard for consistency and convenience. (#4921)
- Windows: BeginChild(): fixed a glitch when during a resize of a child window which is
tightly close to the boundaries of its parent (e.g. with zero WindowPadding), the child
position could have temporarily be moved around by erroneous padding application. (#7706)
Expand Down
11 changes: 8 additions & 3 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4998,9 +4998,14 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags()
}

// Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to Dear ImGui only, false = dispatch keyboard info to Dear ImGui + underlying app)
io.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL);
if (io.NavActive && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard))
io.WantCaptureKeyboard = true;
io.WantCaptureKeyboard = false;
if ((io.ConfigFlags & ImGuiConfigFlags_NoKeyboard) == 0)
{
if ((g.ActiveId != 0) || (modal_window != NULL))
io.WantCaptureKeyboard = true;
else if (io.NavActive && (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard))
io.WantCaptureKeyboard = true;
}
if (g.WantCaptureKeyboardNextFrame != -1) // Manual override
io.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0);

Expand Down

0 comments on commit c4bc674

Please sign in to comment.