1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-15 11:33:29 +01:00

Merge branch 'master' into docking

This commit is contained in:
ocornut 2023-07-04 16:22:25 +02:00
commit dc3e531ff2
3 changed files with 34 additions and 23 deletions

View File

@ -117,39 +117,41 @@ Breaking changes:
and relied on ambiguously defined design. Use 'SetNextItemAllowOverlap()' before item instead. and relied on ambiguously defined design. Use 'SetNextItemAllowOverlap()' before item instead.
- Renamed 'ImGuiTreeNodeFlags_AllowItemOverlap' to 'ImGuiTreeNodeFlags_AllowOverlap'. - Renamed 'ImGuiTreeNodeFlags_AllowItemOverlap' to 'ImGuiTreeNodeFlags_AllowOverlap'.
- Renamed 'ImGuiSelectableFlags_AllowItemOverlap' to 'ImGuiSelectableFlags_AllowOverlap' - Renamed 'ImGuiSelectableFlags_AllowItemOverlap' to 'ImGuiSelectableFlags_AllowOverlap'
- IsItemHovered: Changed behavior to return false when querying an item using AllowOverlap mode
which is being overlapped. Added ImGuiHoveredFlags_AllowWhenOverlappedByItem. (#6512, #3909, #517)
- Selectable, TreeNode: When using ImGuiSelectableFlags_AllowOverlap/ImGuiTreeNodeFlags_AllowOverlap
and holding item held, overlapping widgets won't appear as hovered. (#6512, #3909)
- Most item types should now work with SetNextItemAllowOverlap(). (#6512, #3909, #517)
- Fixed first frame of an overlap highlighting underlying item if previous frame didn't hover anything.
- Kept redirecting enums (will obsolete). - Kept redirecting enums (will obsolete).
Other changes: Other changes:
- Tooltips/IsItemHovered() related changes: - Tooltips/IsItemHovered() related changes:
- IsItemHovered: Added ImGuiHoveredFlags_Stationary to require mouse being
stationary when hovering a new item. Added style.HoverStationaryDelay (~0.15 sec).
Once the mouse has been stationary once the state is preserved for same item. (#1485)
- IsItemHovered: Added ImGuiHoveredFlags_ForTooltip as a shortcut for pulling flags
from style.HoverFlagsForTooltipMouse or style.HoverFlagsForTooltipNav. (#1485)
- style.HoverFlagsForTooltipMouse defaults to ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort
- style.HoverFlagsForTooltipNav defaults to ImGuiHoveredFlags_NoSharedDelay | ImGuiHoveredFlags_DelayNormal
- Tooltips: Added SetItemTooltip() and BeginItemTooltip() functions. - Tooltips: Added SetItemTooltip() and BeginItemTooltip() functions.
They are shortcuts for the common idiom of using IsItemHovered(). They are shortcuts for the common idiom of using IsItemHovered().
- SetItemTooltip("Hello") == if (IsItemHovered(ImGuiHoveredFlags_Tooltip)) { SetTooltip("Hello"); } - SetItemTooltip("Hello") == if (IsItemHovered(ImGuiHoveredFlags_Tooltip)) { SetTooltip("Hello"); }
- BeginItemTooltip() == IsItemHovered(ImGuiHoveredFlags_Tooltip) && BeginTooltip() - BeginItemTooltip() == IsItemHovered(ImGuiHoveredFlags_Tooltip) && BeginTooltip()
The newly added ImGuiHoveredFlags_Tooltip is meant to standardize mouse hovering The newly added ImGuiHoveredFlags_Tooltip is meant to facilitate standardizing
delays and rules for a whole application. mouse hovering delays and rules for a given application.
The previously common idiom of using 'if (IsItemHovered()) { SetTooltip(...); }' won't The previously common idiom of using 'if (IsItemHovered()) { SetTooltip(...); }'
use delay or stationary test. won't use delay or stationary test.
- IsItemHovered: Added ImGuiHoveredFlags_Stationary to require mouse being
stationary when hovering a new item. Added style.HoverStationaryDelay (~0.15 sec).
Once the mouse has been stationary once the state is preserved for same item. (#1485)
- IsItemHovered: Added ImGuiHoveredFlags_ForTooltip as a shortcut for pulling flags
from style.HoverFlagsForTooltipMouse or style.HoverFlagsForTooltipNav depending
on active inputs (#1485)
- style.HoverFlagsForTooltipMouse defaults to 'ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort'
- style.HoverFlagsForTooltipNav defaults to 'ImGuiHoveredFlags_NoSharedDelay | ImGuiHoveredFlags_DelayNormal'.
- Tooltips: Tweak default offset for non-drag and drop tooltips so underlying items - Tooltips: Tweak default offset for non-drag and drop tooltips so underlying items
isn't covered as much. (Match offset for drag and drop tooltips) isn't covered as much. (Match offset for drag and drop tooltips)
- IsItemHovered: Tweaked default value of style.HoverDelayNormal from 0.30 to 0.40, - IsItemHovered: Tweaked default value of style.HoverDelayNormal from 0.30 to 0.40,
Tweaked default value of style.HoverDelayShort from 0.10 to 0.15. (#1485) Tweaked default value of style.HoverDelayShort from 0.10 to 0.15. (#1485)
- IsItemHovered: Added _AllowWhenOverlappedByWindow to ignore window-overlap only. - IsItemHovered: Added ImGuiHoveredFlags_AllowWhenOverlappedByWindow to ignore window-overlap only.
Option ImGuiHoveredFlags_AllowWhenOverlapped now expand into a combination of both Option ImGuiHoveredFlags_AllowWhenOverlapped now expand into a combination of both
_AllowWhenOverlappedByWindow + _AllowWhenOverlappedByItem, matching old behavior. _AllowWhenOverlappedByWindow + _AllowWhenOverlappedByItem, matching old behavior.
- Overlapping items: (#6512, #3909, #517)
- Most item types should now work with SetNextItemAllowOverlap(). (#6512, #3909, #517)
- Fixed first frame of an overlap highlighting underlying item if previous frame didn't hover anything.
- IsItemHovered: Changed to return false when querying an item using AllowOverlap mode which
is being overlapped. Added ImGuiHoveredFlags_AllowWhenOverlappedByItem to opt-out. (#6512, #3909, #517)
- Selectable, TreeNode: When using ImGuiSelectableFlags_AllowOverlap/ImGuiTreeNodeFlags_AllowOverlap
and holding item held, overlapping widgets won't appear as hovered. (#6512, #3909)
- IsWindowHovered: Added support for ImGuiHoveredFlags_Stationary. - IsWindowHovered: Added support for ImGuiHoveredFlags_Stationary.
- IsWindowHovered, IsItemHovered: Assert when passed any unsupported flags. - IsWindowHovered, IsItemHovered: Assert when passed any unsupported flags.
- Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either - Tables: Fixed a regression in 1.89.6 leading to the first column of tables with either
@ -157,15 +159,16 @@ Other changes:
- CollapsingHeader/TreeNode: Fixed text padding when using _Framed+_Leaf flags. (#6549) [@BobbyAnguelov] - CollapsingHeader/TreeNode: Fixed text padding when using _Framed+_Leaf flags. (#6549) [@BobbyAnguelov]
- InputText: Fixed not returning true when buffer is cleared while using the - InputText: Fixed not returning true when buffer is cleared while using the
ImGuiInputTextFlags_EscapeClearsAll flag. (#5688, #2620) ImGuiInputTextFlags_EscapeClearsAll flag. (#5688, #2620)
- InputText: Fixed a crash on deactivating a ReadOnly buffer. (#6570, #6292, #4714)
- InputText: ImGuiInputTextCallbackData::InsertChars() accept (NULL,NULL) range, in order to conform - InputText: ImGuiInputTextCallbackData::InsertChars() accept (NULL,NULL) range, in order to conform
to common idioms (e.g. passing .data(), .data() + .size() from a null string). (#6565, #6566, #3615) to common idioms (e.g. passing .data(), .data() + .size() from a null string). (#6565, #6566, #3615)
- Combo: Made simple/legacy Combo() function not returns true when picking already selected item. - Combo: Made simple/legacy Combo() function not returns true when picking already selected item.
This is consistent with other widgets. If you need something else, you can use BeginCombo(). (#1182) This is consistent with other widgets. If you need something else, you can use BeginCombo(). (#1182)
- Clipper: Rework inner logic to allow functioning with a zero-clear constructor. - Clipper: Rework inner logic to allow functioning with a zero-clear constructor.
This is order to facilitate usage for language bindings (e.g cimgui or dear_binding) This is order to facilitate usage for language bindings (e.g cimgui or dear_binding)
where user may not be callinga constructor manually. (#5856) where user may not be calling a constructor manually. (#5856)
- Drag and Drop: Apply default behavior of drag source not reporting itself as hovered - Drag and Drop: Apply default behavior of drag source not reporting itself as hovered
at lower-level, so DragXXX, SliderXXX, InputXXX, Plot widgets are fullfilling it. at lower-level, so DragXXX, SliderXXX, InputXXX, Plot widgets are fulfilling it.
(Behavior doesn't apply when ImGuiDragDropFlags_SourceNoDisableHover is set). (Behavior doesn't apply when ImGuiDragDropFlags_SourceNoDisableHover is set).
- Modals: In the case of nested modal, made sure that focused or appearing windows are - Modals: In the case of nested modal, made sure that focused or appearing windows are
moved below the lowest blocking modal (rather than the highest one). (#4317) moved below the lowest blocking modal (rather than the highest one). (#4317)

View File

@ -25,7 +25,7 @@
// Library Version // Library Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
#define IMGUI_VERSION "1.89.7" #define IMGUI_VERSION "1.89.7"
#define IMGUI_VERSION_NUM 18970 #define IMGUI_VERSION_NUM 18971
#define IMGUI_HAS_TABLE #define IMGUI_HAS_TABLE
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch #define IMGUI_HAS_VIEWPORT // Viewport WIP branch
#define IMGUI_HAS_DOCK // Docking WIP branch #define IMGUI_HAS_DOCK // Docking WIP branch

View File

@ -4058,8 +4058,16 @@ void ImGui::InputTextDeactivateHook(ImGuiID id)
if (id == 0 || state->ID != id) if (id == 0 || state->ID != id)
return; return;
g.InputTextDeactivatedState.ID = state->ID; g.InputTextDeactivatedState.ID = state->ID;
g.InputTextDeactivatedState.TextA.resize(state->CurLenA + 1); if (state->Flags & ImGuiInputTextFlags_ReadOnly)
memcpy(g.InputTextDeactivatedState.TextA.Data, state->TextA.Data ? state->TextA.Data : "", state->CurLenA + 1); {
g.InputTextDeactivatedState.TextA.resize(0); // In theory this data won't be used, but clear to be neat.
}
else
{
IM_ASSERT(state->TextA.Data != 0);
g.InputTextDeactivatedState.TextA.resize(state->CurLenA + 1);
memcpy(g.InputTextDeactivatedState.TextA.Data, state->TextA.Data, state->CurLenA + 1);
}
} }
// Edit a string of text // Edit a string of text