From 3831b5f64f6dea5f98938ae75f98c1bd1804d87b Mon Sep 17 00:00:00 2001 From: Jade Macho Date: Sat, 28 Jun 2025 18:21:23 +0200 Subject: [PATCH] config: Update when using hotkey, disable save on enter, always enable inputs --- CustomResolution2782/Configuration.cs | 1 + CustomResolution2782/Plugin.cs | 2 +- CustomResolution2782/PluginUI.cs | 5 +++++ CustomResolution2782/Windows/ConfigWindow.cs | 15 +-------------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/CustomResolution2782/Configuration.cs b/CustomResolution2782/Configuration.cs index 98b76c4..9b06482 100644 --- a/CustomResolution2782/Configuration.cs +++ b/CustomResolution2782/Configuration.cs @@ -36,6 +36,7 @@ public class Configuration : IPluginConfiguration public void Save() { pluginInterface!.SavePluginConfig(this); + Service.PluginUI.UpdateFromConfig(); } } diff --git a/CustomResolution2782/Plugin.cs b/CustomResolution2782/Plugin.cs index b14ce7c..92ef9ae 100644 --- a/CustomResolution2782/Plugin.cs +++ b/CustomResolution2782/Plugin.cs @@ -182,7 +182,7 @@ public sealed unsafe class Plugin : IDalamudPlugin _currentHwnd = (HWND) win->WindowHandle; -#if CRES_CLEAN +#if CRES_CLEAN || true var _dev_hWnd = (IntPtr*) &dev->hWnd; var _dev_NewWidth = &dev->NewWidth; var _dev_NewHeight = &dev->NewHeight; diff --git a/CustomResolution2782/PluginUI.cs b/CustomResolution2782/PluginUI.cs index 6437576..d6454f1 100644 --- a/CustomResolution2782/PluginUI.cs +++ b/CustomResolution2782/PluginUI.cs @@ -44,6 +44,11 @@ public sealed class PluginUI : IDisposable WindowSystem.Draw(); } + public void UpdateFromConfig() + { + _configWindow.UpdateFromConfig(); + } + private void ShowConfigWindow() { SettingsVisible = true; diff --git a/CustomResolution2782/Windows/ConfigWindow.cs b/CustomResolution2782/Windows/ConfigWindow.cs index b9556af..04b1631 100644 --- a/CustomResolution2782/Windows/ConfigWindow.cs +++ b/CustomResolution2782/Windows/ConfigWindow.cs @@ -130,30 +130,17 @@ public class ConfigWindow : Window, IDisposable ImGui.Text("Hotkey"); - if (!_configIsEnabled) - { - ImGui.BeginDisabled(); - } - ImGui.Checkbox("Use scale", ref _configIsScale); if (_configIsScale) { - if (ImGui.InputFloat("Scale", ref _configScale, 0.01f, 0.1f, "%.3f", ImGuiInputTextFlags.EnterReturnsTrue)) - { - save = true; - } + ImGui.InputFloat("Scale", ref _configScale, 0.01f, 0.1f, "%.3f", ImGuiInputTextFlags.EnterReturnsTrue); } else { ImGui.InputInt2("Size in pixels", ref _configWH[0]); } - if (!_configIsEnabled) - { - ImGui.EndDisabled(); - } - if (ImGui.BeginCombo("Borderless window workaround", _configDXVKDWMHackMode.ToHumanNameString())) { foreach (var mode in Enum.GetValues())