Skip to content
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

Add a "HyperLink" control (clickable text with link-like styling) #7660

Closed
seanmiddleditch opened this issue Jun 4, 2024 · 45 comments
Closed

Comments

@seanmiddleditch
Copy link
Contributor

Version/Branch of Dear ImGui:

Version 1.90.7, Branch: master

Back-ends:

Any (Unity/C# integration most recent case)

Compiler, OS:

Any (Windows, Unity C# 2022.x in most recent case)

Full config/build information:

No response

Details:

Feature Request

A small control that I've written for past projects and which we implemented at Wargaming, Blizzard (SGE), and at my current employer is a "HyperLink" widget, so it seems to me to be a frequently recurring pattern.

A hyperlink is some Text but which is rendered in a different color (e.g. blue) and has an underline, changes color slightly when hovered, and responds to clicks like a button, etc.

For users, this would be something like:

if (ImGui::HyperLink("Some label##id"))
  DoThing();

Writing the most basic version of this is almost trivial, of course, but it gets a bit trickier once things like keyboard focus and activation are considered, and really tricky to handle keyboard focus styling well. Every single implementation of such a control that I've seen (including mine!) got some or all of those wrong initially. I'm still not sure that I've seen one that handles word-wrap and focus highlight correctly, now that I think about it.

Having something like this in dear imgui itself instead of being reimplemented (often poorly) would be a small win.

Screenshots/Video:

Example of what a HyperLink control might look like:

image

And focused (styling could be better, just a quick demo here):
image

Minimal, Complete and Verifiable Example code:

// Crappy HyperLink implemented in a few minutes
//
// Does not handle: wordwrap
// Focus handling is not quite right (focus item stays after clicking with the mouse; ideally would be only outlined if keyboard was used to select/activate most recently)
// More input options for buttons, etc.
// Lacks custom style options. uses hard-coded colors
// Lacks a flag or style/color for "visited" links
// Lacks disabled link style/color
// Option to only show underline on hover could be a style? Or part of flags
bool ImGui::HyperLink(const char* label, bool underlineWhenHoveredOnly = false)
{
    const ImU32 linkColor = ImGui::ColorConvertFloat4ToU32({0.2, 0.3, 0.8, 1});
    const ImU32 linkHoverColor = ImGui::ColorConvertFloat4ToU32({0.4, 0.6, 0.8, 1});
    const ImU32 linkFocusColor = ImGui::ColorConvertFloat4ToU32({0.6, 0.4, 0.8, 1});

    const ImGuiID id = ImGui::GetID(label);

    ImGuiWindow* const window = ImGui::GetCurrentWindow();
    ImDrawList* const draw = ImGui::GetWindowDrawList();

    const ImVec2 pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
    const ImVec2 size = ImGui::CalcTextSize(label);
    ImRect bb(pos, {pos.x + size.x, pos.y + size.y});

    ImGui::ItemSize(bb, 0.0f);
    if (!ImGui::ItemAdd(bb, id))
        return false;

    bool isHovered = false;
    const bool isClicked = ImGui::ButtonBehavior(bb, id, &isHovered, nullptr);
    const bool isFocused = ImGui::IsItemFocused();

    const ImU32 color = isHovered ? linkHoverColor : isFocused ? linkFocusColor : linkColor;

    draw->AddText(bb.Min, color, label);

    if (isFocused)
        draw->AddRect(bb.Min, bb.Max, color);
    else if (!underlineWhenHoveredOnly || isHovered)
        draw->AddLine({ bb.Min.x, bb.Max.y }, bb.Max, color);

    return isClicked;
}
// Test code that generated the screenshot
if (ImGui::Begin("Test Hyperlink"))
{
    static bool clicked = false;
    ImGui::Text("%s", clicked ? "YES" : "NO");

    ImGui::Text("This is a link."); ImGui::SameLine();
    if (ImGuiHyperLink("Click me!"))
        clicked = !clicked;
    if (ImGui::BeginItemTooltip())
    {
        ImGui::Text("Click to toggle");
        ImGui::EndTooltip();
    }

    ImGui::SameLine(); ImGui::Text("That was a link.");
}
ImGui::End();
@ocornut
Copy link
Owner

ocornut commented Jun 5, 2024

I am puzzled because I thought there was a topic or PR exactly about this but I can't find one now.
Also note TextURL() in https://gist.github.com/dougbinks/ef0962ef6ebe2cadae76c4e9f0586c69 for another reference (and generally https://github.com/ocornut/imgui/wiki/Useful-Extensions#rich-text).

Having something like this in dear imgui itself instead of being reimplemented (often poorly) would be a small win.

You are right.

The reasons something like this is not in yet:

  • I've been shy of adding too many new colors in the style system, while the expectation is that this will be boldly reworked. Admittedly this is a bit of a procrastination tactic at this point.
  • It'd be awkward to implement/demo an "open browser" thing at least in the demo as that's quite OS dependent. And it may be nice if links would open without user need to wrap link+action, but that's optional. See ImOsOpenInShell() in https://github.com/ocornut/imgui_test_engine/blob/main/imgui_test_engine/imgui_te_utils.cpp. I wonder if if we should add this to dear imgui behind a function pointer stored in ImGuiIO, defaulting to a internal version of ImOsOpenInShell but letting user override.
  • It'd been hoping to include this as part of a larger rework of text functions, so it would be easily to include in wrapping text, markups etc. But arguably we would likely still need a helper API entry point similar to one you suggested.

I'm going to keep this open and see if we can implement something simple.

@seanmiddleditch
Copy link
Contributor Author

I've been shy of adding too many new colors in the style system, while the expectation is that this will be boldly reworked. Admittedly this is a bit of a procrastination tactic at this point.

Hah, alright. Perhaps a version that takes colors as parameters, a la TextColored, to start? (Though using the standard style system would be better ofc.)

It'd be awkward to implement/demo an "open browser" thing at least in the demo as that's quite OS dependent

A significant number of uses here have nothing to do with browers, but rather just replacing buttons for navigating within the app itself. That is, this is just a differently-styled button.

It certainly would be awesome to have an OpenExternal kind of thing in imgui, I think that's entirely orthogonal.

A control that's actually built around opening links in browsers is slightly different in other ways. It needs both URL and optional label parameters. It needs default behaviours to show the URL in a tooltip (assuming the label is not omitted). It needs some way to easily copy the URL to clipboard, e.g. via a context menu. That's a lot more stuff and a lot more "opinion" the that a URL/browser-focused control needs to provide over the core UI functionality of having clickable hyperlinks.

It'd been hoping to include this as part of a larger rework of text functions, so it would be easily to include in wrapping text, markups etc. But arguably we would likely still need a helper API entry point similar to one you suggested.

👍🏼 Some work I'm doing right now on an experimental "advancing layout+styling in imgui" project makes me think you're right about that. Breaking up text into separate runs across line breaks, with each run having its own hitbox/etc. makes handling advanced behavior w/ wordwrap much easier. Leaving all the wordwrap to the DrawList limits flexibility substantially.

@ocornut
Copy link
Owner

ocornut commented Jun 5, 2024

Some work I'm doing right now on an experimental "advancing layout+styling in imgui" project makes me think you're right about that. Breaking up text into separate runs across line breaks, with each run having its own hitbox/etc. makes handling advanced behavior w/ wordwrap much easier. Leaving all the wordwrap to the DrawList limits flexibility substantially.

I have work in progress new text functions which will be more flexible in many ways (and also faster) but they aren't ready yet.
One common issue is #2313 that wrapping offset is conflating with start offset.

ocornut added a commit that referenced this issue Jul 2, 2024
… in OS shell, added IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS. (#7660)
@ocornut
Copy link
Owner

ocornut commented Jul 2, 2024

I have added a io.PlatformOpenInShellFn handler now 8f36798

ocornut added a commit that referenced this issue Jul 2, 2024
@ocornut
Copy link
Owner

ocornut commented Jul 2, 2024

Added new widgets functions 5496050

bool TextLink(const char* label);                                    // hyperlink text button, return true when clicked
void TextLinkOpenURL(const char* label, const char* url = NULL);     // hyperlink text button, automatically open file/url when clicked

hyperlink

(right-click has a context menu with a Copy Link button)

Two things I'm not happy about:

  • I intentionally exposed a single new style color, deriving others from this one (I prefer to do that for now, to avoid cluttering style)
  • Calculation of font descent is probably unperfect. To minimize issue I made the underline less saturated and rendered before the text.

Glad we have this in!

@juliettef @dougbinks @mekhontsev: note the underlying io.PlatformOpenInShellFn handler added by 8f36798 which should be a good standard (from #if (IMGUI_VERSION_NUM >= 19092)) to use. Default is implemented in PlatformOpenInShellFn_DefaultImpl() in imgui.cpp

@floooh @ypujante
Feedback welcome on making this handler work better on all platforms, in particular I am curious if we can get this to work on Emscripten?

@ypujante
Copy link
Contributor

ypujante commented Jul 2, 2024

@ocornut As far as I know there is no built-in function to call in emscripten proper, but it is super easy to add one (feel free to name whatever makes sense...). Being in a browser environment in the first place makes the code trivial...

#ifdef __EMSCRIPTEN__
EM_JS(void, open_url, (char const *url), {
  url = url ? UTF8ToString(url): null;
  if(url)
    window.open(url, '_blank');
});
#endif

// example usage:
if (ImGui::Button("Open URL"))
  open_url("https://github.com/ocornut/imgui");

I don't know how you would translate this into the "handler" api/implementation, but this is the code you need to open a URL in emscripten...

ocornut added a commit that referenced this issue Jul 2, 2024
…scripten versions. (#7660)
@ocornut
Copy link
Owner

ocornut commented Jul 2, 2024

Thanks! Added and tested the Emscripten handlers in GLFW and SDL backends now: 380b355

@ypujante
Copy link
Contributor

ypujante commented Jul 2, 2024

Happy to help. Let me know if you have any issues.

ocornut added a commit that referenced this issue Jul 2, 2024
@floooh
Copy link
Contributor

floooh commented Jul 3, 2024

This is what I do to open a link in a new browser tab, it's essentially the same as above:

EM_JS(void, emsc_js_open_link, (const char* c_url), {
    var url = UTF8ToString(c_url);
    window.open(url);
});

But: IIRC it is important to call this code from within a HTML input event handler (or equivalent from within an Emscripten event callback) - more on that below.

...I'm using this here (go to "Help => About": https://floooh.github.io/visual6502remix/). The About-box content is rendered with imgui-markdown which has support for links.

The way link-clicks are handled is awkward though because of the above limitation that tabs can only be opened from within an HTML event handler:

I'm hooking into ImGuiMarkdown's "link-clicked callback" (which seems to be called when the mouse button is pressed down over the link) and only record the information that a link was clicked and its url. Then in the sokol_app.h mouse-up event handler (which is called from within the HTML event handler) I check that flag and call emsc_js_open_link().

PS: @ypujante I'm very surprised that this works because of the above mentioned limitation that browser tabs can only be opened from within HTML event handlers:

// example usage:
if (ImGui::Button("Open URL"))
  open_url("https://github.com/ocornut/imgui");

Because (from: https://developer.mozilla.org/en-US/docs/Web/API/Window/open):

image

@dougbinks
Copy link
Contributor

I'm hooking into ImGuiMarkdown's "link-clicked callback" (which seems to be called when the mouse button is pressed down over the link)

This should be called when the mouse button is released:

https://github.com/enkisoftware/imgui_markdown/blob/main/imgui_markdown.h#L852-L862

@floooh
Copy link
Contributor

floooh commented Jul 3, 2024

@dougbinks Hmm indeed, now I'm actually wondering why it works :D

My link-clicked callback looks like this:

https://github.com/floooh/v6502r/blob/2c3dd083b2087577a9a49364c2822564cc2dfc52/src/ui.cc#L2032-L2046

...this just records that a link has been clicked...

...and then in the sokol_app.h event handler I'm handling that before even passing input events to Dear ImGui (this test_click() function checks for mouse-button-up):

https://github.com/floooh/v6502r/blob/2c3dd083b2087577a9a49364c2822564cc2dfc52/src/ui.cc#L520-L525

...and only further down I'm passing input events to Dear ImGui:

https://github.com/floooh/v6502r/blob/2c3dd083b2087577a9a49364c2822564cc2dfc52/src/ui.cc#L616-L621

...need to investigate, one sec...

@floooh
Copy link
Contributor

floooh commented Jul 3, 2024

@dougbinks: mystery solved, I actually changed imgui_markdown.h so that the callback is always called as soon as it is hovered:

https://github.com/floooh/v6502r/blob/2c3dd083b2087577a9a49364c2822564cc2dfc52/ext/imgui_markdown/imgui_markdown.h#L516-L526

(also this is a very old version of imgui_markdown.h)

@ocornut
Copy link
Owner

ocornut commented Jul 3, 2024

Afaik in my test it worked on Firefox but it was from localhost:8000 and i don't know if there are varying policies for this.

@ocornut ocornut added web and removed style labels Jul 3, 2024
@floooh
Copy link
Contributor

floooh commented Jul 3, 2024

Yeah it's a mess tbh (like many things on the web platform unfortunately), serving from localhost typically enables a couple of security-related features to make testing easier. But I don't know if opening a new browser tab via window.open() is one of those, it could also be a Firefox thing.

@ypujante
Copy link
Contributor

ypujante commented Jul 3, 2024

@floooh I tried with 3 different browsers on my desktop (macOS): Firefox / Chrome and Safari. I use Chrome and Firefox all the time. Rarely Safari. Firefox and Chrome opened the link with no issue. Safari blocked the popup window, but displayed a message about it with a button to allow it: I clicked it and it worked. I probably have allowed popups from localhost on Firefox and Chrome a while back since I use them for development a lot

But I believe Safari is the "normal" behavior: browsers will more likely block the popup but will let you know about it and you can override it.

@floooh
Copy link
Contributor

floooh commented Jul 3, 2024

Hmm yeah, I seem to remember that there's just a subtle icon that a "popup" has been blocked when serving from real web servers, and clicking the icon may allow to define an exception, but this kind-of sucks because it looks like the application wants to do something fishy :)

I think it would still be good to allow applications to open the browser tab from a different place where the Dear ImGui link is defined, but I don't know how this could be best done without breaking the ImGui philosophy too much.

The way I solved it is basically to keep track if the currently hovered item is a link (and which link), because I need to know this information before the actual click-event on the link happens. Then in my own 'mouse button event handler' (which is running inside the HTML event handler) I check that earlier recorded 'is-link-hovered' flag and call window.open() with the (also recorded) link URL.

PS: this hover-check wouldn't work for touch UIs unfortunately :(

PPS: yeah, confirmed, my approach doesn't work on Android because it relies on the information that an item is hovered.

@ypujante
Copy link
Contributor

ypujante commented Jul 3, 2024

@floooh this is definitely one of the major drawbacks of Immediate GUI in general... in the browser everything is event based and that is a very different model...

@floooh
Copy link
Contributor

floooh commented Jul 3, 2024

The regular key- and pointer-input from browser to Dear ImGui works pretty well, it's mostly about special browser features which require to be called from a "short-lived event handler" for security reasons. So far I stumbled over this issue for:

  • clipboard features (exceptionally gnarly in browsers)
  • opening tabs
  • activating web audio contexts
  • switching to fullscreen
  • activating pointer-lock

...also slightly unrelated, text input on mobile devices is its own special circle of hell, I simply gave up on that.

For the link-input I can think of a model that could work also on mobile though, instead of recording 'hover' I could probably record whether a touch-start event happens over a link, and then in the following associated touch-end event try to open the tab. Similar with mouse-down / mouse-up. I wonder why I didn't try that - or maybe I tried it and it didn't work for some reason :/

ocornut pushed a commit that referenced this issue Jul 7, 2024
+ Enable on non-iPhone macOS builds
Ciachociech added a commit to Ciachociech/imgui that referenced this issue Jul 24, 2024
* 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>
@ocornut
Copy link
Owner

ocornut commented Jul 30, 2024

I'm not sure I understand the problem discussed above. May I close this issue? Is there something that you think should be done on imgui or imgui's backends end?

@ypujante
Copy link
Contributor

Thank you for the link and explanation. I will investigate and see if I can come up with something generic for emscripten-glfw and ImGui.

TBH I am having somewhat similar issue with get clipboard due to the asynchronous nature of the api: I implemented an extension API (asynchronous) but it is hard to retrofit it in ImGui (since the Paste keyboard event triggers the asynchronous call and only when it happens can you actually apply the paste...)

@floooh
Copy link
Contributor

floooh commented Jul 30, 2024

Yeah I have the same sorts of hacks for clipboard support on the web. When you look around in the code near the region I linked above, you'll see :D

@ypujante
Copy link
Contributor

ypujante commented Aug 8, 2024

@floooh I wanted to let you know that I have a "clean" solution for the "Popup Blocked" Safari issue and that it will be released with the next version of emscripten_glfw with a new convenient API:

// cpp API
/**
 * Convenient call to open a url */
void OpenURL(std::string_view url, std::optional<std::string_view> target = "_blank");

// C API
/**
 * Convenient call to open a url
 * @param target can be `nullptr` which defaults to `_blank` */
void emscripten_glfw_open_url(char const *url, char const *target);

it will just be a matter of setting this function something like this in ImGui (I will do a PR when ready):

#ifdef __EMSCRIPTEN__
#if EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3 > [versionTBD]
void ImGui_ImplGlfw_EmscriptenOpenURL(char const* url)
{
  if(url) emscripten_glfw_open_url(url, nullptr);
}
#else
EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (char const* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); });
#endif

#endif

ocornut added a commit that referenced this issue Aug 13, 2024
ocornut added a commit that referenced this issue Aug 22, 2024
ocornut added a commit that referenced this issue Aug 22, 2024
@ocornut
Copy link
Owner

ocornut commented Aug 22, 2024

FYI i have just introduced ImGuiPlatformIO essentially backported from docking branch and moved the new function here.

GetIO().PlatformOpenInShellFn -> GetPlatformIO()->Platform_OpenInShellFn

(Because this was introduced very recently and presumably not used much as core lib implement a good default, I have choosent to not implement legacy redirection for it.)

@ypujante
Copy link
Contributor

Thanks for the heads up. Much appreciated!

ocornut pushed a commit that referenced this issue Sep 3, 2024
…SCRIPTEN_USE_PORT_CONTRIB_GLFW3. Fixes popup blocked in some browsers. (#7915, #7660)
ocornut added a commit that referenced this issue Sep 6, 2024
@achabense
Copy link

Some feedback

  1. ShowAboutWindow is not detecting IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS, which IMO should be added (like other IMGUI_DISABLE_... flags.)

  2. The current default windows impl for Platform_OpenInShellFn_DefaultImpl is:

    imgui/imgui.cpp

    Lines 15091 to 15094 in e8ad60c

    static bool Platform_OpenInShellFn_DefaultImpl(ImGuiContext*, const char* path)
    {
    return (INT_PTR)::ShellExecuteA(NULL, "open", path, NULL, NULL, SW_SHOWDEFAULT) > 32;
    }

    This is assuming the path be encoded as "current code page", instead of a fixed encoding e.g. utf-8. I find this problematic for some cases. For example, the following link https://tonyteaches.tech/🤔/ is valid, but with the current impl it cannot be hard-coded to be opened directly by the function, as the current code page is uncontrollable. (For local paths, the encoding problem can be more tricky; I met this problem initially when I tried to open a utf8 path with the function.)

  3. I'm using SDL2, and there is SDL_OpenURL, which is fine for opening links (the paths are taken as utf8). Is it possible to add this to the backend? (It seems already supported Emscripten.)

@ocornut
Copy link
Owner

ocornut commented Feb 9, 2025

Could you clarify a repro for 2 and/or a suggested fix?
Yes for 1 and 3 we can do that.

@achabense
Copy link

#include<Windows.h>

static bool current_impl(const char* path) {
    return (INT_PTR)::ShellExecuteA(NULL, "open", path, NULL, NULL, SW_SHOWDEFAULT) > 32;
}

int main() {
    const char* url = (const char*)u8R"(https://tonyteaches.tech/🤔/)";
    current_impl(url);
}

Effect, in my default coding page:
ImageImage

Effect, after setting utf8:
ImageImage

@achabense
Copy link

I think Platform_OpenInShellFn_DefaultImpl should clarify what encoding it expects - to be more exact, according to what is done to ImFileOpen and Platform_SetClipboardTextFn_DefaultImpl, I think it should always accept utf8 path (then it's MultiByteToWideChar(CP_UTF8... and ShellExecuteW).

@ocornut
Copy link
Owner

ocornut commented Feb 9, 2025

Thank you. I’ll try to investigate and push a fix tomorrow or Tuesday.

@ocornut ocornut reopened this Feb 9, 2025
ocornut added a commit that referenced this issue Feb 10, 2025
…er to handle UTF-8 regardless of system regional settings. (#7660)
ocornut added a commit that referenced this issue Feb 10, 2025
@ocornut
Copy link
Owner

ocornut commented Feb 10, 2025

Pushed a18622c and a431e12, thank you!

@ypujante Do you know why the Emscripten Open URL workaround isn't also in the SDL3 backend?
For some reason I cannot seem to be able to build SDL3 examples in the command-line, the scripts are using pkg-config and I can't seem to find why/how it worked for me before.

@ocornut ocornut closed this as completed Feb 10, 2025
@ypujante
Copy link
Contributor

@ocornut No I do not know as I am not familiar with SDL3. I was testing some of my changes recently and noticed that there was this comment in the example file for sdl3/opengl3:

# IMPORTANT: SDL3 IS IN DEVELOPMENT, AS OF 2023-05-30, EMSCRIPTEN DOESN'T SUPPORT SDL3 YET.
# WE ARE LEAVING THIS MAKEFILE AROUND FOR THE DAY IT WILL SUPPORT IT.

And Makefile.emscripten uses this: -s USE_SDL=2 which is clearly not SDL3

I also have heard that SDL3 was released recently and although it does support Emscripten, it is via CMake file (which means you need to clone and compile it yourself). I was planning to see if I can create the Emscripten port file (similar to SDL2) to be able to use SDL3 unless somebody has already done so (which doesn't look like it as of now).

@achabense
Copy link

achabense commented Feb 10, 2025

SDL_OpenURL has support for emscripten as well (source), so I think the workaround may not be necessary now (I'm not familiar with emscripten, so this needs further confirmation)

@floooh
Copy link
Contributor

floooh commented Feb 10, 2025

@achabense the important part is that this SDL_OpenURL function must be called from within a HTML 'user input event handler' otherwise it won't work on Safari. I guess SDL just delegates that detail to the user.

E.g. this info snippet from MDN is relevant ('popup window' in this context also applies to browser tabs):

Modern browsers have strict popup blocker policies. Popup windows must be opened in direct response to user input, and a separate user gesture event is required for each Window.open() call. This prevents sites from spamming users with lots of windows. However, this poses an issue for multi-window applications.

@ocornut
Copy link
Owner

ocornut commented Feb 10, 2025

@achabense the important part is that this SDL_OpenURL function must be called from within a HTML 'user input event handler' otherwise it won't work on Safari. I guess SDL just delegates that detail to the user.

That's true but @achabense's correct merely points out that SDL3 already does what we manually did in SDL2 backend, and therefore the same change is not necessary, which answer my question. Solving the issue you point is still sort of an open topic.

@ypujante

I also have heard that SDL3 was released recently and although it does support Emscripten, it is via CMake file (which means you need to clone and compile it yourself). I was planning to see if I can create the Emscripten port file (similar to SDL2) to be able to use SDL3 unless somebody has already done so (which doesn't look like it as of now).

Yes, the makefile comment should be updated, this is exactly what I wanted to do today and then I couldn't figure out how to compile/link in the makefile. I understand cmake tends to be preferred there, but it'd be nice if our simple makefiles could also build those examples.

@ypujante
Copy link
Contributor

Given the relative complexity of what SDL2 is doing in the port file, I doubt you can "simply" change Makefile.emscripten to compile SDL3. CMake takes care of the complexity...

Of course if/when a SDL3 Emscripten port file is available, then Makefile.emscripten will become trivial: --use-port=contrib.sdl3...

ocornut added a commit that referenced this issue Feb 12, 2025
@ypujante
Copy link
Contributor

@ocornut For your information, I was working on the SDL3 port, but Sam beat me to it... emscripten-core/emscripten@2306e68 You should be able to use --use-port=sdl3 whenever the next release of Emscripten happens. I will post another message when that happens.

LalisaTM added a commit to LalisaTM/imgui that referenced this issue Feb 25, 2025
commit 2db3e9d
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Feb 25 17:11:56 2025 +0100

    Backends: SDL2, SDL3: Use display bounds when SDL_GetDisplayUsableBounds() fails or return a zero size. (ocornut#8415, ocornut#3457)

    Analoguous to aa8e09d for GLFW.

commit 9ab0b66
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Feb 25 15:55:54 2025 +0100

    Backends: fixed comment to state that ImGuiViewport::PlaformHandle is used to store SDL's WindowID, not SDL_Window*. (ocornut#7853)

    Amend 2d99052

commit dd89bb1
Author: ocornut <omarcornut@gmail.com>
Date:   Fri Feb 21 23:51:30 2025 +0100

    Backends: DirectX11: configure swap chain creation for secondary viewports via undocumented ImGui_ImplDX11_SetSwapChainDescs(). (ocornut#5437, ocornut#7607, ocornut#7286, ocornut#2970)

commit 3064e6d
Author: Marius PvW <marius@taniustech.com>
Date:   Fri Feb 21 22:37:51 2025 +0100

    Viewports + Backends: Win32: Fixed setting title bar text when application is compiled without UNICODE. (ocornut#7979, ocornut#5725)

commit 6acdce7
Author: ocornut <omarcornut@gmail.com>
Date:   Fri Feb 21 22:12:53 2025 +0100

    Backends: Win32: use UnregisterClassW() for matching consistency. (ocornut#8423, ocornut#7979)

    Amend 3293ef8

commit 7730601
Merge: 1a7b594 434b771
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 21 19:56:20 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	backends/imgui_impl_glfw.cpp
    #	backends/imgui_impl_glfw.h
    #	backends/imgui_impl_opengl3.cpp
    #	backends/imgui_impl_osx.h
    #	backends/imgui_impl_osx.mm
    #	backends/imgui_impl_sdl2.cpp
    #	backends/imgui_impl_sdl3.cpp
    #	backends/imgui_impl_win32.cpp
    #	imgui.cpp

commit 434b771
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Feb 19 16:49:35 2025 +0100

    Internals: packing ImGuiDataVarInfo + misc renaming + value of ImGuiDataType_Pointer doesn't need to be Count+1

commit 1a7b594
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 21 19:18:31 2025 +0100

    Backends: GLFW/SDL2/SDL3: Update monitors and work areas information every frame, as the later may change regardless of monitor changes. (ocornut#8415)

commit ea59440
Author: David Maas <contact@pathogenstudios.com>
Date:   Fri Feb 21 17:08:16 2025 +0100

    Backends: Win32: WM_SETTINGCHANGE's SPI_SETWORKAREA message also triggers a refresh of monitor list. (ocornut#8415)

commit 1e18a6c
Author: ocornut <omarcornut@gmail.com>
Date:   Fri Feb 21 16:55:35 2025 +0100

    Examples: GLFW+Vulkan: make GLFW_DIR overridable in cmake bit. (ocornut#8419)

commit a6bcbb1
Author: Tygyh <32486062+tygyh@users.noreply.github.com>
Date:   Thu Feb 20 18:07:25 2025 +0100

    Examples: Android: Update kotlin version (ocornut#8409)

commit 6dc376f
Author: ocornut <omar@miracleworld.net>
Date:   Thu Feb 20 11:54:32 2025 +0100

    ImFontAtlas: added software/drawlist version of ImGuiMouseCursor_Wait/ImGuiMouseCursor_Progress + moved GetMouseCursorTexData() to internals.

commit 85c488e
Author: ocornut <omar@miracleworld.net>
Date:   Thu Feb 20 11:46:56 2025 +0100

    Hot-fix for broken MouseDrawCursor support for ImGuiMouseCursor_Wait/ImGuiMouseCursor_Progress/ImGuiMouseCursor_NotAllowed.

    Amend 8a35386, eec097f.

commit 05742f9
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Feb 19 10:55:44 2025 +0100

    Tables: share code between TableSetupColumn() and TableLoadSettings(). (ocornut#7934)

commit 8b7b3ce
Author: ocornut <omarcornut@gmail.com>
Date:   Wed Feb 19 10:14:38 2025 +0100

    Tables: fixed an issue where Columns Width state wouldn't be correctly restored when hot-reloading .ini state. (ocornut#7934)

    Amend 7cd31c3
    column->SortDirection initialized setting was wrong in first block but without side-effect, since sorting always stored explicitly in .ini data.

commit eec097f
Author: ocornut <omar@miracleworld.net>
Date:   Tue Feb 18 18:52:08 2025 +0100

    Added ImGuiMouseCursor_Progress mouse cursor 8a35386+ support in SDL2,SDL3,Win32,Allegro5 backends.

    Amend 8a35386

commit 8a35386
Author: ocornut <omar@miracleworld.net>
Date:   Tue Feb 18 18:40:47 2025 +0100

    Added ImGuiMouseCursor_Wait mouse cursor (busy/wait/hourglass shape) + support in SDL2,SDL3,Win32,Allegro5 backends.

commit 8f0411f
Author: ocornut <omar@miracleworld.net>
Date:   Tue Feb 18 18:19:10 2025 +0100

    Backends: OpenGL3: Lazily reinitialize embedded GL loader for when calling backend from e.g. other DLL boundaries. (ocornut#8406)

commit afd659b
Merge: a4ebe3d5 c4a32a1
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 17 11:46:16 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	backends/imgui_impl_sdl2.cpp
    #	backends/imgui_impl_vulkan.cpp

commit c4a32a1
Author: Nico van Bentum <niico0708@gmail.com>
Date:   Thu Feb 13 21:50:12 2025 +0100

    Tabs: fixed middle-button to close not checking hovering, only close button visibility. (ocornut#8399, ocornut#8387)

    Main bug has been here since 54a60aa, but it's only ef7ffaf which made it very visible.

commit 78ec127
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 14 21:39:45 2025 +0100

    ImDrawList: added InitialFringeScale in ImDrawListSharedData. Default to 1.0f.

    This is to allow some DPI mods with less changes. Only the initial value in SetupDrawListSharedData() will need change.

commit 2860d7b
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 14 19:44:35 2025 +0100

    Selectable: Fixed horizontal label alignment with SelectableTextAlign.x > 0 and specifying a selectable size. (ocornut#8338)

    Regression from ed7551c

commit 474305c
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 14 16:15:09 2025 +0100

    ImFont: simpler constructor.

commit ec4cd2c
Author: ocornut <omarcornut@gmail.com>
Date:   Fri Feb 14 12:19:24 2025 +0100

    Backends: Vulkan: Fixed crash with using no prototypes + *BREAKING* Added ApiVersion to ImGui_ImplVulkan_LoadFunctions(). (ocornut#8326, ocornut#8365, ocornut#8400)

commit a4ebe3d
Author: ocornut <omarcornut@gmail.com>
Date:   Fri Feb 14 12:04:05 2025 +0100

    Viewports: Fixed assertion when multi-viewports disabled and no monitor submitted. Reworked 95c4111. (ocornut#8401, ocornut#8393, ocornut#8385)

commit 98c2f6b
Author: ocornut <omar@miracleworld.net>
Date:   Thu Feb 13 16:19:41 2025 +0100

    Tables, Error Handling: Recovery from invalid index in TableSetColumnIndex(). (ocornut#1651)

commit e1ae7db
Author: ocornut <omar@miracleworld.net>
Date:   Thu Feb 13 16:03:40 2025 +0100

    Backends: Vulkan: Fixed building with older headers not supporting VK_HEADER_VERSION_COMPLETE. (ocornut#8326, ocornut#8365)

commit 12963f5
Author: ocornut <omar@miracleworld.net>
Date:   Thu Feb 13 15:49:47 2025 +0100

    Examples: Vulkan: make ApiVersion a little more visible in examples. (ocornut#8326, ocornut#8365)

commit 890ead6
Author: ocornut <omar@miracleworld.net>
Date:   Thu Feb 13 15:40:49 2025 +0100

    Backends: Vulkan: Added ApiVersion field in ImGui_ImplVulkan_InitInfo. Dynamic rendering path loads "vkCmdBeginRendering/vkCmdEndRendering" without -KHR on API 1.3. (ocornut#8326, ocornut#8365)

commit 95c4111
Author: Gabriel Rodriguez <gabrielrodriguez@mediamolecule.com>
Date:   Wed Feb 12 12:39:44 2025 +0100

    Viewports: default to first monitor is viewport is outside bounds. (ocornut#8393, ocornut#8385)

    Before the assert was introduced in d66f4e5 the viewport would be eventually clamped with ClampWindowPos using g.FallbackMonitor, but code would run temporarly with DpiScale=0.

commit f94a5f0
Author: Rémy Tassoux <contact@rt2.fr>
Date:   Thu Feb 13 14:30:49 2025 +0100

    Docs: Update doc about plutosvg (ocornut#8395)

commit b78cc37
Author: ocornut <omar@miracleworld.net>
Date:   Wed Feb 12 19:27:43 2025 +0100

    Backends: SDL2: Fixed build for versions older than 2.0.14. (ocornut#7660)

commit 71d39a4
Merge: 8679cfa a931fb7
Author: ocornut <omar@miracleworld.net>
Date:   Wed Feb 12 19:17:48 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	backends/imgui_impl_sdl2.cpp
    #	backends/imgui_impl_sdl3.cpp
    #	imgui.cpp
    #	imgui_internal.h

commit a931fb7
Author: ocornut <omar@miracleworld.net>
Date:   Wed Feb 12 19:15:00 2025 +0100

    Fixed static analyzer warning.

    (was harmless as initialized in NewFrame)

commit 7cd31c3
Author: ocornut <omar@miracleworld.net>
Date:   Wed Feb 12 19:08:52 2025 +0100

    Tables: tamed some .ini settings optimizations to more accurately allow overwriting/hot-reloading settings. (ocornut#7934)

commit 7221f5e
Author: ocornut <omar@miracleworld.net>
Date:   Wed Feb 12 19:01:02 2025 +0100

    Styles, Tabs: Fixed ef7ffaf. (ocornut#8387)

commit ef7ffaf
Author: ocornut <omar@miracleworld.net>
Date:   Wed Feb 12 15:46:17 2025 +0100

    Styles, Tabs: (Breaking) Renamed TabMinWidthForCloseButton to TabCloseButtonMinWidthUnselected. Added TabCloseButtonMinWidthSelected. (ocornut#8387)

commit 3d900ed
Author: PuPuHX <654524200@qq.com>
Date:   Tue Feb 11 10:57:47 2025 +0800

    Examples: Win32+DirectX12: Fixed ExampleDescriptorHeapAllocator overflow free index.

    Amend 40b2286.

commit 6916f93
Author: fdsa <14tanks999@gmail.com>
Date:   Tue Feb 11 13:12:55 2025 -0800

    InputText: Allow CTRL+Shift+Z to redo even outside of OSX. (ocornut#8389)

commit 3b2f260
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 10 21:33:49 2025 +0100

    Windows: Fixed an issue where BeginChild() inside a collapsed Begin() wouldn't inherit the SkipItems flag.

    Amend/fix a89f05a (old!)
    Discovered while looking at glyph being processed in WIP branch.

commit 4dc9df6
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 10 19:29:18 2025 +0100

    Tables: fixed an issue where Columns Visible/Hidden state wouldn't be correctly overridden when hot-reloading .ini state. (ocornut#7934)

commit 88cda0c
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 10 12:39:54 2025 +0100

    Fixed minor warning. Added comment.

commit a431e12
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 10 12:09:44 2025 +0100

    Backends: SDL2, SDL3:  Using SDL_OpenURL() in platform_io.Platform_OpenInShellFn handler. (ocornut#7660)

commit a18622c
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 10 12:02:01 2025 +0100

    TextLinkOpenURL(): fixed default Win32 io.PlatformOpenInShellFn handler to handle UTF-8 regardless of system regional settings. (ocornut#7660)

commit 2206e31
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 10 11:37:55 2025 +0100

    Demo: Combos: demonstrate a very simple way to add a filter to a combo. (ocornut#718)

commit e8ad60c
Author: edenware <52419657+edenoftheware@users.noreply.github.com>
Date:   Fri Feb 7 21:01:46 2025 -0600

    Fix typo (ocornut#8382)

commit 50dbb08
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 7 22:57:15 2025 +0100

    Tables: sneakily honor ImGuiNextWindowDataFlags_HasChildFlags/ImGuiNextWindowDataFlags_HasWindowFlags as a way to facilitate various hacks/workarounds.

commit e368015
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 7 22:56:02 2025 +0100

    Tables: a clipped scrolling table correctly clears SetNextWindowXXX flags. (ocornut#8196)

    Amend 43c51eb

commit e5668b8
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 7 22:48:31 2025 +0100

    Internals: rename ImGuiNextWindowData::Flags to HasFlags for consistency and to reduce mistakes.

commit 8679cfa
Merge: d803476 4982602
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 7 18:27:32 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	backends/imgui_impl_glfw.cpp
    #	backends/imgui_impl_glfw.h
    #	examples/example_apple_metal/example_apple_metal.xcodeproj/project.pbxproj
    #	imgui.cpp

commit 4982602
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 7 18:16:04 2025 +0100

    Windows, Style: Added style.WindowBorderHoverPadding setting to configure inner/outer padding applied to hit-testing of windows borders.

    Amend 3c7177c, 59f3c4f, ae7f833.
    Could be latched inside windows to be multi-dpi friendly, but likely won't matter soon.

commit 914fbcf
Author: ocornut <omar@miracleworld.net>
Date:   Fri Feb 7 16:23:00 2025 +0100

    Fonts: removed unnecessary const qualifier from ImFont::FindGlyph()

    Amend 0bde57c

commit 4f1d380
Author: fdsa <14tanks999@gmail.com>
Date:   Wed Feb 5 18:41:03 2025 -0800

    Fixed tabs and spaces (ocornut#8377)

commit 0625b37
Author: ocornut <omar@miracleworld.net>
Date:   Thu Feb 6 18:37:32 2025 +0100

    Scrollbar: Rework logic that fades-out scrollbar when it becomes too small.

    Amend 0236bc2

commit cfed18a
Author: ocornut <omar@miracleworld.net>
Date:   Thu Feb 6 12:34:37 2025 +0100

    Add ImFontConfig::GlyphExtraAdvanceX as a replacement for GlyphExtraSpacing.x (ocornut#242)

    Partly restore 1a31e31.

commit 2d20e13
Author: ocornut <omarcornut@gmail.com>
Date:   Tue Feb 4 20:19:57 2025 +0100

    Backends: GLFW: Added comment about io.AddMouseSourceEvent() not being properly called. (ocornut#8374)

commit d803476
Merge: 1820fe5 1a31e31
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 3 18:42:24 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	backends/imgui_impl_metal.mm
    #	imgui.cpp
    #	imgui_internal.h

commit 1a31e31
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 3 17:55:35 2025 +0100

    (Breaking) Fonts: removed ImFontConfig::GlyphExtraSpacing option which seems largely obsolete and unused. (ocornut#242)

commit de962e8
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 3 17:50:12 2025 +0100

    ImFont: remove SetGlyphVisible()

    Which was never marked public. Added by d284a6c. (ocornut#2149, ocornut#515)
    Making room by removing stuff that are inconvenient to implement in our scaling system.
    If you were using this function please post an issue to report it.

commit da0ba9e
Author: PhantomCloak <unalozyurtrooter@hotmail.com>
Date:   Sun Feb 2 19:25:09 2025 +0300

    Backends: WebGPU: add type alias for dawn WGPUProgrammableStageDescriptor -> WGPUComputeState. (ocornut#8369)

commit 5dd8408
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 3 15:11:03 2025 +0100

    InputTextWithHint(): Fixed buffer overflow when user callback modifies the buffer contents in a way that alters hint visibility. (ocornut#8368)

commit 204cebc
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 3 14:21:53 2025 +0100

    Backends: Metal: Fixed a crash on application resources. (ocornut#8367, ocornut#7419) [@anszom]

commit 6265339
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 3 14:01:48 2025 +0100

    Fixed IsItemDeactivatedAfterEdit() signal being broken for Checkbox(), RadioButton(), Selectable(). (ocornut#8370)

    Item is already made inactive at the time of calling MarkItemEdited().
    Fix a604d4f

commit f820bf7
Author: ocornut <omar@miracleworld.net>
Date:   Mon Feb 3 12:33:40 2025 +0100

    Version 1.91.9 WIP

commit e4db4e4
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 31 19:50:18 2025 +0100

    Internals: renamed GetIOEx() to GetIO(). Added GetPlatformIO() explicit context variant. - OOPS

commit 1820fe5
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 31 19:02:14 2025 +0100

    Comments, minor alignments tweaks.

commit e2a99b5
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 31 18:26:52 2025 +0100

    Internals: renamed GetIOEx() to GetIO(). Added GetPlatformIO() explicit context variant.

commit 11b3a7c
Merge: c2dcc80 dbb5eea
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 31 16:10:20 2025 +0100

    Merge branch 'master' into docking

commit dbb5eea
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 31 15:57:48 2025 +0100

    Version 1.91.8

commit e6c5296
Author: Konstantin Podsvirov <konstantin@podsvirov.pro>
Date:   Fri Jan 31 16:11:33 2025 +0300

    Examples: SDL3: Fix for Emscripten platform (ocornut#8363)

commit ae6cfd3
Author: ocornut <omar@miracleworld.net>
Date:   Thu Jan 30 14:34:05 2025 +0100

    Tables, Menus: Fixed tables or child windows submitted inside BeginMainMenuBar() being unable to save their settings. (ocornut#8356)

    Amend error handling (fa178f4) to avoid us setting ImGuiWindowFlags_NoSavedSettings on the wrong window.

commit fa178f4
Author: ocornut <omar@miracleworld.net>
Date:   Thu Jan 30 14:30:14 2025 +0100

    Error Handling: Recovery from missing EndMenuBar() call. (ocornut#1651)

commit c2dcc80
Author: ocornut <omarcornut@gmail.com>
Date:   Thu Jan 30 11:39:52 2025 +0100

    Docking: fixed ImGuiWindowFlags_DockNodeHost/ImGuiWindowFlags_NavFlattened clash introduced by c38c18c just for 1.91.7 (ocornut#8357)

commit 1dc7762
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 29 20:13:22 2025 +0100

    Fixed zealous GCC warning. (ocornut#8355)

    Amend dfd1bc3

commit c0308da
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 29 20:13:22 2025 +0100

    Fixed zealous GCC warning. (ocornut#8355)

    Amend dfd1bc3

commit 0825952
Merge: 75d9965 dabc990
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 29 20:04:45 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	imgui.cpp
    #	imgui_internal.h

commit dabc990
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 29 19:59:41 2025 +0100

    Rename internal id for standardizing naming convention. "##menubar" -> "##MenuBar", "###NavWindowingList" -> "###NavWindowingOverlay"

    "###NavUpdateWindowing" one should have zero side effect on anyone.

commit a711915
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 29 19:07:28 2025 +0100

    EndMainMenuBar doesn't attempt to restore focus when there's an active id. (ocornut#8355)

    I don't have a specific issue in mind but it seems sane to add that test.

commit dfd1bc3
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 29 19:05:18 2025 +0100

    Tables, Menus: Fixed using BeginTable() in menu layer (any menu bar). (ocornut#8355)

commit 4230e98
Author: ocornut <omar@miracleworld.net>
Date:   Tue Jan 28 14:39:00 2025 +0100

    Error Handling, Debug Log: IMGUI_DEBUG_LOG_ERROR() doesn't need the extra variable.

    Amend 2360061

commit ea0da0b
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 27 18:04:44 2025 +0100

    Extracted PushPasswordFont() out of InputText code.

commit 75d9965
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 27 15:48:20 2025 +0100

    Docking: move DockTabItemStatusFlags stuff next to its peers in DC structure.

commit db4e541
Merge: 81dab64 9c4948a
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 27 15:45:26 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	imgui.cpp
    #	imgui_internal.h
    #	imgui_widgets.cpp

commit 9c4948a
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 27 15:41:24 2025 +0100

    TabBar: Internals: added TabItemSpacing(). (ocornut#8349, ocornut#3291)

commit a05d547
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 27 14:39:26 2025 +0100

    Windows: separating WindowItemStatusFlags from ChildItemStatusFlag, because IsItemXXX _after_ BeginChild()>Begin() shouldn't return last status emitted by e.g. EndChild()

    As IsItemXXX() after is specced as returning title bar data we don't want to lock ourselves up from adding them to child window (e.g. MDI idea using windows to host child windows).

commit 134fbe1
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 27 12:39:44 2025 +0100

    Windows: Fixed IsItemXXXX() functions not working on append-version of EndChild(). (ocornut#8350)

    Also made some of the fields accessible after BeginChild() to match Begin() logic.

commit 5a28f18
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 27 12:27:10 2025 +0100

    Fixed parameter names to SetLastItemData() to align with current names.

commit 81dab64
Merge: 355cb58 96e3b14
Author: ocornut <omarcornut@gmail.com>
Date:   Sat Jan 25 01:15:30 2025 +0100

    Merge branch 'master' into docking

commit 96e3b14
Author: ocornut <omarcornut@gmail.com>
Date:   Sat Jan 25 01:14:46 2025 +0100

    Fixed build with IMGUI_ENABLE_FREETYPE (ocornut#8346)

commit afb6e9a
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 24 20:03:04 2025 +0100

    Fonts: OversampleH auto-selection uses 36 as heuristic for now.

commit 355cb58
Merge: 64e738c 8a1613a
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 24 19:40:54 2025 +0100

    Merge branch 'master' into docking, incl conflict merge in BeginMenuBar() for ocornut#8267

    # Conflicts:
    #	imgui_widgets.cpp

commit 8a1613a
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 24 19:27:50 2025 +0100

    Fonts: OversampleH/OversampleV value defaults to 0 for automatic selection.

commit 4211fdc
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 22 15:44:51 2025 +0100

    ImFont: compact comments in header section.

commit 9eafb7b
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 24 16:54:59 2025 +0100

    ImFont: IndexLookup[] table hold 16-bit values even in ImWchar32 mode.

commit 53244aa
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 24 15:00:21 2025 +0100

    Amend 9bc5b04 with a shadowed variable warning fix.

commit ed7551c
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 24 14:59:37 2025 +0100

    Selectable: Fixed horizontal label alignment when combined with using ImGuiSelectableFlags_SpanAllColumns. (ocornut#8338)

commit bbf9578
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 24 14:43:16 2025 +0100

    Amend 9bc5b04 to avoid using GImGui mid-function.

commit 9bc5b04
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 24 14:39:07 2025 +0100

    Windows, Style: Fixed small rendering issues with menu bar, resize grip and scrollbar when using thick border sizes. (ocornut#8267, ocornut#7887)

    Amend e.g. 742b5f4.

commit 1019934
Author: ocornut <omar@miracleworld.net>
Date:   Thu Jan 23 11:31:32 2025 +0100

    ImFontAtlas: made calling ClearFonts() call ClearInputData(). (ocornut#8174, ocornut#6556, ocornut#6336, ocornut#4723)

commit 71da34c
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 22 16:56:18 2025 +0100

    Debug Tools: Tweaked font preview + indent "Glyphs" block.

commit 64e738c
Merge: a3802c8 6906ac9
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 22 12:19:09 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	imgui.cpp

commit 6906ac9
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 22 12:12:07 2025 +0100

    ColorEdit, ColorPicker: (Breaking) redesigned how alpha is displayed in the preview square. (ocornut#8335, ocornut#1578, ocornut#346)

    Added ImGuiColorEditFlags_AlphaOpaque, ImGuiColorEditFlags_AlphaNoBg.
    Removed ImGuiColorEditFlags_AlphaPreview.

commit fdca6c0
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 22 11:28:47 2025 +0100

    Inputs: added IsMouseReleasedWithDelay() helper. (ocornut#8337, ocornut#8320)

commit d17e9fc
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 22 10:32:09 2025 +0100

    Backends: SDL_GPU: shallow tweaks + disable anisotropy in sampler. Examples: SDL+Vulkan: Fixed incorrect defines.

commit 3e6bdc2
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 22 10:22:31 2025 +0100

    Examples: SDL3+SDL_GPU: use SDL_GPU_PRESENTMODE_MAILBOX swapchain parameters.

commit a3802c8
Author: David Maas <contact@pathogenstudios.com>
Date:   Wed Jan 22 10:01:40 2025 +0100

    Backends: SDL3: new viewport windows are created with the SDL_WINDOW_HIDDEN flag before calling SDL_ShowWindow(). (ocornut#8328

    Unsure why it was missing from a526ff8

commit bf13442
Author: ocornut <omar@miracleworld.net>
Date:   Tue Jan 21 14:59:29 2025 +0100

    Moved ImGuiColorEditFlags_AlphaPreview/ImGuiColorEditFlags_AlphaPreviewHalf flags. Demo: reorganized some of color edit/picker demo section.

commit 2af26b7
Author: David Maas <contact@pathogenstudios.com>
Date:   Tue Jan 21 14:25:39 2025 +0100

    ColorEdit, ColorPicker: Fixed alpha preview broken in 1.91.7. (ocornut#8336, ocornut#8241). [@PathogenDavid]

    ImAlphaBlendColors() was broken by ImLerp() change. (cd6c83c)

commit 7ae7c90
Author: ocornut <omar@miracleworld.net>
Date:   Tue Jan 21 13:55:44 2025 +0100

    Tabs, Style: reworked selected overline rendering to better accommodate for rounded tabs. (ocornut#8334)

commit 6e94f6c
Merge: 109dd2b e8779a6
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 20 18:04:31 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	backends/imgui_impl_osx.mm
    #	backends/imgui_impl_sdl2.cpp
    #	backends/imgui_impl_sdl3.cpp
    #	imgui.cpp
    #	imgui_internal.h

commit e8779a6
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 20 17:55:09 2025 +0100

    Font: direct AddText()/RenderText() calls don't need to call strlen() if below clipping region.

    Unlikely to meaningful affect anyone but still..

commit 4c2e7bb
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 20 15:24:46 2025 +0100

    Backends: SDL2,SDL3: removed assert preventing using ImGui_ImplSDL2_SetGamepadMode()/ImGui_ImplSDL3_SetGamepadMode() with ImGui_ImplSDL2_GamepadMode_Manual/ImGui_ImplSDL3_GamepadMode_Manual and an empty array. (ocornut#8329)

commit 8b0af7f
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 20 14:30:40 2025 +0100

    Backends: SDL: update comments regarding API stability, regarding SDL_GPU and SDL_Renderer.

commit aa1b4ea
Author: Julian Rachele <julrachele@gmail.com>
Date:   Sun Jan 19 16:30:15 2025 -0500

    Backends: OSX: Remove notification observer when shutting down. (ocornut#8331)

commit aa23f38
Author: Daniel K. O. (dkosmari) <none@none>
Date:   Fri Jan 17 19:18:05 2025 -0300

    Backends: SDL_Renderer2/3: Use endian-dependent RGBA32 texture format, to match SDL_Color. (ocornut#8327)

commit 80c9cd1
Author: ocornut <omar@miracleworld.net>
Date:   Sat Jan 18 16:43:17 2025 +0100

    Font: reduce unnecessary padding in ImFontConfig struct too.

commit d7454de
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 17 18:09:28 2025 +0100

    Font: minor tweak to struct alignment.

commit dd89a37
Author: ocornut <omar@miracleworld.net>
Date:   Fri Jan 17 17:11:22 2025 +0100

    Backends: Vulkan: sharing duplicate code. (ocornut#5446, ocornut#8326)

commit 487d7f9
Author: ocornut <omar@miracleworld.net>
Date:   Thu Jan 16 22:30:43 2025 +0100

    Font: Internals: make used page maps smaller. Since it's extremely rarely used and for iterations only. ~34->16 bytes with ImWchar32.

commit f2262eb
Author: ocornut <omar@miracleworld.net>
Date:   Thu Jan 16 19:46:54 2025 +0100

    Windows: latch FontRefSize at time of Begin(), consistent with e.g. TitleBarHeight, and to avoid calling CalcFontSize() on non-current window.

commit b7c27c5
Author: ocornut <omar@miracleworld.net>
Date:   Thu Jan 16 19:07:09 2025 +0100

    Windows: legacy SetWindowFontScale() is properly inherited by nested child windows. (ocornut#2701, ocornut#8138, ocornut#1018)

commit 4c64ba1
Author: ocornut <omar@miracleworld.net>
Date:   Thu Jan 16 17:42:00 2025 +0100

    imgui_freetype: fixed issue where glyph advances would incorrectly be snapped to pixels.

commit 0077357
Author: Diego Mateos <diego.mateos@mecalux.com>
Date:   Thu Jan 16 17:10:26 2025 +0100

    Ignore vscode artifacts (ocornut#8324)

commit b4a5d1d
Author: ocornut <omar@miracleworld.net>
Date:   Thu Jan 16 12:42:54 2025 +0100

    Backends: SDLGPU3: Rename GpuDevice->Device. Expose ImGui_ImplSDLGPU3_CreateDeviceObjects(), ImGui_ImplSDLGPU3_DestroyDeviceObjects(). Misc renaming. (ocornut#8163, ocornut#7998, ocornut#7988)

commit 109dd2b
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 17:50:57 2025 +0100

    Backends: Vulkan: VK_SUBOPTIMAL_KHR doesn't skip frame. (ocornut#7831, ocornut#7825)

commit 507cdba
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 17:38:37 2025 +0100

    Backends: Vulkan: vkQueuePresentKHR() returning VK_SUBOPTIMAL_KHR keeps moving forward. (ocornut#7825)

commit 015186a
Merge: b9badb5 0f33d71
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 17:34:17 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	backends/imgui_impl_dx12.cpp
    #	backends/imgui_impl_vulkan.cpp

commit 0f33d71
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 17:25:44 2025 +0100

    Examples: Vulkan: vkAcquireNextImageKHR() and vkQueuePresentKHR() returning VK_SUBOPTIMAL_KHR keeps moving forward. (ocornut#7825, ocornut#7831)

commit b9badb5
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 17:08:04 2025 +0100

    Backends: Vulkan: removed misleading code incrementing frameindex. (ocornut#7834)

    Thanks NostraMagister!

commit 8ebf22d
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 16:10:47 2025 +0100

    Backends: Vulkan: use ImVector<> for simplicity.

commit 6684984
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 15:13:05 2025 +0100

    Examples: DirectX12: Reduced number of frame in flight from 3 to 2 in provided example, to reduce latency.

commit 0e21bde
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 13:58:38 2025 +0100

    Misc shallow merge to reduce diff in other branches.

commit 8a9de84
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 13:47:52 2025 +0100

    FontAtlas: reduced baked IM_DRAWLIST_TEX_LINES_WIDTH_MAX from 63 to 32. (ocornut#3245)

commit 100075f
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 12:05:33 2025 +0100

    Backends: DirectX12: Texture upload use the command queue provided in ImGui_ImplDX12_InitInfo instead of creating its own.

    + minor tweaks to faciliate branch merging.

commit c59a226
Author: ocornut <omar@miracleworld.net>
Date:   Wed Jan 15 11:58:47 2025 +0100

    Version 1.91.8 WIP

commit c0ae325
Merge: d0d571e 5c1d2d1
Author: ocornut <omar@miracleworld.net>
Date:   Tue Jan 14 13:46:39 2025 +0100

    Merge branch 'master' into docking

    # Conflicts:
    #	imgui.cpp

commit 5c1d2d1
Author: ocornut <omar@miracleworld.net>
Date:   Tue Jan 14 13:16:43 2025 +0100

    Version 1.91.7

commit 9f8481a
Author: ocornut <omar@miracleworld.net>
Date:   Tue Jan 14 13:14:50 2025 +0100

    (Breaking) TreeNode: renamed ImGuiTreeNodeFlags_SpanTextWidth to ImGuiTreeNodeFlags_SpanLabelWidth. (ocornut#6937)

commit 21902e2
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 13 19:51:15 2025 +0100

    Backends: SDL_GPU: fixed SDL_GPUViewport initialisation. (ocornut#8163, ocornut#7998, ocornut#7988)

    Probably harmless. Amend 8bbccf7

commit c38c18c
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 13 19:39:57 2025 +0100

    Avoid using 1<<31 for ImGuiWindowFlags_NavFlattened as it seems to confuse some binding generators.

commit c5f6094
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 13 19:18:05 2025 +0100

    Demo: tweak demo for ImGuiTreeNodeFlags_LabelSpanAllColumns. (ocornut#8318, ocornut#3565)

commit 290e402
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 13 18:55:09 2025 +0100

    TreeNode, Tables: added ImGuiTreeNodeFlags_LabelSpanAllColumns. (ocornut#8318, ocornut#3565)

commit 6fb7d44
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 13 16:46:29 2025 +0100

    Backends: SDL2/SDL3: Comments. (ocornut#7672, ocornut#7670)

commit 32cea85
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 13 15:51:39 2025 +0100

    Debug Tools:  Item Picker: Always available in menu. Tweak Demo Debug Options. (ocornut#2673, ocornut#1651)

commit 00f12b9
Author: ocornut <omar@miracleworld.net>
Date:   Mon Jan 13 15:22:45 2025 +0100

    InputText: Fixed not calling CallbackEdit on revert/clear with Escape key. (ocornut#8273) + rework comments.

    Seems like there is no reason to not run that path. Amend ancient 9501cd9, f3ab5e6
ocornut added a commit that referenced this issue Mar 2, 2025
@ypujante
Copy link
Contributor

ypujante commented Mar 4, 2025

@ocornut Following up on this and letting you know that 4.0.4 is now live with support for SDL3 (it is marked experimental and since I am not the one who did it, I am not sure what that means).

From the Changelog:

An initial port of SDL3 was added. Use it with -sUSE_SDL=3. This port is still experimental. (#23630)

You can also use the syntax --use-port=sdl3 although it is not mentioned in the Changelog (either way will work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants