mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
parent
009276b6cb
commit
8241cd6284
@ -2927,6 +2927,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
|||||||
}
|
}
|
||||||
g.ActiveId = id;
|
g.ActiveId = id;
|
||||||
g.ActiveIdAllowOverlap = false;
|
g.ActiveIdAllowOverlap = false;
|
||||||
|
g.ActiveIdNoClearOnFocusLoss = false;
|
||||||
g.ActiveIdWindow = window;
|
g.ActiveIdWindow = window;
|
||||||
g.ActiveIdHasBeenEditedThisFrame = false;
|
g.ActiveIdHasBeenEditedThisFrame = false;
|
||||||
if (id)
|
if (id)
|
||||||
@ -2944,7 +2945,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
|||||||
|
|
||||||
void ImGui::ClearActiveID()
|
void ImGui::ClearActiveID()
|
||||||
{
|
{
|
||||||
SetActiveID(0, NULL);
|
SetActiveID(0, NULL); // g.ActiveId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SetHoveredID(ImGuiID id)
|
void ImGui::SetHoveredID(ImGuiID id)
|
||||||
@ -3301,6 +3302,7 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window)
|
|||||||
FocusWindow(window);
|
FocusWindow(window);
|
||||||
SetActiveID(window->MoveId, window);
|
SetActiveID(window->MoveId, window);
|
||||||
g.NavDisableHighlight = true;
|
g.NavDisableHighlight = true;
|
||||||
|
g.ActiveIdNoClearOnFocusLoss = true;
|
||||||
g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos;
|
g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos;
|
||||||
|
|
||||||
bool can_move_window = true;
|
bool can_move_window = true;
|
||||||
@ -6147,8 +6149,11 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
|||||||
ImGuiWindow* focus_front_window = window ? window->RootWindow : NULL; // NB: In docking branch this is window->RootWindowDockStop
|
ImGuiWindow* focus_front_window = window ? window->RootWindow : NULL; // NB: In docking branch this is window->RootWindowDockStop
|
||||||
ImGuiWindow* display_front_window = window ? window->RootWindow : NULL;
|
ImGuiWindow* display_front_window = window ? window->RootWindow : NULL;
|
||||||
|
|
||||||
// Steal focus on active widgets
|
// Steal active widgets. Some of the cases it triggers includes:
|
||||||
|
// - Focus a window while an InputText in another window is active, if focus happens before the old InputText can run.
|
||||||
|
// - When using Nav to activate menu items (due to timing of activating on press->new window appears->losing ActiveId)
|
||||||
if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != focus_front_window)
|
if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != focus_front_window)
|
||||||
|
if (!g.ActiveIdNoClearOnFocusLoss)
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
|
|
||||||
// Passing NULL allow to disable keyboard focus
|
// Passing NULL allow to disable keyboard focus
|
||||||
|
@ -1147,6 +1147,7 @@ struct ImGuiContext
|
|||||||
float ActiveIdTimer;
|
float ActiveIdTimer;
|
||||||
bool ActiveIdIsJustActivated; // Set at the time of activation for one frame
|
bool ActiveIdIsJustActivated; // Set at the time of activation for one frame
|
||||||
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
|
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
|
||||||
|
bool ActiveIdNoClearOnFocusLoss; // Disable losing active id if the active id window gets unfocused.
|
||||||
bool ActiveIdHasBeenPressedBefore; // Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch.
|
bool ActiveIdHasBeenPressedBefore; // Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch.
|
||||||
bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state.
|
bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state.
|
||||||
bool ActiveIdHasBeenEditedThisFrame;
|
bool ActiveIdHasBeenEditedThisFrame;
|
||||||
|
Loading…
Reference in New Issue
Block a user