Skip to content

make popup_flags use ImGuiPopupFlags_MouseButtonRight as a default value instead of 1#9146

Closed
Rune-Magic wants to merge 1 commit intoocornut:masterfrom
Rune-Magic:patch-1
Closed

make popup_flags use ImGuiPopupFlags_MouseButtonRight as a default value instead of 1#9146
Rune-Magic wants to merge 1 commit intoocornut:masterfrom
Rune-Magic:patch-1

Conversation

@Rune-Magic
Copy link
Copy Markdown

  • ImGuiPopupFlags_MouseButtonRight is more self documenting than 1
  • 1 is also bad for bindings since they usually use the enums directly instead of the typedefs

@ocornut
Copy link
Copy Markdown
Owner

ocornut commented Jan 3, 2026

Err... did you try to compile this?

@ocornut ocornut added the popups label Jan 3, 2026
@Rune-Magic
Copy link
Copy Markdown
Author

oops

@Rune-Magic Rune-Magic closed this Jan 3, 2026
@ocornut
Copy link
Copy Markdown
Owner

ocornut commented Jan 3, 2026

It's rather terrible in the first place that those 4 api have a non-zero default parameters due to legacy reason, I think I would prefer to find a solution to this problem that allows us to switch the default to 0.

I didn't have a good solution for it back then when fed80b9 was pushed.
Since:

  • this is now a 5+ years change.
  • BeginPopupContextXXX() is imho rarely used with ImGuiPopupFlags_MouseButtonLeft, let alone with an explicit 0.

We could decide to make the breaking change of:

  • Changing all ImGuiPopupFlags_MouseButtonXXX values to be non-zero.
  • When none is set, use the default which is ImGuiPopupFlags_MouseButtonRight.
  • Reserve bit 0-1 are "unauthorized use" to detect use of hardcoded 1 or 2.

This would still work:

  • BeginPopupContextXXX(...., ImGuiPopupFlags_MouseButtonLeft)

This would break behavior by changing the button from left to right:

  • BeginPopuContextXXX(...., 0);

I believe it's an acceptable breaking change especially since it can be regexp searched..

@Rune-Magic
Copy link
Copy Markdown
Author

yeah that would nice

ocornut added a commit that referenced this pull request Jan 7, 2026
…value to be '= 0' for BeginPopupContextItem(), BeginPopupContextWindow(), BeginPopupContextVoid(), OpenPopupOnItemClick(). (#9157, #9146)
@ocornut
Copy link
Copy Markdown
Owner

ocornut commented Jan 7, 2026

Applied this change, see #9157

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants