1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-09 23:54:20 +00:00

(Breaking) Popups: changed 'ImGuiPopupFlags popup_flags = 1' default value to be '= 0' for BeginPopupContextItem(), BeginPopupContextWindow(), BeginPopupContextVoid(), OpenPopupOnItemClick(). (#9157, #9146)

This commit is contained in:
ocornut 2026-01-07 18:15:15 +01:00
parent 4ce188def8
commit 7b3ad4a282
4 changed files with 82 additions and 24 deletions

View file

@ -70,6 +70,33 @@ Breaking Changes:
the issue altogether.
- Removed ImFontConfig::PixelSnapV added in 1.92 which turns out is unnecessary
(and misdocumented). Post-rescale GlyphOffset is always rounded.
- Popups: changed compile-time 'ImGuiPopupFlags popup_flags = 1' default value to be '= 0' for
BeginPopupContextItem(), BeginPopupContextWindow(), BeginPopupContextVoid(), OpenPopupOnItemClick().
The default value has same meaning before and after. (#9157, #9146)
- Before this version, those functions had a 'ImGuiPopupFlags popup_flags = 1' default
value in their function signature. This was introduced by a change on 2020/06/23 (1.77)
while changing the signature from 'int mouse_button' to 'ImGuiPopupFlags popup_flags'
and trying to preserve then-legacy behavior.
- We have now changed this behavior to: cleanup a very old API quirk, facilitate use by
bindings, and to remove the last and error-prone non-zero default value. Also because we
deemed it extremely rare to use those helper functions with the Left mouse button!
As using the LMB would generally be triggered via another widget, e.g. a Button() +
a OpenPopup()/BeginPopup() call.
- Before: The default = 1 means ImGuiPopupFlags_MouseButtonRight.
Explicitly passing a literal 0 means ImGuiPopupFlags_MouseButtonLeft.
- After: The default = 0 means ImGuiPopupFlags_MouseButtonRight.
Explicitly passing a literal 1 also means ImGuiPopupFlags_MouseButtonRight
(if legacy behavior are enabled) or will assert (if legacy behavior are disabled).
- TL;DR: if you don't want to use right mouse button for popups, always specify it
explicitly using a named ImGuiPopupFlags_MouseButtonXXXX value.
Recap:
- BeginPopupContextItem("foo"); // Behavior unchanged (use Right button)
- BeginPopupContextItem("foo", ImGuiPopupFlags_MouseButtonLeft); // Behavior unchanged (use Left button)
- BeginPopupContextItem("foo", ImGuiPopupFlags_MouseButtonLeft | xxx); // Behavior unchanged (use Left button + flags)
- BeginPopupContextItem("foo", ImGuiPopupFlags_MouseButtonRight | xxx); // Behavior unchanged (use Right button + flags)
- BeginPopupContextItem("foo", 1); // Behavior unchanged (as a courtesy we legacy interpret 1 as ImGuiPopupFlags_MouseButtonRight, will assert if disabling legacy behaviors.
- BeginPopupContextItem("foo", 0); // !! Behavior changed !! Was Left button. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft.
- BeginPopupContextItem("foo", ImGuiPopupFlags_NoReopen); // !! Behavior changed !! Was Left button + flags. Now will defaults to Right button! --> Use ImGuiPopupFlags_MouseButtonLeft | xxx.
Other Changes: