Skip to content

Commit

Permalink
Backends: Win32, SDL, GLFW: only honor io.WantSetMousePos when focuse…
Browse files Browse the repository at this point in the history
…d + fix GLFW uninstalling handler + tweaks to reduce branch drift with docking. (ocornut#787, ocornut#2445, ocornut#2696, ocornut#3751, ocornut#4377)

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
#	backends/imgui_impl_win32.cpp
  • Loading branch information
ocornut authored and bojosos committed Nov 16, 2021
1 parent 134bf8a commit a6e5635
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backends/imgui_impl_vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ IMGUI_IMPL_API void ImGui_ImplVulkan_TransitionLayouts(Crowny::VulkanCmdB
#endif
IMGUI_IMPL_API ImTextureID ImGui_ImplVulkan_AddTexture(VkSampler sampler, VkImageView imageView, VkImageLayout imageLayout, Crowny::VulkanImage* image = nullptr);

#ifdef CW
IMGUI_IMPL_API ImTextureID ImGui_ImplVulkan_AddTexture(const Crowny::Ref<Crowny::Texture>& texture);
IMGUI_IMPL_API void ImGui_ImplVulkan_ClearTextures();
#include "Platform/Vulkan/VulkanCommandBuffer.h"
IMGUI_IMPL_API void ImGui_ImplVulkan_TransitionLayouts(Crowny::VulkanCmdBuffer* cmdBuffer);
#endif
IMGUI_IMPL_API ImTextureID ImGui_ImplVulkan_AddTexture(VkSampler sampler, VkImageView imageView, VkImageLayout imageLayout, Crowny::VulkanImage* image = nullptr);

// Optional: load Vulkan functions with a custom function loader
// This is only useful with IMGUI_IMPL_VULKAN_NO_PROTOTYPES / VK_NO_PROTOTYPES
IMGUI_IMPL_API bool ImGui_ImplVulkan_LoadFunctions(PFN_vkVoidFunction(*loader_func)(const char* function_name, void* user_data), void* user_data = NULL);
Expand Down
31 changes: 31 additions & 0 deletions imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4213,6 +4213,37 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
state->OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT);
state->OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT);
}
else if (hovered && io.MouseClickedCount[0] >= 2 && !io.KeyShift)
{
stb_textedit_click(state, &state->Stb, mouse_x, mouse_y);
const int multiclick_count = (io.MouseClickedCount[0] - 2);
if ((multiclick_count % 2) == 0)
{
int ext_len = 0;
for (int i = state->CurLenW - 1; i >= 0; i--)
{
ext_len++;
if (state->TextW[i] == '.')
break;
}
if (ext_len == state->CurLenW) // no . char in string.
ext_len = 0;
state->Select(0, ext_len);
state->SelectedAllMouseLock = true;
}
else
{
state->SelectAll();
state->SelectedAllMouseLock = true;
}
}
else if (hovered && is_osx && io.MouseDoubleClicked[0])
{
// Double-click select a word only, OS X style (by simulating keystrokes)
// Maybe worth doing this on all platforms? Shouldn't this be default behaviour?
state->OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT);
state->OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT);
}
else if (io.MouseClicked[0] && !state->SelectedAllMouseLock)
{
if (hovered)
Expand Down

0 comments on commit a6e5635

Please sign in to comment.