Skip to content

Commit 72ebd91

Browse files
committed
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_opengl3.cpp # imgui.h
2 parents 9064dbd + 2c07d58 commit 72ebd91

File tree

12 files changed

+183
-73
lines changed

12 files changed

+183
-73
lines changed

backends/imgui_impl_opengl3.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// CHANGELOG
2525
// (minor and older changes stripped away, please see git history for details)
2626
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
27+
// 2023-10-05: OpenGL: Rename symbols in our internal loader so that LTO compilation with another copy of gl3w is possible. (#6875, #6668, #4445)
2728
// 2023-06-20: OpenGL: Fixed erroneous use glGetIntegerv(GL_CONTEXT_PROFILE_MASK) on contexts lower than 3.2. (#6539, #6333)
2829
// 2023-05-09: OpenGL: Support for glBindSampler() backup/restore on ES3. (#6375)
2930
// 2023-04-18: OpenGL: Restore front and back polygon mode separately when supported by context. (#6333)

backends/imgui_impl_opengl3_loader.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ GL3W_API int imgl3wIsSupported(int major, int minor);
467467
GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc);
468468

469469
/* gl3w internal state */
470-
union GL3WProcs {
470+
union ImGL3WProcs {
471471
GL3WglProc ptr[59];
472472
struct {
473473
PFNGLACTIVETEXTUREPROC ActiveTexture;
@@ -532,7 +532,7 @@ union GL3WProcs {
532532
} gl;
533533
};
534534

535-
GL3W_API extern union GL3WProcs imgl3wProcs;
535+
GL3W_API extern union ImGL3WProcs imgl3wProcs;
536536

537537
/* OpenGL functions */
538538
#define glActiveTexture imgl3wProcs.gl.ActiveTexture
@@ -794,7 +794,7 @@ static const char *proc_names[] = {
794794
"glViewport",
795795
};
796796

797-
GL3W_API union GL3WProcs imgl3wProcs;
797+
GL3W_API union ImGL3WProcs imgl3wProcs;
798798

799799
static void load_procs(GL3WGetProcAddressProc proc)
800800
{

docs/CHANGELOG.txt

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,25 @@ Other changes:
7373
- Nav: Tabbing always enable nav highlight when ImGuiConfigFlags_NavEnableKeyboard is set.
7474
Previously was inconsistent and only enabled when stepping through a non-input item.
7575
(#6802, #3092, #5759, #787)
76+
- Separator(): Altered end-points to use more standard boundaries. (#205, #4787, #1643)
77+
- Left position is always current cursor X position.
78+
- Right position is always work-rect rightmost edge.
79+
- Effectively means that:
80+
- A separator in the root of a window will end up a little more distant from edges
81+
than previously (essentially following WindowPadding instead of clipping edges).
82+
- A separator inside a table cell end up a little distance from edges instead of
83+
touching them (essentially following CellPadding instead of clipping edges).
84+
- Matches tree indentation (was not the case before).
85+
- Matches SeparatorText(). (#1643)
86+
- Makes things correct inside groups without specific/hard-coded handling. (#205)
87+
- Mostly legacy behavior when used inside old Columns(), as we favored that idiom back then,
88+
only different is left position follows indentation level, to match calling a Separator()
89+
inside or outside Columns().
90+
- Drag and Drop: Rework drop target highlight: reduce rectangle to its visible portion, and
91+
then expand slightly. A full rectangle is always visible and it may protrude slightly. (#4281, #3272)
92+
- Drag and Drop: Fixed submitting a tooltip from drop target location when using AcceptDragDropPayload()
93+
with ImGuiDragDropFlags_AcceptNoPreviewTooltip and submitting a tooltip manually.
94+
- TreeNode: Added ImGuiTreeNodeFlags_SpanAllColumns for use in tables. (#3151, #3565, #2451, #2438)
7695
- Tables: Fixed an edge-case when no columns are visible + table scrollbar is visible + user
7796
code is always testing return value of TableSetColumnIndex() to coarse clip. With an active
7897
clipper it would have asserted. Without a clipper, the scrollbar range would be wrong.
@@ -105,14 +124,18 @@ Other changes:
105124
Was most often noticable when using an horizontal scrollbar. (#6789)
106125
- Misc: Most text functions also treat "%.*s" (along with "%s") specially to avoid formatting. (#3466, #6846)
107126
- IO: Setting io.WantSetMousePos ignores incoming MousePos events. (#6837, #228) [@bertaye]
108-
- Debug Tools: Metrics: Added log recent alloc/free calls.
127+
- Debug Tools: Metrics: Added log of recent alloc/free calls.
128+
- Debug Tools: Metrics: Added "Show groups rectangles" in tools.
109129
- ImDrawList: Added AddEllipse(), AddEllipseFilled(), PathEllipticalArcTo(). (#2743) [@Doohl]
110130
- ImVector: Added find_index() helper.
131+
- Demo: Added "Drag and Drop -> Tooltip at target location" demo.
111132
- Backends: GLFW: Clear emscripten's MouseWheel callback before shutdown. (#6790, #6096, #4019) [@halx99]
112133
- Backends: Win32: Added support for keyboard codepage conversion for when application
113134
is compiled in MBCS mode and using a non-Unicode window. (#6785, #6782, #5725, #5961) [@sneakyevil]
114135
- Backends: Win32: Synthesize key-down event on key-up for VK_SNAPSHOT / ImGuiKey_PrintScreen as Windows
115136
doesn't emit it (same behavior as GLFW/SDL). (#6859) [@thedmd, @SuperWangKai]
137+
- Backends: OpenGL3: rename symbols in our internal loader so that LTO compilation with another
138+
copy of gl3w becomes possible. (#6875, #6668, #4445) [@nicolasnoble]
116139
- Internals: Renamed ImFloor() to ImTrunc(). Renamed ImFloorSigned() to ImFloor(). (#6861)
117140

118141
Docking+Viewports Branch:
@@ -1617,7 +1640,7 @@ Breaking Changes:
16171640
- Commented out redirecting functions/enums names that were marked obsolete in 1.67 and 1.69 (March 2019):
16181641
- ImGui::GetOverlayDrawList() -> use ImGui::GetForegroundDrawList()
16191642
- ImFont::GlyphRangesBuilder -> use ImFontGlyphRangesBuilder
1620-
- Backends: OpenGL3: added a third source file "imgui_impl_opengl3_loader.h". [@rokups]
1643+
- Backends: OpenGL3: added a third source file "imgui_impl_opengl3_loader.h". (#4445) [@rokups]
16211644
- Backends: GLFW: backend now uses glfwSetCursorEnterCallback(). (#3751, #4377, #2445)
16221645
- Backends: GLFW: backend now uses glfwSetWindowFocusCallback(). (#4388) [@thedmd]
16231646
- If calling ImGui_ImplGlfw_InitXXX with install_callbacks=true: this is already done for you.
@@ -1706,7 +1729,7 @@ Other Changes:
17061729
about building on 32-bit systems. (#4225) [@kingofthebongo2008]
17071730
- Backends: OpenGL3: Embed our own minimal GL headers/loader (imgui_impl_opengl3_loader.h) based on gl3w.
17081731
Reduces the frequent issues and confusion coming from having to support multiple loaders and requiring users to use and
1709-
initialize the same loader as the backend. [@rokups]
1732+
initialize the same loader as the backend. (#4445) [@rokups]
17101733
Removed support for gl3w, glew, glad, glad2, glbinding2, glbinding3 (all now unnecessary).
17111734
- Backends: OpenGL3: Handle GL_CLIP_ORIGIN on <4.5 contexts if "GL_ARB_clip_control" extension is detected. (#4170, #3998)
17121735
- Backends: OpenGL3: Destroy vertex/fragment shader objects right after they are linked into main shader. (#4244) [@Crowbarous]

docs/FAQ.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ You may take a look at:
627627
- [Quotes](https://github.com/ocornut/imgui/wiki/Quotes)
628628
- [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui)
629629
- [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors)
630-
- [Gallery](https://github.com/ocornut/imgui/issues/6478)
630+
- [Gallery](https://github.com/ocornut/imgui/issues/6897)
631631

632632
##### [Return to Index](#index)
633633

@@ -673,7 +673,7 @@ There is an auto-generated [c-api for Dear ImGui (cimgui)](https://github.com/ci
673673
- Individuals: you can support continued maintenance and development via PayPal donations. See [README](https://github.com/ocornut/imgui/blob/master/docs/README.md).
674674
- If you are experienced with Dear ImGui and C++, look at [GitHub Issues](https://github.com/ocornut/imgui/issues), [GitHub Discussions](https://github.com/ocornut/imgui/discussions), the [Wiki](https://github.com/ocornut/imgui/wiki), read [docs/TODO.txt](https://github.com/ocornut/imgui/blob/master/docs/TODO.txt), and see how you want to help and can help!
675675
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere, etc.
676-
You may post screenshots or links in the [gallery threads](https://github.com/ocornut/imgui/issues/6478). Visuals are ideal as they inspire other programmers. Disclosing your use of Dear ImGui helps the library grow credibility, and helps other teams and programmers with taking decisions.
676+
You may post screenshots or links in the [gallery threads](https://github.com/ocornut/imgui/issues/6897). Visuals are ideal as they inspire other programmers. Disclosing your use of Dear ImGui helps the library grow credibility, and helps other teams and programmers with taking decisions.
677677
- If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues or sometimes incomplete PR.
678678

679679
##### [Return to Index](#index)

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Also see [Wiki](https://github.com/ocornut/imgui/wiki) for more links and ideas.
139139

140140
### Gallery
141141

142-
For more user-submitted screenshots of projects using Dear ImGui, check out the [Gallery Threads](https://github.com/ocornut/imgui/issues/6478)!
142+
For more user-submitted screenshots of projects using Dear ImGui, check out the [Gallery Threads](https://github.com/ocornut/imgui/issues/6897)!
143143

144144
For a list of third-party widgets and extensions, check out the [Useful Extensions/Widgets](https://github.com/ocornut/imgui/wiki/Useful-Extensions) wiki page.
145145

@@ -170,7 +170,7 @@ We occasionally tag [Releases](https://github.com/ocornut/imgui/releases) (with
170170

171171
**Who uses Dear ImGui?**
172172

173-
See the [Quotes](https://github.com/ocornut/imgui/wiki/Quotes), [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors), and [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) Wiki pages for an idea of who is using Dear ImGui. Please add your game/software if you can! Also, see the [Gallery Threads](https://github.com/ocornut/imgui/issues/6478)!
173+
See the [Quotes](https://github.com/ocornut/imgui/wiki/Quotes), [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors), and [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) Wiki pages for an idea of who is using Dear ImGui. Please add your game/software if you can! Also, see the [Gallery Threads](https://github.com/ocornut/imgui/issues/6897)!
174174

175175
How to help
176176
-----------

docs/TODO.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
126126

127127
- separator: expose flags (#759)
128128
- separator: take indent into consideration (optional)
129-
- separator: width, thickness, centering (#1643)
129+
- separator: width, thickness, centering (#1643, #2657)
130130
- splitter: formalize the splitter idiom into an official api (we want to handle n-way split) (#319)
131131

132132
- docking: B: ordering currently held in tab bar should be implicitly held by windows themselves (also see #2304)
@@ -215,7 +215,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
215215
- tree node / selectable render mismatch which is visible if you use them both next to each other (e.g. cf. property viewer)
216216
- tree node: tweak color scheme to distinguish headers from selected tree node (#581)
217217
- tree node: leaf/non-leaf highlight mismatch.
218-
- tree node: flag to disable formatting and/or detect "%s"
219218
- tree node/opt: could avoid formatting when clipped (flag assuming we don't care about width/height, assume single line height? format only %s/%c to be able to count height?)
220219

221220
- settings: write more decent code to allow saving/loading new fields: columns, selected tree nodes?

imgui.cpp

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// - Getting Started https://dearimgui.com/getting-started
1212
// - Homepage https://github.com/ocornut/imgui
1313
// - Releases & changelog https://github.com/ocornut/imgui/releases
14-
// - Gallery https://github.com/ocornut/imgui/issues/6478 (please post your screenshots/video there!)
14+
// - Gallery https://github.com/ocornut/imgui/issues/6897 (please post your screenshots/video there!)
1515
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
1616
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
1717
// - Issues & support https://github.com/ocornut/imgui/issues
@@ -10609,7 +10609,8 @@ void ImGui::EndGroup()
1060910609
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Deactivated;
1061010610

1061110611
g.GroupStack.pop_back();
10612-
//window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255)); // [Debug]
10612+
if (g.DebugShowGroupRects)
10613+
window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255)); // [Debug]
1061310614
}
1061410615

1061510616

@@ -13082,6 +13083,14 @@ void ImGui::ClearDragDrop()
1308213083
memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));
1308313084
}
1308413085

13086+
bool ImGui::BeginTooltipHidden()
13087+
{
13088+
ImGuiContext& g = *GImGui;
13089+
bool ret = Begin("##Tooltip_Hidden", NULL, ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize);
13090+
SetWindowHiddendAndSkipItemsForCurrentFrame(g.CurrentWindow);
13091+
return ret;
13092+
}
13093+
1308513094
// When this returns true you need to: a) call SetDragDropPayload() exactly once, b) you may render the payload visual/description, c) call EndDragDropSource()
1308613095
// If the item has an identifier:
1308713096
// - This assume/require the item to be activated (typically via ButtonBehavior).
@@ -13184,12 +13193,13 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
1318413193
{
1318513194
// Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)
1318613195
// We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.
13187-
bool ret = BeginTooltip();
13196+
bool ret;
13197+
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
13198+
ret = BeginTooltipHidden();
13199+
else
13200+
ret = BeginTooltip();
1318813201
IM_ASSERT(ret); // FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", NULL, ImGuiWindowFlags_NoSavedSettings) + SetWindowHiddendAndSkipItemsForCurrentFrame().
1318913202
IM_UNUSED(ret);
13190-
13191-
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
13192-
SetWindowHiddendAndSkipItemsForCurrentFrame(g.CurrentWindow);
1319313203
}
1319413204

1319513205
if (!(flags & ImGuiDragDropFlags_SourceNoDisableHover) && !(flags & ImGuiDragDropFlags_SourceExtern))
@@ -13326,7 +13336,6 @@ bool ImGui::IsDragDropPayloadBeingAccepted()
1332613336
const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags)
1332713337
{
1332813338
ImGuiContext& g = *GImGui;
13329-
ImGuiWindow* window = g.CurrentWindow;
1333013339
ImGuiPayload& payload = g.DragDropPayload;
1333113340
IM_ASSERT(g.DragDropActive); // Not called between BeginDragDropTarget() and EndDragDropTarget() ?
1333213341
IM_ASSERT(payload.DataFrameCount != -1); // Forgot to call EndDragDropTarget() ?
@@ -13350,7 +13359,7 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop
1335013359
payload.Preview = was_accepted_previously;
1335113360
flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that live for 1 frame)
1335213361
if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview)
13353-
window->DrawList->AddRect(r.Min - ImVec2(3.5f,3.5f), r.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f);
13362+
RenderDragDropTargetRect(r);
1335413363

1335513364
g.DragDropAcceptFrameCount = g.FrameCount;
1335613365
payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting OS window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()
@@ -13361,10 +13370,20 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop
1336113370
return &payload;
1336213371
}
1336313372

13364-
// FIXME-DRAGDROP: Settle on a proper default visuals for drop target.
13373+
// FIXME-STYLE FIXME-DRAGDROP: Settle on a proper default visuals for drop target.
1336513374
void ImGui::RenderDragDropTargetRect(const ImRect& bb)
1336613375
{
13367-
GetWindowDrawList()->AddRect(bb.Min - ImVec2(3.5f, 3.5f), bb.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f);
13376+
ImGuiContext& g = *GImGui;
13377+
ImGuiWindow* window = g.CurrentWindow;
13378+
ImRect bb_display = bb;
13379+
bb_display.ClipWith(window->ClipRect); // Clip THEN expand so we have a way to visualize that target is not entirely visible.
13380+
bb_display.Expand(3.5f);
13381+
bool push_clip_rect = !window->ClipRect.Contains(bb_display);
13382+
if (push_clip_rect)
13383+
window->DrawList->PushClipRectFullScreen();
13384+
window->DrawList->AddRect(bb_display.Min, bb_display.Max, GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f);
13385+
if (push_clip_rect)
13386+
window->DrawList->PopClipRect();
1336813387
}
1336913388

1337013389
const ImGuiPayload* ImGui::GetDragDropPayload()
@@ -19483,6 +19502,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
1948319502
Unindent();
1948419503
}
1948519504
}
19505+
Checkbox("Show groups rectangles", &g.DebugShowGroupRects); // Storing in context as this is used by group code and prefers to be in hot-data
1948619506

1948719507
Checkbox("Debug Begin/BeginChild return value", &io.ConfigDebugBeginReturnValueLoop);
1948819508
SameLine();
@@ -19733,11 +19753,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
1973319753
{
1973419754
ImGuiDebugAllocInfo* info = &g.DebugAllocInfo;
1973519755
Text("%d current allocations", info->TotalAllocCount - info->TotalFreeCount);
19756+
Text("Recent frames with allocations:");
1973619757
int buf_size = IM_ARRAYSIZE(info->LastEntriesBuf);
1973719758
for (int n = buf_size - 1; n >= 0; n--)
1973819759
{
1973919760
ImGuiDebugAllocEntry* entry = &info->LastEntriesBuf[(info->LastEntriesIdx - n + buf_size) % buf_size];
19740-
BulletText("Frame %06d: %+3d ( %2d malloc, %2d free )", entry->FrameCount, entry->AllocCount - entry->FreeCount, entry->AllocCount, entry->FreeCount);
19761+
BulletText("Frame %06d: %+3d ( %2d malloc, %2d free )%s", entry->FrameCount, entry->AllocCount - entry->FreeCount, entry->AllocCount, entry->FreeCount, (n == 0) ? " (most recent)" : "");
1974119762
}
1974219763
TreePop();
1974319764
}

0 commit comments

Comments
 (0)