Split clientedge resize and border

This commit is contained in:
Jade Macho 2024-03-16 21:57:27 +01:00
parent 07263f0ecc
commit 876892db27
Signed by: 0x0ade
GPG Key ID: E1960710FE4FBEEF
4 changed files with 35 additions and 8 deletions

View File

@ -36,7 +36,8 @@ public enum DXVKDWMHackMode
{ {
Off = 0, Off = 0,
UnsetPopup = 1, UnsetPopup = 1,
SetClientEdge = 2 SetClientEdgeResize = 3,
SetClientEdgeBorder = 2,
} }
public static class DXVKDWMHackModeExt public static class DXVKDWMHackModeExt
@ -45,14 +46,25 @@ public static class DXVKDWMHackModeExt
{ {
DXVKDWMHackMode.Off => "Off", DXVKDWMHackMode.Off => "Off",
DXVKDWMHackMode.UnsetPopup => "Best: -WS_POPUP", 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(), _ => mode.ToString(),
}; };
public static string? ToHumanInfoString(this DXVKDWMHackMode mode) => mode switch public static string? ToHumanInfoString(this DXVKDWMHackMode mode) => mode switch
{ {
DXVKDWMHackMode.UnsetPopup => "Least intrusive option, doesn't work everywhere.\nWorks best with NVIDIA GPUs.", DXVKDWMHackMode.UnsetPopup => "Least intrusive option, try this first.\nWorks best with NVIDIA GPUs.",
DXVKDWMHackMode.SetClientEdge => "Extends the game window 1 pixel to the bottom.\nCauses problems in proper \"Full Screen\" mode!", 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 _ => 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
};
} }

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors>0x0ade</Authors> <Authors>0x0ade</Authors>
<Company></Company> <Company></Company>
<Version>0.2.0.0</Version> <Version>0.2.0.1</Version>
<Description></Description> <Description></Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl></PackageProjectUrl> <PackageProjectUrl></PackageProjectUrl>

View File

@ -96,7 +96,7 @@ public sealed unsafe class WndProcHook : IDisposable
} }
if (args.Message == WM.WM_NCCALCSIZE && args.WParam != 0 && plugin.CurrentBorderlessFullscreen && 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; NCCALCSIZE_PARAMS* ncsize = (NCCALCSIZE_PARAMS*) args.LParam;
MONITORINFO monitorInfo = new() MONITORINFO monitorInfo = new()
@ -108,10 +108,25 @@ public sealed unsafe class WndProcHook : IDisposable
GetMonitorInfo(monitor, &monitorInfo)) GetMonitorInfo(monitor, &monitorInfo))
{ {
ncsize->rgrc[0] = monitorInfo.rcMonitor; ncsize->rgrc[0] = monitorInfo.rcMonitor;
switch (Service.Config.DXVKDWMHackMode)
{
case DXVKDWMHackMode.SetClientEdgeResize:
ncsize->rgrc[0].bottom += 1; 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; args.SuppressCall = true;
} }
// TODO: Check if border + repaing nc area to black works? Otherwise unset composited
} }
} }

View File

@ -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_CLIENTEDGE;
exstyle |= WS.WS_EX_COMPOSITED; exstyle |= WS.WS_EX_COMPOSITED;