Skip to content

Commit 5fdce12

Browse files
committed
Merge branch '1.78'
2 parents bb60fa9 + e387109 commit 5fdce12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4023
-1340
lines changed

.idea/codeStyles/Project.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Opengl3Kt.xml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/main/kotlin/imgui/api/demoDebugInformations.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import imgui.ImGui.pushID
3838
import imgui.ImGui.pushTextWrapPos
3939
import imgui.ImGui.sameLine
4040
import imgui.ImGui.saveIniSettingsToDisk
41+
import imgui.ImGui.saveIniSettingsToMemory
4142
import imgui.ImGui.selectable
4243
import imgui.ImGui.separator
4344
import imgui.ImGui.setNextItemWidth
@@ -286,17 +287,19 @@ interface demoDebugInformations {
286287
//
287288
// Details for Docking
288289
// #ifdef IMGUI_HAS_DOCK
289-
// if (ImGui::TreeNode("Docking"))
290-
// {
291-
// ImGui::TreePop();
292-
// }
290+
treeNode("Dock nodes") {
291+
292+
}
293293
// #endif // #define IMGUI_HAS_DOCK
294294

295295
// Settings
296296
treeNode("Settings") {
297297
if (smallButton("Clear"))
298298
clearIniSettings()
299299
sameLine()
300+
if (smallButton("Save to memory"))
301+
saveIniSettingsToMemory()
302+
sameLine()
300303
if (smallButton("Save to disk"))
301304
saveIniSettingsToDisk(io.iniFilename)
302305
sameLine()
@@ -306,7 +309,7 @@ interface demoDebugInformations {
306309
textUnformatted("<NULL>")
307310
text("SettingsDirtyTimer %.2f", g.settingsDirtyTimer)
308311
treeNode("SettingsHandlers", "Settings handlers: (${g.settingsHandlers.size})") {
309-
g.settingsHandlers.forEach { textUnformatted(it.typeName) }
312+
g.settingsHandlers.forEach { bulletText(it.typeName) }
310313
}
311314
treeNode("SettingsWindows", "Settings packed data: Windows: ${g.settingsWindows.size} bytes") {
312315
g.settingsWindows.forEach(Funcs::nodeWindowSettings)
@@ -329,6 +332,7 @@ interface demoDebugInformations {
329332
if (treeNode("Internal state")) {
330333
text("HoveredWindow: '${g.hoveredWindow?.name}'")
331334
text("HoveredRootWindow: '${g.hoveredWindow?.name}'")
335+
text("HoveredWindowUnderMovingWindow: '${g.hoveredWindowUnderMovingWindow?.name}'")
332336
/* Data is "in-flight" so depending on when the Metrics window is called we may see current frame
333337
information or not */
334338
text("HoveredId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: ${g.hoveredIdAllowOverlap}", g.hoveredId, g.hoveredIdPreviousFrame, g.hoveredIdTimer)
@@ -360,7 +364,7 @@ interface demoDebugInformations {
360364
if (showWindowsBeginOrder && window.flags hasnt Wf._ChildWindow) {
361365
val buf = "${window.beginOrderWithinContext}"
362366
drawList.addRectFilled(window.pos, window.pos + Vec2(fontSize), COL32(200, 100, 100, 255))
363-
drawList.addText(window.pos, COL32(255, 255, 255, 255), buf)
367+
drawList.addText(window.pos, COL32(255), buf)
364368
}
365369
}
366370

core/src/main/kotlin/imgui/api/dragAndDrop.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ interface dragAndDrop {
187187

188188
val window = g.currentWindow!!
189189
if (window.dc.lastItemStatusFlags hasnt ItemStatusFlag.HoveredRect) return false
190-
g.hoveredWindow.let { if (it == null || window.rootWindow !== it.rootWindow) return false }
190+
val hoveredWindow = g.hoveredWindowUnderMovingWindow
191+
if (hoveredWindow == null || window.rootWindow !== hoveredWindow.rootWindow) return false
191192

192193
val displayRect = when {
193194
window.dc.lastItemStatusFlags has ItemStatusFlag.HasDisplayRect -> window.dc.lastItemDisplayRect

core/src/main/kotlin/imgui/api/inputUtilitiesKeyboard.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import imgui.internal.classes.Rect
1212

1313

1414
/** Inputs Utilities: Keyboard
15-
* - For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[].
15+
* - For 'int user_key_index' you can use your own indices/enums according to how your back-end/engine stored them in io.KeysDown[].
1616
* - We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index. */
1717
interface inputUtilitiesKeyboard {
1818

core/src/main/kotlin/imgui/api/inputUtilitiesMouse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ interface inputUtilitiesMouse {
5252
}
5353

5454

55-
/** did mouse button double-clicked? A double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime. */
55+
/** did mouse button double-clicked? (note that a double-click will also report IsMouseClicked() == true) */
5656
fun isMouseDoubleClicked(button: MouseButton): Boolean {
5757
if (button == MouseButton.None)
5858
return false // The None button is never clicked.

core/src/main/kotlin/imgui/api/itemWidgetsUtilities.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ interface itemWidgetsUtilities {
4949
g.navDisableMouseHover || !window.isContentHoverable(flags) -> false
5050
// Test if the item is disabled
5151
window.dc.itemFlags has ItemFlag.Disabled && flags hasnt Hf.AllowWhenDisabled -> false
52-
/* Special handling for the dummy item after Begin() which represent the title bar or tab.
52+
/* Special handling for calling after Begin() which represent the title bar or tab.
5353
When the window is collapsed (SkipItems==true) that last item will never be overwritten
5454
so we need to detect the case. */
5555
window.dc.lastItemId == window.moveId && window.writeAccessed -> false

core/src/main/kotlin/imgui/api/main.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package imgui.api
22

33
import glm_.f
4+
import glm_.hasnt
45
import glm_.max
56
import glm_.min
67
import glm_.vec2.Vec2
@@ -25,6 +26,7 @@ import imgui.ImGui.updateMouseMovingWindowEndFrame
2526
import imgui.ImGui.updateMouseMovingWindowNewFrame
2627
import imgui.classes.IO
2728
import imgui.classes.Style
29+
import imgui.font.FontAtlas
2830
import imgui.internal.*
2931
import imgui.internal.sections.or
3032
import imgui.static.*
@@ -80,13 +82,16 @@ interface main {
8082
g.drawListSharedData.clipRectFullscreen = Vec4(0f, 0f, io.displaySize.x, io.displaySize.y)
8183
g.drawListSharedData.curveTessellationTol = style.curveTessellationTol
8284
g.drawListSharedData.setCircleSegmentMaxError_(style.circleSegmentMaxError)
83-
g.drawListSharedData.initialFlags = Dlf.None.i
85+
var flags = Dlf.None.i
8486
if (style.antiAliasedLines)
85-
g.drawListSharedData.initialFlags = g.drawListSharedData.initialFlags or Dlf.AntiAliasedLines
87+
flags = flags or Dlf.AntiAliasedLines
88+
if (style.antiAliasedLinesUseTex && g.font.containerAtlas.flags hasnt FontAtlas.Flag.NoBakedLines.i)
89+
flags = flags or Dlf.AntiAliasedLinesUseTex
8690
if (style.antiAliasedFill)
87-
g.drawListSharedData.initialFlags = g.drawListSharedData.initialFlags or Dlf.AntiAliasedFill
91+
flags = flags or Dlf.AntiAliasedFill
8892
if (io.backendFlags has BackendFlag.RendererHasVtxOffset)
89-
g.drawListSharedData.initialFlags = g.drawListSharedData.initialFlags or Dlf.AllowVtxOffset
93+
flags = flags or Dlf.AllowVtxOffset
94+
g.drawListSharedData.initialFlags = flags
9095

9196
g.backgroundDrawList._resetForNewFrame()
9297
g.backgroundDrawList.pushTextureId(io.fonts.texID)
@@ -115,6 +120,7 @@ interface main {
115120
g.hoveredIdPreviousFrame = g.hoveredId
116121
g.hoveredId = 0
117122
g.hoveredIdAllowOverlap = false
123+
g.hoveredIdDisabled = false
118124

119125
// Update ActiveId data (clear reference to active widget if the widget isn't alive anymore)
120126
if (g.activeIdIsAlive != g.activeId && g.activeIdPreviousFrame == g.activeId && g.activeId != 0)

core/src/main/kotlin/imgui/api/popupsModals.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import imgui.ImGui.navMoveRequestTryWrapping
1717
import imgui.ImGui.openPopupEx
1818
import imgui.ImGui.setNextWindowPos
1919
import imgui.ImGui.topMostPopupModal
20+
import imgui.internal.sections.IMGUI_DEBUG_LOG_POPUP
2021
import imgui.internal.sections.NavMoveFlag
2122
import imgui.internal.sections.NextWindowDataFlag
2223
import imgui.internal.sections.hasnt
@@ -118,7 +119,10 @@ interface popupsModals {
118119
/** call to mark popup as open (don't call every frame!). */
119120
fun openPopup(strId: String, popupFlags: PopupFlags = PopupFlag.None.i) = openPopupEx(g.currentWindow!!.getID(strId), popupFlags)
120121

121-
/** helper to open popup when clicked on last item. return true when just opened. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) */
122+
/** helper to open popup when clicked on last item. return true when just opened.
123+
* (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors)
124+
*
125+
* Open a popup if mouse button is released over the item */
122126
fun openPopupContextItem(strId: String = "", popupFlags: PopupFlags = PopupFlag.MouseButtonRight.i): Boolean =
123127
with(g.currentWindow!!) {
124128
val mouseButton = popupFlags and PopupFlag.MouseButtonMask_
@@ -149,7 +153,7 @@ interface popupsModals {
149153
break
150154
popupIdx--
151155
}
152-
//IMGUI_DEBUG_LOG("CloseCurrentPopup %d -> %d\n", g.BeginPopupStack.Size - 1, popup_idx);
156+
IMGUI_DEBUG_LOG_POPUP("CloseCurrentPopup ${g.beginPopupStack.lastIndex} -> $popupIdx")
153157
closePopupToLevel(popupIdx, true)
154158

155159
/* A common pattern is to close a popup when selecting a menu item/selectable that will open another window.

core/src/main/kotlin/imgui/api/tabBarsTabs.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface tabBarsTabs {
3333
if (window.skipItems) return
3434

3535
val tabBar = g.currentTabBar ?: error("Mismatched BeginTabBar()/EndTabBar()!")
36-
if (tabBar.wantLayout)
36+
if (tabBar.wantLayout) // Fallback in case no TabItem have been submitted
3737
tabBar.layout()
3838

3939
// Restore the last visible height if no tab is visible, this reduce vertical flicker/movement when a tabs gets removed without calling SetTabItemClosed().
@@ -88,17 +88,17 @@ interface tabBarsTabs {
8888
* For tab-bar: call after BeginTabBar() and before Tab submissions. Otherwise call with a window name.
8989
*
9090
* [Public] This is call is 100% optional but it allows to remove some one-frame glitches when a tab has been unexpectedly removed.
91-
* To use it to need to call the function SetTabItemClosed() after BeginTabBar() and before any call to BeginTabItem().
92-
* Tabs closed by the close button will automatically be flagged to avoid this issue.
93-
* FIXME: We should aim to support calling SetTabItemClosed() after the tab submission (for next frame) */
91+
* To use it to need to call the function SetTabItemClosed() between BeginTabBar() and EndTabBar().
92+
* Tabs closed by the close button will automatically be flagged to avoid this issue. */
9493
fun setTabItemClosed(tabOrDockedWindowLabel: String) {
9594

9695
val isWithinManualTabBar = g.currentTabBar?.flags?.hasnt(TabBarFlag._DockNode) == true
9796
if (isWithinManualTabBar) {
9897
val tabBar = g.currentTabBar!!
99-
assert(tabBar.wantLayout) { "Needs to be called AFTER BeginTabBar() and BEFORE the first call to BeginTabItem()" }
10098
val tabId = tabBar calcTabID tabOrDockedWindowLabel
101-
tabBar removeTab tabId
99+
tabBar.findTabByID(tabId)?.let {
100+
it.wantClose = true // Will be processed by next call to TabBarLayout()
101+
}
102102
}
103103
}
104104

0 commit comments

Comments
 (0)