-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New IO event API: io.AddKeyEvent(), io.AddMousePosEvent() etc + full range of ImGuiKey values w/ backward compatibility #4858
Comments
So I have tested this new event feature on my old project (https://github.com/jokteur/BM-Segmenter). I haven't touched the code in months, so first I had to make sure that it worked with last version of ImGui (1.86) with the docking branch enabled. Configuration of projectI am using the glfw backend with OpenGl3. I am working with docking and multi-viewports enabled. Last working working version: 1.86. I am on windows 10, working with Visual Studio. Testing of the branchI checkout imgui to the branch https://github.com/ocornut/imgui/tree/features/extra-keys-and-key-event-docking. It compiled without problems, but the first problem I encountered when opening the program was: Now, the program works, and I don't have any event related problems to report. I can type any characters in text inputs no problems so far. Testing of GLFW backend in 09b03a6I tried using the latest update in 09b03a6 (still with Things to testI am using a custom module for handling shortcuts (see here and here ; the code is a mess, sorry). This module allows me to do global shortcuts, local shortcuts (which override global shortcuts), timed shortcuts, ... However, I am using GLFW keycodes to handle the shortcuts. I would still need to rewrite this module using the new ImGui key events. |
Thanks for testing!
The first issue was fixed this morning in the main branch (but didn’t backport the fix in the -docking one, my bad).
The second I believe relate to code that is different between master and docking branch (the IME stuff) which I forgot to finish reworking. Changes were needed to make IME work on multiple viewports.
|
Off-topic: your message prompted me to do the small Platform IME refactor that caused some backends to be incompatible between master and docking. This is now all done. (starting from 3a90dc3 on master + small other features, and the docking 704ab11), so this is also fixed. |
Added a few back and forth this has been tweaked, improved, merged and applied to all backends! |
Thats very cool update but: What about mouse keys to keyboard and vice versa (I mean to enable you writing shortcuts (or something based on input) device-independent). AFAIK unity engine includes mouse button into keymap (https://docs.unity3d.com/ScriptReference/KeyCode.Mouse0.html) so can it be the case? |
Do you use and need those features ?
|
If you are adding custom keymap ability to your app then you are assuming user can bind command either to ctrl+v (other world) or rmb-click (terminal specific) or mmb-click (realistic scenario) and you dont wanna check every case or storing keybind as sick union of key+mousekey. Honestly I think that input device unification can make archtecture much simpler and not to break backwards compatibility (old mouse checks just would be redirected to new enum inside keyboard space It is sick to see how people are installing third party apps (ref: xmouse button control) on top of everything to get such simple stuff like binding something to mouse One more case I've just remembered is mouse buttons 4+ (which are really used for shortcuts most of times. And again people are having to use external solution inside most of the apps) As for me, I've used KeyCode.MouseX in unity3d many times, especially for key binding and it I've found it pretty comfy. Unity has 4 ways of handling mouse input and KeyCode way was the most usable for me |
956e030 looked like it worked nicely without any code modifications on my custom backend. This was probably already discussed, but couldn't find it sorry, the keysym names are custom or based on some convention? |
ImGui already used |
Moved to #4921 now that things have settled. |
IMPORTANT: If you have updated backends between January 10 and January 27 All backends have been updated. This only applies to you if you updated standard or custom backend between January 10 and January 27. If you use standard backends, simply update. If you use a custom backend change code above. |
…4921, ocornut#4858) + Snuck in unrelated comments and removed the "fill once" comment (ocornut#5043)
…ified key enum system. Backends: update most. (ocornut#4921, ocornut#4858) Sorry this is an unusual breaking but since we are WIP it is a good time to make a correction.
…n favor of unified key enum system. (ocornut#4921, ocornut#4858)
…4921, ocornut#4858) + Snuck in unrelated comments and removed the "fill once" comment (ocornut#5043)
… InputText() is not active. (ocornut#4921, ocornut#4858)
* Docking: added comments. added experimental TabItemFlagsOverrideSet to ImGuiWindowClass. (Could probably do something similar with TabBarFlagsOverrideSet+Clear for ocornut#2700 later.) * Docking: docked window honor tab and text colors by storing them. (ocornut#2771) Later to lead into ocornut#2700 and ocornut#2539 Move tab submission block above in DockNodeUpdateTabBar(), not strictly necessary for this change as is, but useful if needing to apply override for TitleBg* as we'd need a value for node->VisibleWindow earlier than currently set. * Fixed some compile warnings with Clang on Windows (ocornut#3754) * Viewports, Backends: Vulkan: handle VK_ERROR_OUT_OF_DATE_KHR when resizing secondary viewport (ocornut#3766, ocornut#3758) Cannot repro here but appears to a user on Linux. Fix may be not super solid. * Docking: on node split, update memorized DockId for currently closed windows (ocornut#3716) Amended by @ocornut with same fix in DockBuilderRemoveNodeChildNodes(). * Docking: fix gap in hit test hold when using ImGuiDockNodeFlags_PassthruCentralNode touching the edge of a viewport. (ocornut#3733) * Viewports: (breaking) removed ImGuiPlatformIO::MainViewport which is now pretty much unused and duplicate (and misleading as we will evolve the concept) Use GetMainViewport() if stuck. * Viewports: Moved in own section of imgui.h ahead of merging a small part of viewport interface to master. * Viewports: trying to treat GetMainViewport() as const. Reducing unnecessary casts of ImGuiViewportP* Metrics: readded root Drawlists node in metrics to match master. The (void*) casts are implying const-casst but currently left GetMainViewport() as returning non-const. * Viewports: (Breaking) turned GetWorkPos(), GetWorkSize() into straight fields -> WorkPos, WorkSize before exposing in master branch. * Fix for compiling imgui_internal.h without operators + made GetWorkRect() consistent with clamped WorkSize. * Misc tweaks - mostly toward minimizing diff in upcoming backport merge of a few viewport structures in master * Viewports: Fix issue inferring viewport z-order when new popups gets created. (ocornut#3734) + Metrics updates. Revert 6bc5266 Showing inferred order and missing flags in metrics. * Viewports: Setting the new (currently dummy) flags on viewports. (ocornut#3789, ocornut#1542, ocornut#3680, ocornut#3350, ocornut#3012, ocornut#2471) Amend the merging of f14042c (merge ee59d7a) * Remove redundant GetMainViewport decl in imgui.h (ocornut#3801, ocornut#3800) * Docking: Made close button enable logic consistent on dockspace. When no docked window have a close button or it is disabled on the node, the space is given to tabs. Clarified close_button_is_visible vs close_button_is_enabled behavior in DockNodeUpdateTabBar().. (ocornut#3633, ocornut#3521) Reduced alpha of disabled close button a little bit further. Removed 'EnableCloseButton' which was actually unused (can't be infered early, need ->VisibleWindow anyway, which is not == ->ActiveWindow) * Examples: DX9-DX11: Removed half-assed DPI awareness enable. Updated Docking/Viewports part of Changelog (e.g. removed bits that are now already in master, clarified some added bits) * Viewports: Fix setting of ImGuiViewportFlags_NoRendererClear. (ocornut#3213) * Internals: Add a way to request window to not process any interactions for specified number of frames. * Added missing IMGUI_API to internal docking-related structs. (ocornut#3850) * Internals: Docking: some renaming. * Internals: rename RootWindow->RootWindowDockTree, RootWindowDockStop->RootWindow. Why? So by default RootWindow matches user expectation on both branches, and RootWindowDockTree is more intentful. (Actually should reduce diff between master<>docking) * Viewports, Backend: SDL: Fix missing ImGuiBackendFlags_HasSetMousePos flag in docking branch (ok in master), GLFW: Fix application of WantSetMousePos. (ocornut#1542, ocornut#787) Shows how little this feature is used with nav (was designed for small devices and frankly may be dropped) - but the backend support itself we will make use of for other features. * Viewports, Internals: added GetViewportPlatformMonitor() will a safety net to keep code portable + simplified handling of disconnected monitor in Begin(). * ImDrawFlags: rework/revert c2d6d26 + 39432bf in a way that is closer to old version and back to opt-in but with default 0 = all corners. * Removed deprecated flag stopping compilation (ocornut#3902) * Docking: Dockspace() never draws a background. (ocornut#3924) * Docking: undocking nodes/windows covering most of the monitor max their size down to 90% to ease further manipulations. Kind of a welcome hack. * Docking: Add support for split_outer in DockContextCalcDropPosForDocking(). Misc: Add FIXME regarding behavior of some window fields. * Viewports, Backends: Vulkan: Rebuild swapchain on VK_SUBOPTIMAL_KHR. (ocornut#3881) * BeginMainMenuBar(): remove expectation that we don't know menu bar height ahead, allowing up to generalize placement in any direction (will be done in master) Amend 75de34e * Viewports: Hotfix for crash in monitor array access, caused by 4b9bc49. (ocornut#3967) * TabBar: Use mouse position instead of hardcoded +1/-1 offset when reordering tabs. Fixes tab reordering in test engine when using fast mode. # Conflicts: # imgui_widgets.cpp * TabBar: Amend previous commit. Fix tab reordering when tab bar has scrolling. Some tidying up with helpers + honor 16-bit offsets as with other tab bar features (unlikely single reorder can reach that but consistent) * Backends, Viewports: GLFW: Add a workaround for stuck keys after closing a GLFW window (ocornut#3837). * Docking: DockSpace() returns its node ID + adding branch changelog. * Docking: fix undocking from tab-bar by moving mouse horizontally, broken by d705192. * Docking: removed io.ConfigDockingWithShift option. (ocornut#2109) * Docking: fix undocking from tab-bar by moving mouse horizontally, amend 3ed07a8 + d705192. Automation system may drag e.g. right-most tab far left (and vice-versa) and one frame and our current logic would fail at it. * Fix popup positioning, broken by 84e6fe4. (ocornut#3991, ocornut#3982) * Docking: Fixed restoring of tab order within a dockspace or a split node. (tests in "docking_tab_order") * Docking: Fixed multiple simultaneously reappearing window from appearing undocked in their initial frame. * Docking: Fixed reappearing docked windows with no close button showing a tab with extraneous space for one frame. * Docking: move NavWindow to SelectedTabId application lower to leave a chance for in-between code to alter focus. + store per-node window menu button id to simplify usage. * Docking: Fix window menu button. Broken by 3f16a52 (ocornut#4043) Worked on single-frame click. * Changelog: added docking+entries from 1.72 to 1.82 to increase their visibility. * Backends: Vulkan: Fix for using IMGUI_IMPL_VULKAN_NO_PROTOTYPES (ocornut#4151, ocornut#3759, ocornut#3227) * Docking: Docking node tab bar honors ItemInnerSpacing.x before first tab. Tweak rendering and alignment of dock node menu marker. (ocornut#4130) + Fix ~0 in EndFrameDrawDimmedBackgrounds() which is obsolete way of signifying "all round corners". * Docking: Fix IsWindowAppearing() and ImGuiCond_Appearing on docked windows. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061) * Docking: Amend 91704b7, window->DockXXX booleans not properly cleared when window not docked. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061) Fix issue with freshly split windows/nodes incorrectly returning true to IsWindowAppearing(). * Docking: Fix IsWindowAppearing() unnecessarily returning true twice in a row. (ocornut#4177, ocornut#3982, ocornut#1497, ocornut#1061) + added a zealous assert. * Docking: Clicking on the right-most close button of a docking node closes all windows. (ocornut#4186) * Docking: comments (ocornut#4189) * Added PushDisabled(), PopDisabled() currently only exposed in imgui_internal.h (ocornut#211) * ImVector: added clear_delete(), clear_destruct() helpers. # Conflicts: # imgui.cpp * Nav, Drag and Drop, Docking: fixed two issues leading nav result to conflict with moving a window. (ocornut#4211, ocornut#3025) * Backends, Viewports: Vulkan: Fix the use of the incorrect fence in wait for fence. (ocornut#4208) The fence being waited upon was not the one associated with the current frame. This results in validation error detecting a reset of command buffers still in use and resetting fences while still in use. Read more details in ocornut#4208 * Metrics: Tentative fix for bad printf format. Ref b53b8f5, a7a1b3b * Viewport: extracted code out of Begin() into WindowSyncOwnedViewport() - no other change * Viewports: Fix popup/tooltip created without a parent window from being given a ParentViewportId value of the implicit/fallback window. (ocornut#4236, ocornut#2409) Amend 3ead982 * Backends: amends to 1db1066 + merge minor bits from docking incl SetActiveIdUsingNavAndKeys(). No need to clear fields before deletion. DX12: renamed to match docking branch. * Backends: Viewports: renamed viewport storage structures ImGuiViewportDataXXXX -> ImGui_ImplXXXX_ViewportData and locals (matching naming convention in 70c6038) * Docking: removed DockNodeFlagsOverrideClear flags from ImGuiWindowClass. (ocornut#2999, ocornut#3521, ocornut#3633) + extraded bits of metrics into DebugNodeDockNodeFlags() * Docking: Reworked node flags saving/inheritance... (ocornut#4292, ocornut#3834, ocornut#3633, ocornut#3521, ocornut#3492, ocornut#3335, ocornut#2999, ocornut#2648) ..so that flags enforced by docked windows via the DockNodeFlagsOverrideSet mechanism are are not left in empty dockspace nodes once the windows gets undocked. * Docking: Added ImGuiDockNodeFlags_NoDockingOverEmpty. Breaking definition of ImGuiDockNodeFlags_NoDockingOverOther which now means "non empty node". (ocornut#3492, ocornut#2648, ocornut#4292) * Docking: Fixed crash issues using DockBuilderRemoveNode() in some situations. (ocornut#3111, ocornut#3179, ocornut#3203, ocornut#4295) If the deleted root node isn't part of a dockspace with a central node, it won't be "protected" but removed when last window gets removed. * Docking: Fix crash when a dock node gets re-qualified as dockspace>floating>dockspace.. (ocornut#3203, ocornut#4295) Which tends to happen when incorrectly calling DockBuilderAddNode() without ImGuiDockNodeFlags_Dockspace and using it as a Dockspace on the next frame after the floating window hosting the node has been automatically created. * Added missing IMGUI_API to GetViewportPlatformMonitor. (ocornut#4309) * Backends: Win32, SDL, GLFW: only honor io.WantSetMousePos when focused + fix GLFW uninstalling handler + tweaks to reduce branch drift with docking. (ocornut#787, ocornut#2445, ocornut#2696, ocornut#3751, ocornut#4377) # Conflicts: # backends/imgui_impl_glfw.cpp # backends/imgui_impl_sdl.cpp # backends/imgui_impl_win32.cpp * IO: modify io.AddFocusEvent() to tolerate in/out for multi-viewports. Amend 2f40be6. (ocornut#3532) * Fix BeginDisabled(false), (ocornut#211, ocornut#4452) * Fix BeginDisabled(false), again, (ocornut#211, ocornut#4452, ocornut#4453) Version 1.84.1 (forced pushed since our earlier versioning didn't sort correctly in github web) # Conflicts: # docs/CHANGELOG.txt * Backends: GLFW: Fixed unused variable warning for empty assert macro. (ocornut#4459) * Docking: fixed settings load issue when mouse wheeling. (ocornut#4310) * Docking: fix 58f5092 (ocornut#4310) If we clear _ChildWindow flag we must remove it from here otherwise render loop will fail. * Docking: warning fix for when IM_ASSERT() is empty * Fixed bad merge of Changelog in docking branch * Internals: refactored IsWindowHovered()/IsWindowFocused() to make their logic more similar + change underlying value of ImGuiHoveredFlags_AllowWhenBlockedByPopup + comment out docking only flags. * Fixed _ChildWindows from leaking docking hierarchy. Added ImGuiFocusedFlags_DockHierarchy and ImGuiHoveredFlags_DockHierarchy. * Viewports: fixed unnecessary creation of temporary viewports when multiple docked windows got reassigned to a new node (created mid-frame) which already has a HostWindow * Viewports: Fixed a crash while a window owning its viewport disappear while being dragged. t would manifest when e.g. reconfiguring dock nodes while dragging. * Viewports: fix window with viewport ini data immediately merged into a host viewport from leaving a temporary viewport alive for a frame (would leak into backend). * Fixed IsWindowFocused/IsWindowHovered with _ChildWindows for not following through popup parents (amend 6b1e094, fix ocornut#4527) * Viewports: extracted DestroyViewport() out of UpdateViewportsNewFrame() function. * Docking: bits. * Docking: floating node with a central node hides properly when nothing is docked + rename. * Docking: Improved resizing system so that non-central zone are better at keeping their fixed size. * Nav: Fixed an issue with losing focus on docked windows when pressing Alt while keyboard navigation is disabled. (ocornut#4547, ocornut#4439) * Docking: Fixed IsItemHovered() and functions depending on it (e.g. BeginPopupContextItem()) when called after Begin() on a docked window (ocornut#3851) Fix ee643b2 * Added ImGuiFocusedFlags_NoPopupHierarchy and ImGuiHoveredFlags_NoPopupHierarchy (followup ocornut#4527) IsWindowFocused: fix flag usage (amend 6b1e094) was technically harmless because of light typing. * Docking: reinstate io.ConfigDockingWithShift option. (ocornut#4643) This more or less reverts commit 3ed07a8. * Fixed nested BeginDisabled()/EndDisabled() bug in Docking branch due to bad merge. (ocornut#4655, ocornut#4452, ocornut#4453, ocornut#4462) * Backends: Made it possible to shutdown default Platform Backends before the Renderer backends. (ocornut#4656) * Viewports: Made it possible to explicitly assign ImGuiWindowClass::ParentViewportId to 0. (ocornut#3152, ocornut#2871) * Fixed tooltip in own viewport over modal from being incorrectly dimmed. (ocornut#4729) Normally we would aim to ensure that g.Windows[] gets maintained to reflect display layer but it is presently non trivial. * Fixed crash on right-click without modal, introduced by previous commit a3667f4, (ocornut#4729) * Viewports: fix missing default per-window value for ParentViewportId due to zero-cleared in-window instance (ocornut#4756) Broken by 2080d12 * Docking: Fixed a bug undocking windows docked into a non-visible or _KeepAliveOnly dockspace. (ocornut#4757) * Docking: Fix typo (had no side effect) (ocornut#4778) Co-authored-by: Mikko Sivulainen <mikko.sivulainen@supercell.com> * Viewports: Fixed CTRL+TAB highlight outline on docked windows not always fitting in host viewport + moved EndFrameDrawDimmedBackgrounds() call + removed duplicate code in Begin() already in EndFrameDrawDimmedBackgrounds() * Docking: Fixed incorrectly rounded tab bars for dock node that are not at the top of their dock tree. * Docking: Fixed single-frame node pos/size inconsistencies when window stop or start being submitted. Fix 718e15c while preserving its intended property. Tested by "docking_window_appearing_layout". (ocornut#2109) * Docking: internals: extracted rounding corner calculation into reusable CalcRoundingFlagsForRectInRect() function. * Docking: docked windows honor ImGuiCol_WindowBg. Host window in charge of rendering seams. (ocornut#2700, ocornut#2539 + Docked windows honor display their border properly. (ocornut#2522) Plus: better support for transparent one in nodes Side effects: DockContextBindNodeToWindow doesn't alter node->IsVisible. Side effects: ImDrawList:: _ResetForNewFrame() needs to merge, sane (in case of (Amended, force-pushed) * Docking: Amend b16f738 fixed dimming of docked window + removed thin highlight around windows (never worked on docked window, not viewports friendly, hard to move to EndFrame) (ocornut#2700, ocornut#2539, ocornut#2522) * Nav, Docking: reworked modal/ctrl+tab dimming system to be entirely processed at end of the frame, which will simplify things for an upcoming commit. (Will backport some of this back to master now.) * Nav, Docking: Fix dimming on docked windows. * Nav, Docking: Fix crash on dimming docked window and DockSpaceOverViewport() with PassthruCentralNode. (amend 1dc3af3, 23ef6c1, 657073a) * Added an assertion for the common user mistake of using "" as an identifier at the root level of a window. (ocornut#1414, ocornut#2562, ocornut#2807, ocornut#4008, ocornut#4158, ocornut#4375, ocornut#4548, ocornut#4657, ocornut#4796) ocornut#4158, ocornut#4375, ocornut#4548, ocornut#4657, ocornut#4796) * Docking: prevent docking any window created above a popup/modal. (ocornut#4317) * Internals: UpdateWindowInFocusOrderList: amend a528398 to fix docking. (ocornut#3496, ocornut#4797) * Internals: reduced side-effects of setting window->HiddenFramesForRenderOnly > 0 * Viewports: Fixed a CTRL+TAB crash with viewports enabled (ocornut#4023, ocornut#787) (amend 1dc3af3, 23ef6c1, 657073a) + Expose FindHoveredViewportFromPlatformWindowStack() in imgui_internal.h * Update .gitignore * Backends: OSX: Fixed typo. * Rename io.AddKeyModEvent() -> io.AddKeyModsEvent() and updated backends accordingly. (ocornut#2625, ocornut#4858) Amend 790132a (breaking) # Conflicts: # backends/imgui_impl_glfw.cpp # backends/imgui_impl_sdl.cpp # backends/imgui_impl_win32.cpp * IO: fix SetKeyEventNativeData() not handling ImGuiKey_None the same way as AddKeyEvent(). (ocornut#4905, ocornut#4858) * Merge "Backends: SDL: Fix for Emscriptem. Amend 98ce013." + Fix bad merge from master of "is_app_focused" property (Amend 0647ba3) * Viewports: Fixed active InputText() from preventing viewports to merge. (ocornut#4212) * Viewports: Relaxed specs for backend supporting ImGuiBackendFlags_HasMouseHoveredViewport. Backends: SDL: Added support for simplified HasMouseHoveredViewport. (ocornut#1542, ocornut#4665) * IO: added AddMouseViewportEvent() + used in backends. * Docking: Fixed a CTRL+TAB crash when aiming at an empty docked window. (ocornut#4792) * Revert moving ImGuiKeyModFlags to internal.h (amendc906c65) # Conflicts: # imgui.cpp * Backends: SDL: no support for ImGuiBackendFlags_HasMouseHoveredViewport under OSX/LInux (ocornut#4960) * Docking: Fixed size constraints not working on single window holding on a dock id (still doesn't work on docked windows). * Docking: Tabs use their own identifier (in order to make window->ID refer to whole window in test engine). Also prevents Tab ID from clashing with "" which was common. * Docking: Fixed CTRL+TAB back into a docked window not selecting menu layer when no item are on main layer. Could merge on master. * Backends: SDL: Amend 08350e5, multi-viewports mouse tracking works under Linux. (ocornut#4960) + Reword tests to help static analysis. * Docking: fixed potential crash if a passthrough dock node is submitted without a child intermediate (currently not possible via API) * Internals: rework RenderMouseCursor() signature so we can use it in docking branch more naturally. (Merged from master+ rework for docking) # Conflicts: # imgui.cpp # imgui_draw.cpp * Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize when multi-viewports are disabled. (ocornut#4900) * Docking: Fixed floating docked nodes not being clamped into viewport workrect to stay reachable when g.ConfigWindowsMoveFromTitleBarOnly is set and multi-viewports are disabled. (ocornut#5044) * Viewports: Fixed translating a host viewport from briefly altering the size of AlwaysAutoResize windows. (ocornut#5057) * Backends: SDL: Fix multi-viewport dragging issue with SDL on some systems. (ocornut#5012) * Backends: SDL: Fix more dragging issues. SDL_CaptureMouse() is essentially broken. (ocornut#5012, ocornut#5082) master got c5f6721 which is combining f337378 and this commit. * Windows: Fixed first-time windows appearing in negative coordinates. (ocornut#5215, ocornut#3414) Regression added in 6af92b0 * Backends: OSX, Metal: Added multi-viewports support. (ocornut#4821, ocornut#2778) * Backends: OSX, Metal: Amend d111133, tidying up, remove unused, misc tweaks. . (ocornut#4821, ocornut#2778) * Backends: OSX: Implement ImGui_ImplOSX_ShowWindow(). (ocornut#5299) * Examples: Apple+OpenGL: Fix build. * Docking: Fixed moving window being interrupted when undocing a window with "io.ConfigDockingAlwaysTabBar = true". (ocornut#5324) Regression introduced in 6b77668 * Docking: Fix unhiding tab bar regression. (ocornut#5325, ocornut#5181) Broken by 9038678 * Misc: Fix custom assertion macro failing to compile imgui.cpp (ocornut#5378) * Docking: Fixed incorrect focus highlight on docking node when focusing empty central node or a child window which was manually injected into a dockspace window. * Backends: SDL+GLFW, Examples: SDL+Metal, GLFW+Metal: Fix viewport support with Metal backend. Fixes ocornut#5392 + alignment fixes and removed static_cast<> + Amended with fix. * Docking, Modal: Fixed a crash when opening popup from a parent which is being docked on the same frame. (ocornut#5401) Ideally we should untangle the purpose of parent_window_in_stack / ParentWindowInBeginStack better. * Docking: Amend 24dfebf. Fixed incorrect focus highlight on docking node with nested hierarchies. * Backends: GLFW: Fixed leftover static variable preventing from changing or reinitializing backend while application is running. (ocornut#4616, ocornut#5434) * Backends, Viewport: Metal: Pull format from shared context. (ocornut#5403, ocornut#5437) * Docking, Nav: Fixed using gamepad/keyboard navigation not being able enter menu layer (ocornut#5463, ocornut#4792) Fix 37958ca * Docking: Fix docked window contents not rendering when switching with CTRL+Tab. (regression from 8eb8689). * Internals: Docking: make DockContextFindNodeByID() more visible (instead of DockBuilderGetNode) + using defines for channel changes. * Docking: Fixed splitting/docking into a node that has buttons amended into tab bar. Windows were not moved correctly. (ocornut#5515) * Docking: Fixed amending into an existing tab bar from rendering invisible items. (ocornut#5515, amend b16f738 ocornut#2700, ocornut#2539) Commit b16f738 left us with a "current" channel 0 which seems inadequate. Undoing that, assuming default is always 1, code filling bg color does a switch. Only DockContextEndFrame() leave it at 0 and it's not particularly necessary. * Docking+Viewports: Fix undocking window node causing parent viewport to become unresponsive. (ocornut#5503) Amend 67be485, Somehow ties to 58f5092 + 0eb45a0 (ocornut#4310) Unsure of exact chain of event but this caused a parent link msimatch between the time of the MouseMoving test in AddUpdateViewport() setting _NoInputs on the wrong parent., and the release clearing _NoInputs on the rght one. * Docking: Simplify logic of moving tabs between nodes. Amends 0abe7d. (ocornut#5515) The idea is that in the absence of a tab bar, as new one gets created new tabs will be sorted based on window->DockOrder so this may work but we're not 100% sure. * Docking: Add source dock node parameter DockContextCalcDropPosForDocking() to facilitate test engine (un)docking nodes before they are split out to their own window. Metrics: Display dock_node->Windows in node metrics. * Internals: Docking: rename HoveredDockNode to DebugHoveredDockNode to clarify that it isn't usable for much other than debugging. * Nav: Fixed regression in e99c4fc preventing CTR+Tab to work without NavEnableKeyboard (ocornut#5504, ocornut#4023); * Obsoleted using SetCursorPos()/SetCursorScreenPos() to extend parent window/cell boundaries. (ocornut#5548) This incorrect pattern has been mentioned or suggested in: ocornut#4510, ocornut#3355, ocornut#1760, ocornut#1490, ocornut#4152, ocornut#150 # Conflicts: # imgui.cpp * Backends: SDL: Fixed building backend under non-OSX Apple targets (e.g. iPhone). (ocornut#5665) * Docking: Fixed incorrect focus highlight on docking node when focusing a menu. (ocornut#5702) * Backends: OpenGL: Add ability to #define IMGUI_IMPL_OPENGL_DEBUG. (ocornut#4468, ocornut#4825, ocornut#4832, ocornut#5127, ocornut#5655, ocornut#5709) # Conflicts: # backends/imgui_impl_opengl3.cpp * Update imgui_impl_vulkan.h to match martty/imgui https://github.com/martty/imgui/blob/master/examples/imgui_impl_vulkan.h * Update imgui_impl_vulkan.cpp to match martty/imgui https://github.com/martty/imgui/blob/master/examples/imgui_impl_vulkan.cpp * Viewports: Fix AddMouseViewportEvent() to honor AppAcceptingEvents, filter duplicate, add to debug log. * Docking: Fixed missing highlight when using dock node host window borders. (ocornut#5702) Amend 8f43487, 9764adc, 24dfebf * Fixed ImGuiWindowFlags_UnsavedDocument clipping label in docked windows with no close button. [changes for docking] (ocornut#5745) + TabBar: starts displaying the unsaved document marker with a frame delay to match how close button is processed, otherwise the transition would be noticeable. * Fix for Vulkan validation layer warnings Fix from: TheCherno@add065f ocornut#3957 Co-authored-by: ocornut <omarcornut@gmail.com> Co-authored-by: Sammy Fatnassi <sammyfreg@gmail.com> Co-authored-by: GamingMinds-DanielC <daniel.cremers@gamingmindsstudios.com> Co-authored-by: Adam Kewley <contact@adamkewley.com> Co-authored-by: Rokas Kupstys <rokups@zoho.com> Co-authored-by: David Maas <contact@pathogenstudios.com> Co-authored-by: CheckmateAt7 <66566308+CheckmateAt7@users.noreply.github.com> Co-authored-by: warriormaster12 <streng.alexander@gmail.com> Co-authored-by: Michel Lesoinne <michel.lesoinne@androdevllc.com> Co-authored-by: Mikko Sivulainen <mikko.sivulainen@gmail.com> Co-authored-by: Mikko Sivulainen <mikko.sivulainen@supercell.com> Co-authored-by: Dima Koltun <koltundimachamp@gmail.com> Co-authored-by: stuartcarnie <stuart.carnie@gmail.com> Co-authored-by: omar <ocornut@users.noreply.github.com> Co-authored-by: Andrej Redeky <41929176+WSSDude420@users.noreply.github.com> Co-authored-by: Runik <rtoumazet@free.fr> Co-authored-by: Stephen H. Gerstacker <stephen@gerstacker.us>
… of VK_LWIN||VK_RWIN (#7768, #4858, #2622) Amend 0755767 The `ImGui_ImplWin32_UpdateKeyModifiers()` function maps `ImGuiMod_Super` to `VK_APPS`, the "Application" key located between the Right Windows (Super) and Right Control keys on the keyboard, see https://conemu.github.io/en/AppsKey.html This means that when using `ImGui::GetIO().KeySuper` to try to get the down state of the `VK_RWIN` or `VK_LWIN` keys, it'll always return FALSE when either of those keys are held down, and only return TRUE when `VK_APPS` is held down.
* Version 1.90.8 * Version 1.90.9 WIP * Internals: renamed HoveredIdDisabled to HoveredIdIsDisabled for consistency. * Examples: GLFW+Vulkan: handle swap chain resize even without Vulkan returning VK_SUBOPTIMAL_KHR (ocornut#7671) * Examples: SDL+Vulkan: handle swap chain resize even without Vulkan returning VK_SUBOPTIMAL_KHR (ocornut#7671) * Removed old nested structure: renaming ImGuiStorage::ImGuiStoragePair type to ImGuiStoragePair (simpler for many languages). * Internals: made ImLowerBound() accessible in internals + take a span. + rearrange child/popup/tooltips section. Because upcoming rework of ImGuiSelectionBasicStorage will want to do a lower bound on a span. * IO: do not disable io.ConfigWindowsResizeFromEdges when ImGuiBackendFlags_HasMouseCursors is not set by backend. Amend 42bf149 * Style: (Breaking) renamed ImGuiCol_TabActive -> ImGuiCol_TabSelected, ImGuiCol_TabUnfocused -> ImGuiCol_TabDimmed, ImGuiCol_TabUnfocusedActive -> ImGuiCol_TabDimmedSelected. Amend ocornut#261, ocornut#351 * TabBar, Style: added ImGuiTabBarFlags_DrawSelectedOverline and ImGuiCol_TabSelectedOverline, ImGuiCol_TabDimmedSelectedOverline. * Drag and Drop: BeginDragDropSource() with ImGuiDragDropFlags_SourceExtern. (ocornut#143) Amend 0c6e260 * Drag and Drop: Fixes an issue when elapsing payload would be based on last payload frame instead of last drag source frame. * Internals: added ImGuiContext::ContextName optionally used by debug log and to facilitate debugging. * Drag and Drop: comments, debug log entries. * Drag and Drop: BeginDragDropSource() with ImGuiDragDropFlags_SourceExtern assume a mouse button being pressed. (ocornut#143) * Drag and Drop: (Breaking) renamed ImGuiDragDropFlags_SourceAutoExpirePayload to ImGuiDragDropFlags_PayloadAutoExpire. (ocornut#1725, ocornut#143) * Drag and Drop: Added ImGuiDragDropFlags_PayloadNoCrossContext and ImGuiDragDropFlags_PayloadNoCrossProcess flags. * Ignore .ini file with other suffixes. * Fixed build warning. * IO: added ClearInputMouse(). made ClearInputKeys() not clear mouse data. (ocornut#4921) Amend 6aa408c * IO: added ImGuiConfigFlags_NoKeyboard for consistency and convenience. (ocornut#4921) # Conflicts: # imgui.h # imgui_demo.cpp * Nav: CTRL+Tab overlay display context name if any. * Internals: storing HoveredWindowBeforeClear for use by multi-context compositor drag and drop propagation. # Conflicts: # imgui.cpp # imgui_internal.h * (Breaking) Move ImGuiWindowFlags_NavFlattened to ImGuiChildFlags_NavFlattened. (ocornut#7687) * Backends: SDL3: Follow SDL3 removal of keysym field in SDL_KeyboardEvent (ocornut#7729) * Demo: Style Editor: clarify how _CalcCircleAutoSegmentCount() doesn't always get exact final segment count. (ocornut#7731) * Backends: Vulkan: Remove Volk/ from volk.h #include directives (ocornut#7722, ocornut#6582, ocornut#4854) * Metrics/Debugger: Browsing a Storage perform hover lookup on identifier. * Viewports: Backported 'void* ImGuiViewport::PlatformHandle' from docking branch for use by backends. * Backends: SDL3: Update for SDL_StartTextInput()/SDL_StopTextInput() API changes. (ocornut#7735) * Examples: undo adding SDL3 example to Visual Studio sln. * Backends: OSX: build fix. Amend 32f9dfc * ImGuiStorage: tweak impl for BuildSortByKey(). * Inputs: fixed using Shortcut() or SetNextItemShortcut() within a disabled block bypassing the disabled state. (ocornut#7726) * Tables: moved TableGetHoveredColumn() to public API. (ocornut#7715, ocornut#3740) * Windows: BeginChild(): fixed a glitch when during a resize of a child window which is tightly close to the boundaries of its parent. (ocornut#7706) * Nav: store NavJustMovedToIsTabbing + shuffle a few nav related fields. (for usage by multi-select) * Backends: OpenGL2, OpenGL3: ImGui_ImplOpenGL3_NewFrame() recreates font texture if it has been destroyed by ImGui_ImplOpenGL3_DestroyFontsTexture(). (ocornut#7748) Analogous to change to Vulkan backend in 1.90. * Backends: Win32: Fixed warning with old MinGW/GCC versions. * Drags: added ImGuisliderFlags_WrapAround flag for DragInt(), DragFloat() etc. (ocornut#7749) * Fix typo, rename ImGuisliderFlags_WrapAround flag to ImGuiSliderFlags_WrapAround. (ocornut#7752, ocornut#7749) * Checkbox: minor tidying up to simplify work on multi-select branch. * Backends: Allegro5: Correctly handle unstable bit in version checks (ocornut#7755) * Backends: SDLRenderer3: Update for SDL_RenderGeometryRaw() API changes. * Backends: SDL3: update for SDL_SetTextInputRect() -> SDL_SetTextInputArea() api change. (ocornut#7760, ocornut#7754) * Examples: SDL3: Remove use of SDL_HINT_IME_NATIVE_UI. * Disabled: Reworked 1.90.8 behavior of Begin() not inheriting current BeginDisabled() state. Only tooltip are clearing that state. (ocornut#211, ocornut#7640) * imgui_freetype: fixed divide by zero while handling FT_PIXEL_MODE_BGRA glyphs. (ocornut#7267, ocornut#3369) * IO: do not claim io.WantCaptureMouse=true on the mouse release frame of a button which was pressed over void. (ocornut#1392) * Version 1.90.9 * Version 1.91.0 WIP * Backends: SDL3: Update for API changes: SDLK_x renames and SDLK_KP_x removals (ocornut#7761, ocornut#7762) Also updated function signature in SDL2 backend to match and because it is expected we will use that data (as per ocornut#7672) * Backends: SDL3: Updated comments (IME seems fixed in SDL3). Added SDL3 examples to Visual Studio solution. * Debug Tools: Added IMGUI_DEBUG_LOG(), ImGui::DebugLog() in public API. (ocornut#5855) * Debug Log: Added "Configure Outputs.." button. (ocornut#5855) * Backends: SDL3: add default case to fix warnings. (ocornut#7763) * Demo: changed style editor inline block to its own window. * IO: added io.PlatformOpenInShellFn handler to open a link/folder/file in OS shell, added IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS. (ocornut#7660) * (Breaking) IO, IME: renamed platform IME hook io.SetPlatformImeDataFn() -> io.PlatformSetImeDataFn() and added explicit context. * Commented out obsolete ImGuiModFlags and ImGuiModFlags_XXX values (renamed to ImGuiKeyChord and ImGuiMod_XXX in 1.89). (ocornut#4921, ocornut#456) * Build fix for non Windows platforms. * IO: disable default io.PlatformOpenInShellFn() implementation on iPhone, as compiler errors that system() is not available on iOS. * Internals: added FontScale storage. * Added TextLink(), TextLinkOpenURL() hyperlink widgets. (ocornut#7660) * Internals: added FontScale storage (amend 0f63d3e). * Backends: GLFW,SDL2: Added ioPlatformOpenInShellFn handler for web/Emscripten versions. (ocornut#7660) * IO: amend PlatformOpenInShellFn specs to return a bool. (ocornut#7660) Amend 8f36798 * Misc tweaks, comments. * TreeNode: rename/rework ImGuiNavTreeNodeData system to be usable by more features. (ocornut#2920, ocornut#1131, ocornut#7553) Reworked to it is easier during TreeNode code to request extra data to be stored. * Fixed Unix version of PlatformOpenInShellFn_DefaultImpl. (ocornut#7772, ocornut#7660) + Enable on non-iPhone macOS builds * DemosFix typo in help text in demo Tables/Borders (ocornut#7780) The help text for flags had a "V" flag duplicated, this change corrects it to the missing "H" flag. * Backends: Win32: fixed ImGuiMod_Super being mapped to VK_APPS instead of VK_LWIN||VK_RWIN (ocornut#7768, ocornut#4858, ocornut#2622) Amend 0755767 The `ImGui_ImplWin32_UpdateKeyModifiers()` function maps `ImGuiMod_Super` to `VK_APPS`, the "Application" key located between the Right Windows (Super) and Right Control keys on the keyboard, see https://conemu.github.io/en/AppsKey.html This means that when using `ImGui::GetIO().KeySuper` to try to get the down state of the `VK_RWIN` or `VK_LWIN` keys, it'll always return FALSE when either of those keys are held down, and only return TRUE when `VK_APPS` is held down. * Backends: GLFW+Emscripten: (Breaking) Renamed ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback() to ImGui_ImplGlfw_InstallEmscriptenCallbacks(), added GLFWwindow* parameter. (ocornut#7647, ocornut#7600) + Fixed Emscripten warning when using mouse wheel on some setups. * Backends: GLFW+Emscripten: Added support for GLFW3 contrib port. (ocornut#7647) * Backends: GLFW+Emscripten: Fixed build (ocornut#7647) * Examples: SDL3+OpenGL: Update for API changes: SDL_GL_DeleteContext() renamed to SDL_GL_DestroyContext(). * Fix definition check (ocornut#7793) * Backends: SDL3: Update for API changes: SDL_GetProperty() change to SDL_GetPointerProperty(). (ocornut#7794) * Backends: SDL3: fixed typo leading to PlatformHandleRaw not being set leading to SHOWNA path not working for multi-viewports. * Internals: Added TreeNodeIsOpen() to facilitate discoverability. (ocornut#7553, ocornut#1131, ocornut#2958, ocornut#2079, ocornut#722) * Added ImGuiDataType_Bool for convenience. * Demo: Reworked "Property Editor" demo in a manner that more ressemble the tree data and struct description data that a real application would want to use. * Added PushItemFlag(), PopItemFlag(), ImGuiItemFlags. * (Breaking) Obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag()/PopItemFlag() with ImGuiItemFlags_ButtonRepeat. * Added ImGuiItemFlags_AutoClosePopups as a replacement for internal's ImGuiItemFlags_SelectableDontClosePopup. (ocornut#1379, ocornut#1468, ocornut#2200, ocornut#4936, ocornut#5216, ocornut#7302, ocornut#7573) * (Breaking) Renamed ImGuiSelectableFlags_DontClosePopups to ImGuiSelectableFlags_NoAutoClosePopups. (ocornut#1379, ocornut#1468, ocornut#2200, ocornut#4936, ocornut#5216, ocornut#7302, ocornut#7573) * Obsoleted PushTabStop()/PopTabStop() in favor of using new PushItemFlag()/PopItemFlag() with ImGuiItemFlags_NoTabStop. * Fixed pvs-studio warning. * Demo: Property Editor: rearrange code + replace use of bool to proper ImGuiChildFlags. Amend 46691d1 * Demo: Property Editor: add basic filter. * Style: close button and collapse/window-menu button hover highlight made rectangular instead of round. The reason they were round in the first place was to work better with rounded windows/frames. However since the 4a81424 rework ocornut#6749 we can naturally use a tigher bounding box and it seems to work ok either way. * Nav, Demo: comments. * Clipper: added SeekCursorForItem() function, for use when using ImGuiListClipper::Begin(INT_MAX). (ocornut#1311) Tagging ocornut#3609 just in case we made a mistake introducing a regression (but tests are passing and have been extended). * TreeNode: Internals: facilitate dissociating item ID from storage ID (useful for 1861) * Internals: rename recently added TreeNodeIsOpen() -> TreeNodeGetOpen(). (ocornut#7553, ocornut#1131, ocornut#2958, ocornut#2079, ocornut#722) Amend ac7d6fb * Backends: SDL3: Update for API changes: SDL_GetClipboardText() string ownership change. (ocornut#7801) * MultiSelect: WIP range-select (ocornut#1861) (rebased six millions times) * MultiSelect: Removed SelectableSpacing as I'm not sure it is of use for now (history insert) * MultiSelect: Added IMGUI_HAS_MULTI_SELECT define. Fixed right-click toggling selection without clearing active id, could lead to MarkItemEdited() asserting. Fixed demo. * MultiSelect: Demo sharing selection helper code. Fixed static analyzer warnings. * MultiSelect: Renamed SetNextItemMultiSelectData() to SetNextItemSelectionUserData() * MultiSelect: Transition to use FocusScope bits merged in master. Preserve ability to shift+arrow into an item that is part of FocusScope but doesn't carry a selection without breaking selection. * MultiSelect: Fix for TreeNode following merge of 011d475. Demo: basic test for tree nodes. * MultiSelect: Fixed CTRL+A not testing focus scope id. Fixed CTRL+A not testing active id. Added demo code. Comments. * MultiSelect: Comments. Tweak demo. * MultiSelect: Fix Selectable() ambiguous return value, clarify need to use IsItemToggledSelection(). * MultiSelect: Fix testing key mods from after the nav request (remove need to hold the mod longer) * MultiSelect: Temporary fix/work-around for child/popup to not inherit MultiSelectEnabled flag, until we make mulit-select data stackable. * MultiSelect: Fixed issue with Ctrl+click on TreeNode + amend demo to test drag and drop. * MultiSelect: Demo: Add a simpler version. * MultiSelect: Added ImGuiMultiSelectFlags_ClearOnEscape (unsure of best design), expose IsFocused for custom shortcuts. * MultiSelect: Demo: Added pointer indirection and indent level. This is to reduce noise for upcoming commits, ahead of adding a loop here. * MultiSelect: Added ImGuiMultiSelectFlags_ClearOnClickWindowVoid. + Demo: showcase multiple selection scopes in same window. * MultiSelect: Enter doesn't alter selection (unlike Space). Fix for changes done in 5606. * MultiSelect: Shallow tweaks/refactors. Including moving IsFocused back internally for now. * MultiSelect: Fixed needing to set RangeSrcPassedBy when not using clipper. * MultiSelect: made SetNextItemSelectionData() optional to allow disjoint selection (e.g. with a CollapsingHeader between items). Amend demo. * MultiSelect: Enter can alter selection if current item is not selected. * MultiSelect: removed DragDropActive/preserve_existing_selection logic which seems unused + comments. Can't find trace of early prototype for range-select but I couldn't find way to trigger this anymore. May be wrong. Will find out. * MultiSelect: refactor before introducing persistant state pool and to facilitate adding recursion + debug log calls. This is mostly the noisy/shallow stuff committed here, to get this out of the way. * MultiSelect: (Breaking) Rename ImGuiMultiSelectData to ImGuiMultiSelectIO. * MultiSelect: Demo tweak. Removed multi-scope from Advanced (too messy), made it a seperate mini-demo. * MultiSelect: Internals rename of IO fields to avoid ambiguity with io/rw concepts + memset constructors, tweaks. debug * MultiSelect: (Breaking) Renamed 'RangeSrc -> 'RangeSrcItem', "RangeDst' -> 'RangeDstItem' This is necessary to have consistent names in upcoming fields (NavIdItem etc.) * MultiSelect: (Breaking) Renamed 'RangeValue' -> 'RangeSelected' + amend comments. * MultiSelect: Remove ImGuiMultiSelectFlags_NoUnselect because I currently can't find use for this specific design. And/or it seem partly broken. * MultiSelect: Remove the need for using IsItemToggledSelection(). Update comments. This is the simple version that past our tests. MultiSelectItemFooter() is in need of a cleanup. * MultiSelect: Tidying up/simpllifying MultiSelectItemFooter(). Intended to be entirely a no-op, merely a transform of source code for simplification. But committing separatey from behavior change in previous change. * MultiSelect: Clarify and better enforce lifetime of BeginMultiSelect() value. * MultiSelect: Demo: first-draft of user-side deletion idioms. (will need support from lib) * MultiSelect: (Breaking) BeginMultiSelect() doesn't need two last params maintained by users. Moving some storage from user to core. Proper deletion demo. * MultiSelect: Maintain NavIdSelected for user. Simplify deletion demo. * MultiSelect: Further simplication of user code to support Deletion. Provide standard RequestFocusItem storage. * MultiSelect: Demo: Delete items from menu. * MultiSelect: Fixed right-click handling in MultiSelectItemFooter() when not focused. * MultiSelect: Cleanup unused comments/code. * MultiSelect: (Breaking) Fix + Rename ImGuiMultiSelectFlags_NoMultiSelect to ImGuiMultiSelectFlags_SingleSelect as it seems easier to grasp. Feature was broken by "Tidying up..." June 30 commit. * MultiSelect: Comments, tweaks. + Alignment to reduce noise on next commit. * MultiSelect: (Breaking) Use ImGuiSelectionUserData (= ImS64) instead of void* for selection user data. Less confusing for most users, less casting. * MultiSelect: move HasSelectionData to ImGuiItemFlags to facilitate copying around in standardized fieds. Required/motivated to simplify support for ImGuiTreeNodeFlags_NavLeftJumpsBackHere (bc3c0ce) in this branch. * MultiSelect: Tweak debug log to print decimal+hex values for item data. Struggled to get standard PRIX64 to work on CI. * MultiSelect: clear selection when leaving a scope with a nav directional request. May need to clarify how to depends on actions being performed (e.g. click doesn't). May become optional? * MultiSelect: (Breaking) RequestSetRange's parameter are RangeFirstItem...RangeLastItem (which was always ordered unlike RangeSrcItem...RangeDstItme). Removed RangeDstItem. Removed RangeDirection. * MultiSelect: Demo: rework ExampleSelection names to map better to typical user code + variety of Comments tweaks. * MultiSelect: Demo: added simpler demo using Clipper. Clarify RangeSrcPassedBy doc. * MultiSelect: (Breaking) Removed RangeSrcPassedBy in favor of favoring user to call IncludeByIndex(RangeSrcItem) which is easier/simpler to honor. Especially as recent changes made it required to also update RangeSrcPassedBy after last clipper Step. Should now be simpler. * MultiSelect: Demo: rework ExampleSelection with an ExampleSelectionAdapter layer, allowing to share more code accross examples using different storage systems. Not ideal way to showcase this demo but this is really more flexible. * MultiSelect: Demo: Remove UserDataToIndex from ExampleSelectionAdapter. Seems to make a better demo this way. * MultiSelect: Demo: Make ExampleSelection use ImGuiID. More self-explanatory. * MultiSelect: Demo: Deletion: Rework ApplyDeletionPreLoop to use adapter + fix PostLoop not using right value of RequestFocusItem. Recovery made it transparent visually but user side selection would be empty for a frame before recovery. * MultiSelect: Demo: Deletion: Various renames to clarify. Use adapter and item list in both ApplyDeletion functions. This also minify the patch for an alternative/wip attmept at redesgining pre/post deletion logic. But turns out current attempt may be easier to grasp. * Demo: Dual List Box: Added a dual list box (6648) * MultiSelect: ImGuiMultiSelectIO's field are not used during loop anymore, stripping them out of comments. * MultiSelect: moved RequestClear output so it'll match request list version better. Use Storage->RangeSrcItem in EndMultiSelect(). * MultiSelect: move shared logic to MultiSelectItemHeader(). No logic change AFAIK but added an indent level in MultiSelectItemHeader(). Logic changes will come in next commit. * MultiSelect: Added ImGuiMultiSelectFlags_SelectOnClickRelease to allow dragging an unselected item without altering selection + update drag and drop demo. * Demo: Assets Browser: Added assets browser demo. * Demo: Assets Browser: store items, sorting, type overlay. * MultiSelect: removed seemingly unnecessary block in BeginMultiSelect(). - EndIO.RangeSelected always set along with EndIO.RequestSetRange - Trying to assert for the assignment making a difference when EndIO.RequestSetRange is already set couldn't find a case (tests passing). * MultiSelect: clarified purpose and use of IsItemToggledSelection(). Added assert. Moved to multi-selection section of imgui.h. * MultiSelect: added missing call on Shutdown(). Better reuse selection buffer. * MultiSelect: (Breaking) io contains a ImVector<ImGuiSelectionRequest> list. * MultiSelect: we don't need to ever write to EndIO.RangeSrcItem as this is not meant to be used. * MultiSelect: added support for recovery in ErrorCheckEndWindowRecover(). * MultiSelect: use a single ImGuiMultiSelectIO buffer. + using local storage var in EndMultiSelect(), should be no-op. * MultiSelect: simplify clearing ImGuiMultiSelectTempData. * Demo: Assets Browser: add hit spacing, requierd for box-select patterns. * MultiSelect: (breaking) renamed ImGuiMultiSelectFlags_ClearOnClickWindowVoid -> ImGuiMultiSelectFlags_ClearOnClickVoid. Added ImGuiMultiSelectFlags_ScopeWindow, ImGuiMultiSelectFlags_ScopeRect. * MultiSelect: Box-Select: added support for ImGuiMultiSelectFlags_BoxSelect. (v11) FIXME: broken on clipping demo. * MultiSelect: Box-Select: added scroll support. * MultiSelect: Demo: rework and move selection adapter inside ExampleSelection. * MultiSelect: added support for nested/stacked BeginMultiSelect(). Mimicking table logic, reusing amortized buffers. * MultiSelect: remove ImGuiSelectionRequest/ImGuiMultiSelectIO details from public api to reduce confusion + comments. * MultiSelect: move demo's ExampleSelection to main api as a convenient ImGuiSelectionBasicStorage for basic users. * MultiSelect: reworked comments in imgui.h now that we have our own section. * MultiSelect: Demo: Assets Browser: added deletion support. Store ID in selection. Moved QueueDeletion to local var to emphasis that this is a user extension. * MultiSelect: Demo: Assets Browser: track scrolling target so we can roughly land on hovered item. It's impossible to do this perfectly without some form of locking on item because as the hovered item X position changes it's easy to drift. * MultiSelect: Box-Select: Fixed holes when using with clipper (in 1D list.) Clipper accounts for Selectable() layout oddity as BoxSelect is sensitive to it. Also tweaked scroll triggering region inward. Rename ImGuiMultiSelectFlags_NoBoxSelectScroll to ImGuiMultiSelectFlags_BoxSelectNoScroll. Fixed use with ImGuiMultiSelectFlags_SinglaSelect. * MultiSelect: Box-Select: Added ImGuiMultiSelectFlags_BoxSelect2d support. Enabled in Asset Browser. Selectable() supports it. * MultiSelect: Box-Select: Refactor into its own structure, designed for single-instance but closer to being reusable outside Multi-Select. Kept same member names. * MultiSelect: Box-Select: Refactor: Renames. Split into two commits to facilite looking into previous one if needed. * MultiSelect: Box-Select: Fixed scrolling on high framerates. * MultiSelect: Box-Select: Further refactor to extra mode code away from multi-select function into box-select funcitons. * MultiSelect: Fixed ImGuiSelectionBasicStorage::ApplyRequests() incorrectly maintaining selection size on SelectAll. * MultiSelect: Comments + Assets Browser : Tweak colors. * MultiSelect: Added ImGuiMultiSelectFlags_NoRangeSelect. Fixed ImGuiMultiSelectFlags_ScopeRect not querying proper window hover. * MultiSelect: Box-Select: Fixed CTRL+drag from void clearing items. * MultiSelect: Box-Select: Fixed initial drag from not claiming hovered id, preventing window behind to move for a frame. * MultiSelect: Fixed ImGuiMultiSelectFlags_SelectOnClickRelease over tree node arrow. * MultiSelect: (Breaking) merge ImGuiSelectionRequestType_Clear and ImGuiSelectionRequestType_SelectAll into ImGuiSelectionRequestType_SetAll., rename ImGuiSelectionRequest::RangeSelected to Selected. The reasoning is that it makes it easier/faster to write an adhoc ImGuiMultiSelectIO handler (e.g. trying to apply multi-select to checkboxes) * MultiSelect: Simplified ImGuiSelectionBasicStorage by using a single SetItemSelected() entry point. * MultiSelect: Comments + tweaked location for widgets to test ImGuiItemFlags_IsMultiSelect to avoid misleading into thinking doing it before ItemAdd() is necessary. * MultiSelect: Demo: make various child windows resizable, with synched heights for the dual list box demo. * MultiSelect: added ImGuiMultiSelectFlags_NoAutoSelect, ImGuiMultiSelectFlags_NoAutoClear features + added Checkbox Demo Refer to "widgets_multiselect_checkboxes" in imgui_test_suite. * MultiSelect: Box-Select: fix preventing focus. amend determination of scope_hovered for decorated/non-child windows + avoid stealing NavId. (ocornut#7424) * MultiSelect: Demo: use Shortcut(). Got rid of suggestion to move Delete signal processing to BeginMultiSelect(), seems unnecessary. * RangeSelect/MultiSelect: (Breaking) Added current_selection_size to BeginMultiSelect(). Required for shortcut routing so we can e.g. have Escape be used to clear selection THEN to exit child window. * MultiSelect: Box-Select: minor refactor, tidying up. * MultiSelect: Box-Select: when dragging from void, first hit item sets NavId by simulating a press, so navigation can resume from that spot. * MultiSelect: added GetMultiSelectState() + store LastSelectionSize as provided by user, convenient for quick debugging and testing. * MultiSelect: Box-Select: fixed "when dragging from void" implementation messing with calling BeginMultiSelect() without a selection size. * MultiSelect: (breaking) renamed ImGuiSelectionBasicStorage::AdapterData to UserData. * MultiSelect: Box-Select: fixes for checkboxes support. Comments. * MultiSelect: (breaking) renamed ImGuiMultiSelectFlags_BoxSelect -> ImGuiMultiSelectFlags_BoxSelect1d, ImGuiMultiSelectFlags_BoxSelect2d -> ImGuiMultiSelectFlags_BoxSelect. ImGuiMultiSelectFlags_BoxSelect1d being an optimization it is the optional flag. * MultiSelect: mark parent child window as navigable into, with highlight. Assume user will always submit interactive items. * MultiSelect: (breaking) Added 'items_count' parameter to BeginMultiSelect(). Will enable extra features, and remove equivalent param from ImGuiSelectionBasicStorage::ApplyRequests(. * MultiSelect: added ImGuiSelectionBasicStorage::GetStorageIdFromIndex() indirection to be easier on the reader. Tempting to make it a virtual. * MultiSelect: fixed ImGuiSelectionBasicStorage::Swap() helper. * MultiSelect: added ImGuiSelectionExternalStorage helper. Simplify bool demo. * MultiSelect: comments, header tweaks., simplication (some of it on wiki). * MultiSelect: ImGuiSelectionBasicStorage: added GetNextSelectedItem() to abstract selection storage from user. Amend Assets Browser demo to handle drag and drop correctly. * MultiSelect: ImGuiSelectionBasicStorage: rework to accept massive selections requests without flinching. Batch modification + storage only keeps selected items. * MultiSelect: ImGuiSelectionBasicStorage: simplify by removing compacting code (compacting may be opt-in?). GetNextSelectedItem() wrapper gives us more flexibility to work on this kind of stuff now. * MultiSelect: ImGuiSelectionBasicStorage: move function bodies to cpp file. + make ImGuiStorage::BuildSortByKey() less affected by msvc debug mode. * Demo: Assets Browser: added a way to disable sorting and hide sorting options. This is mostly designed to showcase that on very large sets (e.g. 1 million) most of the time is likely spent on sorting. * MultiSelect: ImGuiSelectionBasicStorage: (breaking) rework GetNextSelectedItem() api to avoid ambiguity/failure when user uses a zero id. * MultiSelect: provide RangeDirection to allow selection handler to handler backward shift+click. * MultiSelect: ImGuiSelectionBasicStorage: added PreserveOrder, maintain implicit order data in storage. Little tested but provided for completeness. * MultiSelect: (breaking) renamed ImGuiMultiSelectFlags_BoxSelect -> ImGuiMultiSelectFlags_BoxSelect2d. Which include not assuming one flag imply the other. Amend 2024/05/31 commit. * MultiSelect: Shift+Tab doesn't enable Shift select on landing item. * MultiSelect: added ImGuiMultiSelectFlags_NoAutoClearOnReselect + tweak flags comments. (ocornut#7424) * MultiSelect: minor tidying up. Checkbox() was reworked in master effectively fixing render clipping when culled by BoxSelect2d's UnclipMode. * MultiSelect: added courtesy ImGuiMultiSelectFlags_NavWrapX flag so we can demo this until a nav api is designed. * MultiSelect: Box-Select: uses SetActiveIdUsingAllKeyboardKeys() to avoid nav interference, much like most drag operations. * MultiSelect: Box-Select: handle Esc to disable box-select. This avoid remove a one-frame delay when finishing box-select, where Esc wouldn't be routed to selection but to child. * MultiSelect: ImGuiSelectionBasicStorage: optimized for smaller insertion amounts in larger sets + fix caling batch select with same value. * MultiSelect: Better document how TreeNode() is not trivially usable yet. Will revert when the time is right. * MultiSelect: added Changelog for the feature. Removed IMGUI_HAS_MULTI_SELECT. * Demo: moved ExampleTreeNode, ExampleMemberInfo above in the demo file. Tidying up index. + change ExampleTreeNode::UID from ImGuiID to int to not suggest that the user ID needs to be of a certain type * Demo: moved some fields inside a struct. * Demo: moved menu bar code to its own function. * MultiSelect: using ImGuiMultiSelectFlags_NoRangeSelect ensure never having to interpolate between two ImGuiSelectionUserData. * Inputs: added SetItemKeyOwner(ImGuiKey key) in public API. (ocornut#456, ocornut#2637, ocornut#2620, ocornut#2891, ocornut#3370, ocornut#3724, ocornut#4828, ocornut#5108, ocornut#5242, ocornut#5641) * Backends: SDL3: Update for API changes: SDL_GetGamepads() memory ownership change. (ocornut#7807) * TabBar, Style: added style option for the size of the Tab-Bar Overline (ocornut#7804) Amend 21bda2e. * Added a comment hinting at how to set IMGUI_API for shared librairies on e.g. Linux, macOS (ocornut#7806) * Demo: rework Property Editor. * Nav: fixed c licking window decorations (e.g. resize borders) from losing focused item when within a child window using ImGuiChildFlags_NavFlattened. In essence, using ImGuiFocusRequestFlags_RestoreFocusedChild here is a way to reduce changes caused by FocusWindow(), but it could be done more neatly. See amended "nav_flattened" test. * Demo: Property Editor: using ImGuiChildFlags_NavFlattened now that a bug is fixed. Fixed static analyzer. * Backends: OpenGL3: Fixed unsupported option warning with apple clang (ocornut#7810) * Internals, TreeNode: indent all render block into its own scope (aim is to add a is_visible test there later) * Internals, TreeNode, Selectable: tweak span_all_columns paths for clarity. * CollapsingHeader: left-side outer extend matches right-side one (moved left by one pixel) Amend c3a348a * Debug Log: fixed incorrect checkbox layout when partially clipped., doesn't parse 64-bits hex value as ImGuiID lookups. * Groups, Tables: fixed EndGroup() failing to correctly capture current table occupied size. (ocornut#7543) See "layout_group_endtable" test. * MultiSelect: sequential SetRange merging not generally handled by box-select path, useful for others. * MultiSelect: add internal MultiSelectAddSetAll() helper. * MultiSelect: fixed an issue caused by previous commit. Amend a285835. Breaks box-select. --------- Co-authored-by: ocornut <omarcornut@gmail.com> Co-authored-by: cfillion <cfillion@users.noreply.github.com> Co-authored-by: Gary Geng <garygengxiao@gmail.com> Co-authored-by: Martin Ejdestig <marejde@gmail.com> Co-authored-by: Kevin Coghlan <mail@kevincoghlan.com> Co-authored-by: Connor Clark <cjamcl@gmail.com> Co-authored-by: Max Ortner <maxortner01@gmail.com> Co-authored-by: Hugues Evrard <hevrard@users.noreply.github.com> Co-authored-by: Aemony <10578344+Aemony@users.noreply.github.com> Co-authored-by: Yan Pujante <ypujante@proton.me> Co-authored-by: Cyao <94928179+cheyao@users.noreply.github.com> Co-authored-by: wermi <32251376+wermipls@users.noreply.github.com> Co-authored-by: Thomas Stehle <th.stehle@icloud.com>
Before we merge into master, this thread is asking for curious testers and feedback.
Temporary test branches:https://github.com/ocornut/imgui/tree/features/extra-keys-and-key-eventhttps://github.com/ocornut/imgui/tree/features/extra-keys-and-key-event-dockingMoved to #4921 now that things have settled.
TL;DR;
The TL;DR; is we are switching from referring to keys using native/backend-dependant indices
ImGui::IsKeyPressed(MY_ENGINE_KEY_F1)
/ImGui::IsKeyPressed(GLFW_KEY_F1)
to referring to keys using a full-range standardizedImGuiKey
enumsImGui::IsKeyPressed(ImGuiKey_F1)
.This will allow writing various features that we couldn't before, and sharing code that's using keyboard while staying backend-agnostic (this was problematic before and a hurdle for people writing code to share).
The challenge was getting that transition done elegantly without causing backward compatibility issues, nor introducing complications or e.g. warnings.
Details
Initially the ##2625 PR by @thedmd was about adding ImGuiKey enum values, trivial at first glance. We discussed it privately for a long time. I had two concerns: existing API made using those keys actually tedious, and we didn't have a way to distinguish translated and untranslated keys (the earlier would be desirable for shortcut), if we start exposing new API (e.g. for shortcuts) without allowing that distinction people would write code that wouldn't localize correctly to varying keyboard layout.
Separately we worked on designing a new IO API that would allow handling of trickling events (for e.g. very low framerate), based on the io_input_queue experiment. Good progress has been made on that (but it got a little more involved than expected).
What we've done for now was to combine the extra-keys + reworking of IO API solely for keyboard keys at first to stay focused.
This was generally the work of @thedmd which I followed/feedbacked and help finish.
Among other things IHMO one of the nice breakthrough was coming with a scheme which is support transparent backward compatibility without adding new API entry points. We also solved fairly elegantly the little puzzle of allowing old backends to work as well as new ones. Technically this is mostly a base for us to build new features and its not taken advantage of yet (but user can use it). I think we will try to make some more use of it before declaring the change valid.
Changelog: Reworked IO keyboard input system. (#2625, #3724) [@thedmd]
Amend: Added io.AddKeyModEvent() function, obsoleting writing directly to io.KeyCtrl, io.KeyShift etc.In a few versions, IMGUI_DISABLE_OBSOLETE_FUNCTIONS will automatically enable IMGUI_DISABLE_OBSOLETE_KEYIO,
so this will be moved into the regular obsolescence path.
so ImGuiKey values can still express a legacy native keycode, and new named keys are all >= 512.
share code using keyboard accross project because of this gap. (Add extra keys #2625, Help with keyboard handling and catching some keys #3724)
Desired feedback
We'd like people to try this.
io.AddKeyEvent()
obvious? If you got issue can you shared them?IMGUI_DISABLE_OBSOLETE_KEYIO
This is how backends were updated:
The text was updated successfully, but these errors were encountered: