mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-18 18:46:13 +01:00
Nav: Fixed issues with nav request being transferred to another window when calling SetKeyboardFocusHere() and simultaneous changing window focus. (#4449)
This commit is contained in:
parent
0b1bcfcc20
commit
076d8fc868
@ -82,6 +82,8 @@ Other Changes:
|
|||||||
- InputScalar: Automatically allow hexadecimal input when format is %X (without extra flag).
|
- InputScalar: Automatically allow hexadecimal input when format is %X (without extra flag).
|
||||||
- InputScalar: Automatically allow scientific input when format is float/double (without extra flag).
|
- InputScalar: Automatically allow scientific input when format is float/double (without extra flag).
|
||||||
- Nav: Fixed nav movement in a scope with only one disabled item from focusing the disabled item. (#5189)
|
- Nav: Fixed nav movement in a scope with only one disabled item from focusing the disabled item. (#5189)
|
||||||
|
- Nav: Fixed issues with nav request being transferred to another window when calling SetKeyboardFocusHere()
|
||||||
|
and simultaneous changing window focus. (#4449)
|
||||||
- IsItemHovered(): added ImGuiHoveredFlags_NoNavOverride to disable the behavior where the
|
- IsItemHovered(): added ImGuiHoveredFlags_NoNavOverride to disable the behavior where the
|
||||||
return value is overriden by focus when gamepad/keyboard navigation is active.
|
return value is overriden by focus when gamepad/keyboard navigation is active.
|
||||||
- InputText: Fixed pressing Tab emitting two tabs characters because of dual Keys/Chars events being
|
- InputText: Fixed pressing Tab emitting two tabs characters because of dual Keys/Chars events being
|
||||||
|
23
imgui.cpp
23
imgui.cpp
@ -7383,7 +7383,10 @@ void ImGui::SetKeyboardFocusHere(int offset)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
IM_ASSERT(offset >= -1); // -1 is allowed but not below
|
IM_ASSERT(offset >= -1); // -1 is allowed but not below
|
||||||
|
|
||||||
g.NavWindow = window;
|
g.NavWindow = window;
|
||||||
|
g.NavInitRequest = g.NavMoveSubmitted = g.NavMoveScoringItems = false;
|
||||||
|
|
||||||
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
||||||
NavMoveRequestSubmit(ImGuiDir_None, offset < 0 ? ImGuiDir_Up : ImGuiDir_Down, ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_FocusApi, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
|
NavMoveRequestSubmit(ImGuiDir_None, offset < 0 ? ImGuiDir_Up : ImGuiDir_Down, ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_FocusApi, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
|
||||||
if (offset == -1)
|
if (offset == -1)
|
||||||
@ -9574,8 +9577,11 @@ void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)
|
|||||||
// Note that window may be != g.CurrentWindow (e.g. SetFocusID call in InputTextEx for multi-line text)
|
// Note that window may be != g.CurrentWindow (e.g. SetFocusID call in InputTextEx for multi-line text)
|
||||||
const ImGuiNavLayer nav_layer = window->DC.NavLayerCurrent;
|
const ImGuiNavLayer nav_layer = window->DC.NavLayerCurrent;
|
||||||
if (g.NavWindow != window)
|
if (g.NavWindow != window)
|
||||||
g.NavInitRequest = false;
|
{
|
||||||
g.NavWindow = window;
|
g.NavWindow = window;
|
||||||
|
g.NavInitRequest = g.NavMoveSubmitted = g.NavMoveScoringItems = false;
|
||||||
|
NavUpdateAnyRequestFlag();
|
||||||
|
}
|
||||||
g.NavId = id;
|
g.NavId = id;
|
||||||
g.NavLayer = nav_layer;
|
g.NavLayer = nav_layer;
|
||||||
g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent;
|
g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent;
|
||||||
@ -9823,7 +9829,12 @@ static void ImGui::NavProcessItem()
|
|||||||
// Update window-relative bounding box of navigated item
|
// Update window-relative bounding box of navigated item
|
||||||
if (g.NavId == id)
|
if (g.NavId == id)
|
||||||
{
|
{
|
||||||
g.NavWindow = window; // Always refresh g.NavWindow, because some operations such as FocusItem() don't have a window.
|
if (g.NavWindow != window)
|
||||||
|
{
|
||||||
|
g.NavWindow = window; // Always refresh g.NavWindow, because some operations such as FocusItem() don't have a window.
|
||||||
|
g.NavInitRequest = g.NavMoveSubmitted = g.NavMoveScoringItems = false;
|
||||||
|
NavUpdateAnyRequestFlag();
|
||||||
|
}
|
||||||
g.NavLayer = window->DC.NavLayerCurrent;
|
g.NavLayer = window->DC.NavLayerCurrent;
|
||||||
g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent;
|
g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent;
|
||||||
g.NavIdIsAlive = true;
|
g.NavIdIsAlive = true;
|
||||||
@ -9901,10 +9912,11 @@ void ImGui::NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavM
|
|||||||
g.NavMoveScrollFlags = scroll_flags;
|
g.NavMoveScrollFlags = scroll_flags;
|
||||||
g.NavMoveForwardToNextFrame = false;
|
g.NavMoveForwardToNextFrame = false;
|
||||||
g.NavMoveKeyMods = g.IO.KeyMods;
|
g.NavMoveKeyMods = g.IO.KeyMods;
|
||||||
g.NavTabbingCounter = 0;
|
|
||||||
g.NavMoveResultLocal.Clear();
|
g.NavMoveResultLocal.Clear();
|
||||||
g.NavMoveResultLocalVisible.Clear();
|
g.NavMoveResultLocalVisible.Clear();
|
||||||
g.NavMoveResultOther.Clear();
|
g.NavMoveResultOther.Clear();
|
||||||
|
g.NavTabbingCounter = 0;
|
||||||
|
g.NavTabbingResultFirst.Clear();
|
||||||
NavUpdateAnyRequestFlag();
|
NavUpdateAnyRequestFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9971,7 +9983,7 @@ void ImGui::NavRestoreLayer(ImGuiNavLayer layer)
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (layer == ImGuiNavLayer_Main)
|
if (layer == ImGuiNavLayer_Main)
|
||||||
g.NavWindow = NavRestoreLastChildNavWindow(g.NavWindow);
|
g.NavWindow = NavRestoreLastChildNavWindow(g.NavWindow); // FIXME-NAV: Should clear ongoing nav requests?
|
||||||
ImGuiWindow* window = g.NavWindow;
|
ImGuiWindow* window = g.NavWindow;
|
||||||
if (window->NavLastIds[layer] != 0)
|
if (window->NavLastIds[layer] != 0)
|
||||||
{
|
{
|
||||||
@ -10451,7 +10463,6 @@ void ImGui::NavUpdateCreateTabbingRequest()
|
|||||||
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
||||||
ImGuiDir clip_dir = (g.NavTabbingDir < 0) ? ImGuiDir_Up : ImGuiDir_Down;
|
ImGuiDir clip_dir = (g.NavTabbingDir < 0) ? ImGuiDir_Up : ImGuiDir_Down;
|
||||||
NavMoveRequestSubmit(ImGuiDir_None, clip_dir, ImGuiNavMoveFlags_Tabbing, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
|
NavMoveRequestSubmit(ImGuiDir_None, clip_dir, ImGuiNavMoveFlags_Tabbing, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
|
||||||
g.NavTabbingResultFirst.Clear();
|
|
||||||
g.NavTabbingCounter = -1;
|
g.NavTabbingCounter = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
imgui.h
2
imgui.h
@ -65,7 +65,7 @@ Index of this file:
|
|||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.88 WIP"
|
#define IMGUI_VERSION "1.88 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18727
|
#define IMGUI_VERSION_NUM 18728
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user