mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
When the focused window become inactive don't restore focus to a window with the ImGuiWindowFlags_NoInputs flag. (#2213)
This commit is contained in:
parent
4a94b251fd
commit
baf67d393f
@ -37,6 +37,7 @@ Breaking Changes:
|
|||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
- When the focused window become inactive don't restore focus to a window with the ImGuiWindowFlags_NoInputs flag. (#2213) [@zzzyap]
|
||||||
- Examples: SDL: changed the signature of ImGui_ImplSDL2_ProcessEvent() to use a const SDL_Event*. (#2187)
|
- Examples: SDL: changed the signature of ImGui_ImplSDL2_ProcessEvent() to use a const SDL_Event*. (#2187)
|
||||||
|
|
||||||
|
|
||||||
|
@ -5289,8 +5289,10 @@ void ImGui::FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
for (int i = g.WindowsFocusOrder.Size - 1; i >= 0; i--)
|
for (int i = g.WindowsFocusOrder.Size - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
// We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user.
|
||||||
ImGuiWindow* window = g.WindowsFocusOrder[i];
|
ImGuiWindow* window = g.WindowsFocusOrder[i];
|
||||||
if (window != ignore_window && window->WasActive && !(window->Flags & ImGuiWindowFlags_ChildWindow))
|
if (window != ignore_window && window->WasActive && !(window->Flags & ImGuiWindowFlags_ChildWindow))
|
||||||
|
if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs))
|
||||||
{
|
{
|
||||||
ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window);
|
ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window);
|
||||||
FocusWindow(focus_window);
|
FocusWindow(focus_window);
|
||||||
@ -5672,6 +5674,8 @@ bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext)
|
// Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext)
|
||||||
|
// Note that NoNavFocus makes the window not reachable with CTRL+TAB but it can still be focused with mouse or programmaticaly.
|
||||||
|
// If you want a window to never be focused, you may use the e.g. NoInputs flag.
|
||||||
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
|
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
|
||||||
{
|
{
|
||||||
return window->Active && window == window->RootWindow && !(window->Flags & ImGuiWindowFlags_NoNavFocus);
|
return window->Active && window == window->RootWindow && !(window->Flags & ImGuiWindowFlags_NoNavFocus);
|
||||||
|
@ -732,7 +732,7 @@ struct ImGuiContext
|
|||||||
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
||||||
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest)
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest)
|
||||||
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame
|
||||||
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode?
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
||||||
ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
|
ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
|
||||||
int NavScoringCount; // Metrics for debugging
|
int NavScoringCount; // Metrics for debugging
|
||||||
ImGuiWindow* NavWindowingTarget; // When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) this window is temporarily displayed front-most.
|
ImGuiWindow* NavWindowingTarget; // When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) this window is temporarily displayed front-most.
|
||||||
|
Loading…
Reference in New Issue
Block a user