From 57d1bc5c0f1ffa27f72884d7e58caf02f5f07ff5 Mon Sep 17 00:00:00 2001 From: Knack117 Date: Sat, 7 Feb 2026 10:57:36 -0500 Subject: [PATCH] 1.0.8.3: Restore WndProc at start of teardown so left-click works after disable Co-authored-by: Cursor --- HSUI.csproj | 6 +++--- HSUI.json | 2 +- Helpers/InputsHelper.cs | 17 ++++++++++++++++- Plugin.cs | 3 +++ changelog.md | 3 +++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/HSUI.csproj b/HSUI.csproj index d6b8db3..228e07f 100644 --- a/HSUI.csproj +++ b/HSUI.csproj @@ -9,9 +9,9 @@ HSUI - 1.0.8.2 - 1.0.8.2 - 1.0.8.2 + 1.0.8.3 + 1.0.8.3 + 1.0.8.3 diff --git a/HSUI.json b/HSUI.json index 2a8bc9f..6ce8f96 100644 --- a/HSUI.json +++ b/HSUI.json @@ -2,7 +2,7 @@ "Author": "Knack117", "Name": "HSUI", "InternalName": "HSUI", - "AssemblyVersion": "1.0.8.2", + "AssemblyVersion": "1.0.8.3", "Description": "HSUI provides a highly configurable HUD replacement for FFXIV, recreated from DelvUI using KamiToolKit, FFXIVClientStructs, and Dalamud. Features unit frames, castbars, job gauges, nameplates, party frames, status effects, enemy list, configurable hotbars with drag-and-drop, and profiles.", "ApplicableVersion": "any", "RepoUrl": "https://github.com/Knack117/HSUI", diff --git a/Helpers/InputsHelper.cs b/Helpers/InputsHelper.cs index 91274c6..e562d0a 100644 --- a/Helpers/InputsHelper.cs +++ b/Helpers/InputsHelper.cs @@ -565,7 +565,8 @@ namespace HSUI.Helpers Plugin.Logger.Info("\tOld WndProc: " + _imguiWndProcPtr.ToString("X")); } - private void RestoreWndProc() + /// Restore the game window's WndProc so left-click works again. Idempotent. + internal void RestoreWndProc() { if (_wndHandle == IntPtr.Zero || _imguiWndProcPtr == IntPtr.Zero) return; @@ -584,6 +585,20 @@ namespace HSUI.Helpers { _wndHandle = IntPtr.Zero; _imguiWndProcPtr = IntPtr.Zero; + _wndProcPtr = IntPtr.Zero; + } + } + + /// Call at the very start of plugin disable so left-click is restored even if disposal fails later. + public static void RestoreWndProcIfNeeded() + { + try + { + Instance?.RestoreWndProc(); + } + catch (Exception ex) + { + Plugin.Logger?.Warning($"[HSUI] RestoreWndProcIfNeeded: {ex.Message}"); } } diff --git a/Plugin.cs b/Plugin.cs index b1e4aa7..8b6ec62 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -438,6 +438,9 @@ namespace HSUI { if (!disposing) return; + // Restore game window WndProc first so left-click works again immediately, even if teardown throws. + InputsHelper.RestoreWndProcIfNeeded(); + // Stop UI callbacks first so no Draw/OpenConfigUi runs during teardown try { diff --git a/changelog.md b/changelog.md index 2152854..c023d84 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# 1.0.8.3 +- **Fix**: Left-click no longer sometimes stays broken after disabling HSUI. WndProc is restored at the very start of plugin teardown so the game window gets normal input back even if disposal fails later. + # 1.0.8.2 - **Action bars**: Charge icons stay lit until all charges are spent — uses the slot’s recast charge count and ActionManager so abilities with charges remaining no longer grey out incorrectly.