diff --git a/CustomResolution/Configuration.cs b/CustomResolution/Configuration.cs index 9073f9a..0b94599 100644 --- a/CustomResolution/Configuration.cs +++ b/CustomResolution/Configuration.cs @@ -36,7 +36,8 @@ public enum DXVKDWMHackMode { Off = 0, UnsetPopup = 1, - SetClientEdge = 2 + SetClientEdgeResize = 3, + SetClientEdgeBorder = 2, } public static class DXVKDWMHackModeExt @@ -45,14 +46,25 @@ public static class DXVKDWMHackModeExt { DXVKDWMHackMode.Off => "Off", DXVKDWMHackMode.UnsetPopup => "Best: -WS_POPUP", - DXVKDWMHackMode.SetClientEdge => "Worst: +WS_EX_CLIENTEDGE", + DXVKDWMHackMode.SetClientEdgeResize => "+WS_EX_CLIENTEDGE (resize)", + DXVKDWMHackMode.SetClientEdgeBorder => "+WS_EX_CLIENTEDGE (border)", _ => mode.ToString(), }; public static string? ToHumanInfoString(this DXVKDWMHackMode mode) => mode switch { - DXVKDWMHackMode.UnsetPopup => "Least intrusive option, doesn't work everywhere.\nWorks best with NVIDIA GPUs.", - DXVKDWMHackMode.SetClientEdge => "Extends the game window 1 pixel to the bottom.\nCauses problems in proper \"Full Screen\" mode!", + DXVKDWMHackMode.UnsetPopup => "Least intrusive option, try this first.\nWorks best with NVIDIA GPUs.", + DXVKDWMHackMode.SetClientEdgeResize => "Extends the game window 1 pixel to the bottom.\nDon't use if it makes text look blurry!", + DXVKDWMHackMode.SetClientEdgeBorder => "Adds a 1 pixel border around the game.", _ => null }; + + public static bool IsUnsetPopup(this DXVKDWMHackMode mode) => mode == DXVKDWMHackMode.UnsetPopup; + + public static bool IsSetClientEdge(this DXVKDWMHackMode mode) => mode switch + { + DXVKDWMHackMode.SetClientEdgeResize => true, + DXVKDWMHackMode.SetClientEdgeBorder => true, + _ => false + }; } diff --git a/CustomResolution/CustomResolution.csproj b/CustomResolution/CustomResolution.csproj index c407a18..dfb46ca 100644 --- a/CustomResolution/CustomResolution.csproj +++ b/CustomResolution/CustomResolution.csproj @@ -3,7 +3,7 @@ 0x0ade - 0.2.0.0 + 0.2.0.1 diff --git a/CustomResolution/Hooks/WndProcHook.cs b/CustomResolution/Hooks/WndProcHook.cs index 2275b38..9eb0a00 100644 --- a/CustomResolution/Hooks/WndProcHook.cs +++ b/CustomResolution/Hooks/WndProcHook.cs @@ -96,7 +96,7 @@ public sealed unsafe class WndProcHook : IDisposable } if (args.Message == WM.WM_NCCALCSIZE && args.WParam != 0 && plugin.CurrentBorderlessFullscreen && - Service.Config.DXVKDWMHackMode >= DXVKDWMHackMode.SetClientEdge) + Service.Config.DXVKDWMHackMode.IsSetClientEdge()) { NCCALCSIZE_PARAMS* ncsize = (NCCALCSIZE_PARAMS*) args.LParam; MONITORINFO monitorInfo = new() @@ -108,10 +108,25 @@ public sealed unsafe class WndProcHook : IDisposable GetMonitorInfo(monitor, &monitorInfo)) { ncsize->rgrc[0] = monitorInfo.rcMonitor; - ncsize->rgrc[0].bottom += 1; + + switch (Service.Config.DXVKDWMHackMode) + { + case DXVKDWMHackMode.SetClientEdgeResize: + ncsize->rgrc[0].bottom += 1; + break; + + case DXVKDWMHackMode.SetClientEdgeBorder: + ncsize->rgrc[0].left += 1; + ncsize->rgrc[0].top += 1; + ncsize->rgrc[0].right -= 1; + ncsize->rgrc[0].bottom -= 1; + break; + } args.SuppressCall = true; } + + // TODO: Check if border + repaing nc area to black works? Otherwise unset composited } } diff --git a/CustomResolution/Plugin.cs b/CustomResolution/Plugin.cs index 6d6e398..6388986 100644 --- a/CustomResolution/Plugin.cs +++ b/CustomResolution/Plugin.cs @@ -270,7 +270,7 @@ public sealed unsafe class Plugin : IDalamudPlugin } } - if (fullscreen && mode >= DXVKDWMHackMode.SetClientEdge) + if (fullscreen && mode.IsSetClientEdge()) { exstyle |= WS.WS_EX_CLIENTEDGE; exstyle |= WS.WS_EX_COMPOSITED;