mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-31 03:53:44 +01:00
InputText: ensure mouse cursor is set regardless of whether keyboard mode is enabled or not. (#6417)
+ Nav comments (#8059)
This commit is contained in:
parent
20ae8bd4c3
commit
349af8766c
@ -73,6 +73,8 @@ Other changes:
|
|||||||
- Tables: fixed initial auto-sizing issue with synched-instances. (#8045, #7218)
|
- Tables: fixed initial auto-sizing issue with synched-instances. (#8045, #7218)
|
||||||
- InputText: fixed an issue with not declaring ownership of Delete/Backspace/Arrow keys,
|
- InputText: fixed an issue with not declaring ownership of Delete/Backspace/Arrow keys,
|
||||||
preventing use of external shortcuts not guarded by an ActiveId check. (#8048) [@geertbleyen]
|
preventing use of external shortcuts not guarded by an ActiveId check. (#8048) [@geertbleyen]
|
||||||
|
- InputText: ensure mouse cursor shape is set regardless of whether keyboard mode is
|
||||||
|
enabled or not. (#6417)
|
||||||
- Backends: DX11, DX12, SDLRenderer2/3. Vulkan, WGPU: expose selected state in
|
- Backends: DX11, DX12, SDLRenderer2/3. Vulkan, WGPU: expose selected state in
|
||||||
ImGui_ImplXXXX_RenderState structures during render loop. (#6969, #5834, #7468, #3590)
|
ImGui_ImplXXXX_RenderState structures during render loop. (#6969, #5834, #7468, #3590)
|
||||||
- Backends: DX9, DX10, DX11, DX12, OpenGL, Vulkan, WGPU: Changed default texture sampler
|
- Backends: DX9, DX10, DX11, DX12, OpenGL, Vulkan, WGPU: Changed default texture sampler
|
||||||
|
@ -4606,7 +4606,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flag
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g.NavDisableMouseHover)
|
if (g.NavDisableMouseHover && (item_flags & ImGuiItemFlags_NoNavDisableMouseHover) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -13340,8 +13340,11 @@ static void ImGui::NavUpdateCancelRequest()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were
|
// Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were
|
||||||
|
// FIXME-NAV: This should happen on window appearing.
|
||||||
if (g.NavWindow && ((g.NavWindow->Flags & ImGuiWindowFlags_Popup) || !(g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow)))
|
if (g.NavWindow && ((g.NavWindow->Flags & ImGuiWindowFlags_Popup) || !(g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow)))
|
||||||
g.NavWindow->NavLastIds[0] = 0;
|
g.NavWindow->NavLastIds[0] = 0;
|
||||||
|
|
||||||
|
// Clear nav focus
|
||||||
g.NavId = 0;
|
g.NavId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,6 +833,7 @@ enum ImGuiItemFlagsPrivate_
|
|||||||
ImGuiItemFlags_MixedValue = 1 << 12, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
ImGuiItemFlags_MixedValue = 1 << 12, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
||||||
ImGuiItemFlags_NoWindowHoverableCheck = 1 << 13, // false // Disable hoverable check in ItemHoverable()
|
ImGuiItemFlags_NoWindowHoverableCheck = 1 << 13, // false // Disable hoverable check in ItemHoverable()
|
||||||
ImGuiItemFlags_AllowOverlap = 1 << 14, // false // Allow being overlapped by another widget. Not-hovered to Hovered transition deferred by a frame.
|
ImGuiItemFlags_AllowOverlap = 1 << 14, // false // Allow being overlapped by another widget. Not-hovered to Hovered transition deferred by a frame.
|
||||||
|
ImGuiItemFlags_NoNavDisableMouseHover = 1 << 15, // false // Nav keyboard/gamepad mode doesn't disable hover.
|
||||||
|
|
||||||
// Controlled by widget code
|
// Controlled by widget code
|
||||||
ImGuiItemFlags_Inputable = 1 << 20, // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
|
ImGuiItemFlags_Inputable = 1 << 20, // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
|
||||||
|
@ -4462,9 +4462,13 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemFlags_Inputable))
|
if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemFlags_Inputable))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags);
|
|
||||||
|
// Ensure mouse cursor is set even after switching to keyboard/gamepad mode. May generalize further? (#6417)
|
||||||
|
bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.InFlags | ImGuiItemFlags_NoNavDisableMouseHover);
|
||||||
if (hovered)
|
if (hovered)
|
||||||
SetMouseCursor(ImGuiMouseCursor_TextInput);
|
SetMouseCursor(ImGuiMouseCursor_TextInput);
|
||||||
|
if (hovered && g.NavDisableMouseHover)
|
||||||
|
hovered = false;
|
||||||
|
|
||||||
// We are only allowed to access the state if we are already the active widget.
|
// We are only allowed to access the state if we are already the active widget.
|
||||||
ImGuiInputTextState* state = GetInputTextState(id);
|
ImGuiInputTextState* state = GetInputTextState(id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user