InputTextEx: do not set WantTextInputNextFrame during the frame Input…#6341
InputTextEx: do not set WantTextInputNextFrame during the frame Input…#6341lukaasm wants to merge 1 commit intoocornut:masterfrom lukaasm:master
Conversation
…Text is deactivated
|
Thanks! This looks correct but out of curiosity could you clarify how/why this was a problem for you ? |
|
Yes, when making modal dialogs that are "acceptable" with Enter key I was looking for a way to allow/handle that even when single/multi-line InputText was active, I found a "way" where I can handle Esc/Enter keys without side-effects when Without this fix, a double Enter press is needed to 'Accept' dialog. |
|
I am not sure I understand wgy you aren’t using eg GetActiveID() == 0 or GetActiveID() != GetID(“##input1”); ? |
|
Because it is a "generic" DrawDialogButtons function that doesn't know about surrounding widgets, so checking for every possible InputText is not possible. Pseudocode: And |
|
I see. You can use the Input Owner aware variant of GetKeyPressed() (currently in imgui_internal.h) specifying an owner id of ImGuiKeyOwner_None and you’ll only get the key if no one is claiming it, which may be a little more correct. Either way I’ll merge your PR soon (not in front of a computer atm). |
Thanks, I will look into it |
|
Merged as 0948cfc, thank you! |
* origin/docking-dev: (1059 commits) Backends: Vulkan: Fix failing assertion for platforms where viewports are not supported (ocornut#8734) Backends: GLFW: Fixed not installing WndProc hook in all GLFW version, so AddMouseSourceEvent() logic was missing for some viewports. Backends: GLFW: Fixed crash when using GLFW 3.3 (ocornut#8713, ocornut#8676, ocornut#8239, ocornut#8069) Backends: warning fixes (for docking branch). Backends: GLFW: amend for multi-context support with multi-viewport. (ocornut#8676, ocornut#8239, ocornut#8069) Backends: OSX: ImGui_ImplOSX_HandleEvent() only process event for window containing our viewports. Amend 7ac99a4 for docking. (ocornut#8644) Fixed duplicate symbols in some compile-time configurations. Fonts: Misc merge fixes. Examples: set ConfigDpiScaleFonts / ConfigDpiScaleViewports in all examples already setup for scaling. Backends: GLFW, SDL2, SDL3, update for docking to use helpers. (Breaking) renamed/moved ImGuiConfigFlags_DpiEnableScaleFonts -> ioConfigDpiScaleFonts, ImGuiConfigFlags_DpiEnableScaleViewports -> io.ConfigDpiScaleViewports Backends: Win32: Viewports: handle WM_DPICHANGED in backend when ImGuiConfigFlags_DpiEnableScaleViewports flag is enabled. Viewports: fixed handling of simultaneous move + resize (e.g. toggling maximized) when ImGuiConfigFlags_DpiEnableScaleViewports is enabled. Refactor: move SetCurrentFont(), PushFont(), PopFont() to a section. Platform IME: Fixed multi-viewports IME support, affecting SDL backends. (ocornut#8648, ocornut#8584, ocornut#7492, ocornut#6341) Viewports: added per-viewport FramebufferScale, Platform_GetWindowFramebufferScale() + Backends: GLFW, SDL2, SDL3, Apple: added support. (ocornut#1065, ocornut#1542, ocornut#1676, ocornut#1786, ocornut#2826, ocornut#3757, ocornut#5081, ocornut#5580, ocornut#5592, ocornut#6465, ocornut#7273, ocornut#7779 etc.) ) Backends: OSX: rename internal struct for consistency with other backends. Viewports: fallback DpiScale pulled from fallback Monitor for consistency. Backends: Vulkan: fixed build with VK_NO_PROTOTYPES. Backends: Vulkan: fixed validation errors during window detach in multi-viewport mode. [docking branch amend] (ocornut#8600, ocornut#8176) ...
…Text is deactivated
Currently, when InputText is active and is forced to be deactivated with Enter/Escape key it still requests
WantTextInputNextFrameto be set for the next frame which makesWantTextInputflag to linger one frame longer than it needs to.