From abea3c4089453d1f2e9f00d3fda96440e13765fd Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Thu, 17 Jul 2025 01:32:14 +0200 Subject: [PATCH 1/6] Remove ImGui.NET-472 from solution --- Dalamud.sln | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Dalamud.sln b/Dalamud.sln index 0aea37055..eccce60c0 100644 --- a/Dalamud.sln +++ b/Dalamud.sln @@ -72,8 +72,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Bindings", "Bindings", "{A2 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StandaloneImGuiTestbed", "imgui\StandaloneImGuiTestbed\StandaloneImGuiTestbed.csproj", "{4702A911-2513-478C-A434-2776393FDE77}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImGui.NET-472", "lib\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj", "{FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImGuiScene", "imgui\ImGuiScene\ImGuiScene.csproj", "{66753AC7-0029-4373-9CC4-7760B1F46141}" EndProject Global @@ -166,10 +164,6 @@ Global {4702A911-2513-478C-A434-2776393FDE77}.Debug|Any CPU.Build.0 = Debug|x64 {4702A911-2513-478C-A434-2776393FDE77}.Release|Any CPU.ActiveCfg = Release|x64 {4702A911-2513-478C-A434-2776393FDE77}.Release|Any CPU.Build.0 = Release|x64 - {FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}.Debug|Any CPU.ActiveCfg = Debug|x64 - {FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}.Debug|Any CPU.Build.0 = Debug|x64 - {FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}.Release|Any CPU.ActiveCfg = Release|x64 - {FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}.Release|Any CPU.Build.0 = Release|x64 {66753AC7-0029-4373-9CC4-7760B1F46141}.Debug|Any CPU.ActiveCfg = Debug|x64 {66753AC7-0029-4373-9CC4-7760B1F46141}.Debug|Any CPU.Build.0 = Debug|x64 {66753AC7-0029-4373-9CC4-7760B1F46141}.Release|Any CPU.ActiveCfg = Release|x64 @@ -196,7 +190,6 @@ Global {5E6EDD75-AE95-43A6-9D67-95B840EB4B71} = {A217B3DF-607A-4EFB-B107-3C4809348043} {9C70BD06-D52C-425E-9C14-5D66BC6046EF} = {A217B3DF-607A-4EFB-B107-3C4809348043} {4702A911-2513-478C-A434-2776393FDE77} = {A217B3DF-607A-4EFB-B107-3C4809348043} - {FAD7F842-2E81-456F-8AE8-DFFEDC258EC3} = {DBE5345E-6594-4A59-B183-1C3D5592269D} {66753AC7-0029-4373-9CC4-7760B1F46141} = {A217B3DF-607A-4EFB-B107-3C4809348043} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution From 72f5da2214b2564ef6a25dd51f38427cebce03b0 Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Thu, 17 Jul 2025 01:32:54 +0200 Subject: [PATCH 2/6] Generate CsWin32 APIs as internally --- Dalamud/NativeMethods.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dalamud/NativeMethods.json b/Dalamud/NativeMethods.json index 6001e3abc..ffb313dfc 100644 --- a/Dalamud/NativeMethods.json +++ b/Dalamud/NativeMethods.json @@ -1,5 +1,4 @@ -{ +{ "$schema": "https://aka.ms/CsWin32.schema.json", - "allowMarshaling": false, - "public": true + "allowMarshaling": false } From 54ec64e159eb7cced55c2b41fa200a848cab9d5e Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Thu, 17 Jul 2025 01:36:45 +0200 Subject: [PATCH 3/6] Remove IDalamudTextureWrap.ImGuiHandle --- .../Windows/Data/Widgets/TexWidget.cs | 4 ++-- .../Textures/DalamudTextureWrapExtensions.cs | 3 +-- .../Internal/TextureManager.BlameTracker.cs | 4 ++-- .../TextureWraps/IDalamudTextureWrap.cs | 9 ++----- .../Internal/DrawListTextureWrap.cs | 4 ++-- .../Utility/Internal/DevTextureSaveMenu.cs | 2 +- Dalamud/Utility/ImGuiBindingsToDoAttribute.cs | 24 ------------------- 7 files changed, 10 insertions(+), 40 deletions(-) delete mode 100644 Dalamud/Utility/ImGuiBindingsToDoAttribute.cs diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs index 9277d01f3..d40544def 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; @@ -469,7 +469,7 @@ internal class TexWidget : IDataWindowWidget { _ = Service.Get().ShowTextureSaveMenuAsync( this.DisplayName, - $"{wrap.ImGuiHandle:X16}", + $"{wrap.Handle.Handle:X16}", Task.FromResult(wrap.CreateWrapSharingLowLevelResource())); } diff --git a/Dalamud/Interface/Textures/DalamudTextureWrapExtensions.cs b/Dalamud/Interface/Textures/DalamudTextureWrapExtensions.cs index 7f8f02c7e..e786d373c 100644 --- a/Dalamud/Interface/Textures/DalamudTextureWrapExtensions.cs +++ b/Dalamud/Interface/Textures/DalamudTextureWrapExtensions.cs @@ -1,4 +1,3 @@ -using Dalamud.Interface.Internal; using Dalamud.Interface.Textures.TextureWraps; namespace Dalamud.Interface.Textures; @@ -17,6 +16,6 @@ public static class DalamudTextureWrapExtensions return false; if (a is null) return false; - return a.ImGuiHandle == b.ImGuiHandle; + return a.Handle == b.Handle; } } diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs b/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs index 673d40d18..837b41271 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs @@ -66,7 +66,7 @@ internal sealed partial class TextureManager try { - if (textureWrap.ImGuiHandle == nint.Zero) + if (textureWrap.Handle.IsNull) return textureWrap; } catch (ObjectDisposedException) @@ -103,7 +103,7 @@ internal sealed partial class TextureManager try { - if (textureWrap.ImGuiHandle == nint.Zero) + if (textureWrap.Handle.IsNull) return textureWrap; } catch (ObjectDisposedException) diff --git a/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs index f58c167ed..b30adced7 100644 --- a/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs +++ b/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs @@ -2,7 +2,6 @@ using System.Numerics; using Dalamud.Bindings.ImGui; using Dalamud.Interface.Textures.TextureWraps.Internal; -using Dalamud.Utility; using TerraFX.Interop.Windows; @@ -19,10 +18,6 @@ public interface IDalamudTextureWrap : IDisposable /// Gets a texture handle suitable for direct use with ImGui functions. ImTextureID Handle { get; } - /// Gets a texture handle suitable for direct use with ImGui functions. - [ImGuiBindingsToDo("Remove.")] - IntPtr ImGuiHandle => new((long)this.Handle.Handle); - /// Gets the width of the texture. int Width { get; } @@ -38,7 +33,7 @@ public interface IDalamudTextureWrap : IDisposable /// The new reference to this texture wrap. /// /// On calling this function, a new instance of will be returned, but with - /// the same . The new instance must be d, as the backing + /// the same . The new instance must be d, as the backing /// resource will stay alive until all the references are released. The old instance may be disposed as needed, /// once this function returns; the new instance will stay alive regardless of whether the old instance has been /// disposed.
@@ -46,7 +41,7 @@ public interface IDalamudTextureWrap : IDisposable /// across plugin boundaries for use for an indeterminate duration, the receiver should call this function to /// obtain a new reference to the texture received, so that it gets its own "copy" of the texture and the caller /// may dispose the texture anytime without any care for the receiver.
- /// The default implementation will treat as an . + /// The default implementation will treat as an . ///
unsafe IDalamudTextureWrap CreateWrapSharingLowLevelResource() { diff --git a/Dalamud/Interface/Textures/TextureWraps/Internal/DrawListTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/Internal/DrawListTextureWrap.cs index 9f2ef9f78..13878abe2 100644 --- a/Dalamud/Interface/Textures/TextureWraps/Internal/DrawListTextureWrap.cs +++ b/Dalamud/Interface/Textures/TextureWraps/Internal/DrawListTextureWrap.cs @@ -60,7 +60,7 @@ internal sealed unsafe partial class DrawListTextureWrap : IDrawListTextureWrap, this.device.Get()->GetImmediateContext(pdc); this.emptyTexture = emptyTexture; - this.srv = new((ID3D11ShaderResourceView*)emptyTexture.ImGuiHandle); + this.srv = new((ID3D11ShaderResourceView*)emptyTexture.Handle.Handle); } /// Finalizes an instance of the class. @@ -226,7 +226,7 @@ internal sealed unsafe partial class DrawListTextureWrap : IDrawListTextureWrap, this.rtvPremultiplied.Reset(); this.width = newWidth; this.Height = newHeight; - this.srv = new((ID3D11ShaderResourceView*)this.emptyTexture.ImGuiHandle); + this.srv = new((ID3D11ShaderResourceView*)this.emptyTexture.Handle.Handle); return S.S_FALSE; } diff --git a/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs b/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs index 38b46d0c2..4ed6b4e48 100644 --- a/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs +++ b/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs @@ -64,7 +64,7 @@ internal sealed class DevTextureSaveMenu : IInternalDisposableService var initiatorScreenOffset = ImGui.GetMousePos(); using var textureWrap = await texture; var textureManager = await Service.GetAsync(); - var popupName = $"{nameof(this.ShowTextureSaveMenuAsync)}_{textureWrap.ImGuiHandle:X}"; + var popupName = $"{nameof(this.ShowTextureSaveMenuAsync)}_{textureWrap.Handle.Handle:X}"; BitmapCodecInfo? encoder; { diff --git a/Dalamud/Utility/ImGuiBindingsToDoAttribute.cs b/Dalamud/Utility/ImGuiBindingsToDoAttribute.cs deleted file mode 100644 index 60f15c056..000000000 --- a/Dalamud/Utility/ImGuiBindingsToDoAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Dalamud.Utility; - -/// -/// Utility class for marking something to be changed for when the new bindings are fully adopted, for ease of lookup. -/// -[AttributeUsage(AttributeTargets.All, Inherited = false)] -internal sealed class ImGuiBindingsToDoAttribute : Attribute -{ - /// - /// Marks that this should be made internal. - /// - public const string MakeInternal = "Make internal."; - - /// - /// Initializes a new instance of the class. - /// - /// The explanation. - /// The explanation 2. - public ImGuiBindingsToDoAttribute(string what, string what2 = "") - { - _ = what; - _ = what2; - } -} From 9956424c132e06a642d40ebb3c0cf663960258bf Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Thu, 17 Jul 2025 01:42:20 +0200 Subject: [PATCH 4/6] Remove unnecessary IsNull functions --- .../Internals/DelegateFontHandle.cs | 4 ++-- .../FontAtlasFactory.BuildToolkit.cs | 16 +++++++------- .../ManagedFontAtlas/Internals/FontHandle.cs | 2 +- .../Internals/GamePrebakedFontHandle.cs | 4 ++-- Dalamud/Interface/Utility/ImGuiHelpers.cs | 22 ++++--------------- 5 files changed, 17 insertions(+), 31 deletions(-) diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs index 5442755db..f2c91d264 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Dalamud.Bindings.ImGui; @@ -158,7 +158,7 @@ internal sealed class DelegateFontHandle : FontHandle { toolkitPreBuild.Font = default; k.CallOnBuildStepChange(toolkitPreBuild); - if (toolkitPreBuild.Font.IsNull()) + if (toolkitPreBuild.Font.IsNull) { if (fontCountPrevious == fontsVector.Length) { diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs index c300eb494..2a93cf093 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs @@ -116,7 +116,7 @@ internal sealed partial class FontAtlasFactory foreach (var s in this.data.Substances) { var f = s.GetFontPtr(fontHandle); - if (!f.IsNull()) + if (!f.IsNull) return f; } @@ -215,7 +215,7 @@ internal sealed partial class FontAtlasFactory } catch { - if (!font.IsNull()) + if (!font.IsNull) { // Note that for both RemoveAt calls, corresponding destructors will be called. @@ -331,14 +331,14 @@ internal sealed partial class FontAtlasFactory } } - if (font.IsNull()) + if (font.IsNull) { // fall back to AXIS fonts font = this.AddGameGlyphs(new(GameFontFamily.Axis, sizePx), glyphRanges, default); } this.AttachExtraGlyphsForDalamudLanguage(new() { SizePx = sizePx, MergeFont = font }); - if (this.Font.IsNull()) + if (this.Font.IsNull) this.Font = font; return font; } @@ -413,9 +413,9 @@ internal sealed partial class FontAtlasFactory int style = (int)DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL) { var targetFont = fontConfig.MergeFont; - if (targetFont.IsNull()) + if (targetFont.IsNull) targetFont = this.Font; - if (targetFont.IsNull()) + if (targetFont.IsNull) return; // https://learn.microsoft.com/en-us/windows/apps/design/globalizing/loc-international-fonts @@ -556,9 +556,9 @@ internal sealed partial class FontAtlasFactory public void AttachExtraGlyphsForDalamudLanguage(in SafeFontConfig fontConfig) { var targetFont = fontConfig.MergeFont; - if (targetFont.IsNull()) + if (targetFont.IsNull) targetFont = this.Font; - if (targetFont.IsNull()) + if (targetFont.IsNull) return; var dalamudConfiguration = Service.Get(); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs index 88c124b49..1fdaf4596 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs @@ -182,7 +182,7 @@ internal abstract class FontHandle : IFontHandle } var fontPtr = substance.GetFontPtr(this); - if (fontPtr.IsNull()) + if (fontPtr.IsNull) { // The font for the requested handle is unavailable. Release the reference and try again. substance.DataRoot.Release(); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs index 9a91e7327..f6904db7c 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs @@ -1,4 +1,4 @@ -using System.Buffers; +using System.Buffers; using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -250,7 +250,7 @@ internal class GamePrebakedFontHandle : FontHandle GameFontStyle style, ushort[]? glyphRanges = null) { - if (font.IsNull()) + if (font.IsNull) font = this.CreateTemplateFont(toolkitPreBuild, style.SizePx); this.attachments.Add((font, style, glyphRanges)); return font; diff --git a/Dalamud/Interface/Utility/ImGuiHelpers.cs b/Dalamud/Interface/Utility/ImGuiHelpers.cs index 3285c8daf..9b21bf02d 100644 --- a/Dalamud/Interface/Utility/ImGuiHelpers.cs +++ b/Dalamud/Interface/Utility/ImGuiHelpers.cs @@ -556,25 +556,11 @@ public static partial class ImGuiHelpers .ToArray(); /// - /// Determines whether is empty. + /// Determines whether is not empty and loaded. /// /// The pointer. - /// Whether it is empty. - public static unsafe bool IsNull(this ImFontPtr ptr) => ptr.Handle == null; - - /// - /// Determines whether is empty. - /// - /// The pointer. - /// Whether it is empty. - public static unsafe bool IsNotNullAndLoaded(this ImFontPtr ptr) => ptr.Handle != null && ptr.IsLoaded(); - - /// - /// Determines whether is empty. - /// - /// The pointer. - /// Whether it is empty. - public static unsafe bool IsNull(this ImFontAtlasPtr ptr) => ptr.Handle == null; + /// Whether it is not null and loaded. + public static unsafe bool IsNotNullAndLoaded(this ImFontPtr ptr) => !ptr.IsNull && ptr.IsLoaded(); /// /// If is default, then returns . @@ -583,7 +569,7 @@ public static partial class ImGuiHelpers /// The other. /// if it is not default; otherwise, . public static unsafe ImFontPtr OrElse(this ImFontPtr self, ImFontPtr other) => - self.Handle is null ? other : self; + self.IsNull ? other : self; /// /// Mark 4K page as used, after adding a codepoint to a font. From d25b16aa938111793293f98990edadb66249bbe2 Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Thu, 17 Jul 2025 01:24:30 +0200 Subject: [PATCH 5/6] Remove unnecessary AddText extension --- Dalamud/Interface/Utility/ImGuiExtensions.cs | 33 -------------------- 1 file changed, 33 deletions(-) diff --git a/Dalamud/Interface/Utility/ImGuiExtensions.cs b/Dalamud/Interface/Utility/ImGuiExtensions.cs index 8aad48fab..5a7ee61a2 100644 --- a/Dalamud/Interface/Utility/ImGuiExtensions.cs +++ b/Dalamud/Interface/Utility/ImGuiExtensions.cs @@ -1,5 +1,4 @@ using System.Numerics; -using System.Text; using Dalamud.Bindings.ImGui; @@ -52,36 +51,4 @@ public static class ImGuiExtensions drawListPtr.AddText(ImGui.GetFont(), ImGui.GetFontSize(), pos, ImGui.GetColorU32(ImGuiCol.Text), text); } } - - /// - /// Add text to a draw list. - /// - /// Pointer to the draw list. - /// Font to use. - /// Font size. - /// Position to draw at. - /// Color to use. - /// Text to draw. - /// Clip rect to use. - // TODO: This should go into ImDrawList.Manual.cs in ImGui.NET... - public static unsafe void AddText(this ImDrawListPtr drawListPtr, ImFontPtr font, float fontSize, Vector2 pos, uint col, string textBegin, ref Vector4 cpuFineClipRect) - { - var nativeFont = font.Handle; - var textBeginByteCount = Encoding.UTF8.GetByteCount(textBegin); - var nativeTextBegin = stackalloc byte[textBeginByteCount + 1]; - - fixed (char* textBeginPtr = textBegin) - { - var nativeTextBeginOffset = Encoding.UTF8.GetBytes(textBeginPtr, textBegin.Length, nativeTextBegin, textBeginByteCount); - nativeTextBegin[nativeTextBeginOffset] = 0; - } - - byte* nativeTextEnd = null; - var wrapWidth = 0.0f; - - fixed (Vector4* nativeCpuFineClipRect = &cpuFineClipRect) - { - drawListPtr.AddText(nativeFont, fontSize, pos, col, nativeTextBegin, nativeTextEnd, wrapWidth, nativeCpuFineClipRect); - } - } } From a1b8dbcf271b584ffdad3efaf4605f86e6067d6b Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Thu, 17 Jul 2025 01:54:40 +0200 Subject: [PATCH 6/6] Simplify ImGuiListClipper initialization --- .../Interface/ImGuiFileDialog/FileDialog.UI.cs | 6 +----- .../SingleFontChooserDialog.cs | 6 +++--- .../Internal/Windows/ConsoleWindow.cs | 5 +---- .../Data/Widgets/SeStringRendererTestWidget.cs | 2 +- .../Internal/Windows/Data/Widgets/TexWidget.cs | 4 ++-- .../Windows/Data/Widgets/UIColorWidget.cs | 2 +- Dalamud/Interface/Utility/ImGuiClip.cs | 18 +++--------------- 7 files changed, 12 insertions(+), 31 deletions(-) diff --git a/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs b/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs index fa74b424a..4940793cc 100644 --- a/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs +++ b/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs @@ -381,11 +381,7 @@ public partial class FileDialog if (this.filteredFiles.Count > 0) { - ImGuiListClipperPtr clipper; - unsafe - { - clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); - } + var clipper = ImGui.ImGuiListClipper(); lock (this.filesLock) { diff --git a/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs b/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs index 4aa57eceb..2b25ffca5 100644 --- a/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs +++ b/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs @@ -689,7 +689,7 @@ public sealed class SingleFontChooserDialog : IDisposable if (ImGui.BeginChild("##familyList", ImGui.GetContentRegionAvail())) { - var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); + var clipper = ImGui.ImGuiListClipper(); var lineHeight = ImGui.GetTextLineHeightWithSpacing(); if ((changed || this.firstDrawAfterRefresh) && this.selectedFamilyIndex != -1) @@ -856,7 +856,7 @@ public sealed class SingleFontChooserDialog : IDisposable if (ImGui.BeginChild("##fontList")) { - var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); + var clipper = ImGui.ImGuiListClipper(); var lineHeight = ImGui.GetTextLineHeightWithSpacing(); if ((changed || this.firstDrawAfterRefresh) && this.selectedFontIndex != -1) @@ -960,7 +960,7 @@ public sealed class SingleFontChooserDialog : IDisposable if (ImGui.BeginChild("##fontSizeList")) { - var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); + var clipper = ImGui.ImGuiListClipper(); var lineHeight = ImGui.GetTextLineHeightWithSpacing(); if (changed && this.selectedFontIndex != -1) diff --git a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs index 00afd53b0..8e030819b 100644 --- a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs @@ -112,10 +112,7 @@ internal class ConsoleWindow : Window, IDisposable this.configuration.DalamudConfigurationSaved += this.OnDalamudConfigurationSaved; - unsafe - { - this.clipperPtr = new(ImGui.ImGuiListClipper()); - } + this.clipperPtr = ImGui.ImGuiListClipper(); } /// Gets the queue where log entries that are not processed yet are stored. diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs index 3f677c4f0..418eac80d 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs @@ -190,7 +190,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget var addon = Service.GetNullable()?.GetExcelSheet() ?? throw new InvalidOperationException("Addon sheet not loaded."); - var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); + var clipper = ImGui.ImGuiListClipper(); clipper.Begin(addon.Count); while (clipper.Step()) { diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs index d40544def..027e792ab 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs @@ -449,7 +449,7 @@ internal class TexWidget : IDataWindowWidget sortSpecs.SpecsDirty = false; } - var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); + var clipper = ImGui.ImGuiListClipper(); clipper.Begin(allBlames.Count); while (clipper.Step()) @@ -538,7 +538,7 @@ internal class TexWidget : IDataWindowWidget (ImGui.GetStyle().ItemSpacing.X * 1 * numIcons)); ImGui.TableHeadersRow(); - var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); + var clipper = ImGui.ImGuiListClipper(); clipper.Begin(textures.Count); using (var enu = textures.GetEnumerator()) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs index 8334db8e9..3f29c5aa0 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs @@ -64,7 +64,7 @@ internal class UiColorWidget : IDataWindowWidget ImGui.TableSetupColumn("Clear Blue", ImGuiTableColumnFlags.WidthFixed, colorw); ImGui.TableHeadersRow(); - var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); + var clipper = ImGui.ImGuiListClipper(); clipper.Begin(colors.Count, ImGui.GetFrameHeightWithSpacing()); while (clipper.Step()) { diff --git a/Dalamud/Interface/Utility/ImGuiClip.cs b/Dalamud/Interface/Utility/ImGuiClip.cs index 73a56d47b..2d3f07b0c 100644 --- a/Dalamud/Interface/Utility/ImGuiClip.cs +++ b/Dalamud/Interface/Utility/ImGuiClip.cs @@ -34,11 +34,7 @@ public static class ImGuiClip // Uses ImGuiListClipper and thus handles start- and end-dummies itself. public static void ClippedDraw(IReadOnlyList data, Action draw, float lineHeight) { - ImGuiListClipperPtr clipper; - unsafe - { - clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); - } + var clipper = ImGui.ImGuiListClipper(); clipper.Begin(data.Count, lineHeight); while (clipper.Step()) @@ -69,11 +65,7 @@ public static class ImGuiClip /// The type of data to draw. public static void ClippedDraw(IReadOnlyList data, Action draw, int itemsPerLine, float lineHeight) { - ImGuiListClipperPtr clipper; - unsafe - { - clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); - } + var clipper = ImGui.ImGuiListClipper(); var maxRows = (int)MathF.Ceiling((float)data.Count / itemsPerLine); @@ -113,11 +105,7 @@ public static class ImGuiClip // Uses ImGuiListClipper and thus handles start- and end-dummies itself, but acts on type and index. public static void ClippedDraw(IReadOnlyList data, Action draw, float lineHeight) { - ImGuiListClipperPtr clipper; - unsafe - { - clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper()); - } + var clipper = ImGui.ImGuiListClipper(); clipper.Begin(data.Count, lineHeight); while (clipper.Step())