|
@@ -7386,6 +7386,17 @@ void ImGui::SetKeyboardFocusHere(int offset)
|
|
|
IM_ASSERT(offset >= -1); // -1 is allowed but not below
|
|
|
IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere(%d) in window \"%s\"\n", offset, window->Name);
|
|
|
|
|
|
+ // It makes sense in the vast majority of cases to never interrupt a drag and drop.
|
|
|
+ // When we refactor this function into ActivateItem() we may want to make this an option.
|
|
|
+ // Note that g.ActiveId being stolen while g.MovingWindow != NULL is currently ill-defined (subtle side-effects on master, assert in docking),
|
|
|
+ // so there's another layer we need to fix. Would make sense to automatically drop g.MovingWindow when g.ActiveId is changed.
|
|
|
+ // MovingWindow is protected from most user inputs using SetActiveIdUsingNavAndKeys() but we may need to enforce a better more encompassing scheme.
|
|
|
+ if (g.DragDropActive || g.MovingWindow != NULL)
|
|
|
+ {
|
|
|
+ IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere() ignored while DragDropActive!\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
SetNavWindow(window);
|
|
|
|
|
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|