Commit Graph

4088 Commits

Author SHA1 Message Date
ocornut
44d98bfd6d Fix build with IMGUI_DISABLE_DEBUG_TOOLS 2022-11-04 16:35:57 +01:00
ocornut
529cba19b0 Debug Tools: Added DebugLocateItem()/DebugLocateItemOnHover() to visually locate items when hovering a 0xXXXXXXXX value. (#5855, #2673, #4631) 2022-11-04 16:06:34 +01:00
ocornut
7109f32f96 Internals: tidying up and stripping more of focus scope code. 2022-11-04 12:19:23 +01:00
ocornut
9f66a3a9ed Internals: rework FocusScope system, current scope doesn't need to be in window + child doesn't inherit.
Intended as part of work for input routing + blind menu processing shortcuts. Some of this commit will be stripped by next commit.
Intent was to sort windows along with focus scope to build a hierarchy, but for our needs we'd need a persistant one, so scrapping the idea. Not squashing this with next commit to keep a bit of history for future references.
2022-11-04 12:19:20 +01:00
ocornut
90e9465fa5 Window: Fixed position not being clamped while auto-resizing (#5843) 2022-11-02 12:36:41 +01:00
ocornut
6e9dfe1de1 Window: Auto-fit size takes account of work rectangle (menu bars eating from viewport). (#5843) 2022-11-02 12:36:22 +01:00
ocornut
22bcfca700 IO: Clear AppFocusLost in EndFrame() in order to allow backend or application code to poll and react to it
+ Amend a241dc7 with the same clearing of MouseDownDuration[] as keyboard ones.
2022-10-28 20:01:20 +02:00
ocornut
a241dc7990 IO: Fixed AddFocusEvent(false) to also clear MouseDown[] state. (#4921) 2022-10-27 20:17:19 +02:00
ocornut
a61bbdc239 Commented out redirecting OpenPopupContextItem() which was briefly the name of OpenPopupOnItemClick() from 1.77 to 1.79. 2022-10-26 22:22:53 +02:00
ocornut
baea25e657 Drag and Drop: extracted a RenderDragDropTargetRect() function (#1603) 2022-10-25 15:54:22 +02:00
ocornut
431fc6a7f6 Internals: using ItemAdd() consistently for internal items: windows & tables resize grips/borders, ScrollbarEx().
This put an extra flag check in ItemAdd() but essentially reduce inconsistency with windows decorations not using this. Useful for debugging.
It however buries the info/blurs the line about what it means to not use ItemAdd() since they are now doing it much less.
2022-10-24 22:54:29 +02:00
ocornut
178aee4b1c Debug Tools: Debug Log: add and use ImGuiTextLineIndex.
This is needed for next commit where we want to parse hovered Debug Log line.
2022-10-24 21:23:59 +02:00
ocornut
f6bd7c8e53 Debug Tools: Item Picker: remove IMGUI_DEBUG_TOOL_ITEM_PICKER_EX since it doesn't work on non-ItemHoverable() items anyway. (#2673)
Call stack difference not meaningful.
2022-10-21 18:32:40 +02:00
ocornut
bc918404fe Internals: using ImToUpper() since std one does too many things.
As a bonus side-effect may remove reliance on ctype.h (will see if CI complains)
2022-10-21 16:13:52 +02:00
ocornut
9a35bfea39 Internals: added temporary ImGuiItemStatusFlags_Visible (used internally - please do not use).
Used by BeginMenu() as I'm experimenting with blind menus honoring shortcuts.
Extra comments about KeyMap and ImGuiKeys
2022-10-21 14:57:10 +02:00
ocornut
5ac94ad898 Window: Fixed an issue where uncollapsed a window would show a scrollbar for a frame.
Amend / fix regression from 6e8e2c0
2022-10-18 16:43:38 +02:00
ocornut
08752b372e Menus, Popups: Experimental fix for issue where clicking on an open BeginMenu() item called from a window which is neither a popup neither a menu used to incorrectly close and reopen the menu. (#5775)
This works by moving the ClosePopupsOverWindow() in FocusWindow() in the if() block which luckily solves our problem.
In our test suite I couldn't find situation where this had side-effect others than BeginMenu() using the 'menuset_is_open' trick.
It's difficult to tell if other side-effects are possible: a window being already focused should mean it doesn't have popups overit.
Effectively this means that clicking e.g. on the BeginMenu() item to close a menu in a menu-bar now relies on BeginMenu() logic for the closure rather than FocusWindow() triggerd by button behavior.
2022-10-14 18:47:00 +02:00
ocornut
81176737f8 Menus: Fixed using IsItemHovered()/IsItemClicked() on BeginMenu(). (#5775) 2022-10-14 17:39:04 +02:00
ocornut
3e8d198133 Removed runtime patching of obsolete/invalid "%f"/"%.0f" types of format strings for DragInt()/SliderInt(). 2022-10-12 23:09:09 +02:00
ocornut
8a44c31c95 Scrolling: Further reduce unrelease mouse-wheel locked window timer + misc refactor (#2604, #3795, #4559)
The refactor are designed to minimize the diff for changes needed for #3795
2022-10-06 20:17:28 +02:00
ocornut
c7d3d22ae1 Scrolling: Mitigated issue where multi-axis mouse-wheel inputs (usually from touch pad events) are incorrectly locking scrolling in a parent window. (#4559, #3795, #2604) 2022-10-04 15:41:57 +02:00
ocornut
80a870a3e5 Scrolling: Tweak mouse-wheel locked window timer so it is shorter but also gets reset whenever scrolling again (#2604) + small refactor
Somehow interesting for (#3795, #4559). sorry this will break PR for 3795 but we got the info.
2022-10-04 15:34:17 +02:00
ocornut
f2a522d70d ImDrawList: Not using alloca() anymore, lift single polygon size limits. (#5704, #1811) 2022-09-30 15:58:55 +02:00
ocornut
cc5058e5d7 IO: Filter duplicate input events during the AddXXX() calls. (#5599, #4921) 2022-09-29 22:01:11 +02:00
ocornut
fac8295d6e IO: remove ImGuiInputEvent::IgnoredAsSame (revert part of 839c3100), will filter earlier in next commit. (#5599)
Making it a separate commit as this leads to much indentation change.
2022-09-29 22:00:38 +02:00
ocornut
9e7f460c09 Fixed GetKeyName() for ImGuiMod_XXX values, made invalid MousePos display in log nicer. (#4921, #456)
Amend fd408c9
2022-09-29 22:00:35 +02:00
ocornut
9f6aae3bf2 Nav: Fixed race condition pressing Esc during popup opening frame causing crash. 2022-09-29 19:48:27 +02:00
ocornut
bd2355a047 Menus, Nav: Fixed using left/right navigation when appending to an existing menu (multiple BeginMenu() call with same names). (#1207) 2022-09-29 19:25:26 +02:00
ocornut
3532ed1621 Menus, Nav: Fixed keyboard/gamepad navigation occasionally erroneously landing on menu-item in parent when the parent is not a popup. (#5730)
Replace BeginMenu/MenuItem swapping g.NavWindow with a more adequate ImGuiItemFlags_NoWindowHoverableCheck.
Expecting more subtle issues to stem from this.
Note that NoWindowHoverableCheck is not supported by IsItemHovered() but then IsItemHovered() on BeginMenu() never worked: fix should be easy in BeginMenu() + add test is IsItemHovered(), will do later
2022-09-29 18:44:19 +02:00
ocornut
d5d705069d Various comments
As it turns out, functions like IsItemHovered() won't work on an open BeginMenu() because LastItemData is overriden by BeginPopup(). Probably an easy fix.
2022-09-29 18:44:19 +02:00
ocornut
a725db17b7 Comments for flags discoverability + add to debug log (#3795, #4559) 2022-09-27 20:08:40 +02:00
ocornut
fd408c9790 Renamed and merged keyboard modifiers key enums and flags into a same set:. ImGuiKey_ModXXX -> ImGuiMod_XXX and ImGuiModFlags_XXX -> ImGuiMod_XXX. (#4921, #456)
Changed signature of GetKeyChordName() to use ImGuiKeyChord.
Additionally SetActiveIdUsingAllKeyboardKeys() doesn't set ImGuiKey_ModXXX but we never need/use those and the system will be changed in upcoming commits.
2022-09-26 10:43:26 +02:00
ocornut
f359dca0dc Misc input related changes to facilitate upcoming merges. 2022-09-22 19:00:30 +02:00
ocornut
4b522e145c Experiment: ImGuiKey is now a typed enum, allowing ImGuiKey_XXX symbols to be named in debuggers. (#4921, #4537)
May affect binding generators.
2022-09-20 12:42:29 +02:00
ocornut
1dd964f87d Popups & Modals: Fix (amended) somehow undocumented Popup+Child behavior (useful for e.g. #718, #4461 and probably other things)
(broken by 1c4066cd)
2022-09-16 23:27:16 +02:00
ocornut
440f257688 Popups & Modals: fixed nested Begin() being erroneously input-inhibited. (useful for e.g. #718, #4461 and probably other things) 2022-09-16 22:08:11 +02:00
tocic
2b1d8e3eaf Fix more typos in sources and docs (#5681) 2022-09-14 20:36:45 +02:00
tocic
6c3c9cea7f Fix typos in source comments (#5675) 2022-09-13 11:09:34 +02:00
ocornut
513c1ba996 Removed the bizarre legacy default argument for 'TreePush(const void* ptr = NULL)' (#1057)
Followup to e605f2179
2022-09-12 16:00:19 +02:00
ocornut
52d9ee0dc2 Tabs: Fixed ShrinkWidths() redistribution of remainder leading to infinite bug (second fix). (#5652, #5262)
Amend b137f31
2022-09-09 20:01:59 +02:00
ocornut
9e1ccf8fab Commented out redirecting functions/enums names that were marked obsolete in 1.77 and 1.78 (June 2020): (#3361)
- DragScalar(), DragScalarN(), DragFloat(), DragFloat2(), DragFloat3(), DragFloat4() with signature ending with (..., float power = 1.0f)
- SliderScalar(), SliderScalarN(), SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4() with signatures ending with (..., float power = 1.0f)
- BeginPopupContextWindow(const char*, ImGuiMouseButton, bool)
2022-09-05 14:38:00 +02:00
ocornut
edcd5b113e Obsoleted using SetCursorPos()/SetCursorScreenPos() to extend parent window/cell boundaries. (#5548)
This incorrect pattern has been mentioned or suggested in: #4510, #3355, #1760, #1490, #4152, #150
2022-09-02 16:37:35 +02:00
Rokas Kupstys
b3ea01d86f Menus: Fix sub-menu inhibition stopping working in some cases. (Amend WIP) (#2517, #5614, noticed in #5546)
Amend bda2cde6
Fixes the case where following menu hover sequence results in incorrect RestoreNavWindow (previously SourceWindow) pointing to opened sub-menu:
1. Hover "Menu -> Options" - Open ##Menu_01 window
2. Hover "Menu -> Colors"  - SourceWindow incorrectly points to ##Menu_01 window
2022-09-01 17:02:46 +02:00
ocornut
7f25143972 Better error reporting for PopStyleColor()/PopStyleVar() + easier to recover. (#1651) 2022-09-01 10:54:00 +02:00
ocornut
747c9a7adf IsKeyPressed(), IsMouseClicked(), GetKeyPressedAmount(): add a (normally unnecessary) test for ->Down next to ->DownDuration tests, facilitating the use of key eating mechanism.
Consider removing when we add support for input ownership.
2022-08-31 19:15:13 +02:00
ocornut
e13913ed57 IsItemHovered: Added ImGuiHoveredFlags_DelayNormal, ImGuiHoveredFlags_DelayShort, ImGuiHoveredFlags_NoSharedDelay. (#1485)
IsItemHovered() can't have a non-zero default, but higher-level tooltip helpers may enable a different default later.
2022-08-24 21:32:13 +02:00
ocornut
b3b3a07133 Nav: Fixed regression in e99c4fc preventing CTR+Tab to work without NavEnableKeyboard (#5504, #4023); 2022-08-24 14:45:11 +02:00
ocornut
72096bf698 Clipper: simplify code and remove cases where true is returned with empty display range as an extra step. 2022-08-23 15:40:07 +02:00
ocornut
07b9999de9 Debug Log: added 'Clipper' events logging. 2022-08-23 15:40:07 +02:00
ocornut
4eb9066997 Clipper: extract code into a ImGuiListClipper_StepInternal() to facilitate debugging. Moved clipper End() call to outer layer, stopped heretic use of comma operator.
Removed obsolete comments in clipper Begin()
2022-08-23 15:40:06 +02:00