Remove ImGui.NET entirely

This commit is contained in:
goaaats 2025-06-22 22:21:12 +02:00
parent 95ec633cc5
commit 90e426b325
29 changed files with 32 additions and 173 deletions

3
.gitmodules vendored
View file

@ -19,6 +19,3 @@
[submodule "lib/Hexa.NET.ImGui"]
path = lib/Hexa.NET.ImGui
url = https://github.com/goatcorp/Hexa.NET.ImGui.git
[submodule "lib/ImGui.NET"]
path = lib/ImGui.NET
url = https://github.com/goatcorp/ImGui.NET.git

View file

@ -20,7 +20,7 @@ namespace Dalamud.CorePlugin
this.IsOpen = true;
this.Size = new Vector2(810, 520);
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
}
/// <inheritdoc/>

View file

@ -109,7 +109,6 @@
<ProjectReference Include="..\imgui\ImGuiScene\ImGuiScene.csproj" />
<ProjectReference Include="..\lib\FFXIVClientStructs\FFXIVClientStructs\FFXIVClientStructs.csproj" />
<ProjectReference Include="..\lib\FFXIVClientStructs\InteropGenerator.Runtime\InteropGenerator.Runtime.csproj" />
<ProjectReference Include="..\lib\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj" />
</ItemGroup>
<ItemGroup>

View file

@ -493,7 +493,7 @@ internal partial class InterfaceManager : IInternalDisposableService
var value = enabled ? 1u : 0u;
global::Windows.Win32.PInvoke.DwmSetWindowAttribute(
new(this.GameWindowHandle.Value),
new(new IntPtr(this.GameWindowHandle.Value)),
DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE,
&value,
sizeof(uint)).ThrowOnFailure();
@ -723,7 +723,7 @@ internal partial class InterfaceManager : IInternalDisposableService
// NOTE (Chiv) Explicitly deactivate on dalamud boot
ImGui.GetIO().ConfigFlags &= ~ImGuiConfigFlags.NavEnableGamepad;
ImGuiHelpers.MainViewportNew = ImGui.GetMainViewport();
ImGuiHelpers.MainViewport = ImGui.GetMainViewport();
Log.Information("[IM] Scene & ImGui setup OK!");
}

View file

@ -672,6 +672,6 @@ internal unsafe class UiDebug
position += ImGuiHelpers.MainViewport.Pos;
ImGui.GetForegroundDrawList(ImGuiHelpers.MainViewportNew).AddRect(position, position + size, nodeVisible ? 0xFF00FF00 : 0xFF0000FF);
ImGui.GetForegroundDrawList(ImGuiHelpers.MainViewport).AddRect(position, position + size, nodeVisible ? 0xFF00FF00 : 0xFF0000FF);
}
}

View file

@ -23,14 +23,14 @@ internal class AddonPopoutWindow : Window, IDisposable
: base(name)
{
this.addonTree = tree;
this.PositionConditionNew = ImGuiCond.Once;
this.PositionCondition = ImGuiCond.Once;
var pos = ImGui.GetMousePos() + new Vector2(50, -50);
var workSize = ImGui.GetMainViewport().WorkSize;
var pos2 = new Vector2(Math.Min(workSize.X - 750, pos.X), Math.Min(workSize.Y - 250, pos.Y));
this.Position = pos2;
this.SizeConditionNew = ImGuiCond.Once;
this.SizeCondition = ImGuiCond.Once;
this.Size = new(700, 200);
this.IsOpen = true;
this.SizeConstraints = new() { MinimumSize = new(100, 100) };

View file

@ -35,8 +35,8 @@ internal unsafe class NodePopoutWindow : Window, IDisposable
this.Position = pos2;
this.IsOpen = true;
this.PositionConditionNew = ImGuiCond.Once;
this.SizeConditionNew = ImGuiCond.Once;
this.PositionCondition = ImGuiCond.Once;
this.SizeCondition = ImGuiCond.Once;
this.Size = new(700, 200);
this.SizeConstraints = new() { MinimumSize = new(100, 100) };
}

View file

@ -216,7 +216,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
ImGui.SetNextWindowBgAlpha(Math.Clamp(this.windowFade.EasedPoint.X, 0, 0.9f));
this.Size = new Vector2(900, 400);
this.SizeConditionNew = ImGuiCond.Always;
this.SizeCondition = ImGuiCond.Always;
// Center the window on the main viewport
var viewportPos = ImGuiHelpers.MainViewport.Pos;

View file

@ -23,7 +23,7 @@ internal sealed class ColorDemoWindow : Window
: base("Dalamud Colors Demo")
{
this.Size = new Vector2(600, 500);
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
this.colors = new List<(string Name, Vector4 Color)>()
{

View file

@ -38,7 +38,7 @@ internal sealed class ComponentDemoWindow : Window
: base("Dalamud Components Demo")
{
this.Size = new Vector2(600, 500);
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
this.RespectCloseHotkey = false;

View file

@ -100,7 +100,7 @@ internal class ConsoleWindow : Window, IDisposable
cm.AddAlias("clear", "cls");
this.Size = new Vector2(500, 400);
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
this.RespectCloseHotkey = false;

View file

@ -78,7 +78,7 @@ internal class DataWindow : Window, IDisposable
: base("Dalamud Data", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
{
this.Size = new Vector2(400, 300);
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
this.RespectCloseHotkey = false;
this.orderedModules = this.modules.OrderBy(module => module.DisplayName);

View file

@ -24,7 +24,7 @@ internal class GamepadModeNotifierWindow : Window
true)
{
this.Size = Vector2.Zero;
this.SizeConditionNew = ImGuiCond.Always;
this.SizeCondition = ImGuiCond.Always;
this.IsOpen = false;
this.RespectCloseHotkey = false;

View file

@ -152,7 +152,7 @@ internal class PluginInstallerWindow : Window, IDisposable
this.imageCache = imageCache;
this.Size = new Vector2(830, 570);
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConstraints = new WindowSizeConstraints
{

View file

@ -37,7 +37,7 @@ internal class PluginStatWindow : Window
this.RespectCloseHotkey = false;
this.Size = new Vector2(810, 520);
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
}
/// <inheritdoc/>

View file

@ -73,7 +73,7 @@ internal class SelfTestWindow : Window
: base("Dalamud Self-Test", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
{
this.Size = new Vector2(800, 800);
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
this.RespectCloseHotkey = false;
}

View file

@ -1,9 +1,5 @@
using Dalamud.Bindings.ImGui;
using Dalamud.Game.Command;
using Dalamud.Game.Gui;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;

View file

@ -39,7 +39,7 @@ internal class SettingsWindow : Window
MaximumSize = new Vector2(1780, 940),
};
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeCondition = ImGuiCond.FirstUseEver;
this.tabs =
[

View file

@ -56,7 +56,7 @@ public class SettingsTabDtr : SettingsTab
// TODO: Maybe we can also resort the rest of the bar in the future?
// var isRequired = search is Configuration.SearchSetting.Internal or Configuration.SearchSetting.MacroLinks;
ImGui.PushFont(UiBuilder.IconFontNew);
ImGui.PushFont(UiBuilder.IconFont);
var arrowUpText = $"{FontAwesomeIcon.ArrowUp.ToIconString()}##{title}";
if (i == 0)

View file

@ -100,7 +100,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
this.ForceMainWindow = true;
this.Position = new Vector2(0, 200);
this.PositionConditionNew = ImGuiCond.Always;
this.PositionCondition = ImGuiCond.Always;
this.RespectCloseHotkey = false;
this.shadeTexture = new(() => dalamudAssetManager.GetDalamudTextureWrap(DalamudAsset.TitleScreenMenuShade));

View file

@ -1,7 +1,5 @@
using System.Runtime.InteropServices;
using ImGuiNET;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;

View file

@ -333,67 +333,19 @@ public sealed class UiBuilder : IDisposable, IUiBuilder
/// Gets the default Dalamud font - supporting all game languages and icons.<br />
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
/// </summary>
public static ImFontPtr DefaultFontNew => InterfaceManager.DefaultFont;
public static ImFontPtr DefaultFont => InterfaceManager.DefaultFont;
/// <summary>
/// Gets the default Dalamud icon font based on FontAwesome 5 Free solid.<br />
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
/// </summary>
public static ImFontPtr IconFontNew => InterfaceManager.IconFont;
public static ImFontPtr IconFont => InterfaceManager.IconFont;
/// <summary>
/// Gets the default Dalamud monospaced font based on Inconsolata Regular.<br />
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
/// </summary>
public static ImFontPtr MonoFontNew => InterfaceManager.MonoFont;
/// <summary>
/// Gets the default Dalamud font - supporting all game languages and icons.<br />
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
/// </summary>
[ImGuiBindingsToDo("Remove, rename New variant.")]
public static ImGuiNET.ImFontPtr DefaultFont
{
get
{
unsafe
{
return new ImGuiNET.ImFontPtr((nint)InterfaceManager.DefaultFont.Handle);
}
}
}
/// <summary>
/// Gets the default Dalamud icon font based on FontAwesome 5 Free solid.<br />
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
/// </summary>
[ImGuiBindingsToDo("Remove, rename New variant.")]
public static ImGuiNET.ImFontPtr IconFont
{
get
{
unsafe
{
return new ImGuiNET.ImFontPtr((nint)InterfaceManager.IconFont.Handle);
}
}
}
/// <summary>
/// Gets the default Dalamud monospaced font based on Inconsolata Regular.<br />
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
/// </summary>
[ImGuiBindingsToDo("Remove, rename New variant.")]
public static ImGuiNET.ImFontPtr MonoFont
{
get
{
unsafe
{
return new ImGuiNET.ImFontPtr((nint)InterfaceManager.MonoFont.Handle);
}
}
}
public static ImFontPtr MonoFont => InterfaceManager.MonoFont;
/// <summary>
/// Gets the default font specifications.

View file

@ -10,7 +10,6 @@ using System.Text.Unicode;
using Dalamud.Bindings.ImGui;
using Dalamud.Configuration.Internal;
using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface.ImGuiBackend.InputHandler;
using Dalamud.Interface.ImGuiSeStringRenderer;
@ -18,9 +17,7 @@ using Dalamud.Interface.ImGuiSeStringRenderer.Internal;
using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using ImGuiViewport = ImGuiNET.ImGuiViewport;
using VirtualKey = Dalamud.Game.ClientState.Keys.VirtualKey;
namespace Dalamud.Interface.Utility;
@ -33,22 +30,7 @@ public static partial class ImGuiHelpers
/// <summary>
/// Gets the main viewport.
/// </summary>
public static ImGuiViewportPtr MainViewportNew { get; internal set; }
/// <summary>
/// Gets the main viewport.
/// </summary>
[ImGuiBindingsToDo("Remove and rename MainViewportNew to MainViewport")]
public static ImGuiNET.ImGuiViewportPtr MainViewport
{
get
{
unsafe
{
return new ImGuiNET.ImGuiViewportPtr((nint)MainViewportNew.Handle);
}
}
}
public static ImGuiViewportPtr MainViewport { get; internal set; }
/// <summary>
/// Gets the global Dalamud scale.

View file

@ -17,14 +17,6 @@ public static partial class ImRaii
public static Color PushColor(ImGuiCol idx, Vector4 color, bool condition = true)
=> new Color().Push(idx, color, condition);
[ImGuiBindingsToDo("Remove.")]
public static Color PushColor(ImGuiNET.ImGuiCol idx, uint color, bool condition = true)
=> new Color().Push(idx, color, condition);
[ImGuiBindingsToDo("Remove.")]
public static Color PushColor(ImGuiNET.ImGuiCol idx, Vector4 color, bool condition = true)
=> new Color().Push(idx, color, condition);
// Push colors that revert all current color changes made temporarily.
public static Color DefaultColors()
{
@ -40,7 +32,6 @@ public static partial class ImRaii
internal static readonly List<(ImGuiCol, uint)> Stack = new();
private int count;
[ImGuiBindingsToDo("Remove.")]
public Color Push(ImGuiCol idx, uint color, bool condition = true)
{
if (condition)
@ -53,7 +44,6 @@ public static partial class ImRaii
return this;
}
[ImGuiBindingsToDo("Remove.")]
public Color Push(ImGuiCol idx, Vector4 color, bool condition = true)
{
if (condition)
@ -66,12 +56,6 @@ public static partial class ImRaii
return this;
}
public Color Push(ImGuiNET.ImGuiCol idx, uint color, bool condition = true)
=> this.Push((ImGuiCol)idx, color, condition);
public Color Push(ImGuiNET.ImGuiCol idx, Vector4 color, bool condition = true)
=> this.Push((ImGuiCol)idx, color, condition);
public void Pop(int num = 1)
{
num = Math.Min(num, this.count);

View file

@ -10,10 +10,6 @@ public static partial class ImRaii
public static Font PushFont(ImFontPtr font, bool condition = true)
=> condition ? new Font().Push(font) : new Font();
[ImGuiBindingsToDo("Remove.")]
public static Font PushFont(ImGuiNET.ImFontPtr font, bool condition = true)
=> condition ? new Font().Push(font) : new Font();
// Push the default font if any other font is currently pushed.
public static Font DefaultFont()
=> new Font().Push(Font.DefaultPushed, Font.FontPushCounter > 0);
@ -41,12 +37,6 @@ public static partial class ImRaii
return this;
}
[ImGuiBindingsToDo("Remove.")]
public unsafe Font Push(ImGuiNET.ImFontPtr font, bool condition = true)
{
return this.Push(new ImFontPtr((ImFont*)font.NativePtr), condition);
}
public void Pop(int num = 1)
{
num = Math.Min(num, this.count);

View file

@ -71,22 +71,6 @@ public abstract class Window
this.ForceMainWindow = forceMainWindow;
}
/// <summary>
/// Initializes a new instance of the <see cref="Window"/> class.
/// </summary>
/// <param name="name">The name/ID of this window.
/// If you have multiple windows with the same name, you will need to
/// append a unique ID to it by specifying it after "###" behind the window title.
/// </param>
/// <param name="flags">The <see cref="ImGuiWindowFlags"/> of this window.</param>
/// <param name="forceMainWindow">Whether this window should be limited to the main game window.</param>
[ImGuiBindingsToDo("Remove.")]
protected Window(
string name, ImGuiNET.ImGuiWindowFlags flags = ImGuiNET.ImGuiWindowFlags.None, bool forceMainWindow = false)
: this(name, (ImGuiWindowFlags)flags, forceMainWindow)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Window"/> class.
/// </summary>
@ -182,17 +166,7 @@ public abstract class Window
/// <summary>
/// Gets or sets the condition that defines when the position of this window is set.
/// </summary>
public ImGuiCond PositionConditionNew
{
get => (ImGuiCond)this.PositionCondition;
set => this.PositionCondition = (ImGuiNET.ImGuiCond)value;
}
/// <summary>
/// Gets or sets the condition that defines when the position of this window is set.
/// </summary>
[ImGuiBindingsToDo("Remove. Rename New.")]
public ImGuiNET.ImGuiCond PositionCondition { get; set; }
public ImGuiCond PositionCondition { get; set; }
/// <summary>
/// Gets or sets the size of the window. The size provided will be scaled by the global scale.
@ -202,17 +176,7 @@ public abstract class Window
/// <summary>
/// Gets or sets the condition that defines when the size of this window is set.
/// </summary>
public ImGuiCond SizeConditionNew
{
get => (ImGuiCond)this.SizeCondition;
set => this.SizeCondition = (ImGuiNET.ImGuiCond)value;
}
/// <summary>
/// Gets or sets the condition that defines when the size of this window is set.
/// </summary>
[ImGuiBindingsToDo("Remove. Rename New.")]
public ImGuiNET.ImGuiCond SizeCondition { get; set; }
public ImGuiCond SizeCondition { get; set; }
/// <summary>
/// Gets or sets the size constraints of the window. The size constraints provided will be scaled by the global scale.
@ -700,12 +664,12 @@ public abstract class Window
if (this.ForceMainWindow)
pos += ImGuiHelpers.MainViewport.Pos;
ImGui.SetNextWindowPos(pos, this.PositionConditionNew);
ImGui.SetNextWindowPos(pos, this.PositionCondition);
}
if (this.Size.HasValue)
{
ImGui.SetNextWindowSize(this.Size.Value * ImGuiHelpers.GlobalScale, this.SizeConditionNew);
ImGui.SetNextWindowSize(this.Size.Value * ImGuiHelpers.GlobalScale, this.SizeCondition);
}
if (this.Collapsed.HasValue)

View file

@ -1,14 +1,13 @@
using System.Collections.Generic;
using System.Linq.Expressions;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.ImGuiNotification.Internal;
using Dalamud.Interface.Internal;
using Dalamud.Plugin.Internal.Types;
using ImGuiNET;
using Serilog;
namespace Dalamud.Plugin.Internal;

View file

@ -5,12 +5,11 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal.Windows.Data.Widgets;
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
using ImGuiNET;
using Lumina.Data.Files;
namespace Dalamud.Plugin.Services;

@ -1 +0,0 @@
Subproject commit 98304cfd0bf86cf176732d60eb5dba6fc351f737