mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-01 11:39:15 +08:00
Comment on invalid comment regarding preserving keyboard focus of a closed window, due to commit 19d02becef
. This is probably still what we want. (followup #727)
This commit is contained in:
parent
eb405ab375
commit
23a81027e8
@ -1924,10 +1924,7 @@ bool ImGui::FocusableItemRegister(ImGuiWindow* window, bool is_active, bool tab_
|
||||
// Process keyboard input at this point: TAB, Shift-TAB switch focus
|
||||
// We can always TAB out of a widget that doesn't allow tabbing in.
|
||||
if (tab_stop && window->FocusIdxAllRequestNext == INT_MAX && window->FocusIdxTabRequestNext == INT_MAX && is_active && !g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab))
|
||||
{
|
||||
// Modulo on index will be applied at the end of frame once we've got the total counter of items.
|
||||
window->FocusIdxTabRequestNext = window->FocusIdxTabCounter + (g.IO.KeyShift ? (allow_keyboard_focus ? -1 : 0) : +1);
|
||||
}
|
||||
window->FocusIdxTabRequestNext = window->FocusIdxTabCounter + (g.IO.KeyShift ? (allow_keyboard_focus ? -1 : 0) : +1); // Modulo on index will be applied at the end of frame once we've got the total counter of items.
|
||||
|
||||
if (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent)
|
||||
return true;
|
||||
@ -2267,7 +2264,7 @@ void ImGui::NewFrame()
|
||||
}
|
||||
|
||||
// Pressing TAB activate widget focus
|
||||
// NB: Don't discard FocusedWindow if it isn't active, so that a window that go on/off programatically won't lose its keyboard focus.
|
||||
//// NB: Don't discard FocusedWindow if it isn't active, so that a window that go on/off programatically won't lose its keyboard focus. // [2016/07/17] That comment was made invalid by 19d02becef94e8e0f1d432a8bd55cd783876583c
|
||||
if (g.ActiveId == 0 && g.FocusedWindow != NULL && g.FocusedWindow->Active && !g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab, false))
|
||||
g.FocusedWindow->FocusIdxTabRequestNext = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user